Added sendMessageToOps

This commit is contained in:
Kai committed 2016-06-01 12:06:05 +02:00
1 parent 9e182d07e1
commit e36e520801
2 files changed
+11 -6

No files matched your search

@@ -1,6 +1,5 @@
package org.maxgamer.quickshop.Listeners;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -123,11 +122,7 @@ public class BlockListener implements Listener {
if (shop != null) {
event.setCancelled(true);
plugin.getLogger().warning("[Exploit Alert] a piston tried to move the item on top of "+shop);
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.isOp()) {
player.sendMessage(ChatColor.RED+"[QuickShop][Exploit alert] A piston tried to move the item on top of "+shop);
}
}
Util.sendMessageToOps(ChatColor.RED+"[QuickShop][Exploit alert] A piston tried to move the item on top of "+shop);
}
}
@@ -11,6 +11,7 @@ import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -20,6 +21,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@@ -1035,4 +1037,12 @@ public class Util {
return false;
}
}
public static void sendMessageToOps(String message) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.isOp()) {
player.sendMessage(message);
}
}
}
}