This commit is contained in:
ZeroEpoch1969 2018-08-16 17:20:50 -07:00
parent 2bfc412e78
commit 516c21533c
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
6 changed files with 37 additions and 3 deletions

View File

@ -5,8 +5,11 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.util.MaterialGroup;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.ShulkerBox;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -99,4 +102,28 @@ public class BlockBlocker extends FreedomService
} }
} }
@EventHandler(priority = EventPriority.HIGH)
public void onShulkerBoxPlace(BlockPlaceEvent event)
{
Block block = event.getBlock();
if (MaterialGroup.SHULKER_BOXES.contains(event.getBlock().getType()))
{
ShulkerBox shulkerBox = (ShulkerBox)block.getState();
boolean empty = true;
for (ItemStack itemStack : shulkerBox.getInventory().getContents())
{
if (itemStack != null)
{
empty = false;
break;
}
}
if (!empty)
{
shulkerBox.getInventory().clear();
event.getPlayer().sendMessage(ChatColor.RED + "For security reasons, your shulker box has been emptied.");
}
}
}
} }

View File

@ -32,7 +32,7 @@ public class Command_ro extends FreedomCommand
String names = null; String names = null;
if (args[0].equalsIgnoreCase("shulker_boxes") || args[0].equalsIgnoreCase("shulkers")) if (args[0].equalsIgnoreCase("shulker_boxes") || args[0].equalsIgnoreCase("shulkers"))
{ {
materials.addAll(MaterialGroup.SHULKER_BOX_COLORS); materials.addAll(MaterialGroup.SHULKER_BOXES);
names = "shulker boxes"; names = "shulker boxes";
} }
else else

View File

@ -1,7 +1,10 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -39,6 +42,9 @@ public class Command_smite extends FreedomCommand
} }
smite(sender, player, reason); smite(sender, player, reason);
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.SMITE, reason));
return true; return true;
} }

View File

@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Unbans a player", usage = "/<command> <username> [-r[estore]]", aliases = "pardon") @CommandParameters(description = "Unbans a player", usage = "/<command> <username> [-r[estore]]")
public class Command_unban extends FreedomCommand public class Command_unban extends FreedomCommand
{ {

View File

@ -23,7 +23,7 @@ public class MaterialGroup
Material.GRAY_WOOL, Material.GRAY_WOOL,
Material.LIGHT_GRAY_WOOL, Material.LIGHT_GRAY_WOOL,
Material.BLACK_WOOL); Material.BLACK_WOOL);
public static final List<Material> SHULKER_BOX_COLORS = Arrays.asList( public static final List<Material> SHULKER_BOXES = Arrays.asList(
Material.WHITE_SHULKER_BOX, Material.WHITE_SHULKER_BOX,
Material.RED_SHULKER_BOX, Material.RED_SHULKER_BOX,
Material.ORANGE_SHULKER_BOX, Material.ORANGE_SHULKER_BOX,

View File

@ -120,6 +120,7 @@ blocked_commands:
# Disabled commands # Disabled commands
- 'n:b:/time:Server-side time changing is disabled. Please use /ptime to set your own personal time.' - 'n:b:/time:Server-side time changing is disabled. Please use /ptime to set your own personal time.'
- 'n:b:/gamemode:Use /creative and /survival to set your gamemode.' - 'n:b:/gamemode:Use /creative and /survival to set your gamemode.'
- 'n:b:/pardon:_'
- 'n:b:/ban-ip:_' - 'n:b:/ban-ip:_'
- 'n:b:/pardon-ip:_' - 'n:b:/pardon-ip:_'
- 'n:b:/toggledownfall:_' - 'n:b:/toggledownfall:_'