Skip to content

Commit 9850a76

Browse files
authored
Merge pull request #94 from BentoBoxWorld/develop
Release 2.7.2
2 parents 92016ed + 27aff14 commit 9850a76

File tree

7 files changed

+75
-13
lines changed

7 files changed

+75
-13
lines changed

pom.xml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@
5858
<!-- Non-minecraft related dependencies -->
5959
<powermock.version>2.0.9</powermock.version>
6060
<!-- More visible way how to change dependency versions -->
61-
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
62-
<bentobox.version>2.4.0-SNAPSHOT</bentobox.version>
61+
<spigot.version>1.21.1-R0.1-SNAPSHOT</spigot.version>
62+
<bentobox.version>2.5.1-SNAPSHOT</bentobox.version>
6363
<!-- Revision variable removes warning about dynamic version -->
6464
<revision>${build.version}-SNAPSHOT</revision>
6565
<!-- Do not change unless you want different name for local builds. -->
6666
<build.number>-LOCAL</build.number>
6767
<!-- This allows to change between versions. -->
68-
<build.version>2.7.1</build.version>
68+
<build.version>2.7.2</build.version>
6969

7070
<sonar.projectKey>BentoBoxWorld_Boxed</sonar.projectKey>
7171
<sonar.organization>bentobox-world</sonar.organization>
@@ -173,7 +173,7 @@
173173
</dependency>
174174
<!-- Spigot NMS. Used for chunk deletion and pasting. -->
175175

176-
<dependency>
176+
<dependency>
177177
<groupId>org.spigotmc....</groupId>
178178
<artifactId>spigot</artifactId>
179179
<version>1.20.6-R0.1-SNAPSHOT</version>
@@ -191,7 +191,12 @@
191191
<version>1.21-R0.1-SNAPSHOT</version>
192192
<scope>provided</scope>
193193
</dependency>
194-
194+
<dependency>
195+
<groupId>org.spigotmc......</groupId>
196+
<artifactId>spigot</artifactId>
197+
<version>1.21.1-R0.1-SNAPSHOT</version>
198+
<scope>provided</scope>
199+
</dependency>
195200
<dependency>
196201
<groupId>org.spigotmc.</groupId>
197202
<artifactId>spigot</artifactId>

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ public class Settings implements WorldSettings {
133133
@ConfigEntry(path = "world.max-areas")
134134
private int maxIslands = -1;
135135

136+
@ConfigComment("The number of concurrent areas a player can have")
137+
@ConfigComment("A value of 0 will use the BentoBox config.yml default")
138+
@ConfigEntry(path = "world.concurrent-area")
139+
private int concurrentIslands = 0;
140+
141+
@ConfigComment("Disallow team members from having their own area.")
142+
@ConfigEntry(path = "world.disallow-team-member-areas")
143+
private boolean disallowTeamMemberIslands = true;
144+
136145
@ConfigComment("Area height")
137146
@ConfigComment("It is the y coordinate of the bedrock block in the blueprint.")
138147
@ConfigEntry(path = "world.area-height")
@@ -1761,4 +1770,35 @@ public void setIgnoreAdvancements(boolean ignoreAdvancements) {
17611770
this.ignoreAdvancements = ignoreAdvancements;
17621771
}
17631772

1773+
/**
1774+
* @return the concurrentIslands
1775+
*/
1776+
public int getConcurrentIslands() {
1777+
if (concurrentIslands <= 0) {
1778+
return BentoBox.getInstance().getSettings().getIslandNumber();
1779+
}
1780+
return this.concurrentIslands;
1781+
}
1782+
1783+
/**
1784+
* @param concurrentIslands the concurrentIslands to set
1785+
*/
1786+
public void setConcurrentIslands(int concurrentIslands) {
1787+
this.concurrentIslands = concurrentIslands;
1788+
}
1789+
1790+
/**
1791+
* @return the disallowTeamMemberIslands
1792+
*/
1793+
public boolean isDisallowTeamMemberIslands() {
1794+
return disallowTeamMemberIslands;
1795+
}
1796+
1797+
/**
1798+
* @param disallowTeamMemberIslands the disallowTeamMemberIslands to set
1799+
*/
1800+
public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) {
1801+
this.disallowTeamMemberIslands = disallowTeamMemberIslands;
1802+
}
1803+
17641804
}

