Full Item names in notifications
perlsol opened this issue ยท 15 comments
Any chance we can please have the full name of the item(s) sold in the notification
I understand why we can't have the full name in the sign (as I asked before)
player1 bought 1 Enchanted Book#r
I still have to go checking through all the enchanted book shops to establish which shop :(
Well the info which item that is can be queried with /iteminfo so at least there is a workaround for now.
The main issue here is that there is no easy way to get an actually useful name server-side as that's done by client translations. The messaging of the plugin would need to be completely moved to components and I'm unsure if Spigot even has API to get the necessary information from items to use these translation keys. (But I guess hooking into my ShowItem plugin similarly to how ChestShop does it could do it, but ChestShop by itself also only displays the same information as CSN on purchases right now anyways)
/iteminfo EnchantedBook#X does indeed say Swift Sneak III, can the csn just do that to display the full name instead
That is not the "full name", the command shows additional information about the item like all enchantments or potion effects, not the actual name of the item hence why CSN can't use that.
Ah i see, what about making a ref table containing the names and call against that, if there is an enrty for it then use the entry, if no then use the current method, that way just some can be added, like the enchanted books.
make it loadable from an external file so people can update or change it themselves would be good idea
I am VERY new to this but have forked this and will attempt to add a names.yml
it might take me quite a while though! \o/
Ah i see, what about making a ref table containing the names and call against that, if there is an enrty for it then use the entry, if no then use the current method, that way just some can be added, like the enchanted books.
make it loadable from an external file so people can update or change it themselves would be good idea
It's not so easy, there is nothing to really map names against.
The best you could do is take the enchantment and add it to the item name. But what about items with multiple enchants? Or potion effects? Or both? How would their name look like?
The best approach there would be to just use the same name Minecraft itself uses but again, that is done client-side so one would need to send the client the proper translatable component.
I am just on about picking up on the name that is returned at the point of printing the string when running the history command,
lookup the name against names.yml that would contain this...
names:
EnchantedBook#X: Swift Sneak III
I have had a play and compiled a test version but for some reason I can't fire up the test server, I added vault but I get this error...
[21:37:56 INFO]: [ChestShop] Enabling ChestShop v3.12.3-SNAPSHOT (build 423)
[21:37:56 INFO]: [ChestShop] Found locales hu, es_mx, sv, en, ro, zh_tw, fi, tr, af, ca, da, it, ru, nl, cs, vi, pt_br, he, zh, es, ko, no, fr, el, ja, uk, de, pl, ar, sr
[21:37:57 ERROR]: Error occurred while enabling ChestShop v3.12.3-SNAPSHOT (build 423) (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "net.milkbowl.vault.economy.Economy.getName()" because "com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener.provider" is null
at ChestShop.jar/com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener.getProviderInfo(VaultListener.java:68) ~[ChestShop.jar:?]
at ChestShop.jar/com.Acrobot.ChestShop.Dependencies.loadEconomy(Dependencies.java:114) ~[ChestShop.jar:?]
at ChestShop.jar/com.Acrobot.ChestShop.Dependencies.loadPlugins(Dependencies.java:80) ~[ChestShop.jar:?]
at ChestShop.jar/com.Acrobot.ChestShop.ChestShop.onEnable(ChestShop.java:163) ~[ChestShop.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:640) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:589) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:754) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:516) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:329) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1215) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:330) ~[paper-1.21.1.jar:1.21.1-41-fcedb49]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
[21:37:58 INFO]: [ChestShop] Disabling ChestShop v3.12.3-SNAPSHOT (build 423)
I am just on about picking up on the name that is returned at the point of printing the string when running the history command,
lookup the name against names.yml that would contain this...names: EnchantedBook#X: Swift Sneak III
Well the item metadata IDs are unique on each server, I doubt anyone would go through the trouble of specifying them manually. (Also that could already be done using ChestShop's alias system)
I have had a play and compiled a test version but for some reason I can't fire up the test server, I added vault but I get this error...
[21:37:56 INFO]: [ChestShop] Enabling ChestShop v3.12.3-SNAPSHOT (build 423) [21:37:56 INFO]: [ChestShop] Found locales hu, es_mx, sv, en, ro, zh_tw, fi, tr, af, ca, da, it, ru, nl, cs, vi, pt_br, he, zh, es, ko, no, fr, el, ja, uk, de, pl, ar, sr [21:37:57 ERROR]: Error occurred while enabling ChestShop v3.12.3-SNAPSHOT (build 423) (Is it up to date?) java.lang.NullPointerException: Cannot invoke "net.milkbowl.vault.economy.Economy.getName()" because "com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener.provider" is null at ChestShop.jar/com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener.getProviderInfo(VaultListener.java:68) ~[ChestShop.jar:?] at ChestShop.jar/com.Acrobot.ChestShop.Dependencies.loadEconomy(Dependencies.java:114) ~[ChestShop.jar:?] at ChestShop.jar/com.Acrobot.ChestShop.Dependencies.loadPlugins(Dependencies.java:80) ~[ChestShop.jar:?] at ChestShop.jar/com.Acrobot.ChestShop.ChestShop.onEnable(ChestShop.java:163) ~[ChestShop.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-mojangapi-1.21.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:640) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:589) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:754) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:516) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:329) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1215) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:330) ~[paper-1.21.1.jar:1.21.1-41-fcedb49] at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?] [21:37:58 INFO]: [ChestShop] Disabling ChestShop v3.12.3-SNAPSHOT (build 423)
You need an economy plugin too.
And Vault is not an Economy plugin, it only provides an API for other plugins to provide an Economy plugin or hook into one.
Sorry still learning all this, I assume looking at my plugins list that essentialsX is doing this for me then
EnchantedBook#X
where is the X taken from, how does it decide what letter it's using?
on the test server Swift Sneak III is not #X and it uses #A which throws my idea out the window :(
EnchantedBook#X
where is the X taken from, how does it decide what letter it's using?
It's the base 62 encoded id from the item in the items.db. That depends on the order the items were used in a shop.