Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 04:50:06 +01:00
Allow plugins to enchant already enchanted items. Fixes BUKKIT-1956
This causes the server to generate PrepareItemEnchantEvent even in the case that an item is already enchanted or otherwise would normally not be enchantable.
Dieser Commit ist enthalten in:
Ursprung
02a5d09ddf
Commit
3c02fb02a1
@ -79,7 +79,7 @@ public class ContainerEnchantTable extends Container {
|
|||||||
ItemStack itemstack = iinventory.getItem(0);
|
ItemStack itemstack = iinventory.getItem(0);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (itemstack != null && itemstack.w()) {
|
if (itemstack != null) { // CraftBukkit - relax condition
|
||||||
this.f = this.l.nextLong();
|
this.f = this.l.nextLong();
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -125,6 +125,7 @@ public class ContainerEnchantTable extends Container {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
|
CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
|
||||||
PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs, i);
|
PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs, i);
|
||||||
|
event.setCancelled(!itemstack.w())
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren