add run-paper, remove random unneeded static variables & fix Warden cache

This commit is contained in:
Pyr 2023-04-19 13:01:00 +01:00
parent f72fd32bb0
commit 7fe1ade54b
11 changed files with 10 additions and 24 deletions

4
.gitignore vendored

@ -39,4 +39,6 @@ bin/
.vscode/
### Mac OS ###
.DS_Store
.DS_Store
/run/

@ -2,6 +2,7 @@ plugins {
id "java"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "io.papermc.paperweight.userdev" version "1.5.4"
id "xyz.jpenilla.run-paper" version "2.0.1"
}
group "lol.pyr"

@ -10,9 +10,7 @@ public enum CachePackage {
private final String fixedPackageName;
CachePackage(String packageName) {
this
.fixedPackageName = Utils.versionNewer(17) ? packageName : (packageName + (packageName.contains("minecraft") ? (".server." + Utils.getBukkitPackage()) : ""));
this.fixedPackageName = Utils.versionNewer(17) ? packageName : (packageName + (packageName.contains("minecraft") ? (".server." + Utils.getBukkitPackage()) : ""));
}
CachePackage() {

@ -174,7 +174,7 @@ public final class CacheRegistry {
.withCategory(CacheCategory.ENTITY)
.withAdditionalData("monster.warden")
.withClassName("EntityWarden"))).load();
.withClassName("Warden"))).load();
public static final Class<?> ENTITY_BEE_CLASS = (new TypeCache.BaseCache.ClazzLoader((new TypeCache.CacheBuilder(CachePackage.MINECRAFT_SERVER))

@ -13,8 +13,6 @@ import java.util.*;
@SuppressWarnings("deprecation")
public class Command extends BukkitCommand {
private static final String WHITESPACE = " ";
private static final CommandMap COMMAND_MAP;
static {

@ -3,6 +3,7 @@ package io.github.znetworkw.znpcservers.configuration;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.internal.$Gson$Types;
import io.github.znetworkw.znpcservers.utility.Utils;
import lol.pyr.znpcsplus.ZNPCsPlus;
@ -58,9 +59,7 @@ public class Configuration {
if (!single && configValue.getPrimitiveType().isEnum()) {
this.configurationValues.put(configValue, ZNPCsPlus.GSON.fromJson(jsonElement, configValue.getPrimitiveType()));
} else {
throw new RuntimeException();
// what is this fuckery??
// this.configurationValues.put(configValue, ZNPCsPlus.GSON.fromJson(jsonElement, $Gson$Types.newParameterizedTypeWithOwner((Type)null, configValue.getValue().getClass(), new Type[]{configValue.getPrimitiveType()})));
this.configurationValues.put(configValue, ZNPCsPlus.GSON.fromJson(jsonElement, $Gson$Types.newParameterizedTypeWithOwner(null, configValue.getValue().getClass(), configValue.getPrimitiveType())));
}
}
}
@ -94,7 +93,6 @@ public class Configuration {
synchronized(this.path) {
try {
Writer writer = Files.newBufferedWriter(this.path, CHARSET);
try {
ZNPCsPlus.GSON.toJson(this.configurationValues.size() == 1 ? this.configurationValues.values().iterator().next() : this.configurationValues, writer);
writer.close();
@ -104,13 +102,11 @@ public class Configuration {
} catch (Throwable var6) {
var7.addSuppressed(var6);
}
throw var7;
}
} catch (IOException var8) {
throw new IllegalStateException("Failed to save config: " + this.name);
}
}
}

@ -8,8 +8,6 @@ import java.util.*;
@SuppressWarnings("unused")
public class NPCModel {
private static final String EMPTY_STRING = "";
private int id;
private double hologramHeight;

@ -5,7 +5,7 @@ import io.github.znetworkw.znpcservers.skin.SkinFetcherResult;
import io.github.znetworkw.znpcservers.utility.Utils;
public class NPCSkin {
private static final String[] EMPTY_ARRAY = new String[]{"", ""};
private static final String[] EMPTY_ARRAY = new String[0];
private static final int LAYER_INDEX = SkinLayerValues.findLayerByVersion();

@ -60,7 +60,6 @@ public enum NPCType {
AXOLOTL(ENTITY_AXOLOTL_CLASS, -1.0, "setVariant", "setAge"),
GOAT(ENTITY_GOAT_CLASS, -0.5, "setScreamingGoat", "setAge");
private static final String EMPTY_STRING = "";
private final double holoHeight;
private final CustomizationLoader customizationLoader;
private final Constructor<?> constructor;
@ -94,7 +93,7 @@ public enum NPCType {
}
NPCType(Class<?> entityClass, double holoHeight, String ... customization) {
this(entityClass, EMPTY_STRING, holoHeight, customization);
this(entityClass, "", holoHeight, customization);
}
public double getHoloHeight() {

@ -17,10 +17,6 @@ import java.util.UUID;
public class ConversationProcessor {
private static final Map<UUID, String> RUNNING_CONVERSATIONS = new HashMap<>();
private static final String WHITE_SPACE = " ";
private static final int CONVERSATION_DELAY = 20;
private final NPC npc;
private final ConversationModel conversationModel;

@ -17,8 +17,6 @@ import java.util.ArrayList;
import java.util.List;
public class Hologram {
private static final String WHITESPACE = " ";
private static final boolean NEW_METHOD = (Utils.BUKKIT_VERSION > 12);
private static final double LINE_SPACING = Configuration.CONFIGURATION.getValue(ConfigurationValue.LINE_SPACING);