/potspy saving (#64)

This commit is contained in:
Super_ 2018-05-22 19:01:24 -04:00 committed by Seth
parent baf367b003
commit ff3f9f0a66
4 changed files with 12 additions and 8 deletions

View File

@ -58,7 +58,7 @@ public class Monitors extends FreedomService
for (Player p : server.getOnlinePlayers()) 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() + "'."); 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() + "'.");
} }

View File

@ -50,6 +50,9 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
private Boolean commandSpy = false; private Boolean commandSpy = false;
@Getter @Getter
@Setter @Setter
private Boolean potionSpy = false;
@Getter
@Setter
private Boolean oldAdminMode = false; private Boolean oldAdminMode = false;
public static final String CONFIG_FILENAME = "admins.yml"; 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); discordID = cs.getString("discord_id", null);
tag = cs.getString("tag", null); tag = cs.getString("tag", null);
commandSpy = cs.getBoolean("command_spy", false); commandSpy = cs.getBoolean("command_spy", false);
potionSpy = cs.getBoolean("potion_spy", false);
oldAdminMode = cs.getBoolean("old_admin_mode", 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("discord_id", discordID);
cs.set("tag", tag); cs.set("tag", tag);
cs.set("command_spy", commandSpy); cs.set("command_spy", commandSpy);
cs.set("potion_spy", potionSpy);
cs.set("old_admin_mode", oldAdminMode); cs.set("old_admin_mode", oldAdminMode);
} }

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -14,9 +14,11 @@ public class Command_potionspy extends FreedomCommand
@Override @Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
FPlayer playerdata = plugin.pl.getPlayer(playerSender); Admin admin = plugin.al.getAdmin(playerSender);
playerdata.setPotionMonitorEnabled(!playerdata.isPotionMonitorEnabled()); admin.setPotionSpy(!admin.getPotionSpy());
msg("PotionSpy is now " + (playerdata.isPotionMonitorEnabled() ? "enabled." : "disabled.")); plugin.al.save();
plugin.al.updateTables();
msg("PotionSpy is now " + (admin.getPotionSpy() ? "enabled." : "disabled."));
return true; return true;
} }
} }

View File

@ -75,9 +75,6 @@ public class FPlayer
@Getter @Getter
@Setter @Setter
private boolean invSee = false; private boolean invSee = false;
@Getter
@Setter
private boolean potionMonitorEnabled = false;
public FPlayer(TotalFreedomMod plugin, Player player) public FPlayer(TotalFreedomMod plugin, Player player)
{ {