Fredashay's Snoop icon

Fredashay's Snoop -----

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




Updated for Minecraft 1.20.
----------, Nov 11, 2023

Recompiled for 1.16
----------, Dec 19, 2020

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() { }  
           
    }
 
----------, Sep 30, 2017

Resource Information
Author:
----------
Total Downloads: 226
First Release: Sep 20, 2017
Last Update: Nov 11, 2023
Category: ---------------
All-Time Rating:
0 ratings
Find more info at minecraft-server-list.com...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings