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