Add per-arena setting arena-warp-offset.

This commit introduces a quality-of-life feature for spreading players
out during the warp to the arena floor. The feature is configured via
the new per-arena setting `arena-warp-offset`. When the value is greater
than 0.01, MobArena will add a random number of units between 0 and the
offset value to the X and Z axes in either direction. For example, if
the value is set to 3, players will be teleported to a random location
in a 3x3 square centered on the arena warp, rather than directly to the
arena warp itself.

Closes #371
This commit is contained in:
Andreas Troelsen 2020-08-20 23:30:57 +02:00
parent b343976dc8
commit 64d55673a4
3 changed files with 17 additions and 1 deletions

View File

@ -16,6 +16,7 @@ These changes will (most likely) be included in the next version.
- Elytra are now supported chest pieces in class chests.
- Elytra and Netherite armor pieces now correctly auto-equip if specified in the generic `armor` node in classes in the config-file.
- Boss names now support color codes.
- New per-arena setting `arena-warp-offset` can be used to spread out players randomly by an offset from the arena warp. This should help prevent players taking suffocation damage.
- The Root Target ability now uses potion effects (slowness, slow falling, and negative jump boost) instead of repeated teleports. This should make for a smoother root experience.
- Using `spectate-on-death: true` no longer forces players out to their join location/exit warp before moving them to the spectator area. This should prevent "jumpy" behavior in multi-world setups.
- Players should now properly respawn at the spectator area rather than at world spawn on servers with plugins that override respawn locations.

View File

@ -126,6 +126,9 @@ public class ArenaImpl implements Arena
private StartDelayTimer startDelayTimer;
private boolean isolatedChat;
// Warp offsets
private double arenaWarpOffset;
// Scoreboards
private ScoreboardManager scoreboard;
@ -220,6 +223,8 @@ public class ArenaImpl implements Arena
this.isolatedChat = settings.getBoolean("isolated-chat", false);
this.arenaWarpOffset = settings.getDouble("arena-warp-offset", 0.0);
// Scoreboards
this.scoreboard = (settings.getBoolean("use-scoreboards", true) ? new ScoreboardManager(this) : new NullScoreboardManager(this));
@ -518,7 +523,16 @@ public class ArenaImpl implements Arena
}
movingPlayers.add(p);
p.teleport(region.getArenaWarp());
if (arenaWarpOffset > 0.01) {
Location warp = region.getArenaWarp();
double x = warp.getX() + (arenaWarpOffset * 2 * (Math.random() - 0.5));
double y = warp.getY();
double z = warp.getZ() + (arenaWarpOffset * 2 * (Math.random() - 0.5));
Location offset = new Location(warp.getWorld(), x, y, z);
p.teleport(offset);
} else {
p.teleport(region.getArenaWarp());
}
movingPlayers.remove(p);
addClassPermissions(p);

View File

@ -35,6 +35,7 @@ auto-start-timer: 0
start-delay-timer: 0
auto-ready: false
use-class-chests: false
arena-warp-offset: 0
boss-health-bar: boss-bar
display-waves-as-level: false
display-timer-as-level: false