src/main/java/world/bentobox/boxed/listeners/AdvancementListener.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
*/
4646
public class AdvancementListener implements Listener {
4747

48+
private static final Material[] MATS = Material.values();
49+
4850
private final Boxed addon;
4951
private final Advancement netherAdvancement;
5052
private final Advancement netherFortressAdvancement;
@@ -327,7 +329,8 @@ private void grantAdv(User user, List<String> list) {
327329

328330
private void clearAdv(User user) {
329331
// Clear Statistics
330-
Arrays.stream(Statistic.values()).forEach(s -> resetStats(user, s));
332+
Bukkit.getScheduler().runTaskAsynchronously(addon.getPlugin(),
333+
() -> Arrays.stream(Statistic.values()).forEach(s -> resetStats(user, s)));
331334
// Clear advancements
332335
Iterator<Advancement> it = Bukkit.advancementIterator();
333336
while (it.hasNext()) {
@@ -340,8 +343,9 @@ private void clearAdv(User user) {
340343

341344
private void resetStats(User user, Statistic s) {
342345
switch(s.getType()) {
343-
case BLOCK -> Arrays.stream(Material.values()).filter(Material::isBlock).forEach(m -> user.getPlayer().setStatistic(s, m, 0));
344-
case ITEM -> Arrays.stream(Material.values()).filter(Material::isItem).forEach(m -> user.getPlayer().setStatistic(s, m, 0));
346+
case BLOCK ->
347+
Arrays.stream(MATS).filter(Material::isBlock).forEach(m -> user.getPlayer().setStatistic(s, m, 0));
348+
case ITEM -> Arrays.stream(MATS).filter(Material::isItem).forEach(m -> user.getPlayer().setStatistic(s, m, 0));
345349
case ENTITY -> Arrays.stream(EntityType.values()).filter(EntityType::isAlive).forEach(m -> user.getPlayer().setStatistic(s, m, 0));
346350
case UNTYPED -> user.getPlayer().setStatistic(s, 0);
347351
}

src/main/java/world/bentobox/boxed/listeners/EnderPearlListener.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package world.bentobox.boxed.listeners;
22

33
import java.io.IOException;
4+
import java.util.HashSet;
5+
import java.util.Set;
46

57
import org.bukkit.GameMode;
68
import org.bukkit.Location;
@@ -15,6 +17,7 @@
1517
import org.bukkit.event.Listener;
1618
import org.bukkit.event.entity.ProjectileHitEvent;
1719
import org.bukkit.event.player.PlayerTeleportEvent;
20+
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
1821

1922
import world.bentobox.bentobox.api.user.User;
2023
import world.bentobox.bentobox.database.objects.Island;
@@ -29,6 +32,7 @@
2932
public class EnderPearlListener implements Listener {
3033

3134
private final Boxed addon;
35+
private Set<Player> movingPlayer = new HashSet<>();
3236

3337
/**
3438
* @param addon addon
@@ -38,7 +42,11 @@ public EnderPearlListener(Boxed addon) {
3842
}
3943

4044
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
41-
public void onPlayerTeleport(PlayerTeleportEvent e) {
45+
public void onPlayerTeleport(PlayerTeleportEvent e) {
46+
if (e.getCause() == TeleportCause.ENDER_PEARL && movingPlayer.contains(e.getPlayer())) {
47+
movingPlayer.remove(e.getPlayer());
48+
return; // Allow the teleport this one time
49+
}
4250
if (!addon.inWorld(e.getFrom()) || !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)
4351
|| (e.getTo() != null && !addon.inWorld(e.getTo()))
4452
|| addon.getIslands().getSpawn(e.getFrom().getWorld()).map(spawn -> spawn.onIsland(e.getTo())).orElse(false)
@@ -91,7 +99,7 @@ public void onEnderPearlLand(ProjectileHitEvent e) {
9199
if (!toIsland.onIsland(l)) {
92100
// Moving is allowed
93101
moveBox(u, fromIsland, l);
94-
Util.teleportAsync(player, l);
102+
Util.teleportAsync(player, l, TeleportCause.ENDER_PEARL);
95103
}
96104
} else {
97105
// Different box. This is never allowed. Cancel the throw
@@ -117,6 +125,7 @@ private void moveBox(User u, Island fromIsland, Location l) {
117125
fromIsland.setProtectionCenter(l);
118126
fromIsland.setSpawnPoint(l.getWorld().getEnvironment(), l);
119127
u.getPlayer().playSound(l, Sound.ENTITY_GENERIC_EXPLODE, 2F, 2F);
128+
movingPlayer.add(u.getPlayer());
120129
} catch (IOException e1) {
121130
addon.logError("Could not move box " + e1.getMessage());
122131
}

src/main/java/world/bentobox/boxed/listeners/NewAreaListener.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,7 @@ private static String nmsData(Block block) {
635635
throw new IllegalStateException("Class " + clazz.getName() + " does not implement AbstractGetMetaData");
636636
}
637637
} catch (Exception e) {
638-
e.printStackTrace();
639-
BentoBox.getInstance().logWarning("No metadata handler found for " + bukkitVersion + " in Boxed.");
638+
BentoBox.getInstance().logError("No metadata handler found for " + bukkitVersion + " in Boxed (yet).");
640639
handler = new world.bentobox.boxed.nms.fallback.GetMetaData();
641640
}
642641
return handler.nmsData(block);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package world.bentobox.boxed.nms.v1_21_1_R0_1_SNAPSHOT;
2+
3+
public class GetMetaData extends world.bentobox.boxed.nms.v1_21_R0_1_SNAPSHOT.GetMetaData {
4+
// Identical to 1.21
5+
}

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: Boxed
22
main: world.bentobox.boxed.Boxed
33
version: ${version}${build.number}
4-
api-version: 1.24
4+
api-version: 2.5.1
55
metrics: true
66
icon: "COMPOSTER"
77
repository: "BentoBoxWorld/Boxed"

0 commit comments

Comments
 (0)