Giter VIP home page Giter VIP logo

attributehider's People

Contributors

matocolotoe avatar warren1001 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

colorswind

attributehider's Issues

error

timings
https://timings.aikar.co/?id=9ba99cd72644475bac4699e7a1a3136c

logs

[14:30:17] [Server thread/ERROR]: Could not pass event InventoryOpenEvent to AttributeHider v5.0.0
org.bukkit.event.EventException: null
	at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:72) ~[patched_1.12.2.jar:git-Paper-1247]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:514) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:499) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callInventoryOpenEvent(CraftEventFactory.java:777) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callInventoryOpenEvent(CraftEventFactory.java:763) ~[patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.EntityPlayer.openTrade(EntityPlayer.java:863) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.craftbukkit.v1_12_R1.entity.CraftHumanEntity.openMerchant(CraftHumanEntity.java:395) ~[patched_1.12.2.jar:git-Paper-1247]
	at com.nisovin.shopkeepers.compat.v1_12_R1.NMSHandler.openTradeWindow(NMSHandler.java:61) ~[?:?]
	at com.nisovin.shopkeepers.ui.defaults.TradingHandler.openWindow(TradingHandler.java:62) ~[?:?]
	at com.nisovin.shopkeepers.ui.UIManager.requestUI(UIManager.java:77) ~[?:?]
	at com.nisovin.shopkeepers.Shopkeeper.openWindow(Shopkeeper.java:422) ~[?:?]
	at com.nisovin.shopkeepers.Shopkeeper.openTradingWindow(Shopkeeper.java:446) ~[?:?]
	at com.nisovin.shopkeepers.Shopkeeper.onPlayerInteraction(Shopkeeper.java:543) ~[?:?]
	at com.nisovin.shopkeepers.LivingEntityShopListener.onEntityInteract(LivingEntityShopListener.java:59) ~[?:?]
	at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:35) ~[patched_1.12.2.jar:git-Paper-1247]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:514) ~[patched_1.12.2.jar:git-Paper-1247]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:499) ~[patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1656) ~[patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.PacketPlayInUseEntity.a(PacketPlayInUseEntity.java:49) ~[patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.PacketPlayInUseEntity.a(PacketPlayInUseEntity.java:6) ~[patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[patched_1.12.2.jar:git-Paper-1247]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_131]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_131]
	at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:843) [patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:426) [patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:767) [patched_1.12.2.jar:git-Paper-1247]
	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:665) [patched_1.12.2.jar:git-Paper-1247]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
Caused by: java.lang.NullPointerException
	at com.kabryxis.attributehider.version.wrapper.entityvillager.impl.WrappedEntityVillagerv1_12_R1.setVillager(WrappedEntityVillagerv1_12_R1.java:18) ~[?:?]
	at com.kabryxis.attributehider.Remover.modify(Remover.java:99) ~[?:?]
	at com.kabryxis.attributehider.Remover.onInventoryOpen(Remover.java:147) ~[?:?]
	at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor663.execute(Unknown Source) ~[?:?]
	at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:70) ~[patched_1.12.2.jar:git-Paper-1247]
	... 32 more

Plugin incompatibilities due to server-side itemstack modifications

A user of one of my plugins (Shopkeepers) ran into issues with trading. The Shopkeepers plugin uses the villager trading interface to display trades and handle trade interactions.

In some cases, this plugin (AttributeHider) seems to modify items on the server (e.g. it adds the HideFlags tag). This can cause issue in combination with shop plugins like Shopkeepers, which compare the NBT data of items to make sure that the item provided by a player matches the item required by the trade.

According to your changelog (https://www.spigotmc.org/resources/attributehider.10604/update?update=345929), you attempted to resolve these kinds of issues in the past by only visually modifying the items in outgoing packets. However, it seems that in some cases, you still modify the items on the server.

For example, when you handle the WINDOW_ITEMS packet (https://github.com/Warren1001/attributehider/blob/master/src/main/java/com/kabryxis/attributehider/remover/RemoverPacketListener.java#L38), ProtocolLib may return you a list of CraftItemStacks. Any modifications you do to these ItemStacks write through to the underlying Minecraft ItemStacks inside the inventory on the server.
The solution might be to ensure that you always copy the itemstacks of the outgoing packets before you modify them.

Looking at the ProtocolLib and CraftBukkit implementations, in some cases ProtocolLib might already automatically copy the item stacks for you (although this is unspecified): For example, for the list of MerchantRecipes that you get from ProtocolLib when you handle the OPEN_WINDOW_MERCHANT packet (https://github.com/Warren1001/attributehider/blob/master/src/main/java/com/kabryxis/attributehider/remover/RemoverPacketListener.java#L46), ProtocolLib invokes nms.MerchantRecipe#asBukkit (https://github.com/dmulloy2/ProtocolLib/blob/master/src/main/java/com/comphenix/protocol/wrappers/BukkitConverters.java#L1570), which creates copies of the items of the underlying Minecraft merchant recipes (see CraftBukkit implementation).

However, in other cases, such as whenever you retrieve ItemStacks via ProtocolLib's ItemStack converter, ProtocolLib may return you the mentioned CraftItemStack wrappers instead of copies. So you may need to manually copy the items in those cases yourself before you modify them.

Edit: You can confirm this yourself by getting yourself some tool item (e.g. a sword), open and close your inventory (to ensure your packet listener is invoked), and then check the NBT of the sword item inside your inventory via Minecraft's /data get entity @s command. You will notice that the item now contains the HideFlags tag.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.