fixed the pi exploit for normal placement

This commit is contained in:
Super_ 2020-01-01 23:37:20 -05:00
parent c53de9d789
commit eb3a266bf6

View File

@ -5,13 +5,20 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagString;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Skull;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
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
{
@ -139,6 +146,24 @@ public class BlockBlocker extends FreedomService
}
break;
}
case PLAYER_HEAD:
case PLAYER_WALL_HEAD:
{
SkullMeta meta = (SkullMeta) event.getItemInHand().getItemMeta();
if (meta != null)
{
if (meta.hasOwner())
{
if (meta.getOwner().length() > 100)
{
player.sendMessage(ChatColor.GRAY + "Instead of using Pi to crash a server, how about you use it to impress nerds like yourself?");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
event.setCancelled(true);
}
}
}
break;
}
}
}