added logging
This commit is contained in:
parent
39af3589e3
commit
156b7e6b61
@ -92,6 +92,8 @@ public class PixelBlock {
|
|||||||
player.sendMessage(Component.text("Dieser Pixelblock gehört nicht dir!", NamedTextColor.RED));
|
player.sendMessage(Component.text("Dieser Pixelblock gehört nicht dir!", NamedTextColor.RED));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Main.plugin.getLogger().info(String.format("'%s' entered PixelBlock '%s' at %s", player.getName(), this.blockUUID, this.pixelBlockLocation.toString()));
|
||||||
getBlockTaskChain()
|
getBlockTaskChain()
|
||||||
.async(() -> {
|
.async(() -> {
|
||||||
this.lastEntryLocation = player.getLocation();
|
this.lastEntryLocation = player.getLocation();
|
||||||
@ -103,6 +105,7 @@ public class PixelBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void exitBlock(@NotNull Player player) {
|
public void exitBlock(@NotNull Player player) {
|
||||||
|
Main.plugin.getLogger().info(String.format("%s exited PixelBlock", player.getName()));
|
||||||
player.teleport(this.lastEntryLocation);
|
player.teleport(this.lastEntryLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,6 +215,8 @@ public class PixelBlock {
|
|||||||
} else {
|
} else {
|
||||||
spawnInteraction(false);
|
spawnInteraction(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Main.plugin.getLogger().info(String.format("Placed %d entities for PixelBlock '%s'", this.pixels.size(), this.blockUUID));
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@ -224,6 +229,7 @@ public class PixelBlock {
|
|||||||
@Nullable PixelBlock blockAtLocation = PixelBlock.getPixelBlockFromPlacedLocation(newLocation);
|
@Nullable PixelBlock blockAtLocation = PixelBlock.getPixelBlockFromPlacedLocation(newLocation);
|
||||||
if(blockAtLocation != null && blockAtLocation != this) throw new IllegalArgumentException("Es können nicht mehrere Pixelblöcke ineinander platziert werden.");
|
if(blockAtLocation != null && blockAtLocation != this) throw new IllegalArgumentException("Es können nicht mehrere Pixelblöcke ineinander platziert werden.");
|
||||||
|
|
||||||
|
Main.plugin.getLogger().info(String.format("Placing PixelBlock '%s' at %s", this.blockUUID, placeLocation));
|
||||||
this.pixelBlockLocation = newLocation;
|
this.pixelBlockLocation = newLocation;
|
||||||
this.facingDirection = direction;
|
this.facingDirection = direction;
|
||||||
updateEntities();
|
updateEntities();
|
||||||
@ -241,6 +247,8 @@ public class PixelBlock {
|
|||||||
p.teleport(this.lastEntryLocation);
|
p.teleport(this.lastEntryLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Main.plugin.getLogger().info(String.format("Destroying PixelBlock '%s' at %s", this.blockUUID, pixelBlockLocation));
|
||||||
|
|
||||||
this.pixelWorld.getEntitiesInWorld().stream()
|
this.pixelWorld.getEntitiesInWorld().stream()
|
||||||
.filter(entity -> entity instanceof Item)
|
.filter(entity -> entity instanceof Item)
|
||||||
.forEach(entity -> entity.teleport(this.lastEntryLocation));
|
.forEach(entity -> entity.teleport(this.lastEntryLocation));
|
||||||
@ -259,6 +267,7 @@ public class PixelBlock {
|
|||||||
chunk.getEntities();
|
chunk.getEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Main.plugin.getLogger().info(String.format("Removing %d entities for PixelBlock '%s'", this.pixels.size(), this.blockUUID));
|
||||||
this.pixels.forEach(Pixel::destroy);
|
this.pixels.forEach(Pixel::destroy);
|
||||||
this.pixels.clear();
|
this.pixels.clear();
|
||||||
|
|
||||||
@ -273,7 +282,7 @@ public class PixelBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.pixelBlockLocation.getWorld().getEntities().stream()
|
this.pixelBlockLocation.getWorld().getEntities().stream()
|
||||||
.filter(this::isRelevantEntity)
|
.filter(this::isPixelBlockComponent)
|
||||||
.filter(entity -> entity.getLocation()
|
.filter(entity -> entity.getLocation()
|
||||||
.add(0, hitboxOffset, 0)
|
.add(0, hitboxOffset, 0)
|
||||||
.toBlockLocation()
|
.toBlockLocation()
|
||||||
@ -281,7 +290,7 @@ public class PixelBlock {
|
|||||||
.forEach(Entity::remove);
|
.forEach(Entity::remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRelevantEntity(Entity entity) {
|
private boolean isPixelBlockComponent(Entity entity) {
|
||||||
return entity.getType().equals(EntityType.BLOCK_DISPLAY)
|
return entity.getType().equals(EntityType.BLOCK_DISPLAY)
|
||||||
|| entity.getType().equals(EntityType.INTERACTION)
|
|| entity.getType().equals(EntityType.INTERACTION)
|
||||||
|| entity.getType().equals(EntityType.ITEM_DISPLAY);
|
|| entity.getType().equals(EntityType.ITEM_DISPLAY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user