Add leave-buffer-distance to tolerate knockback at region edges
This commit is contained in:
@@ -134,6 +134,7 @@ public class ArenaImpl implements Arena
|
||||
private Map<Integer, ThingPicker> everyWaveMap, afterWaveMap, waveTiersMap;
|
||||
private double spawnpointMinDistanceSquared;
|
||||
private double spawnpointMaxDistanceSquared;
|
||||
private int leaveBufferDistance;
|
||||
|
||||
// Misc
|
||||
private ArenaListener eventListener;
|
||||
@@ -220,6 +221,7 @@ public class ArenaImpl implements Arena
|
||||
this.waveTiersMap = MAUtils.getArenaRewardMap(plugin, section, name, "tiers");
|
||||
this.spawnpointMinDistanceSquared = Math.pow(settings.getDouble("spawnpoint-min-distance", 0), 2);
|
||||
this.spawnpointMaxDistanceSquared = Math.pow(settings.getDouble("spawnpoint-max-distance", 15), 2);
|
||||
this.leaveBufferDistance = settings.getInt("leave-buffer-distance", 3);
|
||||
|
||||
// Misc
|
||||
this.eventListener = new ArenaListener(this, plugin);
|
||||
@@ -403,6 +405,11 @@ public class ArenaImpl implements Arena
|
||||
return spawnpointMaxDistanceSquared;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLeaveBufferDistance() {
|
||||
return leaveBufferDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveManager getWaveManager() {
|
||||
return waveManager;
|
||||
|
||||
@@ -345,7 +345,7 @@ public class MASpawnThread implements Runnable
|
||||
private void removeCheatingPlayers() {
|
||||
List<Player> players = new ArrayList<>(arena.getPlayersInArena());
|
||||
for (Player p : players) {
|
||||
if (region.contains(p.getLocation())) {
|
||||
if (region.contains(p.getLocation(), arena.getLeaveBufferDistance())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ public interface Arena
|
||||
|
||||
double getSpawnpointMaxDistanceSquared();
|
||||
|
||||
int getLeaveBufferDistance();
|
||||
|
||||
WaveManager getWaveManager();
|
||||
|
||||
ArenaListener getEventListener();
|
||||
|
||||
@@ -29,6 +29,7 @@ wave-interval: 15
|
||||
final-wave: 0
|
||||
spawnpoint-min-distance: 0
|
||||
spawnpoint-max-distance: 15
|
||||
leave-buffer-distance: 3
|
||||
monster-limit: 100
|
||||
monster-exp: false
|
||||
keep-exp: false
|
||||
|
||||
Reference in New Issue
Block a user