mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2025-02-12 00:31:28 +01:00
Add an option to revoke visitor advancements or not
https://github.com/BentoBoxWorld/Boxed/issues/38
This commit is contained in:
parent
9e300914d4
commit
8b8dcfa236
@ -57,6 +57,11 @@ public class Settings implements WorldSettings {
|
||||
@ConfigEntry(path = "boxed.broadcast-advancements")
|
||||
private boolean broadcastAdvancements;
|
||||
|
||||
@ConfigComment("Deny advancements for visitors.")
|
||||
@ConfigComment("Visitors cannot get an advancement. Note visitors will still get the reward, e.g., experience")
|
||||
@ConfigEntry(path = "boxed.deny-visitor-advancements")
|
||||
private boolean denyVisitorAdvancements = true;
|
||||
|
||||
/* WORLD */
|
||||
@ConfigComment("Friendly name for this world. Used in admin commands. Must be a single word")
|
||||
@ConfigEntry(path = "world.friendly-name")
|
||||
@ -1753,4 +1758,18 @@ public class Settings implements WorldSettings {
|
||||
public void setBroadcastAdvancements(boolean broadcastAdvancements) {
|
||||
this.broadcastAdvancements = broadcastAdvancements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the denyVisitorAdvancements
|
||||
*/
|
||||
public boolean isDenyVisitorAdvancements() {
|
||||
return denyVisitorAdvancements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param denyVisitorAdvancements the denyVisitorAdvancements to set
|
||||
*/
|
||||
public void setDenyVisitorAdvancements(boolean denyVisitorAdvancements) {
|
||||
this.denyVisitorAdvancements = denyVisitorAdvancements;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class AdvancementListener implements Listener {
|
||||
public void onAdvancement(PlayerAdvancementDoneEvent e) {
|
||||
if (Util.sameWorld(e.getPlayer().getWorld(), addon.getOverWorld())) {
|
||||
// Only allow members or higher to get advancements in a box
|
||||
if (!addon.getIslands().getIslandAt(e.getPlayer().getLocation()).map(i -> i.getMemberSet().contains(e.getPlayer().getUniqueId())).orElse(false)) {
|
||||
if (addon.getSettings().isDenyVisitorAdvancements() && !addon.getIslands().getIslandAt(e.getPlayer().getLocation()).map(i -> i.getMemberSet().contains(e.getPlayer().getUniqueId())).orElse(false)) {
|
||||
// Remove advancement from player
|
||||
e.getAdvancement().getCriteria().forEach(c ->
|
||||
e.getPlayer().getAdvancementProgress(e.getAdvancement()).revokeCriteria(c));
|
||||
|
@ -18,6 +18,9 @@ boxed:
|
||||
# Announce advancements. We recommend you set the game rule `/gamerule announceAdvancements false`
|
||||
# but that blocks all new advancement announcements. This setting tells Boxed to broadcast new advancements.
|
||||
broadcast-advancements: false
|
||||
# Deny advancements for visitors.
|
||||
# Visitors cannot get an advancement. Note visitors will still get the reward, e.g., experience
|
||||
deny-visitor-advancements: true
|
||||
world:
|
||||
# Friendly name for this world. Used in admin commands. Must be a single word
|
||||
friendly-name: Boxed
|
||||
|
Loading…
Reference in New Issue
Block a user