Skip to content

Commit

Permalink
Added config option to show or not show particles.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Aug 16, 2021
1 parent ccb6e4f commit cedf3c4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
19 changes: 19 additions & 0 deletions src/main/java/world/bentobox/border/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public class Settings implements ConfigObject {
@ConfigEntry(path = "show-max-border")
private boolean showMaxBorder= true;

@ConfigComment("")
@ConfigComment("Show particles. If WBAPI isn't used, then enable/disable the particles")
@ConfigEntry(path = "show-particles")
private boolean showParticles = true;

/**
* @param disabledGameModes new disabledGameModes value.
*/
Expand Down Expand Up @@ -133,4 +138,18 @@ public boolean isReturnTeleport() {
public void setReturnTeleport(boolean returnTeleport) {
this.returnTeleport = returnTeleport;
}

/**
* @return the showParticles
*/
public boolean isShowParticles() {
return showParticles;
}

/**
* @param showParticles the showParticles to set
*/
public void setShowParticles(boolean showParticles) {
this.showParticles = showParticles;
}
}
10 changes: 6 additions & 4 deletions src/main/java/world/bentobox/border/listeners/ShowBarrier.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ private void showPlayer(Player player, int i, int j, int k, boolean max) {
}
Location l = new Location(player.getWorld(), i, j, k);
Util.getChunkAtAsync(l).thenAccept(c -> {
if (j < 0 || j > player.getWorld().getMaxHeight()) {
User.getInstance(player).spawnParticle(max ? MAX_PARTICLE : PARTICLE, PARTICLE_DUST_RED, i + 0.5D, j + 0.0D, k + 0.5D);
} else {
User.getInstance(player).spawnParticle(max ? MAX_PARTICLE : PARTICLE, PARTICLE_DUST_BLUE, i + 0.5D, j + 0.0D, k + 0.5D);
if (addon.getSettings().isShowParticles()) {
if (j < 0 || j > player.getWorld().getMaxHeight()) {
User.getInstance(player).spawnParticle(max ? MAX_PARTICLE : PARTICLE, PARTICLE_DUST_RED, i + 0.5D, j + 0.0D, k + 0.5D);
} else {
User.getInstance(player).spawnParticle(max ? MAX_PARTICLE : PARTICLE, PARTICLE_DUST_BLUE, i + 0.5D, j + 0.0D, k + 0.5D);
}
}
if (addon.getSettings().isUseBarrierBlocks() && (l.getBlock().isEmpty() || l.getBlock().isLiquid())) {
player.sendBlockChange(l, BLOCK);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ show-by-default: true
#
# Show max-protection range border. This is a visual border only and not a barrier.
show-max-border: true
# Show particles. If WABI isn't used, then enable/disable the particles
show-particles: true

0 comments on commit cedf3c4

Please sign in to comment.