add run-paper, remove random unneeded static variables & fix Warden cache
This commit is contained in:
parent
f72fd32bb0
commit
7fe1ade54b
11 changed files with 10 additions and 24 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -39,4 +39,6 @@ bin/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
### Mac OS ###
|
### Mac OS ###
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
/run/
|
|
@ -2,6 +2,7 @@ plugins {
|
||||||
id "java"
|
id "java"
|
||||||
id "com.github.johnrengelman.shadow" version "8.1.1"
|
id "com.github.johnrengelman.shadow" version "8.1.1"
|
||||||
id "io.papermc.paperweight.userdev" version "1.5.4"
|
id "io.papermc.paperweight.userdev" version "1.5.4"
|
||||||
|
id "xyz.jpenilla.run-paper" version "2.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
group "lol.pyr"
|
group "lol.pyr"
|
||||||
|
|
|
@ -10,9 +10,7 @@ public enum CachePackage {
|
||||||
private final String fixedPackageName;
|
private final String fixedPackageName;
|
||||||
|
|
||||||
CachePackage(String packageName) {
|
CachePackage(String packageName) {
|
||||||
this
|
this.fixedPackageName = Utils.versionNewer(17) ? packageName : (packageName + (packageName.contains("minecraft") ? (".server." + Utils.getBukkitPackage()) : ""));
|
||||||
|
|
||||||
.fixedPackageName = Utils.versionNewer(17) ? packageName : (packageName + (packageName.contains("minecraft") ? (".server." + Utils.getBukkitPackage()) : ""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CachePackage() {
|
CachePackage() {
|
||||||
|
|
|
@ -174,7 +174,7 @@ public final class CacheRegistry {
|
||||||
|
|
||||||
.withCategory(CacheCategory.ENTITY)
|
.withCategory(CacheCategory.ENTITY)
|
||||||
.withAdditionalData("monster.warden")
|
.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))
|
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")
|
@SuppressWarnings("deprecation")
|
||||||
public class Command extends BukkitCommand {
|
public class Command extends BukkitCommand {
|
||||||
private static final String WHITESPACE = " ";
|
|
||||||
|
|
||||||
private static final CommandMap COMMAND_MAP;
|
private static final CommandMap COMMAND_MAP;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.github.znetworkw.znpcservers.configuration;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
import com.google.gson.internal.$Gson$Types;
|
||||||
import io.github.znetworkw.znpcservers.utility.Utils;
|
import io.github.znetworkw.znpcservers.utility.Utils;
|
||||||
import lol.pyr.znpcsplus.ZNPCsPlus;
|
import lol.pyr.znpcsplus.ZNPCsPlus;
|
||||||
|
|
||||||
|
@ -58,9 +59,7 @@ public class Configuration {
|
||||||
if (!single && configValue.getPrimitiveType().isEnum()) {
|
if (!single && configValue.getPrimitiveType().isEnum()) {
|
||||||
this.configurationValues.put(configValue, ZNPCsPlus.GSON.fromJson(jsonElement, configValue.getPrimitiveType()));
|
this.configurationValues.put(configValue, ZNPCsPlus.GSON.fromJson(jsonElement, configValue.getPrimitiveType()));
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException();
|
this.configurationValues.put(configValue, ZNPCsPlus.GSON.fromJson(jsonElement, $Gson$Types.newParameterizedTypeWithOwner(null, configValue.getValue().getClass(), configValue.getPrimitiveType())));
|
||||||
// what is this fuckery??
|
|
||||||
// this.configurationValues.put(configValue, ZNPCsPlus.GSON.fromJson(jsonElement, $Gson$Types.newParameterizedTypeWithOwner((Type)null, configValue.getValue().getClass(), new Type[]{configValue.getPrimitiveType()})));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +93,6 @@ public class Configuration {
|
||||||
synchronized(this.path) {
|
synchronized(this.path) {
|
||||||
try {
|
try {
|
||||||
Writer writer = Files.newBufferedWriter(this.path, CHARSET);
|
Writer writer = Files.newBufferedWriter(this.path, CHARSET);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ZNPCsPlus.GSON.toJson(this.configurationValues.size() == 1 ? this.configurationValues.values().iterator().next() : this.configurationValues, writer);
|
ZNPCsPlus.GSON.toJson(this.configurationValues.size() == 1 ? this.configurationValues.values().iterator().next() : this.configurationValues, writer);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -104,13 +102,11 @@ public class Configuration {
|
||||||
} catch (Throwable var6) {
|
} catch (Throwable var6) {
|
||||||
var7.addSuppressed(var6);
|
var7.addSuppressed(var6);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw var7;
|
throw var7;
|
||||||
}
|
}
|
||||||
} catch (IOException var8) {
|
} catch (IOException var8) {
|
||||||
throw new IllegalStateException("Failed to save config: " + this.name);
|
throw new IllegalStateException("Failed to save config: " + this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ import java.util.*;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class NPCModel {
|
public class NPCModel {
|
||||||
private static final String EMPTY_STRING = "";
|
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
private double hologramHeight;
|
private double hologramHeight;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import io.github.znetworkw.znpcservers.skin.SkinFetcherResult;
|
||||||
import io.github.znetworkw.znpcservers.utility.Utils;
|
import io.github.znetworkw.znpcservers.utility.Utils;
|
||||||
|
|
||||||
public class NPCSkin {
|
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();
|
private static final int LAYER_INDEX = SkinLayerValues.findLayerByVersion();
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ public enum NPCType {
|
||||||
AXOLOTL(ENTITY_AXOLOTL_CLASS, -1.0, "setVariant", "setAge"),
|
AXOLOTL(ENTITY_AXOLOTL_CLASS, -1.0, "setVariant", "setAge"),
|
||||||
GOAT(ENTITY_GOAT_CLASS, -0.5, "setScreamingGoat", "setAge");
|
GOAT(ENTITY_GOAT_CLASS, -0.5, "setScreamingGoat", "setAge");
|
||||||
|
|
||||||
private static final String EMPTY_STRING = "";
|
|
||||||
private final double holoHeight;
|
private final double holoHeight;
|
||||||
private final CustomizationLoader customizationLoader;
|
private final CustomizationLoader customizationLoader;
|
||||||
private final Constructor<?> constructor;
|
private final Constructor<?> constructor;
|
||||||
|
@ -94,7 +93,7 @@ public enum NPCType {
|
||||||
}
|
}
|
||||||
|
|
||||||
NPCType(Class<?> entityClass, double holoHeight, String ... customization) {
|
NPCType(Class<?> entityClass, double holoHeight, String ... customization) {
|
||||||
this(entityClass, EMPTY_STRING, holoHeight, customization);
|
this(entityClass, "", holoHeight, customization);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getHoloHeight() {
|
public double getHoloHeight() {
|
||||||
|
|
|
@ -17,10 +17,6 @@ import java.util.UUID;
|
||||||
public class ConversationProcessor {
|
public class ConversationProcessor {
|
||||||
private static final Map<UUID, String> RUNNING_CONVERSATIONS = new HashMap<>();
|
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 NPC npc;
|
||||||
|
|
||||||
private final ConversationModel conversationModel;
|
private final ConversationModel conversationModel;
|
||||||
|
|
|
@ -17,8 +17,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hologram {
|
public class Hologram {
|
||||||
private static final String WHITESPACE = " ";
|
|
||||||
|
|
||||||
private static final boolean NEW_METHOD = (Utils.BUKKIT_VERSION > 12);
|
private static final boolean NEW_METHOD = (Utils.BUKKIT_VERSION > 12);
|
||||||
|
|
||||||
private static final double LINE_SPACING = Configuration.CONFIGURATION.getValue(ConfigurationValue.LINE_SPACING);
|
private static final double LINE_SPACING = Configuration.CONFIGURATION.getValue(ConfigurationValue.LINE_SPACING);
|
||||||
|
|
Loading…
Reference in a new issue