Skip to content

Commit

Permalink
Merge pull request #63 from BentoBoxWorld/develop
Browse files Browse the repository at this point in the history
Release 2.3.1
  • Loading branch information
tastybento authored Dec 4, 2023
2 parents 470f893 + 97f9ff2 commit 48568e8
Show file tree
Hide file tree
Showing 5 changed files with 417 additions and 351 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.9</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.20.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.24.0</bentobox.version>
<spigot.version>1.20.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>2.0.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. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.3.0</build.version>
<build.version>2.3.1</build.version>

<sonar.projectKey>BentoBoxWorld_Boxed</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/world/bentobox/boxed/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public class Settings implements WorldSettings {
private String defaultPlayerAction = "go";

/* Boxed */
@ConfigComment("Ignore advancements.")
@ConfigComment("If this is true, advancements will not change the size of the box.")
@ConfigEntry(path = "boxed.ignore-advancements")
private boolean ignoreAdvancements = false;

@ConfigComment("Announce advancements. We recommend you set the game rule `/gamerule announceAdvancements false`")
@ConfigComment("but that blocks all new advancement announcements. This setting tells Boxed to broadcast new advancements.")
@ConfigEntry(path = "boxed.broadcast-advancements")
Expand Down Expand Up @@ -125,7 +130,7 @@ public class Settings implements WorldSettings {
@ConfigComment("If the number of areas is greater than this number, it will stop players from joining the world.")
@ConfigEntry(path = "world.max-areas")
private int maxIslands = -1;

@ConfigComment("Area height - Lowest is 5.")
@ConfigComment("It is the y coordinate of the bedrock block in the blueprint.")
@ConfigEntry(path = "world.area-height")
Expand Down Expand Up @@ -317,7 +322,7 @@ public class Settings implements WorldSettings {
@ConfigComment("Grant these advancements")
@ConfigEntry(path = "area.reset.on-leave.grant-advancements")
private List<String> onLeaveGrantAdvancements = new ArrayList<>();

@ConfigComment("Toggles the automatic area creation upon the player's first login on your server.")
@ConfigComment("If set to true,")
@ConfigComment(" * Upon connecting to your server for the first time, the player will be told that")
Expand Down Expand Up @@ -1735,4 +1740,18 @@ public void setIslandHeight(int islandHeight) {
this.islandHeight = islandHeight;
}

/**
* @return the ignoreAdvancements
*/
public boolean isIgnoreAdvancements() {
return ignoreAdvancements;
}

/**
* @param ignoreAdvancements the ignoreAdvancements to set
*/
public void setIgnoreAdvancements(boolean ignoreAdvancements) {
this.ignoreAdvancements = ignoreAdvancements;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public static Advancement getAdvancement(String key) {
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onAdvancement(PlayerAdvancementDoneEvent e) {
// Ignore if player is not in survival
if (!e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)) {
// Ignore if player is not in survival or if advancements are being ignored
if (!e.getPlayer().getGameMode().equals(GameMode.SURVIVAL) || addon.getSettings().isIgnoreAdvancements()) {
return;
}
// Check if player is in the Boxed worlds
Expand Down Expand Up @@ -137,6 +137,7 @@ private void tellTeam(User user, NamespacedKey key, int score) {
* @param user - user
*/
public void syncAdvancements(User user) {
if (addon.getSettings().isIgnoreAdvancements()) return;
Island box = addon.getIslands().getIsland(addon.getOverWorld(), user);
if (box != null) {
grantAdv(user, addon.getAdvManager().getIsland(box).getAdvancements());
Expand Down Expand Up @@ -174,7 +175,8 @@ private String keyToString(User user, NamespacedKey key) {
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPortal(PlayerPortalEvent e) {
if (!addon.inWorld(e.getPlayer().getWorld()) || !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)) {
if (!addon.inWorld(e.getPlayer().getWorld()) || !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)
|| addon.getSettings().isIgnoreAdvancements()) {
return;
}
if (e.getCause().equals(TeleportCause.NETHER_PORTAL)) {
Expand All @@ -194,7 +196,8 @@ public void onPortal(PlayerPortalEvent e) {
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onMove(PlayerMoveEvent e) {
if (!addon.getSettings().isNetherGenerate() || !Util.sameWorld(e.getPlayer().getWorld(), addon.getNetherWorld())) {
if (!addon.getSettings().isNetherGenerate() || !Util.sameWorld(e.getPlayer().getWorld(), addon.getNetherWorld())
|| addon.getSettings().isIgnoreAdvancements()) {
return;
}
// Nether fortress advancement
Expand Down Expand Up @@ -263,6 +266,7 @@ public void onTeamJoinTime(TeamJoinedEvent e) {
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onTeamLeaveTime(TeamLeaveEvent e) {
if (addon.getSettings().isIgnoreAdvancements()) return;
User user = User.getInstance(e.getPlayerUUID());
if (user != null && addon.getSettings().isOnJoinResetAdvancements() && user.isOnline()
&& addon.getOverWorld().equals(Util.getWorld(user.getWorld()))) {
Expand All @@ -278,6 +282,7 @@ public void onTeamLeaveTime(TeamLeaveEvent e) {
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onFirstTime(IslandNewIslandEvent e) {
if (addon.getSettings().isIgnoreAdvancements()) return;
User user = User.getInstance(e.getPlayerUUID());
if (user != null) {
clearAndSetAdv(user, addon.getSettings().isOnJoinResetAdvancements(), addon.getSettings().getOnJoinGrantAdvancements());
Expand Down
Loading

0 comments on commit 48568e8

Please sign in to comment.