Skip to content

Commit

Permalink
Added settings and updated to 1.21.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Aug 18, 2024
1 parent eab215b commit 97f9f44
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.9</powermock.version>
<!-- More visible way to change dependency versions -->
<spigot.version>1.20.1-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
<!-- Might differ from the last Spigot release for short periods
of time -->
<paper.version>1.20.1-R0.1-SNAPSHOT</paper.version>
<bentobox.version>2.0.0-SNAPSHOT</bentobox.version>
<bentobox.version>2.5.0-SNAPSHOT</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/world/bentobox/parkour/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "world.max-areas")
private int maxIslands = -1;

@ConfigComment("The number of concurrent areas a player can have")
@ConfigComment("A value of 0 will use the BentoBox config.yml default")
@ConfigEntry(path = "world.concurrent-area")
private int concurrentIslands = 0;

@ConfigComment("Disallow team members from having their own area.")
@ConfigEntry(path = "world.disallow-team-member-areas")
private boolean disallowTeamMemberIslands = true;

@ConfigComment("The default game mode for this world. Players will be set to this mode when they create")
@ConfigComment("a new area for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR")
@ConfigEntry(path = "world.default-game-mode")
Expand Down Expand Up @@ -1721,4 +1730,33 @@ public Biome getDefaultEndBiome() {
public void setDefaultEndBiome(Biome defaultEndBiome) {
this.defaultEndBiome = defaultEndBiome;
}

/**
* @return the concurrentIslands
*/
@Override
public int getConcurrentIslands() {
return concurrentIslands;
}

/**
* @param concurrentIslands the concurrentIslands to set
*/
public void setConcurrentIslands(int concurrentIslands) {
this.concurrentIslands = concurrentIslands;
}

/**
* @return the disallowTeamMemberIslands
*/
public boolean isDisallowTeamMemberIslands() {
return disallowTeamMemberIslands;
}

/**
* @param disallowTeamMemberIslands the disallowTeamMemberIslands to set
*/
public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) {
this.disallowTeamMemberIslands = disallowTeamMemberIslands;
}
}
19 changes: 10 additions & 9 deletions src/main/java/world/bentobox/parkour/gui/CoursesTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ public String getName() {
.sorted()
.filter(hs -> Objects.nonNull(hs.getWarpSpot()))
.forEach(hs -> {
UUID owner = addon.getIslands().getIslandById(hs.getUniqueId()).map(Island::getOwner).orElse(null);
if (owner != null) {
heads.add(getHead(hs, owner));
}
addon.getIslands().getIslandById(hs.getUniqueId()).ifPresent(is -> {
if (is.getOwner() != null) {
heads.add(getHead(hs, is));
}
});
});
return heads;
}
Expand All @@ -95,18 +96,18 @@ public String getName() {
* Get the head panel item
*
* @param pd - parkour data
* @param playerUUID - the UUID of the owner
* @param is.getOwner() - the UUID of the owner
* @return PanelItem
*/
private PanelItem getHead(ParkourData pd, UUID playerUUID) {
final String name = addon.getPlayers().getName(playerUUID);
private PanelItem getHead(ParkourData pd, Island is) {
final String name = addon.getPlayers().getName(is.getOwner());
List<String> description = new ArrayList<>();
if (pd.getRunCount() > 0) {
description.add(user.getTranslation("parkour.courses.head-description", "[name]", name, "[runs]", String.valueOf(pd.getRunCount())));
}
if (addon.getIslands().inTeam(addon.getOverWorld(), playerUUID)) {
if (addon.getIslands().inTeam(addon.getOverWorld(), is.getOwner())) {
List<String> memberList = new ArrayList<>();
for (UUID members : addon.getIslands().getMembers(addon.getOverWorld(), playerUUID)) {
for (UUID members : is.getMemberSet()) {
memberList.add(ChatColor.AQUA + addon.getPlayers().getName(members));
}
description.addAll(memberList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.damage.DamageSource;
import org.bukkit.damage.DamageType;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
Expand Down Expand Up @@ -281,7 +283,8 @@ public void testOnVisitorLeaveNotRuning() {
*/
@Test
public void testOnPlayerDeath() {
PlayerDeathEvent e = new PlayerDeathEvent(player, new ArrayList<>(), 0, 0, 0, 0, "");
PlayerDeathEvent e = new PlayerDeathEvent(player, DamageSource.builder(DamageType.ARROW).build(),
new ArrayList<>(), 0, 0, 0, 0, null);
crl.onPlayerDeath(e);
assertFalse(prm.timers().containsKey(uuid));
assertFalse(prm.checkpoints().containsKey(uuid));
Expand All @@ -308,7 +311,7 @@ public void testOnVisitorFall() {
PowerMockito.mockStatic(Util.class, RETURNS_MOCKS);
prm.timers().put(uuid, System.currentTimeMillis() - 20000); // ~ 20 seconds ago
prm.checkpoints().put(uuid, location);
EntityDamageEvent e = new EntityDamageEvent(player, DamageCause.VOID, 1D);
EntityDamageEvent e = new EntityDamageEvent(player, null, null, null);
crl.onVisitorFall(e);
verify(player).playEffect(EntityEffect.ENTITY_POOF);
verify(player).setVelocity(new Vector(0, 0, 0));
Expand Down

0 comments on commit 97f9f44

Please sign in to comment.