From 4629ff74f40e07ee680453ed28f24b47f96eff1b Mon Sep 17 00:00:00 2001 From: Mgazul Date: Sat, 27 Apr 2024 22:31:13 +0800 Subject: [PATCH] Fix build --- build.gradle | 4 +-- .../com/mohistmc/banner/BannerMCStart.java | 6 ++-- .../nms/proxy/DelegateURLClassLoder.java | 2 ++ .../banner/config/BannerConfigUtil.java | 4 +-- .../BannerEventDispatcherRegistry.java | 2 +- .../banner/fabric/FabricInjectBukkit.java | 16 ++++----- .../banner/libraries/DefaultLibraries.java | 8 ++--- .../mixin/server/MixinMinecraftServer.java | 2 +- .../dedicated/MixinDedicatedServer.java | 2 +- .../banner/network/download/UpdateUtils.java | 18 +++++----- .../banner/stackdeobf/http/HttpUtil.java | 4 +-- .../stackdeobf/mappings/CachedMappings.java | 14 ++++---- .../providers/AbstractMappingProvider.java | 12 +++---- .../providers/BuildBasedMappingProvider.java | 16 ++++----- .../IntermediaryMappingProvider.java | 2 +- .../providers/MojangMappingProvider.java | 14 ++++---- .../com/mohistmc/banner/util/EulaUtil.java | 2 +- .../util/pluginmanager/PluginManagers.java | 34 +++++++++---------- src/main/java/org/bukkit/Material.java | 9 ++--- .../craftbukkit/v1_19_R3/CraftServer.java | 2 +- .../bukkit/plugin/java/JavaPluginLoader.java | 4 +-- .../org/bukkit/plugin/java/LibraryLoader.java | 6 ++-- .../bukkit/plugin/java/PluginClassLoader.java | 2 ++ src/main/resources/libraries.txt | 1 - 24 files changed, 94 insertions(+), 92 deletions(-) diff --git a/build.gradle b/build.gradle index f03d02e7e..c0146f4be 100644 --- a/build.gradle +++ b/build.gradle @@ -67,7 +67,8 @@ dependencies { implementation "org.apache.maven:maven-model-builder:3.8.5" implementation "org.apache.maven:maven-repository-metadata:3.8.5" compileOnly "org.jetbrains:annotations:21.0.1" - implementation(include("com.mohistmc:i18n:0.2")) + implementation(include("com.mohistmc:i18n:0.6")) + implementation(include("com.mohistmc:dynamicenum:0.3")) // craftbukkit implementation "org.fusesource.jansi:jansi:1.18" @@ -81,7 +82,6 @@ dependencies { // spigot implementation "net.md-5:bungeecord-chat:1.16-R0.4" implementation "io.izzel:tools:1.3.0" - implementation "com.mohistmc:dynamicenum:0.1" implementation "com.google.guava:failureaccess:1.0.1" implementation "com.google.guava:guava:31.0.1-jre" diff --git a/src/main/java/com/mohistmc/banner/BannerMCStart.java b/src/main/java/com/mohistmc/banner/BannerMCStart.java index 163e1329e..223c5084c 100644 --- a/src/main/java/com/mohistmc/banner/BannerMCStart.java +++ b/src/main/java/com/mohistmc/banner/BannerMCStart.java @@ -32,7 +32,7 @@ public static void run() throws Exception { LOGGER.info("| _ { / / | | | |\\ | | |\\ | | __| | _ / "); LOGGER.info("| |_| | / / | | | | \\ | | | \\ | | |___ | | \\ \\ "); LOGGER.info("|_____/ /_/ |_| |_| \\_| |_| \\_| |_____| |_| \\_\\ "); - LOGGER.info(I18N.get("banner.launch.welcomemessage") + " - " + getVersion() + ", Java " + javaVersion); + LOGGER.info(I18N.as("banner.launch.welcomemessage") + " - " + getVersion() + ", Java " + javaVersion); } if (System.getProperty("log4j.configurationFile") == null) { System.setProperty("log4j.configurationFile", "log4j2_banner.xml"); @@ -45,7 +45,7 @@ public static void run() throws Exception { CustomLibraries.loadCustomLibs(); injectDeobfStack(); if (!EulaUtil.hasAcceptedEULA()) { - System.out.println(I18N.get("eula")); + System.out.println(I18N.as("eula")); while (!"true".equals(new Scanner(System.in).next())); EulaUtil.writeInfos(); } @@ -61,7 +61,7 @@ public static String getVersion() { } private static void injectDeobfStack() { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.inject.logger")); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.inject.logger")); RemappingRewritePolicy policy = new RemappingRewritePolicy(); policy.inject((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); CachedMappings.init(new MojangMappingProvider()); diff --git a/src/main/java/com/mohistmc/banner/bukkit/nms/proxy/DelegateURLClassLoder.java b/src/main/java/com/mohistmc/banner/bukkit/nms/proxy/DelegateURLClassLoder.java index ab257481b..8411c807d 100644 --- a/src/main/java/com/mohistmc/banner/bukkit/nms/proxy/DelegateURLClassLoder.java +++ b/src/main/java/com/mohistmc/banner/bukkit/nms/proxy/DelegateURLClassLoder.java @@ -137,6 +137,7 @@ private void fixPackage(Manifest manifest, URL url, String name) { if (attributes != null) { try { try { + /* Object versionInfo = MohistDynamEnum.getField(pkg, Package.class.getDeclaredField("versionInfo")); if (versionInfo != null) { Class Package$VersionInfo = Class.forName("java.lang.Package$VersionInfo"); @@ -147,6 +148,7 @@ private void fixPackage(Manifest manifest, URL url, String name) { MohistDynamEnum.setField(versionInfo, attributes.getValue(Attributes.Name.SPECIFICATION_VERSION), Package$VersionInfo.getDeclaredField("specVersion")); MohistDynamEnum.setField(versionInfo, attributes.getValue(Attributes.Name.SPECIFICATION_VENDOR), Package$VersionInfo.getDeclaredField("specVendor")); } + */ } catch (Exception ignored) { } } finally { diff --git a/src/main/java/com/mohistmc/banner/config/BannerConfigUtil.java b/src/main/java/com/mohistmc/banner/config/BannerConfigUtil.java index 3a05cc7e2..2df3db5ff 100644 --- a/src/main/java/com/mohistmc/banner/config/BannerConfigUtil.java +++ b/src/main/java/com/mohistmc/banner/config/BannerConfigUtil.java @@ -67,9 +67,7 @@ public static void save() { public static void i18n() { String banner_lang = yml.getString("banner.lang", "xx_XX"); - String l = banner_lang.split("_")[0]; - String c = banner_lang.split("_")[1]; - BannerMCStart.I18N = new i18n(BannerMCStart.class.getClassLoader(), new Locale(l, c)); + BannerMCStart.I18N = new i18n(BannerMCStart.class.getClassLoader(), banner_lang); } public static String lang() { diff --git a/src/main/java/com/mohistmc/banner/eventhandler/BannerEventDispatcherRegistry.java b/src/main/java/com/mohistmc/banner/eventhandler/BannerEventDispatcherRegistry.java index b9e4c8bba..0af9977bf 100644 --- a/src/main/java/com/mohistmc/banner/eventhandler/BannerEventDispatcherRegistry.java +++ b/src/main/java/com/mohistmc/banner/eventhandler/BannerEventDispatcherRegistry.java @@ -10,7 +10,7 @@ public class BannerEventDispatcherRegistry { public static void registerEventDispatchers() { - BannerServer.LOGGER.info(BannerMCStart.I18N.get("banner.event_handler.register")); + BannerServer.LOGGER.info(BannerMCStart.I18N.as("banner.event_handler.register")); LevelEventDispatcher.dispatchLevel(); PlayerEventDispatcher.dispatcherPlayer(); EntityEventDispatcher.dispatchEntity(); diff --git a/src/main/java/com/mohistmc/banner/fabric/FabricInjectBukkit.java b/src/main/java/com/mohistmc/banner/fabric/FabricInjectBukkit.java index 0701bbbb9..ac5a22801 100644 --- a/src/main/java/com/mohistmc/banner/fabric/FabricInjectBukkit.java +++ b/src/main/java/com/mohistmc/banner/fabric/FabricInjectBukkit.java @@ -78,7 +78,7 @@ public static void addEnumEnvironment() { if (environment1 == null) { String name = normalizeName(key.location().toString()); int id = i - 1; - environment1 = MohistDynamEnum.addEnum(World.Environment.class, name, new Class[]{Integer.TYPE}, new Object[]{id}); + environment1 = MohistDynamEnum.addEnum(World.Environment.class, name, List.of(Integer.TYPE), List.of(id)); DIM_MAP.put(key, environment1); BannerServer.LOGGER.debug("Registered fabric DimensionType as environment {}", environment1); i++; @@ -145,7 +145,7 @@ public static void addEnumEffectAndPotion() { if (CraftPotionUtil.toBukkit(resourceLocation.toString()).getType() == PotionType.UNCRAFTABLE && potion != Potions.EMPTY) { String name = normalizeName(resourceLocation.toString()); MobEffectInstance effectInstance = potion.getEffects().isEmpty() ? null : potion.getEffects().get(0); - PotionType potionType = MohistDynamEnum.addEnum0(PotionType.class, name, new Class[]{PotionEffectType.class, Boolean.TYPE, Boolean.TYPE}, effectInstance == null ? null : PotionEffectType.getById(MobEffect.getId(effectInstance.getEffect())), false, false); + PotionType potionType = MohistDynamEnum.addEnum(PotionType.class, name, List.of(PotionEffectType.class, Boolean.TYPE, Boolean.TYPE), List.of(effectInstance == null ? null : PotionEffectType.getById(MobEffect.getId(effectInstance.getEffect())), false, false)); if (potionType != null) { BannerServer.LOGGER.debug("Save-PotionType:" + name + " - " + potionType.name()); } @@ -159,7 +159,7 @@ public static void addEnumParticle() { ResourceLocation resourceLocation = registry.getKey(particleType); String name = normalizeName(resourceLocation.toString()); if (!resourceLocation.getNamespace().equals(NamespacedKey.MINECRAFT)) { - Particle particle = MohistDynamEnum.addEnum0(Particle.class, name, new Class[0]); + Particle particle = MohistDynamEnum.addEnum(Particle.class, name, List.of(), List.of()); if (particle != null) { org.bukkit.craftbukkit.v1_19_R3.CraftParticle.putParticles(particle, resourceLocation); BannerServer.LOGGER.debug("Save-ParticleType:" + name + " - " + particle.name()); @@ -176,7 +176,7 @@ public static void addEnumBiome() { String biomeName = normalizeName(resourceLocation.toString()); if (!isMINECRAFT(resourceLocation) && !map.contains(biomeName)) { map.add(biomeName); - org.bukkit.block.Biome biomeCB = MohistDynamEnum.addEnum0(org.bukkit.block.Biome.class, biomeName, new Class[0]); + org.bukkit.block.Biome biomeCB = MohistDynamEnum.addEnum(org.bukkit.block.Biome.class, biomeName, List.of(), List.of()); BannerServer.LOGGER.debug("Save-BIOME:" + biomeCB.name() + " - " + biomeName); } } @@ -190,7 +190,7 @@ public static void addEnumEntity() { if (!isMINECRAFT(resourceLocation)) { String entityType = normalizeName(resourceLocation.toString()); int typeId = entityType.hashCode(); - EntityType bukkitType = MohistDynamEnum.addEnum0(EntityType.class, entityType, new Class[]{String.class, Class.class, Integer.TYPE, Boolean.TYPE}, entityType.toLowerCase(), MohistModsEntity.class, typeId, false); + EntityType bukkitType = MohistDynamEnum.addEnum(EntityType.class, entityType, List.of(String.class, Class.class, Integer.TYPE, Boolean.TYPE), List.of(entityType.toLowerCase(), MohistModsEntity.class, typeId, false)); EntityType.NAME_MAP.put(entityType.toLowerCase(), bukkitType); EntityType.ID_MAP.put((short) typeId, bukkitType); ServerAPI.entityTypeMap.put(entity, entityType); @@ -204,7 +204,7 @@ public static void addEnumVillagerProfession() { ResourceLocation resourceLocation = registry.getKey(villagerProfession); if (!isMINECRAFT(resourceLocation)) { String name = normalizeName(resourceLocation.toString()); - Villager.Profession vp = MohistDynamEnum.addEnum0(Villager.Profession.class, name, new Class[0]); + Villager.Profession vp = MohistDynamEnum.addEnum(Villager.Profession.class, name, List.of(), List.of()); profession.put(vp, resourceLocation); BannerServer.LOGGER.debug("Registered fabric VillagerProfession as Profession {}", vp.name()); } @@ -217,7 +217,7 @@ public static void addFluid() { ResourceLocation resourceLocation = registry.getKey(fluidType); String name = normalizeName(resourceLocation.getPath()); if (!isMINECRAFT(resourceLocation)) { - Fluid fluid = MohistDynamEnum.addEnum0(Fluid.class, name, new Class[0]); + Fluid fluid = MohistDynamEnum.addEnum(Fluid.class, name, List.of(), List.of()); CraftMagicNumbers.FLUIDTYPE_FLUID.put(fluidType, fluid); BannerServer.LOGGER.debug("Registered fabric Fluid as Fluid(Bukkit) {}", fluid.name()); } @@ -230,7 +230,7 @@ public static void addStatistic() { ResourceLocation resourceLocation = registry.getKey(statType); String name = normalizeName(resourceLocation.getPath()); if (!isMINECRAFT(resourceLocation)) { - Statistic statistic = MohistDynamEnum.addEnum0(Statistic.class, name, new Class[0]); + Statistic statistic = MohistDynamEnum.addEnum(Statistic.class, name, List.of(), List.of()); statisticMap.put(statType, statistic); BannerServer.LOGGER.debug("Registered fabric StatType as Statistic(Bukkit) {}", statistic.name()); } diff --git a/src/main/java/com/mohistmc/banner/libraries/DefaultLibraries.java b/src/main/java/com/mohistmc/banner/libraries/DefaultLibraries.java index f2e16c2f1..e7fecf163 100644 --- a/src/main/java/com/mohistmc/banner/libraries/DefaultLibraries.java +++ b/src/main/java/com/mohistmc/banner/libraries/DefaultLibraries.java @@ -35,7 +35,7 @@ public static String libUrl(File lib) { } public static void run() throws Exception { - System.out.println(BannerMCStart.I18N.get("libraries.checking.start")); + System.out.println(BannerMCStart.I18N.as("libraries.checking.start")); LinkedHashMap libs = getDefaultLibs(); AtomicLong currentSize = new AtomicLong(); Set defaultLibs = new LinkedHashSet<>(); @@ -52,14 +52,14 @@ public static void run() throws Exception { lib.getParentFile().mkdirs(); String u = libUrl(lib); - System.out.println(BannerMCStart.I18N.get("libraries.global.percentage") + Math.round((float) (currentSize.get() * 100) / allSize.get()) + "%"); //Global percentage + System.out.println(BannerMCStart.I18N.as("libraries.global.percentage") + Math.round((float) (currentSize.get() * 100) / allSize.get()) + "%"); //Global percentage try { UpdateUtils.downloadFile(u, lib, libs.get(lib)); currentSize.addAndGet(lib.length()); fail.remove(u.replace(MAVENURL, "")); } catch (Exception e) { if (e.getMessage() != null && !"md5".equals(e.getMessage())) { - System.out.println(BannerMCStart.I18N.get("file.download.nook", u)); + System.out.println(BannerMCStart.I18N.as("file.download.nook", u)); lib.delete(); } fail.put(u.replace(MAVENURL, ""), lib.getAbsolutePath()); @@ -69,7 +69,7 @@ public static void run() throws Exception { if (!fail.isEmpty()) { run(); } else { - System.out.println(BannerMCStart.I18N.get("libraries.check.end")); + System.out.println(BannerMCStart.I18N.as("libraries.check.end")); } } diff --git a/src/main/java/com/mohistmc/banner/mixin/server/MixinMinecraftServer.java b/src/main/java/com/mohistmc/banner/mixin/server/MixinMinecraftServer.java index 294e83fb7..a6c479a36 100644 --- a/src/main/java/com/mohistmc/banner/mixin/server/MixinMinecraftServer.java +++ b/src/main/java/com/mohistmc/banner/mixin/server/MixinMinecraftServer.java @@ -345,7 +345,7 @@ public final void prepareLevels(ChunkProgressListener listener) { ServerLevel banner$serverLevel = this.prepareLevels$serverlevel.getAndSet(this.overworld()); banner$serverLevel = banner$serverLevel == null ? this.overworld() : banner$serverLevel; ServerLevel serverLevel = banner$serverLevel; - LOGGER.info(BannerMCStart.I18N.get("server.region.prepare"), serverLevel.dimension().location()); + LOGGER.info(BannerMCStart.I18N.as("server.region.prepare"), serverLevel.dimension().location()); BlockPos blockPos = serverLevel.getSharedSpawnPos(); listener.updateSpawnPos(new ChunkPos(blockPos)); ServerChunkCache serverChunkCache = serverLevel.getChunkSource(); diff --git a/src/main/java/com/mohistmc/banner/mixin/server/dedicated/MixinDedicatedServer.java b/src/main/java/com/mohistmc/banner/mixin/server/dedicated/MixinDedicatedServer.java index 858b30c4f..846538d28 100644 --- a/src/main/java/com/mohistmc/banner/mixin/server/dedicated/MixinDedicatedServer.java +++ b/src/main/java/com/mohistmc/banner/mixin/server/dedicated/MixinDedicatedServer.java @@ -55,7 +55,7 @@ public MixinDedicatedServer(Thread thread, LevelStorageSource.LevelStorageAccess @Inject(method = "initServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/DedicatedServer;usesAuthentication()Z", ordinal = 1)) private void banner$initServer(CallbackInfoReturnable cir) { - BannerServer.LOGGER.info(BannerMCStart.I18N.get("bukkit.plugin.loading.info")); + BannerServer.LOGGER.info(BannerMCStart.I18N.as("bukkit.plugin.loading.info")); // CraftBukkit start this.bridge$server().loadPlugins(); this.bridge$server().enablePlugins(PluginLoadOrder.STARTUP); diff --git a/src/main/java/com/mohistmc/banner/network/download/UpdateUtils.java b/src/main/java/com/mohistmc/banner/network/download/UpdateUtils.java index dec6f2e08..e0188fa57 100644 --- a/src/main/java/com/mohistmc/banner/network/download/UpdateUtils.java +++ b/src/main/java/com/mohistmc/banner/network/download/UpdateUtils.java @@ -29,8 +29,8 @@ public class UpdateUtils { private static int percentage = 0; public static void versionCheck() { - System.out.println(BannerMCStart.I18N.get("update.check")); - System.out.println(BannerMCStart.I18N.get("update.stopcheck")); + System.out.println(BannerMCStart.I18N.as("update.check")); + System.out.println(BannerMCStart.I18N.as("update.stopcheck")); try { JsonElement root = JsonParser.parseReader(new InputStreamReader(getInput("https://ci.codemc.io/job/MohistMC/job/Banner-1.19.4/lastSuccessfulBuild/api/json"))); @@ -40,12 +40,12 @@ public static void versionCheck() { String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(Long.parseLong(root.getAsJsonObject().get("timestamp").toString()))); if (jar_sha.equals(build_number)) - System.out.println(BannerMCStart.I18N.get("update.latest", jar_sha, build_number)); + System.out.println(BannerMCStart.I18N.as("update.latest", jar_sha, build_number)); else { - System.out.println(BannerMCStart.I18N.get("update.detect", build_number, jar_sha, time)); + System.out.println(BannerMCStart.I18N.as("update.detect", build_number, jar_sha, time)); } } catch (Throwable e) { - System.out.println(BannerMCStart.I18N.get("check.update.noci")); + System.out.println(BannerMCStart.I18N.as("check.update.noci")); } } @@ -55,7 +55,7 @@ public static void downloadFile(String URL, File f) throws Exception { public static void downloadFile(String URL, File f, String md5) throws Exception { URLConnection conn = getConn(URL); - System.out.println(BannerMCStart.I18N.get("download.file", f.getName(), getSize(conn.getContentLength()))); + System.out.println(BannerMCStart.I18N.as("download.file", f.getName(), getSize(conn.getContentLength()))); ReadableByteChannel rbc = Channels.newChannel(conn.getInputStream()); FileChannel fc = FileChannel.open(f.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); int fS = conn.getContentLength(); @@ -65,7 +65,7 @@ public static void downloadFile(String URL, File f, String md5) throws Exception () -> { if (rbc.isOpen()) { if (percentage != Math.round((float) f.length() / fS * 100) && percentage < 100) { - System.out.println(BannerMCStart.I18N.get("file.download.percentage", f.getName(), percentage)); + System.out.println(BannerMCStart.I18N.as("file.download.percentage", f.getName(), percentage)); } percentage = Math.round((float) f.length() / fS * 100); } @@ -77,10 +77,10 @@ public static void downloadFile(String URL, File f, String md5) throws Exception String MD5 = MD5Util.getMd5(f); if (f.getName().endsWith(".jar") && md5 != null && MD5 != null && !MD5.equals(md5.toLowerCase())) { f.delete(); - System.out.println(BannerMCStart.I18N.get("file.download.nook.md5", URL, MD5, md5.toLowerCase())); + System.out.println(BannerMCStart.I18N.as("file.download.nook.md5", URL, MD5, md5.toLowerCase())); throw new Exception("md5"); } - System.out.println(BannerMCStart.I18N.get("download.file.ok", f.getName())); + System.out.println(BannerMCStart.I18N.as("download.file.ok", f.getName())); } public static String getSize(long size) { diff --git a/src/main/java/com/mohistmc/banner/stackdeobf/http/HttpUtil.java b/src/main/java/com/mohistmc/banner/stackdeobf/http/HttpUtil.java index ba54ca472..587c33035 100644 --- a/src/main/java/com/mohistmc/banner/stackdeobf/http/HttpUtil.java +++ b/src/main/java/com/mohistmc/banner/stackdeobf/http/HttpUtil.java @@ -43,14 +43,14 @@ public static CompletableFuture getAsync(URI uri, Executor executor) { HttpRequest request = HttpRequest.newBuilder(uri).build(); HttpResponse.BodyHandler handler = HttpResponse.BodyHandlers.ofByteArray(); - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.requesting"), uri); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.requesting"), uri); long start = System.currentTimeMillis(); return getHttpClient(executor).sendAsync(request, handler).thenApplyAsync(resp -> { long timeDiff = System.currentTimeMillis() - start; byte[] bodyBytes = resp.body(); - String message = BannerMCStart.I18N.get("stackdeobf.received"); + String message = BannerMCStart.I18N.as("stackdeobf.received"); Object[] args = {bodyBytes.length, FileUtils.byteCountToDisplaySize(bodyBytes.length), resp.statusCode(), uri, timeDiff}; diff --git a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/CachedMappings.java b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/CachedMappings.java index 88a61f957..ecc575237 100644 --- a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/CachedMappings.java +++ b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/CachedMappings.java @@ -25,7 +25,7 @@ private CachedMappings() { } public static void init(AbstractMappingProvider provider) { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.creating")); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.creating")); ExecutorService cacheExecutor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("Mappings Cache Thread").setDaemon(true).build()); long start = System.currentTimeMillis(); @@ -34,17 +34,17 @@ public static void init(AbstractMappingProvider provider) { provider.cacheMappings(new MappingCacheVisitor(CLASSES, METHODS, FIELDS), cacheExecutor) .thenAccept($ -> { long timeDiff = System.currentTimeMillis() - start; - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.cached.mappings"), timeDiff); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.cached.mappings"), timeDiff); - CompatUtil.LOGGER.info(" " + BannerMCStart.I18N.get("stackdeobf.classes") + " " + CLASSES.size()); - CompatUtil.LOGGER.info(" " + BannerMCStart.I18N.get("stackdeobf.methods") + " " + METHODS.size()); - CompatUtil.LOGGER.info(" " + BannerMCStart.I18N.get("stackdeobf.fields") + " " + FIELDS.size()); + CompatUtil.LOGGER.info(" " + BannerMCStart.I18N.as("stackdeobf.classes") + " " + CLASSES.size()); + CompatUtil.LOGGER.info(" " + BannerMCStart.I18N.as("stackdeobf.methods") + " " + METHODS.size()); + CompatUtil.LOGGER.info(" " + BannerMCStart.I18N.as("stackdeobf.fields") + " " + FIELDS.size()); }) // needs to be executed asynchronously, otherwise the // executor of the current thread would be shut down .thenRunAsync(() -> { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.shutting.down")); - BannerMCStart.LOGGER.info(BannerMCStart.I18N.get("load.libraries")); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.shutting.down")); + BannerMCStart.LOGGER.info(BannerMCStart.I18N.as("load.libraries")); cacheExecutor.shutdown(); }); } diff --git a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/AbstractMappingProvider.java b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/AbstractMappingProvider.java index c4615fa75..0238f8ae9 100644 --- a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/AbstractMappingProvider.java +++ b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/AbstractMappingProvider.java @@ -75,21 +75,21 @@ private CompletableFuture trackTime(CompletableFuture future) { } private CompletableFuture downloadMappings(Path cacheDir, Executor executor) { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.verifying"), this.name); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.verifying"), this.name); return this.trackTime(this.downloadMappings0(cacheDir, executor)).thenAccept(timeDiff -> - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.verified"), this.name, timeDiff)); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.verified"), this.name, timeDiff)); } private CompletableFuture parseMappings(Executor executor) { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.parsing"), this.name); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.parsing"), this.name); return this.trackTime(this.parseMappings0(executor)).thenAccept(timeDiff -> - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.parsed"), this.name, timeDiff)); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.parsed"), this.name, timeDiff)); } private CompletableFuture visitMappings(MappingVisitor visitor, Executor executor) { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.caching"), this.name); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.caching"), this.name); return this.trackTime(this.visitMappings0(visitor, executor)).thenAccept(timeDiff -> - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.cached"), this.name, timeDiff)); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.cached"), this.name, timeDiff)); } protected abstract CompletableFuture downloadMappings0(Path cacheDir, Executor executor); diff --git a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/BuildBasedMappingProvider.java b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/BuildBasedMappingProvider.java index 609227bb6..69616ce18 100644 --- a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/BuildBasedMappingProvider.java +++ b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/BuildBasedMappingProvider.java @@ -57,12 +57,12 @@ protected CompletableFuture downloadMappings0(Path cacheDir, Executor exec // already cached, don't download anything if (Files.exists(this.path)) { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.download.already"), this.name, build); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.download.already"), this.name, build); return CompletableFuture.completedFuture(null); } URI uri = this.artifactInfo.buildUri(build, "jar"); - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.downloading"), this.name, build); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.downloading"), this.name, build); return HttpUtil.getAsync(uri, executor).thenAccept(mappingJarBytes -> { byte[] mappingBytes = this.extractPackagedMappings(mappingJarBytes); @@ -87,11 +87,11 @@ private CompletableFuture fetchLatestVersion(Path cacheDir, String mcVer long maxTimeDiff = Long.getLong("stackdeobf.build-refresh-cooldown", 2 * 24 * 60 /* specified in minutes */); if (timeDiff <= maxTimeDiff) { // latest build has already been fetched in the last x minutes (default: 2 days) - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.getbuild"), + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.getbuild"), this.name, (long) Math.floor(timeDiff / 60d), (long) Math.ceil((maxTimeDiff - timeDiff) / 60d)); return CompletableFuture.completedFuture(Files.readString(versionCachePath).trim()); } else { - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.refreshing"), + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.refreshing"), this.name, (long) Math.ceil(timeDiff / 60d)); } } catch (IOException exception) { @@ -100,7 +100,7 @@ private CompletableFuture fetchLatestVersion(Path cacheDir, String mcVer } URI metaUri = this.artifactInfo.buildMetaUri(); - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.fetching"), this.name); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.fetching"), this.name); return HttpUtil.getAsync(metaUri, executor).thenApply(resp -> { try (InputStream input = new ByteArrayInputStream(resp)) { @@ -130,14 +130,14 @@ private CompletableFuture fetchLatestVersion(Path cacheDir, String mcVer } Files.writeString(versionCachePath, version); - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.cached.lastest"), this.name, version); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.cached.lastest"), this.name, version); return version; } - throw new IllegalArgumentException(BannerMCStart.I18N.get("stackdeobf.cantfind") + " " + this.name + " " + BannerMCStart.I18N.get("stackdeobf.mappings.version") + " " + mcVersion); + throw new IllegalArgumentException(BannerMCStart.I18N.as("stackdeobf.cantfind") + " " + this.name + " " + BannerMCStart.I18N.as("stackdeobf.mappings.version") + " " + mcVersion); } catch (IOException exception) { - throw new RuntimeException(BannerMCStart.I18N.get("stackdeobf.cantparse") + " " + metaUri + " " + BannerMCStart.I18N.get("stackdeobf.for") + " " + mcVersion, exception); + throw new RuntimeException(BannerMCStart.I18N.as("stackdeobf.cantparse") + " " + metaUri + " " + BannerMCStart.I18N.as("stackdeobf.for") + " " + mcVersion, exception); } }); }, executor); diff --git a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/IntermediaryMappingProvider.java b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/IntermediaryMappingProvider.java index 27065a9e4..cb336cb1b 100644 --- a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/IntermediaryMappingProvider.java +++ b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/IntermediaryMappingProvider.java @@ -48,7 +48,7 @@ protected CompletableFuture downloadMappings0(Path cacheDir, Executor exec } URI uri = MAPPINGS_ARTIFACT.buildUri(CompatUtil.VERSION_ID, "jar"); - CompatUtil.LOGGER.info(BannerMCStart.I18N.get("stackdeobf.downloading.intermediary"), CompatUtil.VERSION_ID); + CompatUtil.LOGGER.info(BannerMCStart.I18N.as("stackdeobf.downloading.intermediary"), CompatUtil.VERSION_ID); return HttpUtil.getAsync(uri, executor).thenAccept(jarBytes -> { byte[] mappingBytes = this.extractPackagedMappings(jarBytes); diff --git a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/MojangMappingProvider.java b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/MojangMappingProvider.java index efae4571d..d0323c82c 100644 --- a/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/MojangMappingProvider.java +++ b/src/main/java/com/mohistmc/banner/stackdeobf/mappings/providers/MojangMappingProvider.java @@ -39,11 +39,11 @@ public class MojangMappingProvider extends AbstractMappingProvider { private static final String LICENSE = - BannerMCStart.I18N.get("stackdeobf.mojang.licenseheader.1") + "\n" - + BannerMCStart.I18N.get("stackdeobf.mojang.licenseheader.2")+ "\n" - + BannerMCStart.I18N.get("stackdeobf.mojang.licenseheader.3")+ "\n" - + BannerMCStart.I18N.get("stackdeobf.mojang.licenseheader.4")+ "\n" - + BannerMCStart.I18N.get("stackdeobf.mojang.licenseheader.5")+ "\n" + BannerMCStart.I18N.as("stackdeobf.mojang.licenseheader.1") + "\n" + + BannerMCStart.I18N.as("stackdeobf.mojang.licenseheader.2")+ "\n" + + BannerMCStart.I18N.as("stackdeobf.mojang.licenseheader.3")+ "\n" + + BannerMCStart.I18N.as("stackdeobf.mojang.licenseheader.4")+ "\n" + + BannerMCStart.I18N.as("stackdeobf.mojang.licenseheader.5")+ "\n" + "\n"; // the production/intermediary mappings need to be mapped back to their @@ -59,7 +59,7 @@ public MojangMappingProvider() { Preconditions.checkState(CompatUtil.WORLD_VERSION >= 2203 || CompatUtil.WORLD_VERSION == 1976, "Mojang mappings are only provided by mojang starting from 19w36a (excluding 1.14.4)"); - CompatUtil.LOGGER.warn(BannerMCStart.I18N.get("stackdeobf.mojang.license")); + CompatUtil.LOGGER.warn(BannerMCStart.I18N.as("stackdeobf.mojang.license")); for (String line : StringUtils.split(LICENSE, '\n')) { CompatUtil.LOGGER.warn(line); } @@ -124,7 +124,7 @@ private CompletableFuture fetchMojangMappingsUri(String mcVersion, Executor }); } - throw new IllegalStateException(BannerMCStart.I18N.get("stackdeobf.invalid.mcversion") + " " + mcVersion + " " + BannerMCStart.I18N.get("stackdeobf.mcversion.notfound")); + throw new IllegalStateException(BannerMCStart.I18N.as("stackdeobf.invalid.mcversion") + " " + mcVersion + " " + BannerMCStart.I18N.as("stackdeobf.mcversion.notfound")); }); } diff --git a/src/main/java/com/mohistmc/banner/util/EulaUtil.java b/src/main/java/com/mohistmc/banner/util/EulaUtil.java index a0a21c7d5..8351b7477 100644 --- a/src/main/java/com/mohistmc/banner/util/EulaUtil.java +++ b/src/main/java/com/mohistmc/banner/util/EulaUtil.java @@ -19,7 +19,7 @@ public class EulaUtil { public static void writeInfos() throws IOException { eula.createNewFile(); BufferedWriter b = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("eula.txt"), StandardCharsets.UTF_8)); - b.write(BannerMCStart.I18N.get("eula.text", "https://account.mojang.com/documents/minecraft_eula") + "\n" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "\neula=true"); + b.write(BannerMCStart.I18N.as("eula.text", "https://account.mojang.com/documents/minecraft_eula") + "\n" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + "\neula=true"); b.close(); } diff --git a/src/main/java/com/mohistmc/banner/util/pluginmanager/PluginManagers.java b/src/main/java/com/mohistmc/banner/util/pluginmanager/PluginManagers.java index 339de6f2b..55c3439b1 100644 --- a/src/main/java/com/mohistmc/banner/util/pluginmanager/PluginManagers.java +++ b/src/main/java/com/mohistmc/banner/util/pluginmanager/PluginManagers.java @@ -17,7 +17,7 @@ public class PluginManagers { public static boolean loadPluginCommand(CommandSender sender, String label, String[] split) { if (split.length < 2) { Object[] f = {label}; - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.load", f)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.load", f)); return true; } Object[] objects = new Object[] {split[1]}; @@ -28,7 +28,7 @@ public static boolean loadPluginCommand(CommandSender sender, String label, Stri jarName = split[1] + (split[1].endsWith(".jar") ? ".unloaded" : ".jar.unloaded"); toLoad = new File("plugins" + File.separator + jarName); if (!toLoad.exists()) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.nofile", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.nofile", objects)); return true; } else { String fileName = jarName.substring(0, jarName.length() - (".unloaded".length())); @@ -40,23 +40,23 @@ public static boolean loadPluginCommand(CommandSender sender, String label, Stri PluginDescriptionFile desc = Control.getDescription(toLoad); if (desc == null) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.noyml", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.noyml", objects)); return true; } Plugin[] pl = Bukkit.getPluginManager().getPlugins(); ArrayList plugins = new ArrayList<>(java.util.Arrays.asList(pl)); for (Plugin p : plugins) { if (desc.getName().equals(p.getName())) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.alreadyloaded", new Object[] {desc.getName()})); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.alreadyloaded", new Object[] {desc.getName()})); return true; } } Plugin p = Control.loadPlugin(toLoad); if (p != null) { Bukkit.getServer().getPluginManager().enablePlugin(p); - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.loaded", new Object[] {p.getDescription().getName(), p.getDescription().getVersion()})); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.loaded", new Object[] {p.getDescription().getName(), p.getDescription().getVersion()})); } else { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.notload", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.notload", objects)); } return true; @@ -64,7 +64,7 @@ public static boolean loadPluginCommand(CommandSender sender, String label, Stri public static boolean unloadPluginCommand(CommandSender sender, String label, String[] split) { if (split.length < 2) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.unload", label)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.unload", label)); return true; } @@ -72,15 +72,15 @@ public static boolean unloadPluginCommand(CommandSender sender, String label, St Object[] objects = new Object[] {split[1]}; if (p == null) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.noplugin", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.noplugin", objects)); } else { if (!Control.unloadPlugin(p)) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.unloaderror", p.getDescription().getName(), p.getDescription().getVersion())); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.unloaderror", p.getDescription().getName(), p.getDescription().getVersion())); } if (Control.unloadPlugin(p)) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.unloaded", p.getDescription().getName(), p.getDescription().getVersion())); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.unloaded", p.getDescription().getName(), p.getDescription().getVersion())); } else { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.notunload", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.notunload", objects)); } } @@ -90,7 +90,7 @@ public static boolean unloadPluginCommand(CommandSender sender, String label, St public static boolean reloadPluginCommand(CommandSender sender, String label, String[] split) { if (split.length < 2) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.reload", new Object[] {label})); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.reload", new Object[] {label})); return true; } @@ -98,25 +98,25 @@ public static boolean reloadPluginCommand(CommandSender sender, String label, St Object[] objects = new Object[] {split[1]}; if (p == null) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.noplugin", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.noplugin", objects)); } else { File file = Control.getFile((JavaPlugin) p); if (file == null) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.nojar", new Object[] {p.getName()})); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.nojar", new Object[] {p.getName()})); return true; } File name = new File("plugins" + File.separator + file.getName()); JavaPlugin loaded = null; if (!Control.unloadPlugin(p)) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.reloaderror", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.reloaderror", objects)); } else if ((loaded = (JavaPlugin) Control.loadPlugin(name)) == null) { - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.nojar", objects)); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.nojar", objects)); } Bukkit.getPluginManager().enablePlugin(loaded); - sender.sendMessage(BannerMCStart.I18N.get("pluginscommand.reloaded", new Object[] {split[1], loaded.getDescription().getVersion()})); + sender.sendMessage(BannerMCStart.I18N.as("pluginscommand.reloaded", new Object[] {split[1], loaded.getDescription().getVersion()})); } return true; } diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java index cef01fc7a..5615119ff 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -4,6 +4,7 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import java.lang.reflect.Constructor; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.function.Consumer; @@ -11108,12 +11109,12 @@ public static Material addMaterial(String materialName, int id, boolean isBlock) material.blockID = id; material.isFabricBlock = true; }else { - material = (Material) MohistDynamEnum.addEnum(Material.class, materialName, new Class[]{Integer.TYPE, Boolean.TYPE}, new Object[]{id, true}); + material = MohistDynamEnum.addEnum(Material.class, materialName, List.of(Integer.TYPE, Boolean.TYPE), List.of(id, true)); } BY_NAME.put(materialName, material); return material; } else { // Fabric Items - Material material = (Material) MohistDynamEnum.addEnum(Material.class, materialName, new Class[]{Integer.TYPE, Boolean.TYPE}, new Object[]{id, false}); + Material material = MohistDynamEnum.addEnum(Material.class, materialName, List.of(Integer.TYPE, Boolean.TYPE), List.of(id, false)); BY_NAME.put(materialName, material); return material; } @@ -11127,12 +11128,12 @@ public static Material addMaterial(String materialName, int id, boolean isBlock, material.blockID = id; material.isFabricBlock = true; }else { - material = (Material) MohistDynamEnum.addEnum(Material.class, materialName, new Class[]{Integer.TYPE, Boolean.TYPE, String.class}, new Object[]{id, true, modName}); + material = MohistDynamEnum.addEnum(Material.class, materialName, List.of(Integer.TYPE, Boolean.TYPE, String.class), List.of(id, true, modName)); } BY_NAME.put(materialName, material); return material; } else { // Fabric Items - Material material = (Material) MohistDynamEnum.addEnum(Material.class, materialName, new Class[]{Integer.TYPE, Boolean.TYPE, String.class}, new Object[]{id, false, modName}); + Material material = MohistDynamEnum.addEnum(Material.class, materialName, List.of(Integer.TYPE, Boolean.TYPE, String.class), List.of(id, false, modName)); BY_NAME.put(materialName, material); return material; } diff --git a/src/main/java/org/bukkit/craftbukkit/v1_19_R3/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/v1_19_R3/CraftServer.java index 77c79cab5..c4f0429cb 100644 --- a/src/main/java/org/bukkit/craftbukkit/v1_19_R3/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/v1_19_R3/CraftServer.java @@ -382,7 +382,7 @@ public void loadPlugins() { Plugin[] plugins = pluginManager.loadPlugins(pluginFolder); for (Plugin plugin : plugins) { try { - String message = String.format(BannerMCStart.I18N.get("bukkit.plugin.loading"), plugin.getDescription().getFullName()); + String message = String.format(BannerMCStart.I18N.as("bukkit.plugin.loading"), plugin.getDescription().getFullName()); plugin.getLogger().info(message); plugin.onLoad(); } catch (Throwable ex) { diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index b8486a5da..bdaf72a2f 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -333,7 +333,7 @@ public void enablePlugin(@NotNull final Plugin plugin) { Preconditions.checkArgument(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (!plugin.isEnabled()) { - plugin.getLogger().info(BannerMCStart.I18N.get("bukkit.plugin.enabling") + " " + plugin.getDescription().getFullName()); + plugin.getLogger().info(BannerMCStart.I18N.as("bukkit.plugin.enabling") + " " + plugin.getDescription().getFullName()); JavaPlugin jPlugin = (JavaPlugin) plugin; @@ -362,7 +362,7 @@ public void disablePlugin(@NotNull Plugin plugin) { Preconditions.checkArgument(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (plugin.isEnabled()) { - String message = String.format(BannerMCStart.I18N.get("bukkit.plugin.disabling"), plugin.getDescription().getFullName()); + String message = String.format(BannerMCStart.I18N.as("bukkit.plugin.disabling"), plugin.getDescription().getFullName()); plugin.getLogger().info(message); server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java index 1da162f86..6b28cda16 100644 --- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java @@ -28,7 +28,7 @@ public ClassLoader createLoader(@NotNull PluginDescriptionFile desc) { if (desc.getLibraries().isEmpty()) { return null; } - BannerServer.LOGGER.info(BannerMCStart.I18N.get("spigot.lib.loading"), desc.getName(), desc.getLibraries().size()); + BannerServer.LOGGER.info(BannerMCStart.I18N.as("spigot.lib.loading"), desc.getName(), desc.getLibraries().size()); List dependencies = new ArrayList<>(); for (String libraries : desc.getLibraries()) { @@ -50,7 +50,7 @@ public ClassLoader createLoader(@NotNull PluginDescriptionFile desc) { File file = new File(new File(FabricLoader.getInstance().getGameDir().toFile(), "libraries/spigot-lib"), "%s/%s/%s/%s".formatted(group, dependency.name(), dependency.version(), fileName)); if (file.exists()) { - BannerServer.LOGGER.info(BannerMCStart.I18N.get("spigot.lib.found"), desc.getName(), file); + BannerServer.LOGGER.info(BannerMCStart.I18N.as("spigot.lib.found"), desc.getName(), file); libraries.add(file); continue; } @@ -77,7 +77,7 @@ public ClassLoader createLoader(@NotNull PluginDescriptionFile desc) { for (File file : libraries) { try { jarFiles.add(file.toURI().toURL()); - BannerServer.LOGGER.info(BannerMCStart.I18N.get("spigot.lib.loaded"), desc.getName(), file); + BannerServer.LOGGER.info(BannerMCStart.I18N.as("spigot.lib.loaded"), desc.getName(), file); } catch (MalformedURLException e) { throw new RuntimeException(e); } diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java index 40405db26..0cf93758b 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -269,6 +269,7 @@ private void fixPackage(Manifest manifest, URL url, String name) { if (attributes != null) { try { try { + /* Object versionInfo = MohistDynamEnum.getField(pkg, Package.class.getDeclaredField("versionInfo")); if (versionInfo != null) { Class Package$VersionInfo = Class.forName("java.lang.Package$VersionInfo"); @@ -279,6 +280,7 @@ private void fixPackage(Manifest manifest, URL url, String name) { MohistDynamEnum.setField(versionInfo, attributes.getValue(Attributes.Name.SPECIFICATION_VERSION), Package$VersionInfo.getDeclaredField("specVersion")); MohistDynamEnum.setField(versionInfo, attributes.getValue(Attributes.Name.SPECIFICATION_VENDOR), Package$VersionInfo.getDeclaredField("specVendor")); } + */ } catch (Exception ignored) { } } finally { diff --git a/src/main/resources/libraries.txt b/src/main/resources/libraries.txt index 644e98f1f..fa44e389f 100644 --- a/src/main/resources/libraries.txt +++ b/src/main/resources/libraries.txt @@ -1,4 +1,3 @@ -libraries/com/mohistmc/dynamicenum/0.1/dynamicenum-0.1.jar|ae876076bdcc7ee5673b445c313d3be5 libraries/commons-lang/commons-lang/2.6-mohist/commons-lang-2.6-mohist.jar|755f5cdb5de00d072215340e8370daff libraries/org/apache/maven/maven-artifact/3.8.5/maven-artifact-3.8.5.jar|ce473b0d9fbfd10fe147f03fe8707d67 libraries/org/apache/maven/maven-builder-support/3.8.5/maven-builder-support-3.8.5.jar|fe19c6661c964ce89508900565c8524c