Sueta

Fredashay's Snoop

2023-11-11

Sometimes you just gotta snoop on all the players on your server.

·Plugin
  1. 2023-11-11latestUpdated for 1.20Nov 11, 2023
    Updated for Minecraft 1.20.
  2. 3.0Recompiled for 1.16Dec 19, 2020
    Recompiled for 1.16
    46 downloads
  3. 2017-09-30general improvementsSep 30, 2017
    Sometimes you just gotta snoop on all the players on your server. To install this plugin, copy the plugin JAR file to your server's plugins folder. Issue /SNOOP to use it. You can also issue SNOOP from the console. Code (Text): package FredashaySpigotSnoop; import java.util.List; import java.util.logging.Logger; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; public class MyPlugin extends JavaPlugin implements Listener, CommandExecutor { private static Logger logger = null; private static PluginDescriptionFile pdfFile = null; @Override public void onEnable() { pdfFile = getDescription(); getServer().getPluginManager().registerEvents(this,this); logger = Logger.getLogger("Minecraft"); } @SuppressWarnings("unchecked") @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (label.equalsIgnoreCase("snoop")) { logger.info("[" + pdfFile.getName() + "] Player '" + sender.getName() + "' snooped on the other players. "); Player player = null; List<Player> allPlayers = (List<Player>) getServer().getOnlinePlayers(); int playerIx = 0; String output = null; if (allPlayers.size() <= 0) { sender.sendMessage("<SNOOP> No players are logged on right now. "); } else while (playerIx < allPlayers.size()) { player = allPlayers.get(playerIx); output = "<SNOOP> Player '" + player.getName() + "' is in " + player.getLocation().getWorld().getName() + " at (" + player.getLocation().getBlockX() + ", " + player.getLocation().getBlockZ() + "). "; output = output + "Player is in " + player.getGameMode() + " mode. "; if (player.isOp()) { output = output + "Player is Op. "; } output = output + "Player is carrying "; if ((player.getInventory().getItemInMainHand().getType() == Material.AIR) && (player.getInventory().getItemInOffHand().getType() == Material.AIR)) { output = output + "nothing. "; } else { if (player.getInventory().getItemInMainHand().getType() != Material.AIR) { output = output + player.getInventory().getItemInMainHand().getType().name(); if (player.getInventory().getItemInOffHand().getType() != Material.AIR) { output = output + " and "; } } if (player.getInventory().getItemInOffHand().getType() != Material.AIR) { output = output + player.getInventory().getItemInOffHand().getType().name(); } output = output + ". "; } if (player.getBedSpawnLocation() == null) { output = output + "Player has no bed. "; } else { output = output + "Player's bed is in " + player.getBedSpawnLocation().getWorld().getName() + " at (" + player.getBedSpawnLocation().getBlockX() + ", " + player.getBedSpawnLocation().getBlockZ() + "). ";; } sender.sendMessage(output); playerIx = playerIx + 1; } return (true); } return (false); } // public void doNothing() { } }
    66 downloads
  4. 2017-09-19Sep 20, 2017
    45 downloads

Similar projects

Plugin →