Fixed it?
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
bcc5836ec2
Commit
c25e9fdb8d
@ -40,7 +40,7 @@ public class InventoryListener_15 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int drillDown(NBTTagList items, int layer, int start) {
|
private static int drillDown(NBTTagList items, int layer, int start) {
|
||||||
if (layer > 2) return start;
|
if (layer > 2) return start + 1024;
|
||||||
int invalid = start;
|
int invalid = start;
|
||||||
for (NBTBase nbtBase : items) {
|
for (NBTBase nbtBase : items) {
|
||||||
if (!(nbtBase instanceof NBTTagCompound))
|
if (!(nbtBase instanceof NBTTagCompound))
|
||||||
|
@ -21,13 +21,15 @@ package de.steamwar.bausystem.features.world;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.core.VersionedCallable;
|
import de.steamwar.core.VersionedCallable;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@ -49,11 +51,6 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Core.getVersion() < 15) {
|
|
||||||
e.setCurrentItem(stack);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.getItemMeta().hasAttributeModifiers()) {
|
if (stack.getItemMeta().hasAttributeModifiers()) {
|
||||||
ItemMeta meta = stack.getItemMeta();
|
ItemMeta meta = stack.getItemMeta();
|
||||||
for (Attribute a : Attribute.values()) {
|
for (Attribute a : Attribute.values()) {
|
||||||
@ -63,9 +60,35 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (VersionedCallable.<Boolean>call(new VersionedCallable<Boolean>(() -> InventoryListener_15.checkItemStack(stack), 15))) {
|
if (VersionedCallable.<Boolean>call(new VersionedCallable<Boolean>(() -> InventoryListener_15.checkItemStack(stack), 15))) {
|
||||||
e.setCurrentItem(null);
|
e.setCurrentItem(null);
|
||||||
|
e.setCancelled(true);
|
||||||
|
System.out.println("I");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
e.setCurrentItem(stack);
|
e.setCurrentItem(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player p = event.getPlayer();
|
||||||
|
ItemStack[] content = event.getPlayer().getInventory().getContents();
|
||||||
|
for (int i = 0; i < content.length; i++) {
|
||||||
|
if (content[i] == null) continue;
|
||||||
|
int finalI = i;
|
||||||
|
if (VersionedCallable.<Boolean>call(new VersionedCallable<Boolean>(() -> InventoryListener_15.checkItemStack(content[finalI]), 15))) {
|
||||||
|
p.getInventory().setItem(i, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
|
Player p = event.getPlayer();
|
||||||
|
if (VersionedCallable.<Boolean>call(new VersionedCallable<Boolean>(() -> InventoryListener_15.checkItemStack(event.getItemInHand()), 15))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.setBuild(false);
|
||||||
|
p.getInventory().setItemInMainHand(null);
|
||||||
|
p.getInventory().setItemInOffHand(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren