Removes the last of the unprotected variables from Stargate

Makes all classes use getInstance() to get a Stargate instance
Removes the server variable as it's not needed
This commit is contained in:
2021-10-29 18:35:20 +02:00
parent 0237f45046
commit 56ed0495b0
14 changed files with 47 additions and 35 deletions

View File

@ -48,8 +48,7 @@ public class Stargate extends JavaPlugin {
private static final Queue<ChunkUnloadRequest> chunkUnloadQueue = new PriorityQueue<>();
private static Logger logger;
public static Server server;
public static Stargate stargate;
private static Stargate stargate;
private static String pluginVersion;
@ -75,6 +74,15 @@ public class Stargate extends JavaPlugin {
super(loader, descriptionFile, dataFolder, file);
}
/**
* Gets an instance of this plugin
*
* @return <p>An instance of this plugin, or null if not instantiated</p>
*/
public static Stargate getInstance() {
return stargate;
}
/**
* Adds a block change request to the request queue
*
@ -299,7 +307,7 @@ public class Stargate extends JavaPlugin {
pluginManager = getServer().getPluginManager();
FileConfiguration newConfig = this.getConfig();
logger = Logger.getLogger("Minecraft");
server = getServer();
Server server = getServer();
stargate = this;
stargateConfig = new StargateConfig(logger);