TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java
2021-06-16 22:06:12 -06:00

35 lines
942 B
Java

package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandSpy extends FreedomService
{
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
{
for (Player player : server.getOnlinePlayers())
{
if (plugin.al.isAdmin(player) && plugin.al.getAdmin(player).getCommandSpy())
{
if (player != event.getPlayer())
{
FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage());
}
}
}
}
}