13
0
geforkt von Mirrors/Paper

SPIGOT-3696: Clearing custom name of some blocks does not work

Dieser Commit ist enthalten in:
blablubbabc 2017-12-16 03:43:04 +01:00 committet von md_5
Ursprung 04595908e5
Commit 45c83860e1
5 geänderte Dateien mit 47 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -61,4 +61,13 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
}
@Override
public void applyTo(TileEntityBrewingStand brewingStand) {
super.applyTo(brewingStand);
if (!this.getSnapshot().hasCustomName()) {
brewingStand.setCustomName(null);
}
}
}

Datei anzeigen

@ -25,4 +25,13 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
}
@Override
public void applyTo(TileEntityEnchantTable enchantingTable) {
super.applyTo(enchantingTable);
if (!this.getSnapshot().hasCustomName()) {
enchantingTable.setCustomName(null);
}
}
}

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.block;
import java.util.Objects;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.TileEntityEndGateway;
import org.bukkit.Location;
@ -27,7 +28,7 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
public void setExitLocation(Location location) {
if (location == null) {
this.getSnapshot().exitPortal = null;
} else if (location.getWorld() != (this.isPlaced() ? this.getWorld() : null)) {
} else if (!Objects.equals(location.getWorld(), this.isPlaced() ? this.getWorld() : null)) {
throw new IllegalArgumentException("Cannot set exit location to different world");
} else {
this.getSnapshot().exitPortal = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
@ -43,4 +44,13 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
public void setExactTeleport(boolean exact) {
this.getSnapshot().exactTeleport = exact;
}
@Override
public void applyTo(TileEntityEndGateway endGateway) {
super.applyTo(endGateway);
if (this.getSnapshot().exitPortal == null) {
endGateway.exitPortal = null;
}
}
}

Datei anzeigen

@ -61,4 +61,13 @@ public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements F
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
}
@Override
public void applyTo(TileEntityFurnace furnace) {
super.applyTo(furnace);
if (!this.getSnapshot().hasCustomName()) {
furnace.setCustomName(null);
}
}
}

Datei anzeigen

@ -25,4 +25,13 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
}
@Override
public void applyTo(T lootable) {
super.applyTo(lootable);
if (!this.getSnapshot().hasCustomName()) {
lootable.setCustomName(null);
}
}
}