Clean up PlotId

This commit is contained in:
Alexander Söderberg
2020-07-18 11:05:16 +02:00
parent d077fafd29
commit e80ade65c7
33 changed files with 378 additions and 392 deletions

View File

@ -832,7 +832,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
BukkitUtil.adapt(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
PlotId currentPlotId = area.getPlotAbs(pLoc).getId();
if (!originalPlotId.equals(currentPlotId) && (
currentPlotId == null || !area
.getPlot(originalPlotId)
@ -851,7 +851,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
BukkitUtil.adapt(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
PlotId currentPlotId = area.getPlotAbs(pLoc).getId();
if (currentPlotId != null) {
entity.setMetadata("shulkerPlot",
new FixedMetadataValue(

View File

@ -152,16 +152,16 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.stack = item.getItemStack();
return;
case "ITEM_FRAME":
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
this.x = Math.floor(this.getX());
this.y = Math.floor(this.getY());
this.z = Math.floor(this.z);
ItemFrame itemFrame = (ItemFrame) entity;
this.dataByte = getOrdinal(Rotation.values(), itemFrame.getRotation());
this.stack = itemFrame.getItem().clone();
return;
case "PAINTING":
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
this.x = Math.floor(this.getX());
this.y = Math.floor(this.getY());
this.z = Math.floor(this.z);
Painting painting = (Painting) entity;
Art art = painting.getArt();
@ -407,8 +407,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.lived.leashed = lived.isLeashed();
if (this.lived.leashed) {
Location location = lived.getLeashHolder().getLocation();
this.lived.leashX = (short) (this.x - location.getBlockX());
this.lived.leashY = (short) (this.y - location.getBlockY());
this.lived.leashX = (short) (this.getX() - location.getBlockX());
this.lived.leashY = (short) (this.getY() - location.getBlockY());
this.lived.leashZ = (short) (this.z - location.getBlockZ());
}
EntityEquipment equipment = lived.getEquipment();
@ -460,7 +460,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
}
@Override public Entity spawn(World world, int xOffset, int zOffset) {
Location location = new Location(world, this.x + xOffset, this.y, this.z + zOffset);
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);
location.setYaw(this.yaw);
location.setPitch(this.pitch);
if (!this.getType().isSpawnable()) {

View File

@ -67,8 +67,8 @@ public class TeleportEntityWrapper extends EntityWrapper {
// To account for offsets in the chunk manager
this.oldLocation = oldLocation.clone();
this.oldLocation.setX(this.x);
this.oldLocation.setY(this.y);
this.oldLocation.setX(this.getX());
this.oldLocation.setY(this.getY());
this.oldLocation.setZ(this.z);
this.gravityOld = this.getEntity().hasGravity();

View File

@ -1005,7 +1005,7 @@ import java.util.regex.Pattern;
}
}
String partial = ChatColor.translateAlternateColorCodes('&',
format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
format.replace("%plot_id%", id.getX() + ";" + id.getY()).replace("%sender%", sender));
if (plotPlayer.hasPermission("plots.chat.color")) {
message = Captions.color(message);
}
@ -1015,7 +1015,7 @@ import java.util.regex.Pattern;
}
if (!spies.isEmpty()) {
String spyMessage = Captions.PLOT_CHAT_SPY_FORMAT.getTranslated()
.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender)
.replace("%plot_id%", id.getX() + ";" + id.getY()).replace("%sender%", sender)
.replace("%msg%", message);
for (Player player : spies) {
player.sendMessage(spyMessage);