Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
SPIGOT-2964: Correct number of shelve sin PrepareEnchantEvent
Dieser Commit ist enthalten in:
Ursprung
7c743ff64b
Commit
056af8b9c2
@ -71,9 +71,9 @@
|
|||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
|
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
|
||||||
+ org.bukkit.enchantments.EnchantmentOffer[] offers = new EnchantmentOffer[3];
|
+ org.bukkit.enchantments.EnchantmentOffer[] offers = new EnchantmentOffer[3];
|
||||||
+ for (i = 0; i < 3; ++i) {
|
+ for (j = 0; j < 3; ++j) {
|
||||||
+ org.bukkit.enchantments.Enchantment enchantment = (this.h[i] >= 0) ? org.bukkit.enchantments.Enchantment.getById(this.h[i]) : null;
|
+ org.bukkit.enchantments.Enchantment enchantment = (this.h[j] >= 0) ? org.bukkit.enchantments.Enchantment.getById(this.h[j]) : null;
|
||||||
+ offers[i] = (enchantment != null) ? new EnchantmentOffer(enchantment, this.i[i], this.costs[i]) : null;
|
+ offers[j] = (enchantment != null) ? new EnchantmentOffer(enchantment, this.i[j], this.costs[j]) : null;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, offers, i);
|
+ PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, offers, i);
|
||||||
@ -81,24 +81,24 @@
|
|||||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||||
+
|
+
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ for (i = 0; i < 3; ++i) {
|
+ for (j = 0; j < 3; ++j) {
|
||||||
+ this.costs[i] = 0;
|
+ this.costs[j] = 0;
|
||||||
+ this.h[i] = -1;
|
+ this.h[j] = -1;
|
||||||
+ this.i[i] = -1;
|
+ this.i[j] = -1;
|
||||||
+ }
|
+ }
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ for (i = 0; i < 3; i++) {
|
+ for (j = 0; j < 3; j++) {
|
||||||
+ EnchantmentOffer offer = event.getOffers()[i];
|
+ EnchantmentOffer offer = event.getOffers()[j];
|
||||||
+ if (offer != null) {
|
+ if (offer != null) {
|
||||||
+ this.costs[i] = offer.getCost();
|
+ this.costs[j] = offer.getCost();
|
||||||
+ this.h[i] = offer.getEnchantment().getId();
|
+ this.h[j] = offer.getEnchantment().getId();
|
||||||
+ this.i[i] = offer.getEnchantmentLevel();
|
+ this.i[j] = offer.getEnchantmentLevel();
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.costs[i] = 0;
|
+ this.costs[j] = 0;
|
||||||
+ this.h[i] = -1;
|
+ this.h[j] = -1;
|
||||||
+ this.i[i] = -1;
|
+ this.i[j] = -1;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren