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.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
public class BlockBlocker extends FreedomService
|
||||
@ -145,7 +146,24 @@ public class BlockBlocker extends FreedomService
|
||||
case PLAYER_WALL_HEAD:
|
||||
{
|
||||
Skull skull = (Skull) event.getBlockPlaced().getState();
|
||||
if (skull.hasOwner() && skull.getOwner().length() > 16)
|
||||
if (skull.hasOwner())
|
||||
{
|
||||
if (skull.getOwner().contains("§"))
|
||||
{
|
||||
skull.setOwner(skull.getOwner().replace("§", ""));
|
||||
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();
|
||||
@ -155,6 +173,7 @@ public class BlockBlocker extends FreedomService
|
||||
event.getItemInHand().setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user