TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java

41 lines
1.1 KiB
Java
Raw Normal View History

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
2020-07-01 01:51:06 +00:00
public void onStart()
{
}
@Override
2020-07-01 01:51:06 +00:00
public void onStop()
{
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
{
for (Player player : server.getOnlinePlayers())
{
2018-04-19 14:29:19 +00:00
if (plugin.al.isAdmin(player) && plugin.al.getAdmin(player).getCommandSpy())
{
2018-04-19 14:29:19 +00:00
if (plugin.al.isAdmin(event.getPlayer()) && !plugin.al.isSeniorAdmin(player))
{
continue;
}
if (player != event.getPlayer())
{
FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage());
}
}
}
}
}