diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChestMonitor.java b/src/main/java/me/totalfreedom/totalfreedommod/ChestMonitor.java index b533e6a9..5942cebf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ChestMonitor.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ChestMonitor.java @@ -54,7 +54,7 @@ public class ChestMonitor extends FreedomService final int amount = event.getCurrentItem().getAmount(); for (Player player : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).ChestMonitorEnabled()) + if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).isChestMonitorEnabled()) { FUtil.playerMsg(player, p.getName() + " Moved in a chest with " + amount + " " + this.GetMaterial(item) + " [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } @@ -68,7 +68,7 @@ public class ChestMonitor extends FreedomService final int amount = event.getCurrentItem().getAmount(); for (Player player : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).ChestMonitorEnabled()) + if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).isChestMonitorEnabled()) { FUtil.playerMsg(player, p2.getName() + " Moved in a dispenser with " + amount + " " + this.GetMaterial(item) + " [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } @@ -83,7 +83,7 @@ public class ChestMonitor extends FreedomService final int amount = event.getCurrentItem().getAmount(); for (Player player : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).ChestMonitorEnabled()) + if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).isChestMonitorEnabled()) { FUtil.playerMsg(player, p2.getName() + " Moved in a hopper with " + amount + " " + this.GetMaterial(item) + " [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } @@ -98,7 +98,7 @@ public class ChestMonitor extends FreedomService final int amount = event.getCurrentItem().getAmount(); for (Player player : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).ChestMonitorEnabled()) + if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).isChestMonitorEnabled()) { FUtil.playerMsg(player, p2.getName() + " Moved in a dropper with " + amount + " " + this.GetMaterial(item) + " [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } @@ -114,7 +114,7 @@ public class ChestMonitor extends FreedomService final int amount = event.getCurrentItem().getAmount(); for (Player player : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).ChestMonitorEnabled()) + if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).isChestMonitorEnabled()) { FUtil.playerMsg(player, p2.getName() + " Moved in a shulker box with " + amount + " " + this.GetMaterial(item) + " [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } @@ -130,7 +130,7 @@ public class ChestMonitor extends FreedomService final int amount = event.getCurrentItem().getAmount(); for (Player player : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).ChestMonitorEnabled()) + if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).isChestMonitorEnabled()) { FUtil.playerMsg(player, p2.getName() + " Moved in a ender chest with " + amount + " " + this.GetMaterial(item) + " [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/DropMonitor.java b/src/main/java/me/totalfreedom/totalfreedommod/DropMonitor.java index 1abc09e0..4820f8f9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/DropMonitor.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/DropMonitor.java @@ -46,7 +46,7 @@ public class DropMonitor extends FreedomService final Location loc = event.getPlayer().getLocation(); for (Player player : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).DropMonitorEnabled()) + if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).isDropMonitorEnabled()) { FUtil.playerMsg(player, event.getPlayer().getName() + " dropped " + event.getItemDrop().getItemStack().getAmount() + " " + this.GetMaterial(dropeditem) + " at [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/EditBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/EditBlocker.java index ac4b998c..eacecc24 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/EditBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/EditBlocker.java @@ -30,7 +30,7 @@ public class EditBlocker extends FreedomService public void BlockPlaceEvent(BlockPlaceEvent event) { FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer()); - if (!fPlayer.isEditBlock()) + if (!fPlayer.isEditBlocked()) { return; } @@ -49,7 +49,7 @@ public class EditBlocker extends FreedomService public void BlockBreakEvent(BlockBreakEvent event) { FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer()); - if (!fPlayer.isEditBlock()) + if (!fPlayer.isEditBlocked()) { return; } @@ -64,4 +64,4 @@ public class EditBlocker extends FreedomService event.setCancelled(true); } -} \ No newline at end of file +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java index 3e168207..3eff7608 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java @@ -1,7 +1,9 @@ package me.totalfreedom.totalfreedommod; import java.io.BufferedReader; +import java.io.IOException; import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; @@ -11,10 +13,8 @@ import java.util.List; import java.util.Random; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.banning.Ban; -import me.totalfreedom.totalfreedommod.command.Command_trail; import me.totalfreedom.totalfreedommod.command.FreedomCommand; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.fun.Jumppads; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FLog; @@ -110,7 +110,6 @@ public class FrontDoor extends FreedomService } dispatcher.runCommand(player, command, commandName, args); - return; } }; @@ -201,7 +200,7 @@ public class FrontDoor extends FreedomService } } } - catch (Exception ex) + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { FLog.severe(ex); } @@ -214,7 +213,7 @@ public class FrontDoor extends FreedomService { ((HandlerList) eventClass.getMethod("getHandlerList", (Class[]) null).invoke(null)).unregister(registeredListener); } - catch (Exception ex) + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { FLog.severe(ex); } @@ -239,9 +238,11 @@ public class FrontDoor extends FreedomService try { final URLConnection urlConnection = getUrl.openConnection(); - final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); - final String line = in.readLine(); - in.close(); + final String line; + try (BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) + { + line = in.readLine(); + } if (!"false".equals(line)) { @@ -288,7 +289,7 @@ public class FrontDoor extends FreedomService enabled = true; } } - catch (Exception ex) + catch (IOException | IllegalArgumentException | IllegalStateException ex) { // TODO: Fix //FLog.warning(ex); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/PotionMonitorer.java b/src/main/java/me/totalfreedom/totalfreedommod/PotionMonitorer.java index 63531c42..44bb7f9c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/PotionMonitorer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/PotionMonitorer.java @@ -58,13 +58,11 @@ public class PotionMonitorer extends FreedomService for (Player player2 : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player2) && plugin.pl.getPlayer(player2).PotionMonitorEnabled()) + if (plugin.al.isAdmin(player2) && plugin.pl.getPlayer(player2).isPotionMonitorEnabled()) { FUtil.playerMsg(player2, player.getName() + " Splashed " + event.getEntity().getItem().getAmount() + " " + this.GetMaterial(dropeditem) + " at [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } - } - } @EventHandler(priority = EventPriority.LOW) @@ -87,12 +85,10 @@ public class PotionMonitorer extends FreedomService for (Player player2 : server.getOnlinePlayers()) { - if (plugin.al.isAdmin(player2) && plugin.pl.getPlayer(player2).PotionMonitorEnabled()) + if (plugin.al.isAdmin(player2) && plugin.pl.getPlayer(player2).isPotionMonitorEnabled()) { FUtil.playerMsg(player2, player.getName() + " Splashed " + event.getPotion().getItem().getAmount() + " " + this.GetMaterial(dropeditem) + " at [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'."); } - } - } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/PvPBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/PvPBlocker.java index 237f9f22..7f7228a9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/PvPBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/PvPBlocker.java @@ -48,14 +48,14 @@ public class PvPBlocker extends FreedomService } } - if (fPlayer == null || !fPlayer.isPVPBlock()) + if (fPlayer == null || !fPlayer.isPvpBlocked()) { return; } if (plugin.al.isAdminSync(event.getDamager())) { - fPlayer.setPVPBlock(false); + fPlayer.setPvpBlocked(false); return; } @@ -64,4 +64,4 @@ public class PvPBlocker extends FreedomService FSync.playerMsg(player, ChatColor.RED + "You have been disallowed from PvPing!"); } -} \ No newline at end of file +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java index 90df9edf..d050790c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java @@ -1,7 +1,14 @@ package me.totalfreedom.totalfreedommod; +import java.util.Arrays; +import java.util.List; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; +import net.minecraft.server.v1_12_R1.EntityPlayer; +import net.minecraft.server.v1_12_R1.MinecraftServer; +import net.minecraft.server.v1_12_R1.PropertyManager; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; public class ServerInterface extends FreedomService { @@ -34,52 +41,52 @@ public class ServerInterface extends FreedomService } } -// public void setOnlineMode(boolean mode) -// { -// final PropertyManager manager = getServer().getPropertyManager(); -// manager.setProperty("online-mode", mode); -// manager.savePropertiesFile(); -// } -// -// public int purgeWhitelist() -// { -// String[] whitelisted = getServer().getPlayerList().getWhitelisted(); -// int size = whitelisted.length; -// for (EntityPlayer player : getServer().getPlayerList().players) -// { -// getServer().getPlayerList().getWhitelist().remove(player.getProfile()); -// } -// -// try -// { -// getServer().getPlayerList().getWhitelist().save(); -// } -// catch (Exception ex) -// { -// FLog.warning("Could not purge the whitelist!"); -// FLog.warning(ex); -// } -// return size; -// } -// -// public boolean isWhitelisted() -// { -// return getServer().getPlayerList().getHasWhitelist(); -// } -// -// public List getWhitelisted() -// { -// return Arrays.asList(getServer().getPlayerList().getWhitelisted()); -// } -// -// public String getVersion() -// { -// return getServer().getVersion(); -// } -// -// private MinecraftServer getServer() -// { -// return ((CraftServer) Bukkit.getServer()).getServer(); -// } + public void setOnlineMode(boolean mode) + { + final PropertyManager manager = getServer().getPropertyManager(); + manager.setProperty("online-mode", mode); + manager.savePropertiesFile(); + } + + public int purgeWhitelist() + { + String[] whitelisted = getServer().getPlayerList().getWhitelisted(); + int size = whitelisted.length; + for (EntityPlayer player : getServer().getPlayerList().players) + { + getServer().getPlayerList().getWhitelist().remove(player.getProfile()); + } + + try + { + getServer().getPlayerList().getWhitelist().save(); + } + catch (Exception ex) + { + FLog.warning("Could not purge the whitelist!"); + FLog.warning(ex); + } + return size; + } + + public boolean isWhitelisted() + { + return getServer().getPlayerList().getHasWhitelist(); + } + + public List getWhitelisted() + { + return Arrays.asList(getServer().getPlayerList().getWhitelisted()); + } + + public String getVersion() + { + return getServer().getVersion(); + } + + private MinecraftServer getServer() + { + return ((CraftServer) Bukkit.getServer()).getServer(); + } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java index 2fe4b2a3..9370c043 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java @@ -1,5 +1,3 @@ - - package me.totalfreedom.totalfreedommod.bridge; import org.bukkit.event.player.PlayerQuitEvent; @@ -27,165 +25,216 @@ import me.totalfreedom.totalfreedommod.FreedomService; public class EssentialsBridge extends FreedomService { + private Essentials essentialsPlugin; - - public EssentialsBridge(final TotalFreedomMod plugin) { + + public EssentialsBridge(final TotalFreedomMod plugin) + { super(plugin); this.essentialsPlugin = null; } - - protected void onStart() { + + @Override + protected void onStart() + { } - - protected void onStop() { + + @Override + protected void onStop() + { Command_vanish.vanished.clear(); } - - public Essentials getEssentialsPlugin() { - if (this.essentialsPlugin == null) { - try { + + public Essentials getEssentialsPlugin() + { + if (this.essentialsPlugin == null) + { + try + { final Plugin essentials = Bukkit.getServer().getPluginManager().getPlugin("Essentials"); - if (essentials != null && essentials instanceof Essentials) { - this.essentialsPlugin = (Essentials)essentials; + if (essentials != null && essentials instanceof Essentials) + { + this.essentialsPlugin = (Essentials) essentials; } } - catch (Exception ex) { + catch (Exception ex) + { FLog.severe(ex); } } return this.essentialsPlugin; } - - public User getEssentialsUser(final String username) { - try { + + public User getEssentialsUser(final String username) + { + try + { final Essentials essentials = this.getEssentialsPlugin(); - if (essentials != null) { + if (essentials != null) + { return essentials.getUserMap().getUser(username); } } - catch (Exception ex) { + catch (Exception ex) + { FLog.severe(ex); } return null; } - - public void setNickname(final String username, final String nickname) { - try { + + public void setNickname(final String username, final String nickname) + { + try + { final User user = this.getEssentialsUser(username); - if (user != null) { + if (user != null) + { user.setNickname(nickname); user.setDisplayNick(); } } - catch (Exception ex) { + catch (Exception ex) + { FLog.severe(ex); } } - - public String getNickname(final String username) { - try { + + public String getNickname(final String username) + { + try + { final User user = this.getEssentialsUser(username); - if (user != null) { + if (user != null) + { return user.getNickname(); } } - catch (Exception ex) { + catch (Exception ex) + { FLog.severe(ex); } return null; } - - public long getLastActivity(final String username) { - try { + + public long getLastActivity(final String username) + { + try + { final User user = this.getEssentialsUser(username); - if (user != null) { + if (user != null) + { return FUtil.getField(user, "lastActivity"); } } - catch (Exception ex) { + catch (Exception ex) + { FLog.severe(ex); } return 0L; } - - public void setVanished(final String username, final boolean vanished) { - try { + + public void setVanished(final String username, final boolean vanished) + { + try + { final User user = this.getEssentialsUser(username); - if (user != null) { + if (user != null) + { user.setVanished(vanished); } } - catch (Exception ex) { + catch (Exception ex) + { FLog.severe(ex); } } - + @EventHandler(priority = EventPriority.MONITOR) - public void onInventoryClickEvent(final InventoryClickEvent event) { + public void onInventoryClickEvent(final InventoryClickEvent event) + { Player refreshPlayer = null; final Inventory top = event.getView().getTopInventory(); final InventoryType type = top.getType(); - final Player playerdata = (Player)event.getWhoClicked(); - final FPlayer fPlayer = ((TotalFreedomMod)this.plugin).pl.getPlayer(playerdata); - if (type == InventoryType.PLAYER && fPlayer.isInvsee()) { + final Player playerdata = (Player) event.getWhoClicked(); + final FPlayer fPlayer = ((TotalFreedomMod) this.plugin).pl.getPlayer(playerdata); + if (type == InventoryType.PLAYER && fPlayer.isInvSee()) + { final InventoryHolder invHolder = top.getHolder(); - if (invHolder != null && invHolder instanceof HumanEntity) { - final Player invOwner = (Player)invHolder; - final Rank recieverRank = ((TotalFreedomMod)this.plugin).rm.getRank(playerdata); - final Rank playerRank = ((TotalFreedomMod)this.plugin).rm.getRank(invOwner); - if (playerRank.ordinal() >= recieverRank.ordinal() || !invOwner.isOnline()) { + if (invHolder != null && invHolder instanceof HumanEntity) + { + final Player invOwner = (Player) invHolder; + final Rank recieverRank = ((TotalFreedomMod) this.plugin).rm.getRank(playerdata); + final Rank playerRank = ((TotalFreedomMod) this.plugin).rm.getRank(invOwner); + if (playerRank.ordinal() >= recieverRank.ordinal() || !invOwner.isOnline()) + { event.setCancelled(true); refreshPlayer = playerdata; } } } - if (refreshPlayer != null) { + if (refreshPlayer != null) + { final Player player = refreshPlayer; - new BukkitRunnable() { - public void run() { + new BukkitRunnable() + { + @Override + public void run() + { player.updateInventory(); } - }.runTaskLater((Plugin)this.plugin, 20L); + }.runTaskLater((Plugin) this.plugin, 20L); } } - + @EventHandler(priority = EventPriority.MONITOR) - public void onInventoryCloseEvent(final InventoryCloseEvent event) { + public void onInventoryCloseEvent(final InventoryCloseEvent event) + { Player refreshPlayer = null; final Inventory top = event.getView().getTopInventory(); final InventoryType type = top.getType(); - final Player playerdata = (Player)event.getPlayer(); - final FPlayer fPlayer = ((TotalFreedomMod)this.plugin).pl.getPlayer(playerdata); - if (type == InventoryType.PLAYER && fPlayer.isInvsee()) { - fPlayer.setInvsee(false); + final Player playerdata = (Player) event.getPlayer(); + final FPlayer fPlayer = ((TotalFreedomMod) this.plugin).pl.getPlayer(playerdata); + if (type == InventoryType.PLAYER && fPlayer.isInvSee()) + { + fPlayer.setInvSee(false); refreshPlayer = playerdata; } - if (refreshPlayer != null) { + if (refreshPlayer != null) + { final Player player = refreshPlayer; - new BukkitRunnable() { - public void run() { + new BukkitRunnable() + { + @Override + public void run() + { player.updateInventory(); } - }.runTaskLater((Plugin)this.plugin, 20L); + }.runTaskLater((Plugin) this.plugin, 20L); } } - + @EventHandler(priority = EventPriority.MONITOR) - public void onPlayerQuitEvent(final PlayerQuitEvent event) { + public void onPlayerQuitEvent(final PlayerQuitEvent event) + { final Player player = event.getPlayer(); - if (Command_vanish.vanished.contains(player)) { + if (Command_vanish.vanished.contains(player)) + { Command_vanish.vanished.remove(player); } } - - public boolean isEssentialsEnabled() { - try { + + public boolean isEssentialsEnabled() + { + try + { final Essentials essentials = this.getEssentialsPlugin(); - if (essentials != null) { + if (essentials != null) + { return essentials.isEnabled(); } } - catch (Exception ex) { + catch (Exception ex) + { FLog.severe(ex); } return false; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java index 01434ae9..b71b5f00 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java @@ -1,14 +1,10 @@ - - package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.player.FPlayer; -import java.util.Iterator; import org.bukkit.ChatColor; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.ArrayUtils; import me.totalfreedom.totalfreedommod.util.FUtil; -import me.totalfreedom.totalfreedommod.TotalFreedomMod; import org.bukkit.command.Command; import org.bukkit.entity.Player; import org.bukkit.command.CommandSender; @@ -18,91 +14,120 @@ import me.totalfreedom.totalfreedommod.rank.Rank; @CommandParameters(description = "Blocks all block placing for player with brute force.", usage = "/ [[-s] [reason] | list | purge | all]", aliases = "editmute") public class Command_blockedit extends FreedomCommand { - public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, String[] args, final boolean senderIsConsole) { - if (args.length == 0) { + + @Override + public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, String[] args, final boolean senderIsConsole) + { + if (args.length == 0) + { return false; } - if (args[0].equals("list")) { - this.msg("Block edits blocked for players:"); + + if (args[0].equals("list")) + { + msg("Block edits blocked for players:"); int count = 0; - for (final Player mp : this.server.getOnlinePlayers()) { - final FPlayer info = ((TotalFreedomMod)this.plugin).pl.getPlayer(mp); - if (info.isEditBlock()) { - this.msg("- " + mp.getName()); + for (Player mp : server.getOnlinePlayers()) + { + final FPlayer info = plugin.pl.getPlayer(mp); + if (info.isEditBlocked()) + { + msg("- " + mp.getName()); ++count; } } - if (count == 0) { - this.msg("- none"); + + if (count == 0) + { + msg("- none"); } return true; } - if (args[0].equals("purge")) { + + if (args[0].equals("purge")) + { FUtil.adminAction(sender.getName(), "Unblocking block edits for all players.", true); int count = 0; - for (final Player mp : this.server.getOnlinePlayers()) { - final FPlayer info = ((TotalFreedomMod)this.plugin).pl.getPlayer(mp); - if (info.isEditBlock()) { + for (final Player mp : this.server.getOnlinePlayers()) + { + final FPlayer info = plugin.pl.getPlayer(mp); + if (info.isEditBlocked()) + { info.setEditBlocked(false); ++count; } } - this.msg("Unblocked all block edit for " + count + " players."); + msg("Unblocked all block edit for " + count + " players."); return true; } - if (args[0].equals("all")) { + + if (args[0].equals("all")) + { FUtil.adminAction(sender.getName(), "Blocking block edits for all non-admins.", true); int counter = 0; - for (final Player player : this.server.getOnlinePlayers()) { - if (!((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player)) { - final FPlayer playerdata = ((TotalFreedomMod)this.plugin).pl.getPlayer(player); + for (final Player player : this.server.getOnlinePlayers()) + { + if (!plugin.al.isAdmin((CommandSender) player)) + { + final FPlayer playerdata = plugin.pl.getPlayer(player); playerdata.setEditBlocked(true); ++counter; } } - this.msg("Blocked block edits for " + counter + " players."); + + msg("Blocked block edits for " + counter + " players."); return true; } + final boolean smite = args[0].equals("-s"); - if (smite) { - args = (String[])ArrayUtils.subarray((Object[])args, 1, args.length); - if (args.length < 1) { + if (smite) + { + args = (String[]) ArrayUtils.subarray((Object[]) args, 1, args.length); + if (args.length < 1) + { return false; } } - final Player player2 = this.getPlayer(args[0]); - if (player2 == null) { + + final Player player2 = getPlayer(args[0]); + if (player2 == null) + { sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); return true; } + String reason = null; - if (args.length > 1) { - reason = StringUtils.join((Object[])args, " ", 1, args.length); + if (args.length > 1) + { + reason = StringUtils.join((Object[]) args, " ", 1, args.length); } - final FPlayer playerdata2 = ((TotalFreedomMod)this.plugin).pl.getPlayer(player2); - if (playerdata2.isEditBlock()) { + + final FPlayer playerdata2 = plugin.pl.getPlayer(player2); + if (playerdata2.isEditBlocked()) + { FUtil.adminAction(sender.getName(), "Unblocking block edits for " + player2.getName(), true); playerdata2.setEditBlocked(false); - this.msg("Unblocking block edits for " + player2.getName()); - this.msg((CommandSender)player2, "Your block edits have been unblocked.", ChatColor.RED); + msg("Unblocking block edits for " + player2.getName()); + msg(player2, "Your block edits have been unblocked.", ChatColor.RED); } - else { - if (((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player2)) { - this.msg(player2.getName() + " is an admin, and cannot have their block edits blocked."); + else + { + if (plugin.al.isAdmin((CommandSender) player2)) + { + msg(player2.getName() + " is an admin, and cannot have their block edits blocked."); return true; } + FUtil.adminAction(sender.getName(), "Blocking block edits for " + player2.getName(), true); playerdata2.setEditBlocked(true); - if (smite) { - Command_smite.smite(player2, sender); + + if (smite) + { + Command_smite.smite(sender, player2, reason); } - if (reason != null) { - this.msg((CommandSender)player2, "Your block edits have been blocked. Reason: " + reason, ChatColor.RED); - } - else { - this.msg((CommandSender)player2, "Your block edits have been blocked.", ChatColor.RED); - } - this.msg("Blocked all block edits for " + player2.getName()); + + msg(player2, "Your block edits have been blocked.", ChatColor.RED); + msg("Blocked all block edits for " + player2.getName()); } return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java index 911f9c4f..151650bc 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java @@ -1,14 +1,10 @@ - - package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.player.FPlayer; -import java.util.Iterator; import org.bukkit.ChatColor; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.ArrayUtils; import me.totalfreedom.totalfreedommod.util.FUtil; -import me.totalfreedom.totalfreedommod.TotalFreedomMod; import org.bukkit.command.Command; import org.bukkit.entity.Player; import org.bukkit.command.CommandSender; @@ -18,91 +14,120 @@ import me.totalfreedom.totalfreedommod.rank.Rank; @CommandParameters(description = "Toggle PVP mode for players.", usage = "/ [[-s] [reason] | list | purge | all]", aliases = "pvpblock,pvpmode,pvpman,pvman") public class Command_blockpvp extends FreedomCommand { - public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, String[] args, final boolean senderIsConsole) { - if (args.length == 0) { + + @Override + public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, String[] args, final boolean senderIsConsole) + { + if (args.length == 0) + { return false; } - if (args[0].equals("list")) { + + if (args[0].equals("list")) + { this.msg("PVP is blocked for players:"); int count = 0; - for (final Player mp : this.server.getOnlinePlayers()) { - final FPlayer info = ((TotalFreedomMod)this.plugin).pl.getPlayer(mp); - if (info.isPVPBlock()) { - this.msg("- " + mp.getName()); + for (Player mp : server.getOnlinePlayers()) + { + final FPlayer info = plugin.pl.getPlayer(mp); + if (info.isPvpBlocked()) + { + msg(" - " + mp.getName()); ++count; } } - if (count == 0) { - this.msg("- none"); + + if (count == 0) + { + this.msg(" - none"); } return true; } - if (args[0].equals("purge")) { + + if (args[0].equals("purge")) + { FUtil.adminAction(sender.getName(), "Enabling PVP for all players.", true); int count = 0; - for (final Player mp : this.server.getOnlinePlayers()) { - final FPlayer info = ((TotalFreedomMod)this.plugin).pl.getPlayer(mp); - if (info.isPVPBlock()) { - info.setPVPBlock(false); + for (Player mp : this.server.getOnlinePlayers()) + { + final FPlayer info = plugin.pl.getPlayer(mp); + if (info.isPvpBlocked()) + { + info.setPvpBlocked(false); ++count; } } - this.msg("Enabled PVP for " + count + " players."); + + msg("Enabled PVP for " + count + " players."); return true; } - if (args[0].equals("all")) { + + if (args[0].equals("all")) + { FUtil.adminAction(sender.getName(), "Disabling PVP for all non-admins", true); int counter = 0; - for (final Player player : this.server.getOnlinePlayers()) { - if (!((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player)) { - final FPlayer playerdata = ((TotalFreedomMod)this.plugin).pl.getPlayer(player); - playerdata.setPVPBlock(true); + for (Player player : server.getOnlinePlayers()) + { + if (!plugin.al.isAdmin((CommandSender) player)) + { + final FPlayer playerdata = plugin.pl.getPlayer(player); + playerdata.setPvpBlocked(true); ++counter; } } - this.msg("Disabling PVP for " + counter + " players."); + + msg("Disabling PVP for " + counter + " players."); return true; } + final boolean smite = args[0].equals("-s"); - if (smite) { - args = (String[])ArrayUtils.subarray((Object[])args, 1, args.length); - if (args.length < 1) { + if (smite) + { + args = (String[]) ArrayUtils.subarray(args, 1, args.length); + if (args.length < 1) + { return false; } } - final Player player2 = this.getPlayer(args[0]); - if (player2 == null) { + + final Player player2 = getPlayer(args[0]); + if (player2 == null) + { sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND); return true; } + String reason = null; - if (args.length > 1) { - reason = StringUtils.join((Object[])args, " ", 1, args.length); + if (args.length > 1) + { + reason = StringUtils.join(args, " ", 1, args.length); } - final FPlayer playerdata2 = ((TotalFreedomMod)this.plugin).pl.getPlayer(player2); - if (playerdata2.isPVPBlock()) { + + final FPlayer playerdata2 = plugin.pl.getPlayer(player2); + if (playerdata2.isPvpBlocked()) + { FUtil.adminAction(sender.getName(), "Enabling PVP for " + player2.getName(), true); - playerdata2.setPVPBlock(false); - this.msg("Enabling PVP for " + player2.getName()); - this.msg((CommandSender)player2, "Your PVP have been enabled.", ChatColor.GREEN); + playerdata2.setPvpBlocked(false); + msg("Enabling PVP for " + player2.getName()); + msg((CommandSender) player2, "Your PVP have been enabled.", ChatColor.GREEN); } - else { - if (((TotalFreedomMod)this.plugin).al.isAdmin((CommandSender)player2)) { + else + { + if (plugin.al.isAdmin((CommandSender) player2)) + { this.msg(player2.getName() + " is an admin, and his PVP cannot be disabled."); return true; } + FUtil.adminAction(sender.getName(), "Disabling PVP for " + player2.getName(), true); - playerdata2.setPVPBlock(true); - if (smite) { - Command_smite.smite(player2, sender); + playerdata2.setPvpBlocked(true); + if (smite) + { + Command_smite.smite(sender, player2, reason); } - if (reason != null) { - this.msg((CommandSender)player2, "Your PVP has been disabled. Reason: " + reason, ChatColor.RED); - } - else { - this.msg((CommandSender)player2, "Your PVP has been disabled.", ChatColor.RED); - } - this.msg("Disabled PVP for " + player2.getName()); + + msg(player2, "Your PVP has been disabled.", ChatColor.RED); + msg("Disabled PVP for " + player2.getName()); } return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java index 5e46d3ab..97f86f6c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java @@ -1,10 +1,6 @@ - - package me.totalfreedom.totalfreedommod.command; -import java.util.Iterator; import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.Achievement; import org.bukkit.ChatColor; import org.bukkit.inventory.ItemStack; import org.bukkit.Material; @@ -12,37 +8,39 @@ import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; import org.bukkit.entity.Player; import org.bukkit.command.CommandSender; -import java.util.Random; import me.totalfreedom.totalfreedommod.rank.Rank; @CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "For the people that are still alive.", usage = "/") public class Command_cake extends FreedomCommand { + public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake."; - private final Random random; - - public Command_cake() { - this.random = new Random(); - } - - public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) { + + @Override + public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) + { final StringBuilder output = new StringBuilder(); - final String[] split; - final String[] words = split = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.".split(" "); - for (final String word : split) { - output.append(FUtil.rainbowChatColor()).append(word).append(" "); + + for (final String word : CAKE_LYRICS.split(" ")) + { + output.append(FUtil.randomChatColor()).append(word).append(" "); } + final ItemStack heldItem = new ItemStack(Material.CAKE); final ItemMeta heldItemMeta = heldItem.getItemMeta(); heldItemMeta.setDisplayName(ChatColor.WHITE + "The " + ChatColor.DARK_GRAY + "Lie"); heldItem.setItemMeta(heldItemMeta); - for (final Player player : this.server.getOnlinePlayers()) { + + for (final Player player : this.server.getOnlinePlayers()) + { final int firstEmpty = player.getInventory().firstEmpty(); - if (firstEmpty >= 0) { + if (firstEmpty >= 0) + { player.getInventory().setItem(firstEmpty, heldItem); } } + FUtil.bcastMsg(output.toString()); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_chestspy.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_chestspy.java index 2878c25e..acecc502 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_chestspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_chestspy.java @@ -16,9 +16,8 @@ public class Command_chestspy extends FreedomCommand { FPlayer playerdata = plugin.pl.getPlayer(playerSender); - playerdata.setChestMonitor(!playerdata.ChestMonitorEnabled()); - msg("ChestSpy " + (playerdata.ChestMonitorEnabled()? "enabled." : "disabled.")); - + playerdata.setChestMonitorEnabled(!playerdata.isChestMonitorEnabled()); + msg("ChestSpy " + (playerdata.isChestMonitorEnabled() ? "enabled." : "disabled.")); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dropspy.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dropspy.java index 1f5b6d1d..8b780e98 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dropspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dropspy.java @@ -16,9 +16,8 @@ public class Command_dropspy extends FreedomCommand { FPlayer playerdata = plugin.pl.getPlayer(playerSender); - playerdata.setDropMonitor(!playerdata.DropMonitorEnabled()); - msg("DropSpy " + (playerdata.DropMonitorEnabled() ? "enabled." : "disabled.")); - + playerdata.setDropMonitorEnabled(!playerdata.isDropMonitorEnabled()); + msg("DropSpy " + (playerdata.isDropMonitorEnabled() ? "enabled." : "disabled.")); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java index adb3e44e..82f264f7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java @@ -198,7 +198,7 @@ public class Command_gadmin extends FreedomCommand } case SMITE: { - Command_smite.smite(target, sender); + Command_smite.smite(sender, target); break; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java index 1e95c274..480bd151 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java @@ -40,12 +40,11 @@ public class Command_invsee extends FreedomCommand { msg("You can't spy on admins!"); return true; - } playerSender.closeInventory(); FPlayer fPlayer = plugin.pl.getPlayer(playerSender); - fPlayer.setInvsee(true); + fPlayer.setInvSee(true); Inventory playerInv = player.getInventory(); playerSender.openInventory(playerInv); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java index 7fa00798..2cda539d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java @@ -1,7 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang3.StringUtils; @@ -15,15 +17,9 @@ import org.bukkit.entity.Player; public class Command_nickclean extends FreedomCommand { - private static final ChatColor[] BLOCKED = new ChatColor[] - { - ChatColor.MAGIC, - ChatColor.STRIKETHROUGH, - ChatColor.ITALIC, - ChatColor.UNDERLINE, - ChatColor.BLACK - }; - private static final Pattern REGEX = Pattern.compile(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCKED, "") + "]", Pattern.CASE_INSENSITIVE); + private static final String[] BLOCK = ConfigEntry.BLOCKED_CHATCODES.getString().split(","); + + private static final Pattern REGEX = Pattern.compile(FUtil.colorize(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCK, "") + "]"), Pattern.CASE_INSENSITIVE); @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) 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 4f631a24..c9f12d25 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java @@ -16,9 +16,8 @@ public class Command_potionspy extends FreedomCommand { FPlayer playerdata = plugin.pl.getPlayer(playerSender); - playerdata.setPotionMonitor(!playerdata.PotionMonitorEnabled()); - msg("PotionSpy " + (playerdata.PotionMonitorEnabled() ? "enabled." : "disabled.")); - + playerdata.setPotionMonitorEnabled(!playerdata.isPotionMonitorEnabled()); + msg("PotionSpy " + (playerdata.isPotionMonitorEnabled() ? "enabled." : "disabled.")); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java index 7d206307..94f266e7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java @@ -38,23 +38,24 @@ public class Command_smite extends FreedomCommand return true; } - smite(player, reason); + smite(sender, player, reason); return true; } - public static void smite(Player player) + public static void smite(CommandSender sender, Player player) { - smite(player, null); + smite(sender, player, null); } - public static void smite(Player player, String reason) + public static void smite(CommandSender sender, Player player, String reason) { FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED); if (reason != null) { - FUtil.bcastMsg(" Reason: " + reason, ChatColor.YELLOW); + FUtil.bcastMsg(" Reason: " + ChatColor.YELLOW + reason, ChatColor.RED); } + FUtil.bcastMsg(" Smited by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED); // Deop player.setOp(false); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java index 13e8bfb2..6d93e1e7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java @@ -130,18 +130,10 @@ public class Command_stfu extends FreedomCommand if (smite) { - Command_smite.smite(player); - } - - if (reason != null) - { - msg(player, "You have been muted. Reason: " + reason, ChatColor.RED); - } - else - { - msg(player, "You have been muted.", ChatColor.RED); + Command_smite.smite(sender, player, reason); } + msg(player, "You have been muted.", ChatColor.RED); msg("Muted " + player.getName()); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java index 0ccab569..7e4054ca 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipewarps.java @@ -6,13 +6,13 @@ import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; @CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true) @CommandParameters(description = "Removes essentials warps", usage = "/") public class Command_wipewarps extends FreedomCommand { - @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -21,6 +21,7 @@ public class Command_wipewarps extends FreedomCommand msg("Essentials is not enabled on this server"); return true; } + Plugin essentials = server.getPluginManager().getPlugin("Essentials"); FUtil.adminAction(sender.getName(), "Wiping Essentials Warps", true); server.getPluginManager().disablePlugin(essentials); @@ -28,6 +29,5 @@ public class Command_wipewarps extends FreedomCommand server.getPluginManager().enablePlugin(essentials); msg("All warps deleted."); return true; - } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 2aca9cf6..d0ecfb46 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -22,6 +22,8 @@ public enum ConfigEntry ALLOW_FIREWORK_EXPLOSION(Boolean.class, "allow.fireworks"), ALLOW_FROSTWALKER(Boolean.class, "allow.frostwalker"), // + BLOCKED_CHATCODES(String.class, "blocked_chatcodes"), + // MOB_LIMITER_ENABLED(Boolean.class, "moblimiter.enabled"), MOB_LIMITER_MAX(Integer.class, "moblimiter.max"), MOB_LIMITER_DISABLE_DRAGON(Boolean.class, "moblimiter.disable.dragon"), @@ -185,4 +187,4 @@ public enum ConfigEntry } return null; } -} \ No newline at end of file +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java b/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java index 1872355e..087eb11e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java @@ -66,6 +66,24 @@ public class FPlayer private boolean cmdspyEnabled = false; private String tag = null; private int warningCount = 0; + @Getter + @Setter + private boolean dropMonitorEnabled = false; + @Getter + @Setter + private boolean potionMonitorEnabled = false; + @Getter + @Setter + private boolean editBlocked = false; + @Getter + @Setter + private boolean pvpBlocked = false; + @Getter + @Setter + private boolean chestMonitorEnabled = false; + @Getter + @Setter + private boolean invSee = false; public FPlayer(TotalFreedomMod plugin, Player player) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index c2b332d7..25321c74 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -37,7 +37,7 @@ public class FUtil // public static final String SAVED_FLAGS_FILENAME = "savedflags.dat"; // See https://github.com/TotalFreedom/License - None of the listed names may be removed. - public static final DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "aggelosQQ", "OxLemonxO", "Commodore64x", "Wild1145", "marcocorriero"); + public static final List DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "aggelosQQ", "OxLemonxO", "Commodore64x", "Wild1145"); public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; public static final Map CHAT_COLOR_NAMES = new HashMap<>(); public static final List CHAT_COLOR_POOL = Arrays.asList( @@ -370,14 +370,14 @@ public class FUtil { return CHAT_COLOR_POOL.get(RANDOM.nextInt(CHAT_COLOR_POOL.size())); } - + public static String rainbowify(String string) { CHAT_COLOR_ITERATOR = CHAT_COLOR_POOL.iterator(); - + final StringBuilder newString = new StringBuilder(); final char[] chars = string.toCharArray(); - + for (char c : chars) { if (!CHAT_COLOR_ITERATOR.hasNext()) @@ -386,7 +386,7 @@ public class FUtil } newString.append(CHAT_COLOR_ITERATOR.next()).append(c); } - + return newString.toString(); } @@ -420,5 +420,4 @@ public class FUtil String packageName = Bukkit.getServer().getClass().getPackage().getName(); return packageName.substring(packageName.lastIndexOf('.') + 1); } - -} \ No newline at end of file +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 59608beb..46a3cb60 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -335,4 +335,6 @@ overlord_ips: - 107.191.101.27 - 178.62.117.94 - 141.101.104.243 - + +# Blocked Chat Codes - Use &code,&code2,&code3 (No spaces) +blocked_chatcodes: '&0,&k,&m,&n'