mirror of
https://github.com/kaboomserver/extras.git
synced 2024-12-11 16:41:06 -05:00
Fix errors in inventory checker
This commit is contained in:
parent
6b22761698
commit
a08c19f850
3 changed files with 246 additions and 189 deletions
|
@ -27,6 +27,14 @@ public class Main extends JavaPlugin {
|
|||
/* Fill lists */
|
||||
Collections.addAll(
|
||||
consoleCommandBlacklist,
|
||||
"bukkit:about",
|
||||
"bukkit:ver",
|
||||
"bukkit:version",
|
||||
"about",
|
||||
"icanhasbukkit",
|
||||
"ver",
|
||||
"version",
|
||||
|
||||
"essentials:action",
|
||||
"essentials:adventure",
|
||||
"essentials:adventuremode",
|
||||
|
@ -49,6 +57,126 @@ public class Main extends JavaPlugin {
|
|||
"essentials:creative",
|
||||
"essentials:creativemode",
|
||||
"essentials:describe",
|
||||
"essentials:feed",
|
||||
"essentials:gamemode",
|
||||
"essentials:gm",
|
||||
"essentials:gma",
|
||||
"essentials:gmc",
|
||||
"essentials:gms",
|
||||
"essentials:gmsp",
|
||||
"essentials:gmt",
|
||||
"essentials:heal",
|
||||
"essentials:helpop",
|
||||
"essentials:jail",
|
||||
"essentials:kick",
|
||||
"essentials:kill",
|
||||
"essentials:m",
|
||||
"essentials:mail",
|
||||
"essentials:me",
|
||||
"essentials:memo",
|
||||
"essentials:mute",
|
||||
"essentials:msg",
|
||||
"essentials:nuke",
|
||||
"essentials:pardon",
|
||||
"essentials:pardonip",
|
||||
"essentials:pm",
|
||||
"essentials:shoutworld",
|
||||
"essentials:silence",
|
||||
"essentials:sp",
|
||||
"essentials:spec",
|
||||
"essentials:spectator",
|
||||
"essentials:sudo",
|
||||
"essentials:survival",
|
||||
"essentials:survivalmode",
|
||||
"essentials:t",
|
||||
"essentials:tele",
|
||||
"essentials:teleport",
|
||||
"essentials:tell",
|
||||
"essentials:tempban",
|
||||
"essentials:tjail",
|
||||
"essentials:togglejail",
|
||||
"essentials:tp",
|
||||
"essentials:tp2p",
|
||||
"essentials:tpaall",
|
||||
"essentials:tpall",
|
||||
"essentials:tppos",
|
||||
"essentials:tptoggle",
|
||||
"essentials:unban",
|
||||
"essentials:unbanip",
|
||||
"essentials:v",
|
||||
"essentials:vanish",
|
||||
"essentials:w",
|
||||
"essentials:warp",
|
||||
"essentials:warps",
|
||||
"essentials:whisper",
|
||||
"action",
|
||||
"adventure",
|
||||
"adventuremode",
|
||||
"afk",
|
||||
"amsg",
|
||||
"away",
|
||||
"ban",
|
||||
"banip",
|
||||
"bc",
|
||||
"bcast",
|
||||
"bcastw",
|
||||
"bcw",
|
||||
"broadcast",
|
||||
"broadcastworld",
|
||||
"ci",
|
||||
"clean",
|
||||
"clearinvent",
|
||||
"clearinventory",
|
||||
"creative",
|
||||
"creativemode",
|
||||
"describe",
|
||||
"feed",
|
||||
"gm",
|
||||
"gma",
|
||||
"gmc",
|
||||
"gms",
|
||||
"gmsp",
|
||||
"gmt",
|
||||
"heal",
|
||||
"helpop",
|
||||
"jail",
|
||||
"kill",
|
||||
"m",
|
||||
"mail",
|
||||
"memo",
|
||||
"mute",
|
||||
"nuke",
|
||||
"pardon",
|
||||
"pardonip",
|
||||
"pm",
|
||||
"shoutworld",
|
||||
"silence",
|
||||
"sp",
|
||||
"spec",
|
||||
"spectator",
|
||||
"sudo",
|
||||
"survival",
|
||||
"survivalmode",
|
||||
"t",
|
||||
"tele",
|
||||
"teleport",
|
||||
"tempban",
|
||||
"tjail",
|
||||
"togglejail",
|
||||
"tp2p",
|
||||
"tpaall",
|
||||
"tpall",
|
||||
"tppos",
|
||||
"tptoggle",
|
||||
"unban",
|
||||
"unbanip",
|
||||
"v",
|
||||
"vanish",
|
||||
"w",
|
||||
"warp",
|
||||
"warps",
|
||||
"whisper",
|
||||
|
||||
"essentials:eaction",
|
||||
"essentials:eadventure",
|
||||
"essentials:eadventuremode",
|
||||
|
@ -124,97 +252,6 @@ public class Main extends JavaPlugin {
|
|||
"essentials:ewarp",
|
||||
"essentials:ewarps",
|
||||
"essentials:ewhisper",
|
||||
"essentials:feed",
|
||||
"essentials:gamemode",
|
||||
"essentials:gm",
|
||||
"essentials:gma",
|
||||
"essentials:gmc",
|
||||
"essentials:gms",
|
||||
"essentials:gmsp",
|
||||
"essentials:gmt",
|
||||
"essentials:heal",
|
||||
"essentials:helpop",
|
||||
"essentials:jail",
|
||||
"essentials:kick",
|
||||
"essentials:kill",
|
||||
"essentials:m",
|
||||
"essentials:mail",
|
||||
"essentials:me",
|
||||
"essentials:memo",
|
||||
"essentials:mute",
|
||||
"essentials:msg",
|
||||
"essentials:nuke",
|
||||
"essentials:pardon",
|
||||
"essentials:pardonip",
|
||||
"essentials:pm",
|
||||
"essentials:shoutworld",
|
||||
"essentials:silence",
|
||||
"essentials:sp",
|
||||
"essentials:spec",
|
||||
"essentials:spectator",
|
||||
"essentials:sudo",
|
||||
"essentials:survival",
|
||||
"essentials:survivalmode",
|
||||
"essentials:t",
|
||||
"essentials:tele",
|
||||
"essentials:teleport",
|
||||
"essentials:tell",
|
||||
"essentials:tempban",
|
||||
"essentials:tjail",
|
||||
"essentials:togglejail",
|
||||
"essentials:tp",
|
||||
"essentials:tp2p",
|
||||
"essentials:tpaall",
|
||||
"essentials:tpall",
|
||||
"essentials:tppos",
|
||||
"essentials:tptoggle",
|
||||
"essentials:unban",
|
||||
"essentials:unbanip",
|
||||
"essentials:v",
|
||||
"essentials:vanish",
|
||||
"essentials:w",
|
||||
"essentials:warp",
|
||||
"essentials:warps",
|
||||
"essentials:whisper",
|
||||
"extras:cc",
|
||||
"extras:clearchat",
|
||||
"minecraft:clear",
|
||||
"minecraft:effect",
|
||||
"minecraft:execute",
|
||||
"minecraft:gamemode",
|
||||
"minecraft:gamerule",
|
||||
"minecraft:kill",
|
||||
"minecraft:me",
|
||||
"minecraft:say",
|
||||
"minecraft:spreadplayers",
|
||||
"minecraft:tell",
|
||||
"minecraft:tellraw",
|
||||
"minecraft:title",
|
||||
"minecraft:tp",
|
||||
"action",
|
||||
"adventure",
|
||||
"adventuremode",
|
||||
"afk",
|
||||
"amsg",
|
||||
"away",
|
||||
"ban",
|
||||
"banip",
|
||||
"bc",
|
||||
"bcast",
|
||||
"bcastw",
|
||||
"bcw",
|
||||
"broadcast",
|
||||
"broadcastworld",
|
||||
"cc",
|
||||
"ci",
|
||||
"clean",
|
||||
"clear",
|
||||
"clearchat",
|
||||
"clearinvent",
|
||||
"clearinventory",
|
||||
"creative",
|
||||
"creativemode",
|
||||
"describe",
|
||||
"eaction",
|
||||
"eadventure",
|
||||
"eadventuremode",
|
||||
|
@ -245,7 +282,6 @@ public class Main extends JavaPlugin {
|
|||
"eecreative",
|
||||
"eemail",
|
||||
"efeed",
|
||||
"effect",
|
||||
"egamemode",
|
||||
"egm",
|
||||
"egma",
|
||||
|
@ -291,66 +327,58 @@ public class Main extends JavaPlugin {
|
|||
"ewarp",
|
||||
"ewarps",
|
||||
"ewhisper",
|
||||
|
||||
"extras:cc",
|
||||
"extras:clearchat",
|
||||
"extras:console",
|
||||
"extras:tellraw",
|
||||
"cc",
|
||||
"clearchat",
|
||||
"console",
|
||||
"tellraw",
|
||||
|
||||
"minecraft:clear",
|
||||
"minecraft:datapack",
|
||||
"minecraft:effect",
|
||||
"minecraft:execute",
|
||||
"minecraft:gamemode",
|
||||
"minecraft:gamerule",
|
||||
"minecraft:me",
|
||||
"minecraft:msg",
|
||||
"minecraft:say",
|
||||
"minecraft:spreadplayers",
|
||||
"minecraft:tell",
|
||||
"minecraft:tellraw",
|
||||
"minecraft:title",
|
||||
"minecraft:tp",
|
||||
"minecraft:worldborder",
|
||||
"clear",
|
||||
"datapack",
|
||||
"effect",
|
||||
"execute",
|
||||
"feed",
|
||||
"gamemode",
|
||||
"gamerule",
|
||||
"gm",
|
||||
"gma",
|
||||
"gmc",
|
||||
"gms",
|
||||
"gmsp",
|
||||
"gmt",
|
||||
"heal",
|
||||
"helpop",
|
||||
"jail",
|
||||
"kill",
|
||||
"m",
|
||||
"mail",
|
||||
"me",
|
||||
"memo",
|
||||
"mute",
|
||||
"msg",
|
||||
"nuke",
|
||||
"say",
|
||||
"spreadplayers",
|
||||
"tell",
|
||||
"title",
|
||||
"tp",
|
||||
"worldborder",
|
||||
|
||||
"paper:paper",
|
||||
"paper",
|
||||
"pardon",
|
||||
"pardonip",
|
||||
"pm",
|
||||
"shoutworld",
|
||||
"say",
|
||||
"silence",
|
||||
"sp",
|
||||
"spec",
|
||||
"spectator",
|
||||
|
||||
"spigot:spigot",
|
||||
"spigot",
|
||||
"spreadplayers",
|
||||
"sudo",
|
||||
"survival",
|
||||
"survivalmode",
|
||||
"t",
|
||||
"tele",
|
||||
"teleport",
|
||||
"tell",
|
||||
"tempban",
|
||||
"title",
|
||||
"tjail",
|
||||
"togglejail",
|
||||
"tp",
|
||||
"tp2p",
|
||||
"tpaall",
|
||||
"tpall",
|
||||
"tppos",
|
||||
"tptoggle",
|
||||
"unban",
|
||||
"unbanip",
|
||||
"v",
|
||||
"vanish",
|
||||
"w",
|
||||
"warp",
|
||||
"warps",
|
||||
"whisper"
|
||||
|
||||
"viaversion:viaver",
|
||||
"viaversion:viaversion",
|
||||
"viaversion:vvbukkit",
|
||||
"viaver",
|
||||
"viaversion",
|
||||
"vvbukkit"
|
||||
);
|
||||
|
||||
Collections.addAll(
|
||||
|
|
|
@ -94,6 +94,8 @@ class EntitySpawn implements Listener {
|
|||
|
||||
try {
|
||||
for (ItemStack item : mob.getEquipment().getArmorContents()) {
|
||||
if (item != null &&
|
||||
item.hasItemMeta()) {
|
||||
if (item.getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) item.getItemMeta();
|
||||
|
||||
|
@ -106,6 +108,7 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
mob.getEquipment().setArmorContents(
|
||||
new ItemStack[] {null, null, null, null}
|
||||
|
@ -113,8 +116,12 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
|
||||
try {
|
||||
if (mob.getEquipment().getItemInMainHand().getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) mob.getEquipment().getItemInMainHand().getItemMeta();
|
||||
ItemStack item = mob.getEquipment().getItemInMainHand();
|
||||
|
||||
if (item != null &&
|
||||
item.hasItemMeta()) {
|
||||
if (item.getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) item.getItemMeta();
|
||||
|
||||
for (Pattern pattern : banner.getPatterns()) {
|
||||
if (pattern.getColor() == null) {
|
||||
|
@ -122,11 +129,16 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
mob.getEquipment().setItemInMainHand(null);
|
||||
}
|
||||
|
||||
try {
|
||||
ItemStack item = mob.getEquipment().getItemInMainHand();
|
||||
|
||||
if (item != null &&
|
||||
item.hasItemMeta()) {
|
||||
if (mob.getEquipment().getItemInOffHand().getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) mob.getEquipment().getItemInOffHand().getItemMeta();
|
||||
|
||||
|
@ -136,6 +148,7 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
mob.getEquipment().setItemInOffHand(null);
|
||||
}
|
||||
|
@ -188,6 +201,8 @@ class EntitySpawn implements Listener {
|
|||
|
||||
try {
|
||||
for (ItemStack item : mob.getEquipment().getArmorContents()) {
|
||||
if (item != null &&
|
||||
item.hasItemMeta()) {
|
||||
if (item.getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) item.getItemMeta();
|
||||
|
||||
|
@ -200,6 +215,7 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
mob.getEquipment().setArmorContents(
|
||||
new ItemStack[] {null, null, null, null}
|
||||
|
@ -207,8 +223,12 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
|
||||
try {
|
||||
if (mob.getEquipment().getItemInMainHand().getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) mob.getEquipment().getItemInMainHand().getItemMeta();
|
||||
ItemStack item = mob.getEquipment().getItemInMainHand();
|
||||
|
||||
if (item != null &&
|
||||
item.hasItemMeta()) {
|
||||
if (item.getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) item.getItemMeta();
|
||||
|
||||
for (Pattern pattern : banner.getPatterns()) {
|
||||
if (pattern.getColor() == null) {
|
||||
|
@ -216,11 +236,16 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
mob.getEquipment().setItemInMainHand(null);
|
||||
}
|
||||
|
||||
try {
|
||||
ItemStack item = mob.getEquipment().getItemInMainHand();
|
||||
|
||||
if (item != null &&
|
||||
item.hasItemMeta()) {
|
||||
if (mob.getEquipment().getItemInOffHand().getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) mob.getEquipment().getItemInOffHand().getItemMeta();
|
||||
|
||||
|
@ -230,6 +255,7 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
mob.getEquipment().setItemInOffHand(null);
|
||||
}
|
||||
|
|
|
@ -81,6 +81,8 @@ class PlayerConnection implements Listener {
|
|||
if (player.hasPlayedBefore()) {
|
||||
try {
|
||||
for (ItemStack item : player.getInventory().getContents()) {
|
||||
if (item != null &&
|
||||
item.hasItemMeta()) {
|
||||
if (item.getItemMeta() instanceof BannerMeta) {
|
||||
final BannerMeta banner = (BannerMeta) item.getItemMeta();
|
||||
|
||||
|
@ -91,6 +93,7 @@ class PlayerConnection implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
player.getInventory().clear();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue