Closed pijlwagen closed 3 years ago
I guess that an alternative to this could be using the last line of the sign, for example Enchanted Book#1
. Is there a list I can use so I can translate Enchanted Book#1
to the corresponding enchantment so I can still achieve ENCHANTED_BOOK_MENDING
? I assume I will walk into the same issue with potions.
The item from the event should contain the full information, not sure why you are not getting that. Maybe try the latest ChestShop build?
No luck.
Made a new server using Spigot 1.16.5 (directly created from BuildTools), downloaded the latest development build of chestshop also added updated pom.xml.
I also noticed that the Adminshop signs appeared to be broken, perhaps this is my PC acting up. This issue also occurs on my production server, we have temporarily switched back to essentials sell signs. My production server runs Paper 1.16.5
C:\Users\tfhdg>java -version
java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)
<repository>
<id>chestshop-repo</id>
<url>https://repo.minebench.de/</url>
</repository>
<dependency>
<groupId>com.acrobot.chestshop</groupId>
<artifactId>chestshop</artifactId>
<version>3.12-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@EventHandler
public void chestShopTransaction(TransactionEvent e) {
String type = e.getTransactionType().toString();
ItemStack[] i = e.getStock();
Double price = Double.valueOf(e.getExactPrice().toString());
Integer amount = 0;
String name = null;
for (ItemStack item : i) {
if (name == null) {
name = item.getType().toString();
for (Enchantment ec : item.getItemMeta().getEnchants().keySet()) {
name += ec.getKey().getKey().toUpperCase();
}
}
amount += item.getAmount();
}
saveTransaction(type, name, price, amount);
}
I also noticed that the Adminshop signs appeared to be broken, perhaps this is my PC acting up. This issue also occurs on my production server, we have temporarily switched back to essentials sell signs. My production server runs Paper 1.16.5
The admin shop name can be set in the config, if you didn't do that then it will be Admin Shop
, not Adminshop
... If you actually changed it then please open a new ticket for unrelated issues.
I also noticed that the Adminshop signs appeared to be broken, perhaps this is my PC acting up. This issue also occurs on my production server, we have temporarily switched back to essentials sell signs. My production server runs Paper 1.16.5
The admin shop name can be set in the config, if you didn't do that then it will be
Admin Shop
, notAdminshop
... If you actually changed it then please open a new ticket for unrelated issues.
My bad, anyway back to the original issue
Enchanted Books don't have enchantments, they store enchantments which can be accessed via EnchantmentStorageMeta#hasStoredEnchants
and EnchantmentStorageMeta#getStoredEnchants
.
Plugin Version
3.11 (build 213)
Plugin Config
Not applicable
Server Version
1.16.5
Server Log
Not applicable
What other plugins are you running?
Vault, EssentialsX
What is happening?
When selling or buying enchanted books from a chestshop
<ItemStack>.getItemMeta().hasEnchants()
returns false incom.Acrobot.ChestShop.Events.TransactionEvent
What did you expect to happen?
Return a set of enchantment(s) on this item.
Additional context
What am I trying to achieve? I am saving transactions in a SQLite database, but I am unable to separate enchanted books from regular ENCHANTED_BOOK.
With my current code I am trying to append the enchantment to the item name (ex: ENCHANTED_BOOK_MENDING)