3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

Change the name of the config class to be more consistent

Dieser Commit ist enthalten in:
Myles 2018-11-17 13:12:19 +00:00
Ursprung d0300de136
Commit 8549c22567
8 geänderte Dateien mit 21 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -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<Player> api = new BukkitViaAPI(this);
private List<Runnable> 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);

Datei anzeigen

@ -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<String> 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

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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)");
}

Datei anzeigen

@ -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<String> 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

Datei anzeigen

@ -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<String, Integer> servers = ((BungeeConfigAPI) Via.getConfig()).getBungeeServerProtocols();
Map<String, Integer> 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<String, Integer> servers = ((BungeeConfigAPI) Via.getConfig()).getBungeeServerProtocols();
if (((BungeeViaConfig) Via.getConfig()).isBungeePingSave()) {
Map<String, Integer> servers = ((BungeeViaConfig) Via.getConfig()).getBungeeServerProtocols();
Integer protocol = servers.get(key);
if (protocol != null && protocol == serverPing.getVersion().getProtocol()) {
return;

Datei anzeigen

@ -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!");

Datei anzeigen

@ -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<String> 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