/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())
{
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() + "'.");
}

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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)
{