mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2026-01-04 15:41:35 +00:00
2.1.6
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
|
||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0")
|
||||
implementation("de.tr7zw:item-nbt-api:2.12.3")
|
||||
compileOnly("de.tr7zw:item-nbt-api:2.12.4")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -9,7 +9,7 @@ dependencies {
|
||||
compileOnly("dev.jorel:commandapi-bukkit-core:9.4.0")
|
||||
|
||||
// nbt
|
||||
compileOnly("de.tr7zw:item-nbt-api:2.12.3")
|
||||
compileOnly("de.tr7zw:item-nbt-api:2.12.4")
|
||||
|
||||
// bStats
|
||||
compileOnly("org.bstats:bstats-bukkit:3.0.2")
|
||||
@@ -54,6 +54,7 @@ dependencies {
|
||||
compileOnly("xyz.xenondevs.invui:invui:1.30")
|
||||
compileOnly("com.github.Xiao-MoMi:Custom-Crops:3.4.4.1")
|
||||
compileOnly("com.github.Xiao-MoMi:BiomeAPI:0.6")
|
||||
compileOnly("org.apache.commons:commons-lang3:3.14.0")
|
||||
|
||||
// local jars
|
||||
compileOnly(files("libs/AdvancedEnchantments-api.jar"))
|
||||
@@ -76,6 +77,7 @@ dependencies {
|
||||
tasks {
|
||||
shadowJar {
|
||||
relocate ("org.apache.commons.pool2", "net.momirealms.customfishing.libraries.commonspool2")
|
||||
relocate ("org.apache.commons.lang3", "net.momirealms.customfishing.libraries.lang3")
|
||||
relocate ("com.mysql", "net.momirealms.customfishing.libraries.mysql")
|
||||
relocate ("org.mariadb", "net.momirealms.customfishing.libraries.mariadb")
|
||||
relocate ("com.zaxxer.hikari", "net.momirealms.customfishing.libraries.hikari")
|
||||
|
||||
@@ -56,6 +56,7 @@ import net.momirealms.customfishing.scheduler.SchedulerImpl;
|
||||
import net.momirealms.customfishing.setting.CFConfig;
|
||||
import net.momirealms.customfishing.setting.CFLocale;
|
||||
import net.momirealms.customfishing.storage.StorageManagerImpl;
|
||||
import net.momirealms.customfishing.util.NBTUtils;
|
||||
import net.momirealms.customfishing.version.VersionManagerImpl;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -66,9 +67,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class CustomFishingPluginImpl extends CustomFishingPlugin {
|
||||
|
||||
@@ -102,6 +101,7 @@ public class CustomFishingPluginImpl extends CustomFishingPlugin {
|
||||
Dependency.MONGODB_DRIVER_BSON,
|
||||
Dependency.JEDIS,
|
||||
Dependency.COMMONS_POOL_2,
|
||||
Dependency.COMMONS_LANG_3,
|
||||
Dependency.H2_DRIVER,
|
||||
Dependency.SQLITE_DRIVER,
|
||||
Dependency.BSTATS_BASE,
|
||||
@@ -118,7 +118,7 @@ public class CustomFishingPluginImpl extends CustomFishingPlugin {
|
||||
public void onEnable() {
|
||||
protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
this.versionManager = new VersionManagerImpl(this);
|
||||
this.disableNBTAPILogs();
|
||||
NBTUtils.disableNBTAPILogs();
|
||||
ReflectionUtils.load();
|
||||
|
||||
this.actionManager = new ActionManagerImpl(this);
|
||||
@@ -235,42 +235,6 @@ public class CustomFishingPluginImpl extends CustomFishingPlugin {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable NBT API logs
|
||||
*/
|
||||
private void disableNBTAPILogs() {
|
||||
MinecraftVersion.disableBStats();
|
||||
MinecraftVersion.disableUpdateCheck();
|
||||
VersionChecker.hideOk = true;
|
||||
try {
|
||||
Field field = MinecraftVersion.class.getDeclaredField("version");
|
||||
field.setAccessible(true);
|
||||
MinecraftVersion minecraftVersion;
|
||||
try {
|
||||
minecraftVersion = MinecraftVersion.valueOf(getVersionManager().getServerVersion().replace("v", "MC"));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
minecraftVersion = MinecraftVersion.UNKNOWN;
|
||||
}
|
||||
field.set(MinecraftVersion.class, minecraftVersion);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
boolean hasGsonSupport;
|
||||
try {
|
||||
Class.forName("com.google.gson.Gson");
|
||||
hasGsonSupport = true;
|
||||
} catch (Exception ex) {
|
||||
hasGsonSupport = false;
|
||||
}
|
||||
try {
|
||||
Field field= MinecraftVersion.class.getDeclaredField("hasGsonSupport");
|
||||
field.setAccessible(true);
|
||||
field.set(Boolean.class, hasGsonSupport);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a YAML configuration from a file within the plugin's data folder.
|
||||
*
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.momirealms.customfishing.libraries.dependencies;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.momirealms.customcrops.api.CustomCropsPlugin;
|
||||
import net.momirealms.customfishing.libraries.dependencies.relocation.Relocation;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -234,7 +233,7 @@ public enum Dependency {
|
||||
BIOME_API(
|
||||
"com{}github{}Xiao-MoMi",
|
||||
"BiomeAPI",
|
||||
"0.3",
|
||||
"0.6",
|
||||
"jitpack",
|
||||
"biome-api",
|
||||
Relocation.of("biomeapi", "net{}momirealms{}biomeapi")
|
||||
@@ -255,6 +254,14 @@ public enum Dependency {
|
||||
Relocation.of("adventure", "net{}kyori{}adventure"),
|
||||
Relocation.of("option", "net{}kyori{}option"),
|
||||
Relocation.of("examination", "net{}kyori{}examination")
|
||||
),
|
||||
COMMONS_LANG_3(
|
||||
"org{}apache{}commons",
|
||||
"commons-lang3",
|
||||
"3.14.0",
|
||||
null,
|
||||
"commons-lang3",
|
||||
Relocation.of("lang3", "org{}apache{}commons{}lang3")
|
||||
);
|
||||
|
||||
private final String mavenRepoPath;
|
||||
|
||||
@@ -23,8 +23,6 @@ import net.momirealms.customfishing.api.data.StorageType;
|
||||
import net.momirealms.customfishing.api.util.LogUtils;
|
||||
import net.momirealms.customfishing.setting.CFConfig;
|
||||
import net.momirealms.customfishing.storage.method.AbstractStorage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -20,10 +20,15 @@ package net.momirealms.customfishing.util;
|
||||
import de.tr7zw.changeme.nbtapi.NBTCompound;
|
||||
import de.tr7zw.changeme.nbtapi.NBTListCompound;
|
||||
import de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT;
|
||||
import de.tr7zw.changeme.nbtapi.utils.MinecraftVersion;
|
||||
import de.tr7zw.changeme.nbtapi.utils.VersionChecker;
|
||||
import net.momirealms.customcrops.api.CustomCropsPlugin;
|
||||
import net.momirealms.customfishing.compatibility.papi.PlaceholderManagerImpl;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.MemorySection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -33,6 +38,53 @@ public class NBTUtils {
|
||||
|
||||
private NBTUtils() {}
|
||||
|
||||
public static void disableNBTAPILogs() {
|
||||
MinecraftVersion.disableBStats();
|
||||
MinecraftVersion.disableUpdateCheck();
|
||||
VersionChecker.hideOk = true;
|
||||
try {
|
||||
Field field = MinecraftVersion.class.getDeclaredField("version");
|
||||
field.setAccessible(true);
|
||||
MinecraftVersion minecraftVersion;
|
||||
try {
|
||||
minecraftVersion = MinecraftVersion.valueOf(CustomCropsPlugin.get().getVersionManager().getServerVersion().replace("v", "MC"));
|
||||
} catch (Exception ex) {
|
||||
minecraftVersion = VERSION_TO_REVISION.getOrDefault(Bukkit.getServer().getBukkitVersion().split("-")[0],
|
||||
MinecraftVersion.UNKNOWN);
|
||||
}
|
||||
field.set(MinecraftVersion.class, minecraftVersion);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
boolean hasGsonSupport;
|
||||
try {
|
||||
Class.forName("com.google.gson.Gson");
|
||||
hasGsonSupport = true;
|
||||
} catch (Exception ex) {
|
||||
hasGsonSupport = false;
|
||||
}
|
||||
try {
|
||||
Field field= MinecraftVersion.class.getDeclaredField("hasGsonSupport");
|
||||
field.setAccessible(true);
|
||||
field.set(Boolean.class, hasGsonSupport);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<String, MinecraftVersion> VERSION_TO_REVISION = new HashMap<>() {
|
||||
{
|
||||
this.put("1.20", MinecraftVersion.MC1_20_R1);
|
||||
this.put("1.20.1", MinecraftVersion.MC1_20_R1);
|
||||
this.put("1.20.2", MinecraftVersion.MC1_20_R2);
|
||||
this.put("1.20.3", MinecraftVersion.MC1_20_R3);
|
||||
this.put("1.20.4", MinecraftVersion.MC1_20_R3);
|
||||
this.put("1.20.5", MinecraftVersion.MC1_20_R4);
|
||||
this.put("1.20.6", MinecraftVersion.MC1_20_R4);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Inner class representing a stack element used during NBT data conversion.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user