2015-11-15 23:32:04 +00:00
|
|
|
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;
|
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
public class CommandSpy extends FreedomService {
|
2015-11-15 23:32:04 +00:00
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
public CommandSpy(TotalFreedomMod plugin) {
|
2015-11-15 23:32:04 +00:00
|
|
|
super(plugin);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-05-12 19:40:39 +00:00
|
|
|
protected void onStart() {
|
2015-11-15 23:32:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-05-12 19:40:39 +00:00
|
|
|
protected void onStop() {
|
2015-11-15 23:32:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
2016-05-12 19:40:39 +00:00
|
|
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
|
|
|
if (plugin.al.isAdmin(event.getPlayer())) {
|
2015-11-15 23:32:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
for (Player player : server.getOnlinePlayers()) {
|
|
|
|
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).cmdspyEnabled()) {
|
2015-11-15 23:32:04 +00:00
|
|
|
FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|