Skip to content

Commit d1d0f2c

Browse files
authored
Merge pull request #383 from BentoBoxWorld/allow_team_member_islands
Allow team member islands
2 parents e18e7b9 + 91a2cc7 commit d1d0f2c

File tree

5 files changed

+68
-7
lines changed

5 files changed

+68
-7
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@
5959
<powermock.version>2.0.9</powermock.version>
6060
<!-- More visible way how to change dependency versions -->
6161
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
62-
<bentobox.version>2.0.0-SNAPSHOT</bentobox.version>
62+
<bentobox.version>2.3.0-SNAPSHOT</bentobox.version>
6363
<level.version>2.6.2</level.version>
6464
<bank.version>1.3.0</bank.version>
6565
<!-- Revision variable removes warning about dynamic version -->
6666
<revision>${build.version}-SNAPSHOT</revision>
6767
<!-- Do not change unless you want different name for local builds. -->
6868
<build.number>-LOCAL</build.number>
6969
<!-- This allows to change between versions. -->
70-
<build.version>1.16.0</build.version>
70+
<build.version>1.17.0</build.version>
7171
<!-- SonarCloud -->
7272
<sonar.projectKey>BentoBoxWorld_AOneBlock</sonar.projectKey>
7373
<sonar.organization>bentobox-world</sonar.organization>

src/main/java/world/bentobox/aoneblock/Settings.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ public class Settings implements WorldSettings {
107107
@ConfigEntry(path = "world.holograms")
108108
private boolean useHolograms = true;
109109

110+
@ConfigComment("Hologram position - the offset to the magic block where holograms will appear")
111+
@ConfigEntry(path = "world.hologram-offset")
112+
private String offset = "0.5, 1.1, 0.5";
113+
110114
@ConfigComment("Duration in seconds that phase holograms will exist after being displayed, if used.")
111115
@ConfigComment("If set to 0, then holograms will persist until cleared some other way.")
112116
@ConfigEntry(path = "world.hologram-duration")
@@ -192,6 +196,10 @@ public class Settings implements WorldSettings {
192196
@ConfigEntry(path = "world.island-height")
193197
private int islandHeight = 120;
194198

199+
@ConfigComment("Disallow team members from having their own islands.")
200+
@ConfigEntry(path = "world.disallow-team-member-islands")
201+
private boolean disallowTeamMemberIslands = false;
202+
195203
@ConfigComment("Use your own world generator for this world.")
196204
@ConfigComment("In this case, the plugin will not generate anything.")
197205
@ConfigComment("If used, you must specify the world name and generator in the bukkit.yml file.")
@@ -2176,4 +2184,33 @@ public String getClickType() {
21762184
public void setClickType(String clickType) {
21772185
this.clickType = clickType;
21782186
}
2187+
2188+
/**
2189+
* @return the disallowTeamMemberIslands
2190+
*/
2191+
@Override
2192+
public boolean isDisallowTeamMemberIslands() {
2193+
return disallowTeamMemberIslands;
2194+
}
2195+
2196+
/**
2197+
* @param disallowTeamMemberIslands the disallowTeamMemberIslands to set
2198+
*/
2199+
public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) {
2200+
this.disallowTeamMemberIslands = disallowTeamMemberIslands;
2201+
}
2202+
2203+
/**
2204+
* @return the offset
2205+
*/
2206+
public String getOffset() {
2207+
return offset;
2208+
}
2209+
2210+
/**
2211+
* @param offset the offset to set
2212+
*/
2213+
public void setOffset(String offset) {
2214+
this.offset = offset;
2215+
}
21792216
}

src/main/java/world/bentobox/aoneblock/listeners/HoloListener.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.bukkit.event.EventHandler;
1414
import org.bukkit.event.EventPriority;
1515
import org.bukkit.event.Listener;
16+
import org.bukkit.util.Vector;
1617
import org.eclipse.jdt.annotation.NonNull;
1718

1819
import world.bentobox.aoneblock.AOneBlock;
@@ -50,7 +51,7 @@ private Optional<TextDisplay> getHologram(Island island) {
5051
}
5152

5253
private TextDisplay createHologram(Island island) {
53-
Location pos = island.getCenter().clone().add(0.5, 1.1, 0.5);
54+
Location pos = island.getCenter().clone().add(parseVector(addon.getSettings().getOffset()));
5455
World world = pos.getWorld();
5556
assert world != null;
5657

@@ -63,6 +64,25 @@ private TextDisplay createHologram(Island island) {
6364
return newDisplay;
6465
}
6566

67+
private static Vector parseVector(String str) {
68+
if (str == null) {
69+
return new Vector(0.5, 1.1, 0.5);
70+
}
71+
String[] parts = str.split(",");
72+
if (parts.length != 3) {
73+
return new Vector(0.5, 1.1, 0.5);
74+
}
75+
76+
try {
77+
double x = Double.parseDouble(parts[0].trim());
78+
double y = Double.parseDouble(parts[1].trim());
79+
double z = Double.parseDouble(parts[2].trim());
80+
return new Vector(x, y, z);
81+
} catch (NumberFormatException e) {
82+
return new Vector(0.5, 1.1, 0.5);
83+
}
84+
}
85+
6686
private void clearIfInitialized(TextDisplay hologram) {
6787
if (hologram.isValid()) {
6888
hologram.remove();

src/main/resources/addon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: AOneBlock
22
main: world.bentobox.aoneblock.AOneBlock
33
version: ${version}${build.number}
4-
api-version: 1.24
4+
api-version: 2.3.0
55
metrics: true
66
icon: "STONE"
77
repository: "BentoBoxWorld/AOneBlock"

src/main/resources/config.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ world:
5555
difficulty: NORMAL
5656
# Display holograms
5757
holograms: true
58+
# Hologram position - the offset to the magic block where holograms will appear
59+
hologram-offset: 0.5, 1.1, 0.5
5860
# Duration in seconds that phase holograms will exist after being displayed, if used.
5961
# If set to 0, then holograms will persist until cleared some other way.
6062
hologram-duration: 10
@@ -65,10 +67,10 @@ world:
6567
# Block identification appearance.
6668
# Click type that will make particles appear. Options are:
6769
# LEFT (default), RIGHT, or NONE
68-
click-type: RIGHT
69-
# Size of particles. Default is 0.7. Must be greater than 0.
70+
click-type: LEFT
71+
# Size of particles. Default is 0.5. Must be greater than 0.
7072
particle-size: 0.5
71-
# Density of particles - Value from 0.1 to 1. Default is 0.5. Smaller values are more dense, higher are less.
73+
# Density of particles - Value from 0.1 to 1. Default is 0.65. Smaller values are more dense, higher are less.
7274
particle-density: 0.65
7375
# Color of particles
7476
particle-color:
@@ -123,6 +125,8 @@ world:
123125
# Island height - Lowest is 5.
124126
# It is the y coordinate of the bedrock block in the schem.
125127
island-height: 80
128+
# Disallow team members from having their own islands.
129+
disallow-team-member-islands: false
126130
# Use your own world generator for this world.
127131
# In this case, the plugin will not generate anything.
128132
# If used, you must specify the world name and generator in the bukkit.yml file.

0 commit comments

Comments
 (0)