diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java index 84ac8518..f9d4d130 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java @@ -34,25 +34,22 @@ public class Monitors extends FreedomService { for (Player player : recentlyThrownPotions.keySet()) { - if (plugin.al.isAdmin(player) && plugin.al.getAdmin(player).getPotionSpy()) + List playerThrownPotions = recentlyThrownPotions.get(player); + ThrownPotion latestThrownPotion = playerThrownPotions.get(playerThrownPotions.size() - 1); // Get most recently thrown potion for the position. + int potionsThrown = playerThrownPotions.size(); + int trollPotions = 0; + + for (ThrownPotion potion : playerThrownPotions) { - List playerThrownPotions = recentlyThrownPotions.get(player); - ThrownPotion latestThrownPotion = playerThrownPotions.get(playerThrownPotions.size() - 1); // Get most recently thrown potion for the position. - int potionsThrown = playerThrownPotions.size(); - int trollPotions = 0; - - for (ThrownPotion potion : playerThrownPotions) + if (isTrollPotion(potion)) { - if (isTrollPotion(potion)) - { - trollPotions++; - } + trollPotions++; } - - plugin.al.messageAllAdmins(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.", - player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(), - latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : ""))); } + + plugin.al.messageAllAdmins(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.", + player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(), + latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : ""))); } recentlyThrownPotions.clear(); }, 0L, 40L); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/FAWEBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/FAWEBridge.java index 5a7e4143..d7182949 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/FAWEBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/FAWEBridge.java @@ -134,7 +134,10 @@ public class FAWEBridge extends FreedomService public void logBlockEdits(String playerName, EditSession editSession, Region region, Pattern pattern) { // Add the broken blocks to CoreProtect. - World world = server.getWorld(region.getWorld().getName()); + if (world == null || !world.getName().equals(editSession.getWorld().getName())) + { + world = server.getWorld(editSession.getWorld().getName()); + } List blocks = new ArrayList<>(); for (BlockVector3 blockVector3 : region)