mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
section exploit patch
This commit is contained in:
parent
ee4bbea340
commit
446f658c13
@ -13,6 +13,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
public class BlockBlocker extends FreedomService
|
public class BlockBlocker extends FreedomService
|
||||||
@ -145,14 +146,32 @@ public class BlockBlocker extends FreedomService
|
|||||||
case PLAYER_WALL_HEAD:
|
case PLAYER_WALL_HEAD:
|
||||||
{
|
{
|
||||||
Skull skull = (Skull) event.getBlockPlaced().getState();
|
Skull skull = (Skull) event.getBlockPlaced().getState();
|
||||||
if (skull.hasOwner() && skull.getOwner().length() > 16)
|
if (skull.hasOwner())
|
||||||
{
|
{
|
||||||
skull.setOwner(skull.getOwner().substring(0, 16));
|
if (skull.getOwner().contains("§"))
|
||||||
SkullMeta meta = (SkullMeta) event.getItemInHand().getItemMeta();
|
|
||||||
if (meta != null)
|
|
||||||
{
|
{
|
||||||
meta.setOwner(meta.getOwner().substring(0, 16));
|
skull.setOwner(skull.getOwner().replace("§", ""));
|
||||||
event.getItemInHand().setItemMeta(meta);
|
SkullMeta meta = (SkullMeta) event.getItemInHand().getItemMeta();
|
||||||
|
if (meta != null)
|
||||||
|
{
|
||||||
|
ItemStack newHead = new ItemStack(Material.PLAYER_HEAD, 1);
|
||||||
|
ItemMeta headMeta = newHead.getItemMeta();
|
||||||
|
headMeta.setDisplayName(ChatColor.YELLOW + "C-sectioned Head");
|
||||||
|
newHead.setItemMeta(headMeta);
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), newHead);
|
||||||
|
player.sendMessage(ChatColor.GRAY + "The player head you are attempting to place has a section symbol. Your player head has been C-sectioned.");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (skull.getOwner().length() > 16)
|
||||||
|
{
|
||||||
|
skull.setOwner(skull.getOwner().substring(0, 16));
|
||||||
|
SkullMeta meta = (SkullMeta)event.getItemInHand().getItemMeta();
|
||||||
|
if (meta != null)
|
||||||
|
{
|
||||||
|
meta.setOwner(meta.getOwner().substring(0, 16));
|
||||||
|
event.getItemInHand().setItemMeta(meta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user