Block structure blocks from being placed

This commit is contained in:
Jerom van der Sar 2016-06-25 01:24:56 +02:00
parent 6a004a9f35
commit 92a7e354ba
3 changed files with 32 additions and 12 deletions

View File

@ -6,28 +6,36 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandSpy extends FreedomService {
public class CommandSpy extends FreedomService
{
public CommandSpy(TotalFreedomMod plugin) {
public CommandSpy(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart() {
protected void onStart()
{
}
@Override
protected void onStop() {
protected void onStop()
{
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (plugin.al.isAdmin(event.getPlayer())) {
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
{
if (plugin.al.isAdmin(event.getPlayer()))
{
return;
}
for (Player player : server.getOnlinePlayers()) {
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).cmdspyEnabled()) {
for (Player player : server.getOnlinePlayers())
{
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).cmdspyEnabled())
{
FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage());
}
}

View File

@ -108,6 +108,14 @@ public class BlockBlocker extends FreedomService
}
break;
}
case STRUCTURE_BLOCK:
case STRUCTURE_VOID:
{
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
event.setCancelled(true);
break;
}
}
}

View File

@ -9,12 +9,16 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
public class Command_banlist extends FreedomCommand {
public class Command_banlist extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("purge")) {
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length > 0)
{
if (args[0].equalsIgnoreCase("purge"))
{
checkRank(Rank.SENIOR_ADMIN);
FUtil.adminAction(sender.getName(), "Purging the ban list", true);