diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java index df58a611..7aaa8d94 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java @@ -58,7 +58,7 @@ public class Monitors extends FreedomService for (Player p : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(p) && plugin.pl.getPlayer(p).isPotionMonitorEnabled()) + if (plugin.al.isAdmin(p) && plugin.al.getAdmin(p).getPotionSpy()) { FUtil.playerMsg(p, potionSpyPrefix + ChatColor.WHITE + player.getName() + " splashed " + event.getEntity().getItem().getAmount() + " " + getMaterial(droppedItem) + " at X: " + decimalFormat.format(location.getX()) + ", Y: " + decimalFormat.format(location.getY()) + ", Z: " + decimalFormat.format(location.getZ()) + ", in the world '" + location.getWorld().getName() + "'."); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java index 46c9d028..1aaefda2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java @@ -50,6 +50,9 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable private Boolean commandSpy = false; @Getter @Setter + private Boolean potionSpy = false; + @Getter + @Setter private Boolean oldAdminMode = false; public static final String CONFIG_FILENAME = "admins.yml"; @@ -104,6 +107,7 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable discordID = cs.getString("discord_id", null); tag = cs.getString("tag", null); commandSpy = cs.getBoolean("command_spy", false); + potionSpy = cs.getBoolean("potion_spy", false); oldAdminMode = cs.getBoolean("old_admin_mode", false); } @@ -120,6 +124,7 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable cs.set("discord_id", discordID); cs.set("tag", tag); cs.set("command_spy", commandSpy); + cs.set("potion_spy", potionSpy); cs.set("old_admin_mode", oldAdminMode); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java index ccdb6307..36e75d19 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java @@ -1,7 +1,7 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.player.FPlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -14,9 +14,11 @@ public class Command_potionspy extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - FPlayer playerdata = plugin.pl.getPlayer(playerSender); - playerdata.setPotionMonitorEnabled(!playerdata.isPotionMonitorEnabled()); - msg("PotionSpy is now " + (playerdata.isPotionMonitorEnabled() ? "enabled." : "disabled.")); + Admin admin = plugin.al.getAdmin(playerSender); + admin.setPotionSpy(!admin.getPotionSpy()); + plugin.al.save(); + plugin.al.updateTables(); + msg("PotionSpy is now " + (admin.getPotionSpy() ? "enabled." : "disabled.")); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java b/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java index 949919ce..f7734da1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java @@ -75,9 +75,6 @@ public class FPlayer @Getter @Setter private boolean invSee = false; - @Getter - @Setter - private boolean potionMonitorEnabled = false; public FPlayer(TotalFreedomMod plugin, Player player) {