From 8549c2256789af44ae2cfd7edc28d6b1b26da21a Mon Sep 17 00:00:00 2001 From: Myles Date: Sat, 17 Nov 2018 13:12:19 +0000 Subject: [PATCH] Change the name of the config class to be more consistent --- .../main/java/us/myles/ViaVersion/ViaVersionPlugin.java | 4 ++-- .../{BukkitConfigAPI.java => BukkitViaConfig.java} | 6 +++--- .../src/main/java/us/myles/ViaVersion/BungeePlugin.java | 6 +++--- .../ViaVersion/bungee/commands/subs/ProbeSubCmd.java | 4 ++-- .../{BungeeConfigAPI.java => BungeeViaConfig.java} | 6 +++--- .../bungee/service/ProtocolDetectorService.java | 8 ++++---- .../src/main/java/us/myles/ViaVersion/SpongePlugin.java | 7 ++----- .../{SpongeConfigAPI.java => SpongeViaConfig.java} | 4 ++-- 8 files changed, 21 insertions(+), 24 deletions(-) rename bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/{BukkitConfigAPI.java => BukkitViaConfig.java} (97%) rename bungee/src/main/java/us/myles/ViaVersion/bungee/platform/{BungeeConfigAPI.java => BungeeViaConfig.java} (97%) rename sponge/src/main/java/us/myles/ViaVersion/sponge/platform/{SpongeConfigAPI.java => SpongeViaConfig.java} (97%) diff --git a/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java b/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java index d4c326384..f597c65c1 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java @@ -34,7 +34,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform { private boolean lateBind = false; private boolean protocolSupport = false; @Getter - private BukkitConfigAPI conf; + private BukkitViaConfig conf; @Getter private ViaAPI api = new BukkitViaAPI(this); private List queuedTasks = new ArrayList<>(); @@ -51,7 +51,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform { .loader(new BukkitViaLoader(this)) .build()); // Config magic - conf = new BukkitConfigAPI(); + conf = new BukkitViaConfig(); // For compatibility ViaVersion.setInstance(this); diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitConfigAPI.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java similarity index 97% rename from bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitConfigAPI.java rename to bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java index 74db3b715..014e567e5 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitConfigAPI.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaConfig.java @@ -11,10 +11,10 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -public class BukkitConfigAPI extends Config implements ViaVersionConfig { +public class BukkitViaConfig extends Config implements ViaVersionConfig { private static List UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers"); - public BukkitConfigAPI() { + public BukkitViaConfig() { super(new File(((ViaVersionPlugin) Via.getPlatform()).getDataFolder(), "config.yml")); // Load config reloadConfig(); @@ -192,7 +192,7 @@ public class BukkitConfigAPI extends Config implements ViaVersionConfig { @Override public URL getDefaultConfigURL() { - return BukkitConfigAPI.class.getClassLoader().getResource("assets/viaversion/config.yml"); + return BukkitViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml"); } @Override diff --git a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java index 97e3a9c75..72142e311 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java +++ b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java @@ -31,13 +31,13 @@ import java.util.concurrent.TimeUnit; public class BungeePlugin extends Plugin implements ViaPlatform, Listener { private BungeeViaAPI api; - private BungeeConfigAPI config; + private BungeeViaConfig config; private BungeeCommandHandler commandHandler; @Override public void onLoad() { api = new BungeeViaAPI(); - config = new BungeeConfigAPI(getDataFolder()); + config = new BungeeViaConfig(getDataFolder()); commandHandler = new BungeeCommandHandler(); ProxyServer.getInstance().getPluginManager().registerCommand(this, new BungeeCommand(commandHandler)); // Init platform @@ -134,7 +134,7 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener { } @Override - public BungeeConfigAPI getConf() { + public BungeeViaConfig getConf() { return config; } diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/subs/ProbeSubCmd.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/subs/ProbeSubCmd.java index fda215417..a6184efa6 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/subs/ProbeSubCmd.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/commands/subs/ProbeSubCmd.java @@ -3,7 +3,7 @@ package us.myles.ViaVersion.bungee.commands.subs; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.command.ViaCommandSender; import us.myles.ViaVersion.api.command.ViaSubCommand; -import us.myles.ViaVersion.bungee.platform.BungeeConfigAPI; +import us.myles.ViaVersion.bungee.platform.BungeeViaConfig; import us.myles.ViaVersion.bungee.service.ProtocolDetectorService; public class ProbeSubCmd extends ViaSubCommand { @@ -15,7 +15,7 @@ public class ProbeSubCmd extends ViaSubCommand { @Override public String description() { return "Forces ViaVersion to scan server protocol versions " + - (((BungeeConfigAPI) Via.getConfig()).getBungeePingInterval() == -1 ? + (((BungeeViaConfig) Via.getConfig()).getBungeePingInterval() == -1 ? "" : "(Also happens at an interval)"); } diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeConfigAPI.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java similarity index 97% rename from bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeConfigAPI.java rename to bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java index 4f9112099..cdb1ca4c7 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeConfigAPI.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaConfig.java @@ -9,10 +9,10 @@ import java.io.File; import java.net.URL; import java.util.*; -public class BungeeConfigAPI extends Config implements ViaVersionConfig { +public class BungeeViaConfig extends Config implements ViaVersionConfig { private static List UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers"); - public BungeeConfigAPI(File configFile) { + public BungeeViaConfig(File configFile) { super(new File(configFile, "config.yml")); // Load config reloadConfig(); @@ -20,7 +20,7 @@ public class BungeeConfigAPI extends Config implements ViaVersionConfig { @Override public URL getDefaultConfigURL() { - return BungeeConfigAPI.class.getClassLoader().getResource("assets/viaversion/config.yml"); + return BungeeViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml"); } @Override diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/service/ProtocolDetectorService.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/service/ProtocolDetectorService.java index 252959224..6f5f6a909 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/service/ProtocolDetectorService.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/service/ProtocolDetectorService.java @@ -6,7 +6,7 @@ import net.md_5.bungee.api.ServerPing; import net.md_5.bungee.api.config.ServerInfo; import us.myles.ViaVersion.BungeePlugin; import us.myles.ViaVersion.api.Via; -import us.myles.ViaVersion.bungee.platform.BungeeConfigAPI; +import us.myles.ViaVersion.bungee.platform.BungeeViaConfig; import us.myles.ViaVersion.bungee.providers.BungeeVersionProvider; import java.util.HashMap; @@ -26,7 +26,7 @@ public class ProtocolDetectorService implements Runnable { public static Integer getProtocolId(String serverName) { // Step 1. Check Config - Map servers = ((BungeeConfigAPI) Via.getConfig()).getBungeeServerProtocols(); + Map servers = ((BungeeViaConfig) Via.getConfig()).getBungeeServerProtocols(); Integer protocol = servers.get(serverName); if (protocol != null) { return protocol; @@ -61,8 +61,8 @@ public class ProtocolDetectorService implements Runnable { // Ensure protocol is positive, some services will return -1 if (serverPing.getVersion().getProtocol() > 0) { detectedProtocolIds.put(key, serverPing.getVersion().getProtocol()); - if (((BungeeConfigAPI) Via.getConfig()).isBungeePingSave()) { - Map servers = ((BungeeConfigAPI) Via.getConfig()).getBungeeServerProtocols(); + if (((BungeeViaConfig) Via.getConfig()).isBungeePingSave()) { + Map servers = ((BungeeViaConfig) Via.getConfig()).getBungeeServerProtocols(); Integer protocol = servers.get(key); if (protocol != null && protocol == serverPing.getVersion().getProtocol()) { return; diff --git a/sponge/src/main/java/us/myles/ViaVersion/SpongePlugin.java b/sponge/src/main/java/us/myles/ViaVersion/SpongePlugin.java index 7ca0ac3f6..670dd56ae 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/SpongePlugin.java +++ b/sponge/src/main/java/us/myles/ViaVersion/SpongePlugin.java @@ -17,7 +17,6 @@ import org.spongepowered.api.plugin.PluginContainer; import org.spongepowered.api.scheduler.Task; import org.spongepowered.api.text.serializer.TextSerializers; import us.myles.ViaVersion.api.Via; -import us.myles.ViaVersion.api.ViaAPI; import us.myles.ViaVersion.api.command.ViaCommandSender; import us.myles.ViaVersion.api.configuration.ConfigurationProvider; import us.myles.ViaVersion.api.platform.TaskId; @@ -32,10 +31,8 @@ import us.myles.ViaVersion.util.GsonUtil; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.UUID; -import java.util.concurrent.TimeUnit; import java.util.logging.Logger; @Plugin(id = "viaversion", @@ -58,7 +55,7 @@ public class SpongePlugin implements ViaPlatform { @Getter private SpongeViaAPI api = new SpongeViaAPI(); @Getter - private SpongeConfigAPI conf; + private SpongeViaConfig conf; @Getter private Logger logger; @@ -68,7 +65,7 @@ public class SpongePlugin implements ViaPlatform { // Setup Logger logger = new LoggerWrapper(container.getLogger()); // Setup Plugin - conf = new SpongeConfigAPI(container, defaultConfig.getParentFile()); + conf = new SpongeViaConfig(container, defaultConfig.getParentFile()); SpongeCommandHandler commandHandler = new SpongeCommandHandler(); game.getCommandManager().register(this, commandHandler, "viaversion", "viaver", "vvsponge"); getLogger().info("ViaVersion " + getPluginVersion() + " is now loaded!"); diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeConfigAPI.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaConfig.java similarity index 97% rename from sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeConfigAPI.java rename to sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaConfig.java index a216b0017..ca8ce5dd6 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeConfigAPI.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaConfig.java @@ -12,11 +12,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; -public class SpongeConfigAPI extends Config implements ViaVersionConfig { +public class SpongeViaConfig extends Config implements ViaVersionConfig { private static List UNSUPPORTED = Arrays.asList("anti-xray-patch", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "quick-move-action-fix"); private final PluginContainer pluginContainer; - public SpongeConfigAPI(PluginContainer pluginContainer, File configFile) { + public SpongeViaConfig(PluginContainer pluginContainer, File configFile) { super(new File(configFile, "config.yml")); this.pluginContainer = pluginContainer; // Load config