Compare commits
No commits in common. "ff954a39033c228c1967bd68ffe01b1e66a6a184" and "5b43aed0b490b7f345d0f662d5f7cd528506adae" have entirely different histories.
ff954a3903
...
5b43aed0b4
@ -336,7 +336,7 @@ public interface SuggestionsSupplier<S> {
|
||||
/**
|
||||
* List of all possible duration unit symbols for suggestions.
|
||||
*/
|
||||
List<String> DURATION_SUFFIXES = List.of("y", "mo", "w", "d", "h", "m", "s");
|
||||
public static final List<String> DURATION_SUFFIXES = List.of("y", "mo", "w", "d", "h", "m", "s");
|
||||
|
||||
|
||||
private static void scanAndRemovePastSuffixes(List<String> suffixes, String foundSuffix) {
|
||||
|
@ -310,7 +310,9 @@ public abstract class BackupProcess implements Comparable<BackupProcess>, Runnab
|
||||
return false;
|
||||
if (!isDirty())
|
||||
return false;
|
||||
return getNext() <= System.currentTimeMillis();
|
||||
if (getNext() > System.currentTimeMillis())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,8 +12,8 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
|
||||
|
||||
@ConcreteWrapper(GameVersion.__concrete.class)
|
||||
public interface GameVersion extends ReflectWrapperI {
|
||||
ReflectClass<?> REFLECT = wrapEx(() -> Reflect.ofClass("com.mojang.bridge.game.GameVersion"));
|
||||
ReflectMethod<?> getWorldVersion = wrapEx(() -> REFLECT.method("getWorldVersion"));
|
||||
public static final ReflectClass<?> REFLECT = wrapEx(() -> Reflect.ofClass("com.mojang.bridge.game.GameVersion"));
|
||||
public static final ReflectMethod<?> getWorldVersion = wrapEx(() -> REFLECT.method("getWorldVersion"));
|
||||
|
||||
default int getWorldVersion() {
|
||||
return (int) wrapReflectEx(() -> getWorldVersion.invoke(__getRuntimeInstance()));
|
||||
|
@ -20,12 +20,10 @@ public class CollectionTag extends ReflectWrapperTyped<AbstractList<?>> implemen
|
||||
return wrap(__getRuntimeInstance().get(i), Tag.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Tag set(int i, Tag t) {
|
||||
return wrap(((AbstractList<Object>)__getRuntimeInstance()).set(i, unwrap(t)), Tag.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void add(int i, Tag t) {
|
||||
((AbstractList<Object>)__getRuntimeInstance()).add(i, unwrap(t));
|
||||
}
|
||||
|
@ -1,9 +1,15 @@
|
||||
package fr.pandacube.lib.paper.util;
|
||||
|
||||
import com.destroystokyo.paper.Namespaced;
|
||||
import com.google.common.collect.Streams;
|
||||
import fr.pandacube.lib.chat.Chat;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import fr.pandacube.lib.chat.ChatStatic;
|
||||
import fr.pandacube.lib.util.Log;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -12,12 +18,13 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import com.google.common.collect.Streams;
|
||||
|
||||
import fr.pandacube.lib.chat.Chat;
|
||||
import fr.pandacube.lib.chat.Chat.FormatableChat;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.format.TextDecoration.State;
|
||||
|
||||
import static fr.pandacube.lib.chat.ChatStatic.chatComponent;
|
||||
|
||||
@ -175,19 +182,11 @@ public class ItemStackBuilder {
|
||||
}
|
||||
|
||||
public ItemStackBuilder canDestroy(Set<Material> destroyable) {
|
||||
return canDestroy(destroyable.stream().map(m -> (Namespaced) m.getKey()).toList());
|
||||
return meta(m -> m.setCanDestroy(destroyable));
|
||||
}
|
||||
|
||||
public ItemStackBuilder canPlaceOn(Set<Material> placeOn) {
|
||||
return canPlaceOn(placeOn.stream().map(m -> (Namespaced) m.getKey()).toList());
|
||||
}
|
||||
|
||||
public ItemStackBuilder canDestroy(Collection<Namespaced> destroyable) {
|
||||
return meta(m -> m.setDestroyableKeys(destroyable));
|
||||
}
|
||||
|
||||
public ItemStackBuilder canPlaceOn(Collection<Namespaced> placeOn) {
|
||||
return meta(m -> m.setPlaceableKeys(placeOn));
|
||||
return meta(m -> m.setCanPlaceOn(placeOn));
|
||||
}
|
||||
|
||||
public ItemStackBuilder damage(int d) {
|
||||
|
@ -179,7 +179,7 @@ public class TimeUtil {
|
||||
/**
|
||||
* Seconds precision for relative display.
|
||||
*/
|
||||
SECONDS
|
||||
SECONDS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,20 +43,13 @@ public abstract class AbstractClientWS implements AbstractWS {
|
||||
Listener.super.onOpen(webSocket);
|
||||
}
|
||||
|
||||
StringBuilder partialData = new StringBuilder();
|
||||
|
||||
@Override
|
||||
public CompletionStage<?> onText(WebSocket webSocket, CharSequence data, boolean last) {
|
||||
partialData.append(data.toString());
|
||||
if (last) {
|
||||
try {
|
||||
AbstractClientWS.this.handleReceivedMessage(partialData.toString());
|
||||
} catch (Exception e) {
|
||||
logError("Error handling reception of text.", e);
|
||||
}
|
||||
partialData = new StringBuilder();
|
||||
try {
|
||||
AbstractClientWS.this.handleReceivedMessage(data.toString());
|
||||
} catch (Exception e) {
|
||||
logError("Error handling reception of text.", e);
|
||||
}
|
||||
|
||||
return Listener.super.onText(webSocket, data, last);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user