TotalFreedomMod/commons/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java
Paul Reilly 2265783afb Part 1 / 2
Only thing left is to fix all the code issues from moving out the discord and shop implementations.
2023-03-09 01:42:18 -06:00

29 lines
948 B
Java

package me.totalfreedom.totalfreedommod;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
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)
{
server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)
&& plugin.al.getAdmin(player).getCommandSpy() && player != event.getPlayer()).forEach(player ->
player.sendMessage(Component.text(event.getPlayer().getName()).append(Component.text(": "))
.append(Component.text(event.getMessage()))));
}
}