diff --git a/divinemc-api/paper-patches/features/0001-Rebrand.patch b/divinemc-api/paper-patches/features/0001-Rebrand.patch index 4ea15a9..d2d7e42 100644 --- a/divinemc-api/paper-patches/features/0001-Rebrand.patch +++ b/divinemc-api/paper-patches/features/0001-Rebrand.patch @@ -24,10 +24,10 @@ index fb1fe2651e53a9bf46b3632c638e13eea9dcda93..81e92d1053efd15c079e318a4ae08794 * Gets the {@code ServerBuildInfo}. * diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -index c880d0010849ab733ad13bbd18fab3c864d0cf61..a76439e59eefa4b6dbd0e100d72c21055d0ca008 100644 +index ec2b71cc2023b8ec7b9567a9ab1875cafc14f40d..354bf634b45ae510bdbddb81f7b1689bd2f4dc04 100644 --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -@@ -259,7 +259,7 @@ public class VersionCommand extends BukkitCommand { +@@ -257,7 +257,7 @@ public class VersionCommand extends BukkitCommand { // Purpur start int distance = getVersionFetcher().distance(); final Component message = Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()), diff --git a/divinemc-api/paper-patches/features/0002-Delete-Timings.patch b/divinemc-api/paper-patches/features/0002-Delete-Timings.patch index f907ba1..09a4a5d 100644 --- a/divinemc-api/paper-patches/features/0002-Delete-Timings.patch +++ b/divinemc-api/paper-patches/features/0002-Delete-Timings.patch @@ -736,7 +736,7 @@ index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java deleted file mode 100644 -index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..0000000000000000000000000000000000000000 +index c8287776ad585d04fb4fa3290cd73d7097035ea0..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/TimingHistory.java +++ /dev/null @@ -1,357 +0,0 @@ @@ -1031,7 +1031,7 @@ index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..00000000000000000000000000000000 - final TicksRecord ticksRecord = new TicksRecord(); - final PingRecord pingRecord = new PingRecord(); - final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone(); -- final double tps = 1E9 / ( System.nanoTime() - lastMinuteTime ) * ticksRecord.timed; +- final double tps = 1E9 / (System.nanoTime() - lastMinuteTime) * ticksRecord.timed; - final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory; - final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory; - final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(); @@ -1753,7 +1753,7 @@ index 04d0dc27406e9f96224f88edb1c535176e84d395..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java deleted file mode 100644 -index e72ad05abada04426e32a73d02b21cb69079d268..0000000000000000000000000000000000000000 +index 83a70358e9b7d3d9ae76cf130915b3c33d09a793..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/TimingsManager.java +++ /dev/null @@ -1,192 +0,0 @@ @@ -1912,9 +1912,9 @@ index e72ad05abada04426e32a73d02b21cb69079d268..00000000000000000000000000000000 - public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) { - Plugin plugin = null; - final Server server = Bukkit.getServer(); -- if (!( server == null || pluginName == null || -- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) || -- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) +- if (!(server == null || pluginName == null || +- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) || +- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) - )) { - plugin = server.getPluginManager().getPlugin(pluginName); - } @@ -2104,6 +2104,774 @@ index 632c4961515f5052551f841cfa840e60bba7a257..00000000000000000000000000000000 - super.stopTiming(); - } -} +diff --git a/src/main/java/co/aikar/util/Counter.java b/src/main/java/co/aikar/util/Counter.java +deleted file mode 100644 +index dae84243804b4b076cafb3e1b29bdcf614efc93f..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/Counter.java ++++ /dev/null +@@ -1,39 +0,0 @@ +-package co.aikar.util; +- +-import com.google.common.collect.ForwardingMap; +- +-import java.util.HashMap; +-import java.util.Map; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-@Deprecated(forRemoval = true) +-public class Counter extends ForwardingMap { +- private final Map counts = new HashMap<>(); +- +- public long decrement(@Nullable T key) { +- return increment(key, -1); +- } +- public long increment(@Nullable T key) { +- return increment(key, 1); +- } +- public long decrement(@Nullable T key, long amount) { +- return increment(key, -amount); +- } +- public long increment(@Nullable T key, long amount) { +- Long count = this.getCount(key); +- count += amount; +- this.counts.put(key, count); +- return count; +- } +- +- public long getCount(@Nullable T key) { +- return this.counts.getOrDefault(key, 0L); +- } +- +- @NotNull +- @Override +- protected Map delegate() { +- return this.counts; +- } +-} +diff --git a/src/main/java/co/aikar/util/JSONUtil.java b/src/main/java/co/aikar/util/JSONUtil.java +deleted file mode 100644 +index c105a1429ca58b37be265708ec345e00f0d43ed8..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/JSONUtil.java ++++ /dev/null +@@ -1,141 +0,0 @@ +-package co.aikar.util; +- +-import com.google.common.base.Function; +-import com.google.common.collect.Lists; +-import com.google.common.collect.Maps; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +-import org.json.simple.JSONArray; +-import org.json.simple.JSONObject; +- +-import java.util.ArrayList; +-import java.util.LinkedHashMap; +-import java.util.List; +-import java.util.Map; +- +-/** +- * Provides Utility methods that assist with generating JSON Objects +- */ +-@SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) +-@Deprecated(forRemoval = true) +-public final class JSONUtil { +- private JSONUtil() {} +- +- /** +- * Creates a key/value "JSONPair" object +- * +- * @param key Key to use +- * @param obj Value to use +- * @return JSONPair +- */ +- @NotNull +- public static JSONPair pair(@NotNull String key, @Nullable Object obj) { +- return new JSONPair(key, obj); +- } +- +- @NotNull +- public static JSONPair pair(long key, @Nullable Object obj) { +- return new JSONPair(String.valueOf(key), obj); +- } +- +- /** +- * Creates a new JSON object from multiple JSONPair key/value pairs +- * +- * @param data JSONPairs +- * @return Map +- */ +- @NotNull +- public static Map createObject(@NotNull JSONPair... data) { +- return appendObjectData(new LinkedHashMap(), data); +- } +- +- /** +- * This appends multiple key/value Obj pairs into a JSON Object +- * +- * @param parent Map to be appended to +- * @param data Data to append +- * @return Map +- */ +- @NotNull +- public static Map appendObjectData(@NotNull Map parent, @NotNull JSONPair... data) { +- for (JSONPair JSONPair : data) { +- parent.put(JSONPair.key, JSONPair.val); +- } +- return parent; +- } +- +- /** +- * This builds a JSON array from a set of data +- * +- * @param data Data to build JSON array from +- * @return List +- */ +- @NotNull +- public static List toArray(@NotNull Object... data) { +- return Lists.newArrayList(data); +- } +- +- /** +- * These help build a single JSON array using a mapper function +- * +- * @param collection Collection to apply to +- * @param mapper Mapper to apply +- * @param Element Type +- * @return List +- */ +- @NotNull +- public static List toArrayMapper(@NotNull E[] collection, @NotNull Function mapper) { +- return toArrayMapper(Lists.newArrayList(collection), mapper); +- } +- +- @NotNull +- public static List toArrayMapper(@NotNull Iterable collection, @NotNull Function mapper) { +- List array = Lists.newArrayList(); +- for (E e : collection) { +- Object object = mapper.apply(e); +- if (object != null) { +- array.add(object); +- } +- } +- return array; +- } +- +- /** +- * These help build a single JSON Object from a collection, using a mapper function +- * +- * @param collection Collection to apply to +- * @param mapper Mapper to apply +- * @param Element Type +- * @return Map +- */ +- @NotNull +- public static Map toObjectMapper(@NotNull E[] collection, @NotNull Function mapper) { +- return toObjectMapper(Lists.newArrayList(collection), mapper); +- } +- +- @NotNull +- public static Map toObjectMapper(@NotNull Iterable collection, @NotNull Function mapper) { +- Map object = Maps.newLinkedHashMap(); +- for (E e : collection) { +- JSONPair JSONPair = mapper.apply(e); +- if (JSONPair != null) { +- object.put(JSONPair.key, JSONPair.val); +- } +- } +- return object; +- } +- +- /** +- * Simply stores a key and a value, used internally by many methods below. +- */ +- @SuppressWarnings("PublicInnerClass") +- public static class JSONPair { +- final String key; +- final Object val; +- +- JSONPair(@NotNull String key, @NotNull Object val) { +- this.key = key; +- this.val = val; +- } +- } +-} +diff --git a/src/main/java/co/aikar/util/LoadingIntMap.java b/src/main/java/co/aikar/util/LoadingIntMap.java +deleted file mode 100644 +index 5753b9bce89db2ac378ec41f1b61907cc2e23335..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/LoadingIntMap.java ++++ /dev/null +@@ -1,77 +0,0 @@ +-/* +- * Copyright (c) 2015. Starlis LLC / dba Empire Minecraft +- * +- * This source code is proprietary software and must not be redistributed without Starlis LLC's approval +- * +- */ +-package co.aikar.util; +- +- +-import com.google.common.base.Function; +-import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Allows you to pass a Loader function that when a key is accessed that doesn't exist, +- * automatically loads the entry into the map by calling the loader Function. +- * +- * .get() Will only return null if the Loader can return null. +- * +- * You may pass any backing Map to use. +- * +- * This class is not thread safe and should be wrapped with Collections.synchronizedMap on the OUTSIDE of the LoadingMap if needed. +- * +- * Do not wrap the backing map with Collections.synchronizedMap. +- * +- * @param Value +- */ +-@Deprecated(forRemoval = true) +-public class LoadingIntMap extends Int2ObjectOpenHashMap { +- private final Function loader; +- +- public LoadingIntMap(@NotNull Function loader) { +- super(); +- this.loader = loader; +- } +- +- public LoadingIntMap(int expectedSize, @NotNull Function loader) { +- super(expectedSize); +- this.loader = loader; +- } +- +- public LoadingIntMap(int expectedSize, float loadFactor, @NotNull Function loader) { +- super(expectedSize, loadFactor); +- this.loader = loader; +- } +- +- +- @Nullable +- @Override +- public V get(int key) { +- V res = super.get(key); +- if (res == null) { +- res = loader.apply(key); +- if (res != null) { +- put(key, res); +- } +- } +- return res; +- } +- +- /** +- * Due to java stuff, you will need to cast it to (Function) for some cases +- * +- * @param Type +- */ +- public abstract static class Feeder implements Function { +- @Nullable +- @Override +- public T apply(@Nullable Object input) { +- return apply(); +- } +- +- @Nullable +- public abstract T apply(); +- } +-} +diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java +deleted file mode 100644 +index 1786eeb5cbeaad75602c9c5649bbcd9b2af5cf81..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/LoadingMap.java ++++ /dev/null +@@ -1,369 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.util; +- +-import com.google.common.base.Preconditions; +-import java.lang.reflect.Constructor; +-import java.util.AbstractMap; +-import java.util.Collection; +-import java.util.HashMap; +-import java.util.IdentityHashMap; +-import java.util.Map; +-import java.util.Set; +-import java.util.function.Function; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Allows you to pass a Loader function that when a key is accessed that doesn't exists, +- * automatically loads the entry into the map by calling the loader Function. +- * +- * .get() Will only return null if the Loader can return null. +- * +- * You may pass any backing Map to use. +- * +- * This class is not thread safe and should be wrapped with Collections.synchronizedMap on the OUTSIDE of the LoadingMap if needed. +- * +- * Do not wrap the backing map with Collections.synchronizedMap. +- * +- * @param Key +- * @param Value +- */ +-@Deprecated(forRemoval = true) +-public class LoadingMap extends AbstractMap { +- private final Map backingMap; +- private final java.util.function.Function loader; +- +- /** +- * Initializes an auto loading map using specified loader and backing map +- * @param backingMap Map to wrap +- * @param loader Loader +- */ +- public LoadingMap(@NotNull Map backingMap, @NotNull java.util.function.Function loader) { +- this.backingMap = backingMap; +- this.loader = loader; +- } +- +- /** +- * Creates a new LoadingMap with the specified map and loader +- * +- * @param backingMap Actual map being used. +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map of(@NotNull Map backingMap, @NotNull Function loader) { +- return new LoadingMap<>(backingMap, loader); +- } +- +- /** +- * Creates a LoadingMap with an auto instantiating loader. +- * +- * Will auto construct class of of Value when not found +- * +- * Since this uses Reflection, It is more effecient to define your own static loader +- * than using this helper, but if performance is not critical, this is easier. +- * +- * @param backingMap Actual map being used. +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newAutoMap(@NotNull Map backingMap, @Nullable final Class keyClass, +- @NotNull final Class valueClass) { +- return new LoadingMap<>(backingMap, new AutoInstantiatingLoader<>(keyClass, valueClass)); +- } +- /** +- * Creates a LoadingMap with an auto instantiating loader. +- * +- * Will auto construct class of of Value when not found +- * +- * Since this uses Reflection, It is more effecient to define your own static loader +- * than using this helper, but if performance is not critical, this is easier. +- * +- * @param backingMap Actual map being used. +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newAutoMap(@NotNull Map backingMap, +- @NotNull final Class valueClass) { +- return newAutoMap(backingMap, null, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@Nullable final Class keyClass, @NotNull final Class valueClass) { +- return newAutoMap(new HashMap<>(), keyClass, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@NotNull final Class valueClass) { +- return newHashAutoMap(null, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@Nullable final Class keyClass, @NotNull final Class valueClass, int initialCapacity, float loadFactor) { +- return newAutoMap(new HashMap<>(initialCapacity, loadFactor), keyClass, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param valueClass Class used for the V generic +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@NotNull final Class valueClass, int initialCapacity, float loadFactor) { +- return newHashAutoMap(null, valueClass, initialCapacity, loadFactor); +- } +- +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader) { +- return new LoadingMap<>(new HashMap<>(), loader); +- } +- +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader, int initialCapacity) { +- return new LoadingMap<>(new HashMap<>(initialCapacity), loader); +- } +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader, int initialCapacity, float loadFactor) { +- return new LoadingMap<>(new HashMap<>(initialCapacity, loadFactor), loader); +- } +- +- /** +- * Initializes an auto loading map using an Identity HashMap +- * +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newIdentityHashMap(@NotNull Function loader) { +- return new LoadingMap<>(new IdentityHashMap<>(), loader); +- } +- +- /** +- * Initializes an auto loading map using an Identity HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newIdentityHashMap(@NotNull Function loader, int initialCapacity) { +- return new LoadingMap<>(new IdentityHashMap<>(initialCapacity), loader); +- } +- +- @Override +- public int size() {return backingMap.size();} +- +- @Override +- public boolean isEmpty() {return backingMap.isEmpty();} +- +- @Override +- public boolean containsKey(@Nullable Object key) {return backingMap.containsKey(key);} +- +- @Override +- public boolean containsValue(@Nullable Object value) {return backingMap.containsValue(value);} +- +- @Nullable +- @Override +- public V get(@Nullable Object key) { +- V v = backingMap.get(key); +- if (v != null) { +- return v; +- } +- return backingMap.computeIfAbsent((K) key, loader); +- } +- +- @Nullable +- public V put(@Nullable K key, @Nullable V value) {return backingMap.put(key, value);} +- +- @Nullable +- @Override +- public V remove(@Nullable Object key) {return backingMap.remove(key);} +- +- public void putAll(@NotNull Map m) {backingMap.putAll(m);} +- +- @Override +- public void clear() {backingMap.clear();} +- +- @NotNull +- @Override +- public Set keySet() {return backingMap.keySet();} +- +- @NotNull +- @Override +- public Collection values() {return backingMap.values();} +- +- @Override +- public boolean equals(@Nullable Object o) {return backingMap.equals(o);} +- +- @Override +- public int hashCode() {return backingMap.hashCode();} +- +- @NotNull +- @Override +- public Set> entrySet() { +- return backingMap.entrySet(); +- } +- +- @NotNull +- public LoadingMap clone() { +- return new LoadingMap<>(backingMap, loader); +- } +- +- private static class AutoInstantiatingLoader implements Function { +- final Constructor constructor; +- private final Class valueClass; +- +- AutoInstantiatingLoader(@Nullable Class keyClass, @NotNull Class valueClass) { +- try { +- this.valueClass = valueClass; +- if (keyClass != null) { +- constructor = valueClass.getConstructor(keyClass); +- } else { +- constructor = null; +- } +- } catch (NoSuchMethodException e) { +- throw new IllegalStateException( +- valueClass.getName() + " does not have a constructor for " + (keyClass != null ? keyClass.getName() : null)); +- } +- } +- +- @NotNull +- @Override +- public V apply(@Nullable K input) { +- try { +- return (constructor != null ? constructor.newInstance(input) : valueClass.newInstance()); +- } catch (Exception e) { +- throw new ExceptionInInitializerError(e); +- } +- } +- +- @Override +- public int hashCode() { +- return super.hashCode(); +- } +- +- @Override +- public boolean equals(Object object) { +- return false; +- } +- } +- +- /** +- * Due to java stuff, you will need to cast it to (Function) for some cases +- * +- * @param Type +- */ +- public abstract static class Feeder implements Function { +- @Nullable +- @Override +- public T apply(@Nullable Object input) { +- return apply(); +- } +- +- @Nullable +- public abstract T apply(); +- } +-} +diff --git a/src/main/java/co/aikar/util/MRUMapCache.java b/src/main/java/co/aikar/util/MRUMapCache.java +deleted file mode 100644 +index 3e61a926620a67daec3af54b72a1b911eaef2ed4..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/MRUMapCache.java ++++ /dev/null +@@ -1,112 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.util; +- +-import java.util.AbstractMap; +-import java.util.Collection; +-import java.util.Map; +-import java.util.Set; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Implements a Most Recently Used cache in front of a backing map, to quickly access the last accessed result. +- * +- * @param Key Type of the Map +- * @param Value Type of the Map +- */ +-@Deprecated(forRemoval = true) +-public class MRUMapCache extends AbstractMap { +- final Map backingMap; +- Object cacheKey; +- V cacheValue; +- public MRUMapCache(@NotNull final Map backingMap) { +- this.backingMap = backingMap; +- } +- +- public int size() {return backingMap.size();} +- +- public boolean isEmpty() {return backingMap.isEmpty();} +- +- public boolean containsKey(@Nullable Object key) { +- return key != null && key.equals(cacheKey) || backingMap.containsKey(key); +- } +- +- public boolean containsValue(@Nullable Object value) { +- return value != null && value == cacheValue || backingMap.containsValue(value); +- } +- +- @Nullable +- public V get(@Nullable Object key) { +- if (cacheKey != null && cacheKey.equals(key)) { +- return cacheValue; +- } +- cacheKey = key; +- return cacheValue = backingMap.get(key); +- } +- +- @Nullable +- public V put(@Nullable K key, @Nullable V value) { +- cacheKey = key; +- return cacheValue = backingMap.put(key, value); +- } +- +- @Nullable +- public V remove(@Nullable Object key) { +- if (key != null && key.equals(cacheKey)) { +- cacheKey = null; +- } +- return backingMap.remove(key); +- } +- +- public void putAll(@NotNull Map m) {backingMap.putAll(m);} +- +- public void clear() { +- cacheKey = null; +- cacheValue = null; +- backingMap.clear(); +- } +- +- @NotNull +- public Set keySet() {return backingMap.keySet();} +- +- @NotNull +- public Collection values() {return backingMap.values();} +- +- @NotNull +- public Set> entrySet() {return backingMap.entrySet();} +- +- /** +- * Wraps the specified map with a most recently used cache +- * +- * @param map Map to be wrapped +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map of(@NotNull Map map) { +- return new MRUMapCache(map); +- } +-} diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java index 71eb845a4d3b8b6ec3b816a0f20ec807e0f9a86d..a43419c23aa0f6fd809caf5a841cb138f350b7ba 100644 --- a/src/main/java/org/bukkit/command/Command.java @@ -2219,18 +2987,10 @@ index 001465eedafa51ac027a4db51cba6223edfe1171..9cb0f09b821a4020d17771a5b64ddd53 // Paper start diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 065f182fbfe4541d602f57d548f286ee3c2fab19..40350504b5f7a92d834e95bb2e4e4268195ec9e7 100644 +index b23774f34a39426c7eeba9da05a75de44e603658..1ad24e0107499e4dcaad647feeb54887675d9e51 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -43,7 +43,6 @@ import org.bukkit.plugin.TimedRegisteredListener; - import org.bukkit.plugin.UnknownDependencyException; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; --import org.spigotmc.CustomTimingsHandler; // Spigot - import org.yaml.snakeyaml.error.YAMLException; - - /** -@@ -294,7 +293,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -291,7 +291,7 @@ public final class JavaPluginLoader implements PluginLoader { } } @@ -2239,15 +2999,15 @@ index 065f182fbfe4541d602f57d548f286ee3c2fab19..40350504b5f7a92d834e95bb2e4e4268 @Override public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper try { -@@ -308,7 +307,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -305,7 +305,7 @@ public final class JavaPluginLoader implements PluginLoader { throw new EventException(t); } } - }, plugin, method, eventClass); // Paper + }; // Paper // DivineMC - Delete Timings - if (false) { // Spigot - RL handles useTimings check now - eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); - } else { + eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); + } + return ret; diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java deleted file mode 100644 index b4249da3eb26eae26ec000cc4d56cd21ac2fc6d5..0000000000000000000000000000000000000000 diff --git a/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch b/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch index e367f42..6514c35 100644 --- a/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch +++ b/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Extend Sound API diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index b703ad820ff873097dadff9e55b53fcc6b1b8698..b35c3852a3b8e62c7d2f67fc3ff651c8e0a4d5f2 100644 +index d309e28d7e6756afed82390fd2a99a6131e29140..468e2fa5e059e19c14d095c840723f10a6aa9287 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -817,4 +817,29 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr @@ -39,10 +39,10 @@ index b703ad820ff873097dadff9e55b53fcc6b1b8698..b35c3852a3b8e62c7d2f67fc3ff651c8 + // DivineMC end - Extend Sound API } diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index be56f0f42d4ec23397f9974e158b49fcc7ed44f3..82117a1b258d43f68ff803c4c1af0a33c99065a8 100644 +index 97ba2c698da6820eae7d254008579bb64052f474..5a8635890b83b5eab24a3c155b98b50d07e9d7e4 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1251,4 +1251,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -1269,4 +1269,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ void setImmuneToFire(@Nullable Boolean fireImmune); // Purpur end - Fire Immunity API diff --git a/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch b/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch index 0c33e29..72341e2 100644 --- a/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch +++ b/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch @@ -31,10 +31,10 @@ index 9cb0f09b821a4020d17771a5b64ddd53e7d78478..1638548b766460be65c0c008f7f19df1 callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 40350504b5f7a92d834e95bb2e4e4268195ec9e7..1450ce1ce1ecad79dd9514081190df94ceae9d52 100644 +index 1ad24e0107499e4dcaad647feeb54887675d9e51..9342ea35fb963379039ae020f9317bb02147f9c1 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -336,7 +336,13 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -330,7 +330,13 @@ public final class JavaPluginLoader implements PluginLoader { try { jPlugin.setEnabled(true); } catch (Throwable ex) { @@ -48,7 +48,7 @@ index 40350504b5f7a92d834e95bb2e4e4268195ec9e7..1450ce1ce1ecad79dd9514081190df94 } // Perhaps abort here, rather than continue going, but as it stands, -@@ -361,7 +367,9 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -355,7 +361,9 @@ public final class JavaPluginLoader implements PluginLoader { try { jPlugin.setEnabled(false); } catch (Throwable ex) { diff --git a/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch b/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch index e4ca07b..271db30 100644 --- a/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch +++ b/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Paper PR: Player standing on position API diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 82117a1b258d43f68ff803c4c1af0a33c99065a8..cb8232faed9423dd570e3a6b0ea664182074a1ac 100644 +index 5a8635890b83b5eab24a3c155b98b50d07e9d7e4..8f89484db54209dfe55dab5fce62fd82d04deb6f 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1197,6 +1197,33 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -1215,6 +1215,33 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent void broadcastHurtAnimation(@NotNull java.util.Collection players); // Paper end - broadcast hurt animation diff --git a/divinemc-server/build.gradle.kts.patch b/divinemc-server/build.gradle.kts.patch index 4a6b74d..0be32d9 100644 --- a/divinemc-server/build.gradle.kts.patch +++ b/divinemc-server/build.gradle.kts.patch @@ -1,14 +1,14 @@ --- a/purpur-server/build.gradle.kts +++ b/purpur-server/build.gradle.kts -@@ -22,6 +_,7 @@ - // gitFilePatches = true +@@ -25,6 +_,7 @@ + //} val purpur = forks.register("purpur") { + rootDirectory = upstreamsDirectory().map { it.dir("purpur") } upstream.patchDir("paperServer") { upstreamPath = "paper-server" excludes = setOf("src/minecraft", "patches", "build.gradle.kts") -@@ -29,7 +_,23 @@ +@@ -32,7 +_,23 @@ outputDir = rootDirectory.dir("paper-server") } } @@ -32,8 +32,8 @@ + activeFork = divinemc spigot { - buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42" -@@ -115,10 +_,14 @@ + buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc" +@@ -119,10 +_,14 @@ main { java { srcDir("../paper-server/src/main/java") } resources { srcDir("../paper-server/src/main/resources") } @@ -48,7 +48,7 @@ } } -@@ -142,10 +_,22 @@ +@@ -146,10 +_,22 @@ } dependencies { @@ -74,7 +74,7 @@ implementation("net.minecrell:terminalconsoleappender:1.3.0") implementation("net.kyori:adventure-text-serializer-ansi:4.18.0") // Keep in sync with adventureVersion from Paper-API build file -@@ -155,16 +_,16 @@ +@@ -159,16 +_,16 @@ all its classes to check if they are plugins. Scanning takes about 1-2 seconds so adding this speeds up the server start. */ @@ -95,7 +95,7 @@ implementation("org.ow2.asm:asm-commons:9.7.1") implementation("org.spongepowered:configurate-yaml:4.2.0-20250225.064233-199") implementation("org.spongepowered:configurate-core:4.2.0-20250225.064233-204") // Pinned dependency of above pinned yaml snapshot. -@@ -173,22 +_,24 @@ +@@ -177,22 +_,24 @@ runtimeOnly("com.mysql:mysql-connector-j:9.1.0") runtimeOnly("com.lmax:disruptor:3.4.4") @@ -129,7 +129,7 @@ implementation("net.neoforged:srgutils:1.0.9") // Mappings handling implementation("net.neoforged:AutoRenamingTool:2.0.3") // Remap plugins -@@ -204,30 +_,41 @@ +@@ -208,30 +_,41 @@ implementation("me.lucko:spark-paper:1.10.119-20241121.092015-1") } @@ -156,16 +156,16 @@ + val experimental = rootProject.providers.gradleProperty("experimental").get() attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", -- "Implementation-Title" to "Purpur", // Purpur +- "Implementation-Title" to "Purpur", + "Implementation-Title" to "DivineMC", // DivineMC "Implementation-Version" to implementationVersion, "Implementation-Vendor" to date, -- "Specification-Title" to "Purpur", // Purpur +- "Specification-Title" to "Purpur", + "Specification-Title" to "DivineMC", // DivineMC "Specification-Version" to project.version, -- "Specification-Vendor" to "Purpur Team", // Purpur -- "Brand-Id" to "purpurmc:purpur", // Purpur -- "Brand-Name" to "Purpur", // Purpur +- "Specification-Vendor" to "Purpur Team", +- "Brand-Id" to "purpurmc:purpur", +- "Brand-Name" to "Purpur", + "Specification-Vendor" to "BX Team", // DivineMC + "Brand-Id" to "bxteam:divinemc", // DivineMC + "Brand-Name" to "DivineMC", // DivineMC