From 19179bc55c56e4e35db2d305612c0bf4fc0d22f7 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 6 Apr 2024 09:32:55 -0700 Subject: [PATCH 1/2] Enable team members to have islands - requires Bentobox 2.3.0 --- pom.xml | 4 ++-- .../world/bentobox/aoneblock/Settings.java | 19 +++++++++++++++++++ src/main/resources/addon.yml | 2 +- src/main/resources/config.yml | 12 +++++++----- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 1da291f..bedd75f 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ 2.0.9 1.20.4-R0.1-SNAPSHOT - 2.0.0-SNAPSHOT + 2.3.0-SNAPSHOT 2.6.2 1.3.0 @@ -67,7 +67,7 @@ -LOCAL - 1.16.0 + 1.17.0 BentoBoxWorld_AOneBlock bentobox-world diff --git a/src/main/java/world/bentobox/aoneblock/Settings.java b/src/main/java/world/bentobox/aoneblock/Settings.java index 709f26b..6a76e2e 100644 --- a/src/main/java/world/bentobox/aoneblock/Settings.java +++ b/src/main/java/world/bentobox/aoneblock/Settings.java @@ -192,6 +192,10 @@ public class Settings implements WorldSettings { @ConfigEntry(path = "world.island-height") private int islandHeight = 120; + @ConfigComment("Disallow team members from having their own islands.") + @ConfigEntry(path = "world.disallow-team-member-islands") + private boolean disallowTeamMemberIslands = false; + @ConfigComment("Use your own world generator for this world.") @ConfigComment("In this case, the plugin will not generate anything.") @ConfigComment("If used, you must specify the world name and generator in the bukkit.yml file.") @@ -2176,4 +2180,19 @@ public String getClickType() { public void setClickType(String clickType) { this.clickType = clickType; } + + /** + * @return the disallowTeamMemberIslands + */ + @Override + public boolean isDisallowTeamMemberIslands() { + return disallowTeamMemberIslands; + } + + /** + * @param disallowTeamMemberIslands the disallowTeamMemberIslands to set + */ + public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) { + this.disallowTeamMemberIslands = disallowTeamMemberIslands; + } } \ No newline at end of file diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index 4e3c0f0..76ff4bd 100755 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -1,7 +1,7 @@ name: AOneBlock main: world.bentobox.aoneblock.AOneBlock version: ${version}${build.number} -api-version: 1.24 +api-version: 2.3.0 metrics: true icon: "STONE" repository: "BentoBoxWorld/AOneBlock" diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 2db2ff4..599f825 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -65,10 +65,10 @@ world: # Block identification appearance. # Click type that will make particles appear. Options are: # LEFT (default), RIGHT, or NONE - click-type: RIGHT - # Size of particles. Default is 0.7. Must be greater than 0. + click-type: LEFT + # Size of particles. Default is 0.5. Must be greater than 0. particle-size: 0.5 - # Density of particles - Value from 0.1 to 1. Default is 0.5. Smaller values are more dense, higher are less. + # Density of particles - Value from 0.1 to 1. Default is 0.65. Smaller values are more dense, higher are less. particle-density: 0.65 # Color of particles particle-color: @@ -123,6 +123,8 @@ world: # Island height - Lowest is 5. # It is the y coordinate of the bedrock block in the schem. island-height: 80 + # Disallow team members from having their own islands. + disallow-team-member-islands: false # Use your own world generator for this world. # In this case, the plugin will not generate anything. # If used, you must specify the world name and generator in the bukkit.yml file. @@ -191,9 +193,9 @@ world: create-obsidian-platform: false # Mob white list - these mobs will NOT be removed when logging in or doing /island remove-mobs-whitelist: - - ENDERMAN - - ZOMBIE_VILLAGER - WITHER + - ZOMBIE_VILLAGER + - ENDERMAN # World flags. These are boolean settings for various flags for this world flags: CREEPER_DAMAGE: true From 91a2cc76c1bfeaacce8b64f8ee1c3cda82af786b Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 6 Apr 2024 20:09:25 -0700 Subject: [PATCH 2/2] Added offset setting for holograms. #382 --- .../world/bentobox/aoneblock/Settings.java | 18 +++++++++++++++ .../aoneblock/listeners/HoloListener.java | 22 ++++++++++++++++++- src/main/resources/config.yml | 6 +++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/main/java/world/bentobox/aoneblock/Settings.java b/src/main/java/world/bentobox/aoneblock/Settings.java index 6a76e2e..4ec144e 100644 --- a/src/main/java/world/bentobox/aoneblock/Settings.java +++ b/src/main/java/world/bentobox/aoneblock/Settings.java @@ -107,6 +107,10 @@ public class Settings implements WorldSettings { @ConfigEntry(path = "world.holograms") private boolean useHolograms = true; + @ConfigComment("Hologram position - the offset to the magic block where holograms will appear") + @ConfigEntry(path = "world.hologram-offset") + private String offset = "0.5, 1.1, 0.5"; + @ConfigComment("Duration in seconds that phase holograms will exist after being displayed, if used.") @ConfigComment("If set to 0, then holograms will persist until cleared some other way.") @ConfigEntry(path = "world.hologram-duration") @@ -2195,4 +2199,18 @@ public boolean isDisallowTeamMemberIslands() { public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) { this.disallowTeamMemberIslands = disallowTeamMemberIslands; } + + /** + * @return the offset + */ + public String getOffset() { + return offset; + } + + /** + * @param offset the offset to set + */ + public void setOffset(String offset) { + this.offset = offset; + } } \ No newline at end of file diff --git a/src/main/java/world/bentobox/aoneblock/listeners/HoloListener.java b/src/main/java/world/bentobox/aoneblock/listeners/HoloListener.java index 21f3dc7..a343dce 100644 --- a/src/main/java/world/bentobox/aoneblock/listeners/HoloListener.java +++ b/src/main/java/world/bentobox/aoneblock/listeners/HoloListener.java @@ -13,6 +13,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.util.Vector; import org.eclipse.jdt.annotation.NonNull; import world.bentobox.aoneblock.AOneBlock; @@ -50,7 +51,7 @@ private Optional getHologram(Island island) { } private TextDisplay createHologram(Island island) { - Location pos = island.getCenter().clone().add(0.5, 1.1, 0.5); + Location pos = island.getCenter().clone().add(parseVector(addon.getSettings().getOffset())); World world = pos.getWorld(); assert world != null; @@ -63,6 +64,25 @@ private TextDisplay createHologram(Island island) { return newDisplay; } + private static Vector parseVector(String str) { + if (str == null) { + return new Vector(0.5, 1.1, 0.5); + } + String[] parts = str.split(","); + if (parts.length != 3) { + return new Vector(0.5, 1.1, 0.5); + } + + try { + double x = Double.parseDouble(parts[0].trim()); + double y = Double.parseDouble(parts[1].trim()); + double z = Double.parseDouble(parts[2].trim()); + return new Vector(x, y, z); + } catch (NumberFormatException e) { + return new Vector(0.5, 1.1, 0.5); + } + } + private void clearIfInitialized(TextDisplay hologram) { if (hologram.isValid()) { hologram.remove(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 599f825..3237205 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -55,6 +55,8 @@ world: difficulty: NORMAL # Display holograms holograms: true + # Hologram position - the offset to the magic block where holograms will appear + hologram-offset: 0.5, 1.1, 0.5 # Duration in seconds that phase holograms will exist after being displayed, if used. # If set to 0, then holograms will persist until cleared some other way. hologram-duration: 10 @@ -193,9 +195,9 @@ world: create-obsidian-platform: false # Mob white list - these mobs will NOT be removed when logging in or doing /island remove-mobs-whitelist: - - WITHER - - ZOMBIE_VILLAGER - ENDERMAN + - ZOMBIE_VILLAGER + - WITHER # World flags. These are boolean settings for various flags for this world flags: CREEPER_DAMAGE: true