mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 18:15:39 +01:00
Change the name of the config class to be more consistent
This commit is contained in:
parent
d0300de136
commit
8549c22567
@ -34,7 +34,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform {
|
|||||||
private boolean lateBind = false;
|
private boolean lateBind = false;
|
||||||
private boolean protocolSupport = false;
|
private boolean protocolSupport = false;
|
||||||
@Getter
|
@Getter
|
||||||
private BukkitConfigAPI conf;
|
private BukkitViaConfig conf;
|
||||||
@Getter
|
@Getter
|
||||||
private ViaAPI<Player> api = new BukkitViaAPI(this);
|
private ViaAPI<Player> api = new BukkitViaAPI(this);
|
||||||
private List<Runnable> queuedTasks = new ArrayList<>();
|
private List<Runnable> queuedTasks = new ArrayList<>();
|
||||||
@ -51,7 +51,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform {
|
|||||||
.loader(new BukkitViaLoader(this))
|
.loader(new BukkitViaLoader(this))
|
||||||
.build());
|
.build());
|
||||||
// Config magic
|
// Config magic
|
||||||
conf = new BukkitConfigAPI();
|
conf = new BukkitViaConfig();
|
||||||
// For compatibility
|
// For compatibility
|
||||||
ViaVersion.setInstance(this);
|
ViaVersion.setInstance(this);
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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");
|
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"));
|
super(new File(((ViaVersionPlugin) Via.getPlatform()).getDataFolder(), "config.yml"));
|
||||||
// Load config
|
// Load config
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
@ -192,7 +192,7 @@ public class BukkitConfigAPI extends Config implements ViaVersionConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return BukkitConfigAPI.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
return BukkitViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -31,13 +31,13 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
public class BungeePlugin extends Plugin implements ViaPlatform, Listener {
|
public class BungeePlugin extends Plugin implements ViaPlatform, Listener {
|
||||||
private BungeeViaAPI api;
|
private BungeeViaAPI api;
|
||||||
private BungeeConfigAPI config;
|
private BungeeViaConfig config;
|
||||||
private BungeeCommandHandler commandHandler;
|
private BungeeCommandHandler commandHandler;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
api = new BungeeViaAPI();
|
api = new BungeeViaAPI();
|
||||||
config = new BungeeConfigAPI(getDataFolder());
|
config = new BungeeViaConfig(getDataFolder());
|
||||||
commandHandler = new BungeeCommandHandler();
|
commandHandler = new BungeeCommandHandler();
|
||||||
ProxyServer.getInstance().getPluginManager().registerCommand(this, new BungeeCommand(commandHandler));
|
ProxyServer.getInstance().getPluginManager().registerCommand(this, new BungeeCommand(commandHandler));
|
||||||
// Init platform
|
// Init platform
|
||||||
@ -134,7 +134,7 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BungeeConfigAPI getConf() {
|
public BungeeViaConfig getConf() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package us.myles.ViaVersion.bungee.commands.subs;
|
|||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||||
import us.myles.ViaVersion.api.command.ViaSubCommand;
|
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;
|
import us.myles.ViaVersion.bungee.service.ProtocolDetectorService;
|
||||||
|
|
||||||
public class ProbeSubCmd extends ViaSubCommand {
|
public class ProbeSubCmd extends ViaSubCommand {
|
||||||
@ -15,7 +15,7 @@ public class ProbeSubCmd extends ViaSubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public String description() {
|
public String description() {
|
||||||
return "Forces ViaVersion to scan server protocol versions " +
|
return "Forces ViaVersion to scan server protocol versions " +
|
||||||
(((BungeeConfigAPI) Via.getConfig()).getBungeePingInterval() == -1 ?
|
(((BungeeViaConfig) Via.getConfig()).getBungeePingInterval() == -1 ?
|
||||||
"" : "(Also happens at an interval)");
|
"" : "(Also happens at an interval)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@ import java.io.File;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
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");
|
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"));
|
super(new File(configFile, "config.yml"));
|
||||||
// Load config
|
// Load config
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
@ -20,7 +20,7 @@ public class BungeeConfigAPI extends Config implements ViaVersionConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return BungeeConfigAPI.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
return BungeeViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -6,7 +6,7 @@ import net.md_5.bungee.api.ServerPing;
|
|||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import us.myles.ViaVersion.BungeePlugin;
|
import us.myles.ViaVersion.BungeePlugin;
|
||||||
import us.myles.ViaVersion.api.Via;
|
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 us.myles.ViaVersion.bungee.providers.BungeeVersionProvider;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -26,7 +26,7 @@ public class ProtocolDetectorService implements Runnable {
|
|||||||
|
|
||||||
public static Integer getProtocolId(String serverName) {
|
public static Integer getProtocolId(String serverName) {
|
||||||
// Step 1. Check Config
|
// 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);
|
Integer protocol = servers.get(serverName);
|
||||||
if (protocol != null) {
|
if (protocol != null) {
|
||||||
return protocol;
|
return protocol;
|
||||||
@ -61,8 +61,8 @@ public class ProtocolDetectorService implements Runnable {
|
|||||||
// Ensure protocol is positive, some services will return -1
|
// Ensure protocol is positive, some services will return -1
|
||||||
if (serverPing.getVersion().getProtocol() > 0) {
|
if (serverPing.getVersion().getProtocol() > 0) {
|
||||||
detectedProtocolIds.put(key, serverPing.getVersion().getProtocol());
|
detectedProtocolIds.put(key, serverPing.getVersion().getProtocol());
|
||||||
if (((BungeeConfigAPI) Via.getConfig()).isBungeePingSave()) {
|
if (((BungeeViaConfig) Via.getConfig()).isBungeePingSave()) {
|
||||||
Map<String, Integer> servers = ((BungeeConfigAPI) Via.getConfig()).getBungeeServerProtocols();
|
Map<String, Integer> servers = ((BungeeViaConfig) Via.getConfig()).getBungeeServerProtocols();
|
||||||
Integer protocol = servers.get(key);
|
Integer protocol = servers.get(key);
|
||||||
if (protocol != null && protocol == serverPing.getVersion().getProtocol()) {
|
if (protocol != null && protocol == serverPing.getVersion().getProtocol()) {
|
||||||
return;
|
return;
|
||||||
|
@ -17,7 +17,6 @@ import org.spongepowered.api.plugin.PluginContainer;
|
|||||||
import org.spongepowered.api.scheduler.Task;
|
import org.spongepowered.api.scheduler.Task;
|
||||||
import org.spongepowered.api.text.serializer.TextSerializers;
|
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.ViaAPI;
|
|
||||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||||
import us.myles.ViaVersion.api.configuration.ConfigurationProvider;
|
import us.myles.ViaVersion.api.configuration.ConfigurationProvider;
|
||||||
import us.myles.ViaVersion.api.platform.TaskId;
|
import us.myles.ViaVersion.api.platform.TaskId;
|
||||||
@ -32,10 +31,8 @@ import us.myles.ViaVersion.util.GsonUtil;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@Plugin(id = "viaversion",
|
@Plugin(id = "viaversion",
|
||||||
@ -58,7 +55,7 @@ public class SpongePlugin implements ViaPlatform {
|
|||||||
@Getter
|
@Getter
|
||||||
private SpongeViaAPI api = new SpongeViaAPI();
|
private SpongeViaAPI api = new SpongeViaAPI();
|
||||||
@Getter
|
@Getter
|
||||||
private SpongeConfigAPI conf;
|
private SpongeViaConfig conf;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
@ -68,7 +65,7 @@ public class SpongePlugin implements ViaPlatform {
|
|||||||
// Setup Logger
|
// Setup Logger
|
||||||
logger = new LoggerWrapper(container.getLogger());
|
logger = new LoggerWrapper(container.getLogger());
|
||||||
// Setup Plugin
|
// Setup Plugin
|
||||||
conf = new SpongeConfigAPI(container, defaultConfig.getParentFile());
|
conf = new SpongeViaConfig(container, defaultConfig.getParentFile());
|
||||||
SpongeCommandHandler commandHandler = new SpongeCommandHandler();
|
SpongeCommandHandler commandHandler = new SpongeCommandHandler();
|
||||||
game.getCommandManager().register(this, commandHandler, "viaversion", "viaver", "vvsponge");
|
game.getCommandManager().register(this, commandHandler, "viaversion", "viaver", "vvsponge");
|
||||||
getLogger().info("ViaVersion " + getPluginVersion() + " is now loaded!");
|
getLogger().info("ViaVersion " + getPluginVersion() + " is now loaded!");
|
||||||
|
@ -12,11 +12,11 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
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 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;
|
private final PluginContainer pluginContainer;
|
||||||
|
|
||||||
public SpongeConfigAPI(PluginContainer pluginContainer, File configFile) {
|
public SpongeViaConfig(PluginContainer pluginContainer, File configFile) {
|
||||||
super(new File(configFile, "config.yml"));
|
super(new File(configFile, "config.yml"));
|
||||||
this.pluginContainer = pluginContainer;
|
this.pluginContainer = pluginContainer;
|
||||||
// Load config
|
// Load config
|
Loading…
Reference in New Issue
Block a user