plugin continues to run after disabling"
This commit is contained in:
parent
63d5c6dcb2
commit
e6d3d5fdec
3 changed files with 22 additions and 13 deletions
Binary file not shown.
|
@ -4,6 +4,7 @@ import net.brysonsteck.Resurrection.commands.*;
|
||||||
import net.brysonsteck.Resurrection.player.PlayerListener;
|
import net.brysonsteck.Resurrection.player.PlayerListener;
|
||||||
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
||||||
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -71,6 +72,8 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
// check if playerData.resurrection exists
|
// check if playerData.resurrection exists
|
||||||
File playerFile = new File("plugins/playerData.resurrection");
|
File playerFile = new File("plugins/playerData.resurrection");
|
||||||
File settingsFile = new File("plugins/settings.resurrection");
|
File settingsFile = new File("plugins/settings.resurrection");
|
||||||
|
|
||||||
|
boolean fileFail = false;
|
||||||
if (!playerFile.exists()) {
|
if (!playerFile.exists()) {
|
||||||
System.out.println("[Resurrection] Player data file does not exist. Creating now in the \"plugins\" directory...");
|
System.out.println("[Resurrection] Player data file does not exist. Creating now in the \"plugins\" directory...");
|
||||||
try {
|
try {
|
||||||
|
@ -80,12 +83,14 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
System.out.println("[Resurrection] An error has occurred creating the player data file!");
|
System.out.println("[Resurrection] An error has occurred creating the player data file!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("[Resurrection] This file is crucial to Resurrection. Since the file could not be created, the plugin will now stop.");
|
System.out.println("[Resurrection] This file is crucial to Resurrection. Since the file could not be created, the plugin will now stop.");
|
||||||
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
|
fileFail = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] The player data file has been found!");
|
System.out.println("[Resurrection] The player data file has been found!");
|
||||||
}
|
}
|
||||||
if (!settingsFile.exists()) {
|
if (!settingsFile.exists()) {
|
||||||
System.out.println("[Resurrection] Settings file does not exist. (This file is new with the 0.2 beta if you upgraded.) Creating now in the \"plugins\" directory...");
|
System.out.println("[Resurrection] Settings file does not exist. Creating now in the \"plugins\" directory...");
|
||||||
parseSettings = new ParseSettings();
|
parseSettings = new ParseSettings();
|
||||||
System.out.println("[Resurrection] Settings file created successfully.");
|
System.out.println("[Resurrection] Settings file created successfully.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,20 +99,22 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
System.out.println("[Resurrection] ---------------------------------------------------------");
|
||||||
|
|
||||||
System.out.println("[Resurrection] Registering listeners and adding commands...");
|
if (parseSettings.isSettingsComplete() && !fileFail) {
|
||||||
// register listener
|
System.out.println("[Resurrection] Registering listeners and adding commands...");
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
// register listener
|
||||||
|
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||||
|
|
||||||
// register commands
|
// register commands
|
||||||
this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated));
|
this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated));
|
||||||
this.getCommand("bug").setExecutor(new CommandBug(parseSettings.getSetting("debug")));
|
this.getCommand("bug").setExecutor(new CommandBug(parseSettings.getSetting("debug")));
|
||||||
this.getCommand("resurrect").setExecutor(new CommandResurrect(parseSettings.getSetting("debug")));
|
this.getCommand("resurrect").setExecutor(new CommandResurrect(parseSettings.getSetting("debug")));
|
||||||
this.getCommand("howlong").setExecutor(new CommandHowLong(parseSettings.getSetting("debug")));
|
this.getCommand("howlong").setExecutor(new CommandHowLong(parseSettings.getSetting("debug")));
|
||||||
this.getCommand("source").setExecutor(new CommandSource(parseSettings.getSetting("debug")));
|
this.getCommand("source").setExecutor(new CommandSource(parseSettings.getSetting("debug")));
|
||||||
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
System.out.println("[Resurrection] ---------------------------------------------------------");
|
||||||
System.out.println("[Resurrection] Successfully Started!");
|
System.out.println("[Resurrection] Successfully Started!");
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
System.out.println("[Resurrection] ---------------------------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,4 +104,6 @@ public class ParseSettings {
|
||||||
public String getSetting(String setting) {
|
public String getSetting(String setting) {
|
||||||
return settings.get(setting);
|
return settings.get(setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSettingsComplete() { return settingsComplete; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue