mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
some things
This commit is contained in:
parent
2408054a49
commit
8c7823d7bf
@ -3,8 +3,13 @@ package me.totalfreedom.totalfreedommod.blocking;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.MaterialGroup;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -24,7 +29,9 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.FireworkExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
|
||||
public class EventBlocker extends FreedomService
|
||||
{
|
||||
@ -210,5 +217,24 @@ public class EventBlocker extends FreedomService
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onBlockDispense(BlockDispenseEvent event)
|
||||
{
|
||||
ItemStack item = event.getItem();
|
||||
if (MaterialGroup.SHULKER_BOXES.contains(item.getType()))
|
||||
{
|
||||
BlockStateMeta blockStateMeta = (BlockStateMeta)item.getItemMeta();
|
||||
ShulkerBox shulkerBox = (ShulkerBox)blockStateMeta.getBlockState();
|
||||
for (ItemStack itemStack : shulkerBox.getInventory().getContents())
|
||||
{
|
||||
if (itemStack != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Bans a player", usage = "/<command> <username> [reason] [-rb]", aliases = "ban")
|
||||
@CommandParameters(description = "Bans a player", usage = "/<command> <username> [reason] [-nrb]", aliases = "ban")
|
||||
public class Command_gtfo extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -78,12 +78,12 @@ public class Command_gtfo extends FreedomCommand
|
||||
}
|
||||
|
||||
String reason = null;
|
||||
Boolean rollback = false;
|
||||
Boolean cancelRollback = false;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[args.length - 1].equalsIgnoreCase("-rb"))
|
||||
if (args[args.length - 1].equalsIgnoreCase("-nrb"))
|
||||
{
|
||||
rollback = true;
|
||||
cancelRollback = true;
|
||||
if (args.length >= 3)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
@ -96,7 +96,7 @@ public class Command_gtfo extends FreedomCommand
|
||||
}
|
||||
|
||||
// Checks if CoreProtect is loaded and installed, and skips the rollback and uses CoreProtect directly
|
||||
if (rollback)
|
||||
if (!cancelRollback)
|
||||
{
|
||||
if (!plugin.cpb.isEnabled())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user