added more options for config

This commit is contained in:
2024-07-20 17:01:53 +02:00
parent e48413d111
commit 966f870d96
3 changed files with 21 additions and 9 deletions

View File

@@ -25,6 +25,9 @@ public class PixelBlock {
public static int worldGrassBorderWidth = 5;
public static int pixelsPerBlock = 16;
public static boolean liveUpdate = true;
public static boolean deleteOnBreak = false;
public static boolean onlyBreakableByOwners = false;
public static boolean onlyEditableByOwners = true;
public Location pixelBlockLocation;
public Direction direction;
@@ -169,7 +172,7 @@ public class PixelBlock {
}
public void handleInteraction(Player player) {
if(!player.getUniqueId().equals(ownerUID)) {
if(onlyEditableByOwners && !player.getUniqueId().equals(ownerUID)) {
player.sendMessage("Dieser Pixelblock gehört nicht dir!");
return;
}
@@ -182,10 +185,10 @@ public class PixelBlock {
}
public void handleAttack(Player player) {
// if(!player.getUniqueId().equals(ownerUID)) {
// player.sendMessage("Dieser Pixelblock gehört nicht dir!");
// return;
// }
if(onlyBreakableByOwners && !player.getUniqueId().equals(ownerUID)) {
player.sendMessage("Dieser Pixelblock gehört nicht dir!");
return;
}
World world = Objects.requireNonNull(this.getPixelWorld());
@@ -198,9 +201,13 @@ public class PixelBlock {
world.getEntities().forEach(entity -> entity.teleport(this.lastEntryLocation));
this.remove();
this.pixelBlockLocation.getWorld().playSound(this.pixelBlockLocation, Sound.BLOCK_COPPER_BULB_BREAK, 1.0F, 30);
this.pixelBlockLocation.getWorld().dropItem(this.pixelBlockLocation, this.getAsItem());
if(deleteOnBreak) {
this.delete();
} else {
this.remove();
this.pixelBlockLocation.getWorld().playSound(this.pixelBlockLocation, Sound.BLOCK_COPPER_BULB_BREAK, 1.0F, 30);
this.pixelBlockLocation.getWorld().dropItem(this.pixelBlockLocation, this.getAsItem());
}
}
public void handleBlockBreak(BlockBreakEvent event) {