diff --git a/TreeboTickets.iml b/TreeboTickets.iml
index d97d9dd..17ecc01 100644
--- a/TreeboTickets.iml
+++ b/TreeboTickets.iml
@@ -20,13 +20,13 @@
-
+
-
+
diff --git a/pom.xml b/pom.xml
index 01df82a..9d2b957 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.ShakeforProtein
TreeboTickets
- 4.1.0 - SpMc1.16.2
+ 4.2.0 - SpMc1.16.3
jar
TreeboTickets
@@ -110,13 +110,13 @@
org.spigotmc
spigot-api
- 1.16.2-R0.1-SNAPSHOT
+ 1.16.3-R0.1-SNAPSHOT
provided
org.spigotmc
spigot
- 1.16.2-R0.1-SNAPSHOT
+ 1.16.3-R0.1-SNAPSHOT
provided
diff --git a/src/main/java/me/shakeforprotein/treebotickets/Listeners/InventoryEvents/PlayerUseItem.java b/src/main/java/me/shakeforprotein/treebotickets/Listeners/InventoryEvents/PlayerUseItem.java
index 0d8550c..623fd97 100644
--- a/src/main/java/me/shakeforprotein/treebotickets/Listeners/InventoryEvents/PlayerUseItem.java
+++ b/src/main/java/me/shakeforprotein/treebotickets/Listeners/InventoryEvents/PlayerUseItem.java
@@ -1,19 +1,13 @@
package me.shakeforprotein.treebotickets.Listeners.InventoryEvents;
import me.shakeforprotein.treebotickets.TreeboTickets;
-import net.minecraft.server.v1_16_R2.NBTTagCompound;
-import org.bukkit.Bukkit;
import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.inventory.Inventory;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
-import java.util.Set;
public class PlayerUseItem implements Listener {
@@ -25,49 +19,13 @@ public PlayerUseItem(TreeboTickets main) {
}
@EventHandler
- public void playerUseItem(PlayerInteractEvent e) {
- Inventory inv = Bukkit.createInventory(null,9,"AntiHack Triggered");
+ public void playerRunCommand(PlayerCommandPreprocessEvent e) {
Player p = e.getPlayer();
- if (e.getItem() != null) {
- if (e.getItem().getType() == Material.WRITTEN_BOOK) {
- if (e.getItem().hasItemMeta()) {
- if (e.getItem().getItemMeta() instanceof BookMeta) {
- net.minecraft.server.v1_16_R2.ItemStack nmsItem = getNMSItem(e.getItem());
- NBTTagCompound compound = getCompound(nmsItem);
- Set compoundKeys = compound.getKeys();
- for(String item : compoundKeys){
- if(compound.get(item).asString().contains("clickEvent")){
- e.getItem().setItemMeta(null);
- e.getPlayer().openInventory(inv);
- e.getPlayer().closeInventory();
- break;
- }
- }
- }
- }
- }
- if (e.getPlayer().hasPermission("tbtickets.admin.restoreinventory") && e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName() && e.getItem().getItemMeta().getDisplayName().contains("Death Docket -")) {
- if (e.getItem().getItemMeta().getLore().get(4) != null) {
- String cmd = "tellraw " + e.getPlayer().getName() + " [\"\",{\"text\":\"Click \"},{\"text\":\"[HERE]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/restoreplayerinventory " + e.getItem().getItemMeta().getLore().get(0).split(" - ")[1] + " " + e.getItem().getItemMeta().getLore().get(4).split(" - ")[1] + "\"}},{\"text\":\" to restore player inventory.\"}]";
- Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);
-
- }
- }
+ ItemStack mainHandItem = e.getPlayer().getInventory().getItemInMainHand();
+ ItemStack offHandItem = e.getPlayer().getInventory().getItemInOffHand();
+ if(mainHandItem.getType() == Material.WRITTEN_BOOK || offHandItem.getType() == Material.WRITTEN_BOOK){
+ e.setCancelled(true);
+ p.sendMessage("For your protection, commands have been disabled while holding a written book.");
}
}
-
- public net.minecraft.server.v1_16_R2.ItemStack getNMSItem(ItemStack item){
- net.minecraft.server.v1_16_R2.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
- return nmsItem;
- }
-
- public NBTTagCompound getCompound(net.minecraft.server.v1_16_R2.ItemStack nmsItem){
- NBTTagCompound nmsCompound = (nmsItem.hasTag()) ? nmsItem.getTag() : new NBTTagCompound();
- return nmsCompound;
- }
-
- public ItemStack getBukkitItem(net.minecraft.server.v1_16_R2.ItemStack nmsItem){
- ItemStack bukkitItem = CraftItemStack.asBukkitCopy(nmsItem);
- return bukkitItem;
- }
}
diff --git a/src/main/java/me/shakeforprotein/treebotickets/Listeners/StatTracking/OnPlayerKill.java b/src/main/java/me/shakeforprotein/treebotickets/Listeners/StatTracking/OnPlayerKill.java
index 98ed8b7..1d9a744 100644
--- a/src/main/java/me/shakeforprotein/treebotickets/Listeners/StatTracking/OnPlayerKill.java
+++ b/src/main/java/me/shakeforprotein/treebotickets/Listeners/StatTracking/OnPlayerKill.java
@@ -31,6 +31,9 @@ private void onPlayerKillEvent(EntityDeathEvent e) {
if (entity.getType().toString().toLowerCase().contains(mob.toLowerCase()) || entity.getType().toString().replace(" ","").replace("_","").toLowerCase().contains(mob.toLowerCase())) {
String killedMob = mob.toUpperCase().replace(" ","").replace("_", "");
if (killedMob.toLowerCase().equalsIgnoreCase("PIGZOMBIE")){killedMob = "ZOMBIEPIGMAN";}
+ if (killedMob.toLowerCase().equalsIgnoreCase("PIGLIN")){killedMob = "ZOMBIEPIGMAN";}
+ if (killedMob.toLowerCase().equalsIgnoreCase("PIGLIN_BRUTE")){killedMob = "ZOMBIEPIGMAN";}
+ if (killedMob.toLowerCase().equalsIgnoreCase("ZOMBIFIED_PIGLIN")){killedMob = "ZOMBIEPIGMAN";}
if (killedMob.toLowerCase().equalsIgnoreCase("WITHER")){killedMob = "WITHERBOSS";}
addStatistic.addStatistic(killer,"kills",killedMob);
addStatistic.addStatistic(killer,"kills","TOTALMOB");
diff --git a/src/main/java/me/shakeforprotein/treebotickets/TreeboTickets.java b/src/main/java/me/shakeforprotein/treebotickets/TreeboTickets.java
index e504bfd..1f3b077 100644
--- a/src/main/java/me/shakeforprotein/treebotickets/TreeboTickets.java
+++ b/src/main/java/me/shakeforprotein/treebotickets/TreeboTickets.java
@@ -24,6 +24,7 @@
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -446,8 +447,11 @@ private void defineMobList() {
mobList.add("CAVE_SPIDER");
mobList.add("ELDER_GUARDIAN");
mobList.add("PIG_ZOMBIE");
- mobList.add("ZOMBIE PIGMAN");
+ mobList.add("ZOMBIF PIGMAN");
+ mobList.add("ZOMBIFIED_PIGLIN");
mobList.add("ZOMBIE_VILLAGER");
+ mobList.add("PIGLIN");
+ mobList.add("PIGLIN_BRUTE");
mobList.add("IRON_GOLEM");
mobList.add("SNOW_GOLEM");
mobList.add("ENDER_DRAGON");