found parsesettings bug
This commit is contained in:
parent
ddb4587eb8
commit
2a6465534d
9 changed files with 33 additions and 13 deletions
Binary file not shown.
|
@ -2,9 +2,8 @@ package net.brysonsteck.Resurrection;
|
||||||
|
|
||||||
import net.brysonsteck.Resurrection.commands.*;
|
import net.brysonsteck.Resurrection.commands.*;
|
||||||
import net.brysonsteck.Resurrection.player.PlayerListener;
|
import net.brysonsteck.Resurrection.player.PlayerListener;
|
||||||
import net.brysonsteck.Resurrection.player.TimeCheck;
|
|
||||||
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
||||||
import org.bukkit.Bukkit;
|
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
||||||
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;
|
||||||
|
@ -66,6 +65,8 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
System.out.println("[Resurrection] ---------------------------------------------------------");
|
System.out.println("[Resurrection] ---------------------------------------------------------");
|
||||||
|
|
||||||
|
ParseSettings parseSettings = null;
|
||||||
|
|
||||||
System.out.println("[Resurrection] Locating player data and settings files...");
|
System.out.println("[Resurrection] Locating player data and settings files...");
|
||||||
// check if playerData.resurrection exists
|
// check if playerData.resurrection exists
|
||||||
File playerFile = new File("plugins/playerData.resurrection");
|
File playerFile = new File("plugins/playerData.resurrection");
|
||||||
|
@ -85,7 +86,7 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
}
|
}
|
||||||
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. (This file is new with the 0.2 beta if you upgraded.) Creating now in the \"plugins\" directory...");
|
||||||
ParseSettings parseSettings = new ParseSettings();
|
parseSettings = new ParseSettings();
|
||||||
System.out.println("[Resurrection] Settings file created successfully.");
|
System.out.println("[Resurrection] Settings file created successfully.");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[Resurrection] The settings file has also been found!");
|
System.out.println("[Resurrection] The settings file has also been found!");
|
||||||
|
@ -98,11 +99,11 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||||
|
|
||||||
// register commands
|
// register commands
|
||||||
this.getCommand("about").setExecutor(new CommandAbout(pluginInfo.getVersion(), outdated));
|
this.getCommand("about").setExecutor(new CommandAbout(parseSettings.getSetting("debug"), pluginInfo.getVersion(), outdated));
|
||||||
this.getCommand("bug").setExecutor(new CommandBug());
|
this.getCommand("bug").setExecutor(new CommandBug(parseSettings.getSetting("debug")));
|
||||||
this.getCommand("resurrect").setExecutor(new CommandResurrect());
|
this.getCommand("resurrect").setExecutor(new CommandResurrect(parseSettings.getSetting("debug")));
|
||||||
this.getCommand("howlong").setExecutor(new CommandHowLong());
|
this.getCommand("howlong").setExecutor(new CommandHowLong(parseSettings.getSetting("debug")));
|
||||||
this.getCommand("source").setExecutor(new CommandSource());
|
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!");
|
||||||
|
@ -112,6 +113,12 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// String test = "fals";
|
||||||
|
//
|
||||||
|
// if (!test.toLowerCase().contains("true") && !test.toLowerCase().contains("false")) {
|
||||||
|
// System.out.println("fail");
|
||||||
|
// }
|
||||||
|
|
||||||
// DO THIS
|
// DO THIS
|
||||||
// PlayerData playerData = new PlayerData();
|
// PlayerData playerData = new PlayerData();
|
||||||
// System.out.println("--- Reading Player data file ---");
|
// System.out.println("--- Reading Player data file ---");
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class CommandAbout implements CommandExecutor {
|
||||||
String currentVersion;
|
String currentVersion;
|
||||||
boolean outdated;
|
boolean outdated;
|
||||||
|
|
||||||
public CommandAbout(String currentVersion, boolean outdated) {
|
public CommandAbout(String debug, String currentVersion, boolean outdated) {
|
||||||
this.currentVersion = currentVersion;
|
this.currentVersion = currentVersion;
|
||||||
this.outdated = outdated;
|
this.outdated = outdated;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class CommandBug implements CommandExecutor {
|
public class CommandBug implements CommandExecutor {
|
||||||
|
|
||||||
|
public CommandBug(String debug) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||||
if (commandSender instanceof Player) {
|
if (commandSender instanceof Player) {
|
||||||
|
|
|
@ -11,6 +11,9 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CommandHowLong implements CommandExecutor {
|
public class CommandHowLong implements CommandExecutor {
|
||||||
|
|
||||||
|
public CommandHowLong(String debug) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||||
if (commandSender instanceof Player) {
|
if (commandSender instanceof Player) {
|
||||||
|
|
|
@ -12,6 +12,9 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
public class CommandResurrect implements CommandExecutor {
|
public class CommandResurrect implements CommandExecutor {
|
||||||
|
public CommandResurrect(String debug) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||||
boolean valid = (strings.length == 1);
|
boolean valid = (strings.length == 1);
|
||||||
|
|
|
@ -10,6 +10,11 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class CommandSource implements CommandExecutor {
|
public class CommandSource implements CommandExecutor {
|
||||||
|
boolean debug;
|
||||||
|
|
||||||
|
public CommandSource(String debug) {
|
||||||
|
this.debug = Boolean.parseBoolean(debug);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package net.brysonsteck.Resurrection.player;
|
package net.brysonsteck.Resurrection.player;
|
||||||
|
|
||||||
import net.brysonsteck.Resurrection.ParseSettings;
|
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
||||||
import net.brysonsteck.Resurrection.Resurrection;
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.brysonsteck.Resurrection;
|
package net.brysonsteck.Resurrection.startup;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -91,7 +91,7 @@ public class ParseSettings {
|
||||||
failedSetting = "debug";
|
failedSetting = "debug";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (settings.get("debug").toLowerCase().contains("true") && settings.get("debug").toLowerCase().contains("false")) {
|
if (!settings.get("debug").toLowerCase().contains("true") && !settings.get("debug").toLowerCase().contains("false")) {
|
||||||
failedSetting = "debug";
|
failedSetting = "debug";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue