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

41 lines
1.2 KiB
Java
Raw Normal View History

package me.totalfreedom.totalfreedommod.admin.module;
2021-06-29 22:52:11 +00:00
import me.totalfreedom.totalfreedommod.services.AbstractService;
2021-06-29 22:52:11 +00:00
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 AbstractService
2021-06-29 22:52:11 +00:00
{
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
{
for (Player player : server.getOnlinePlayers())
{
if (plugin.adminList.isAdmin(player) && plugin.adminList.getAdmin(player).getCommandSpy())
2021-06-29 22:52:11 +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());
}
}
}
}
}