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.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; 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); super(plugin);
} }
@Override @Override
protected void onStart() { protected void onStart()
{
} }
@Override @Override
protected void onStop() { protected void onStop()
{
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
if (plugin.al.isAdmin(event.getPlayer())) { {
if (plugin.al.isAdmin(event.getPlayer()))
{
return; return;
} }
for (Player player : server.getOnlinePlayers()) { for (Player player : server.getOnlinePlayers())
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).cmdspyEnabled()) { {
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).cmdspyEnabled())
{
FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage()); FUtil.playerMsg(player, event.getPlayer().getName() + ": " + event.getMessage());
} }
} }

View File

@ -108,6 +108,14 @@ public class BlockBlocker extends FreedomService
} }
break; 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) @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]") @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 @Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
if (args.length > 0) { {
if (args[0].equalsIgnoreCase("purge")) { if (args.length > 0)
{
if (args[0].equalsIgnoreCase("purge"))
{
checkRank(Rank.SENIOR_ADMIN); checkRank(Rank.SENIOR_ADMIN);
FUtil.adminAction(sender.getName(), "Purging the ban list", true); FUtil.adminAction(sender.getName(), "Purging the ban list", true);