mirror of
https://github.com/darksaid98/nightcore-spigot.git
synced 2026-12-01 14:38:47 +00:00
v2.6.3, update 2
This commit is contained in:
1 parent
137f656c7a
commit
5c4477847d
12 files changed
+48
-13
No files matched your search
@@ -8,6 +8,7 @@ import su.nightexpress.nightcore.util.NumberUtil;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@Deprecated
|
||||
public class CommandFlag<T> {
|
||||
|
||||
public static final char PREFIX = '-';
|
||||
|
||||
@@ -7,6 +7,7 @@ import su.nightexpress.nightcore.util.NumberUtil;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Deprecated
|
||||
public class CommandResult {
|
||||
|
||||
private final String label;
|
||||
|
||||
@@ -12,6 +12,7 @@ import su.nightexpress.nightcore.util.placeholder.Placeholder;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Deprecated
|
||||
public interface NightCommand extends Placeholder {
|
||||
|
||||
@NotNull List<String> getTab(@NotNull Player player, int arg, @NotNull String[] args);
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@Deprecated
|
||||
public interface NightPluginCommand extends NightCommand, TabExecutor {
|
||||
|
||||
@Nullable NightCommand getDefaultCommand();
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated
|
||||
public class HelpSubCommand extends AbstractCommand<NightCorePlugin> {
|
||||
|
||||
public HelpSubCommand(@NotNull NightCorePlugin plugin) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import su.nightexpress.nightcore.command.CommandResult;
|
||||
import su.nightexpress.nightcore.command.impl.AbstractCommand;
|
||||
import su.nightexpress.nightcore.core.CoreLang;
|
||||
|
||||
@Deprecated
|
||||
public class ReloadSubCommand extends AbstractCommand<NightCorePlugin> {
|
||||
|
||||
public ReloadSubCommand(@NotNull NightCorePlugin plugin, @NotNull Permission permission) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import su.nightexpress.nightcore.util.placeholder.PlaceholderMap;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Deprecated
|
||||
public abstract class AbstractCommand<P extends NightCorePlugin> implements NightCommand {
|
||||
|
||||
protected final P plugin;
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import su.nightexpress.nightcore.NightCorePlugin;
|
||||
import su.nightexpress.nightcore.command.CommandResult;
|
||||
|
||||
@Deprecated
|
||||
public class BaseCommand extends PluginCommand<NightCorePlugin> {
|
||||
|
||||
public BaseCommand(@NotNull NightCorePlugin plugin) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Deprecated
|
||||
public abstract class PluginCommand<P extends NightCorePlugin> extends AbstractCommand<P> implements NightPluginCommand {
|
||||
|
||||
private Command backend;
|
||||
|
||||
@@ -11,6 +11,7 @@ import su.nightexpress.nightcore.util.wrapper.UniSound;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ConfigValue<T> {
|
||||
@@ -22,6 +23,7 @@ public class ConfigValue<T> {
|
||||
private final Writer<T> writer;
|
||||
|
||||
private T value;
|
||||
private UnaryOperator<T> onRead;
|
||||
|
||||
public ConfigValue(@NotNull String path,
|
||||
@NotNull Reader<T> reader,
|
||||
@@ -246,22 +248,31 @@ public class ConfigValue<T> {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public T read(@NotNull FileConfig cfg) {
|
||||
if (!cfg.contains(this.getPath())) {
|
||||
this.write(cfg);
|
||||
public ConfigValue<T> onRead(@NotNull UnaryOperator<T> onRead) {
|
||||
this.onRead = onRead;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public T read(@NotNull FileConfig config) {
|
||||
if (!config.contains(this.getPath())) {
|
||||
this.write(config);
|
||||
}
|
||||
if (this.getDescription().length > 0 && !this.getDescription()[0].isEmpty()) {
|
||||
cfg.setComments(this.getPath(), this.getDescription());
|
||||
config.setComments(this.getPath(), this.getDescription());
|
||||
}
|
||||
return (this.value = this.reader.read(cfg, this.getPath(), this.getDefaultValue()));
|
||||
|
||||
UnaryOperator<T> operator = this.onRead == null ? value -> value : this.onRead;
|
||||
|
||||
return (this.value = operator.apply(this.reader.read(config, this.getPath(), this.getDefaultValue())));
|
||||
}
|
||||
|
||||
public void write(@NotNull FileConfig cfg) {
|
||||
this.getWriter().write(cfg, this.getPath(), this.get());
|
||||
public void write(@NotNull FileConfig config) {
|
||||
this.getWriter().write(config, this.getPath(), this.get());
|
||||
}
|
||||
|
||||
public boolean remove(@NotNull FileConfig cfg) {
|
||||
return cfg.remove(this.getPath());
|
||||
public boolean remove(@NotNull FileConfig config) {
|
||||
return config.remove(this.getPath());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -300,11 +311,11 @@ public class ConfigValue<T> {
|
||||
|
||||
public interface Reader<T> {
|
||||
|
||||
@NotNull T read(@NotNull FileConfig cfg, @NotNull String path, @NotNull T def);
|
||||
@NotNull T read(@NotNull FileConfig config, @NotNull String path, @NotNull T def);
|
||||
}
|
||||
|
||||
public interface Writer<T> {
|
||||
|
||||
void write(@NotNull FileConfig cfg, @NotNull String path, @NotNull T obj);
|
||||
void write(@NotNull FileConfig config, @NotNull String path, @NotNull T obj);
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class Colorizer {
|
||||
|
||||
public static final Pattern PATTERN_HEX = Pattern.compile("#([A-Fa-f0-9]{6})");
|
||||
@Deprecated public static final Pattern PATTERN_HEX = Pattern.compile("#([A-Fa-f0-9]{6})");
|
||||
//public static final Pattern PATTERN_HEX_LEGACY = Pattern.compile("(?:^|[^<])(#[A-Fa-f0-9]{6})(?:$|[^:>])");
|
||||
public static final Pattern PATTERN_GRADIENT = Pattern.compile("<gradient:" + PATTERN_HEX.pattern() + ">(.*?)</gradient:" + PATTERN_HEX.pattern() + ">");
|
||||
@Deprecated public static final Pattern PATTERN_GRADIENT = Pattern.compile("<gradient:" + PATTERN_HEX.pattern() + ">(.*?)</gradient:" + PATTERN_HEX.pattern() + ">");
|
||||
|
||||
@NotNull
|
||||
public static String apply(@NotNull String str) {
|
||||
@@ -44,6 +44,7 @@ public class Colorizer {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public static String hex(@NotNull String str) {
|
||||
TimedMatcher timedMatcher = TimedMatcher.create(PATTERN_HEX, str);
|
||||
//Matcher matcher = PATTERN_HEX.matcher(str);
|
||||
@@ -60,6 +61,7 @@ public class Colorizer {
|
||||
return timedMatcher.getMatcher().appendTail(buffer).toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static ChatColor[] createGradient(@NotNull java.awt.Color start, @NotNull java.awt.Color end, int length) {
|
||||
ChatColor[] colors = new ChatColor[length];
|
||||
for (int index = 0; index < length; index++) {
|
||||
@@ -76,6 +78,7 @@ public class Colorizer {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public static String gradient(@NotNull String string) {
|
||||
TimedMatcher timedMatcher = TimedMatcher.create(PATTERN_GRADIENT, string);
|
||||
//Matcher matcher = PATTERN_GRADIENT.matcher(string);
|
||||
@@ -126,6 +129,7 @@ public class Colorizer {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public static String plainHex(@NotNull String str) {
|
||||
StringBuilder builder = new StringBuilder(str);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -63,6 +64,16 @@ public class Lists {
|
||||
return indexOf(array, valueToFind) != -1;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T, R> Set<R> modify(@NotNull Set<T> set, @NotNull Function<T, R> function) {
|
||||
return set.stream().map(function).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T, R> List<R> modify(@NotNull List<T> set, @NotNull Function<T, R> function) {
|
||||
return set.stream().map(function).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> List<List<T>> split(@NotNull List<T> list, int targetSize) {
|
||||
List<List<T>> lists = new ArrayList<>();
|
||||
|
||||
Reference in new issue
Block a user