Fix arena border, piston border, and y-Damage #383
@ -61,6 +61,7 @@ public class Config {
|
||||
public static final Region BlueExtendRegion;
|
||||
public static final Region RedExtendRegion;
|
||||
public static final Region ArenaRegion;
|
||||
public static final Region PlayerRegion;
|
||||
|
||||
public static final Location TeamBlueSpawn;
|
||||
public static final Location TeamRedSpawn;
|
||||
@ -300,14 +301,13 @@ public class Config {
|
||||
RedRotate = teamRedRotate;
|
||||
BlueRotate = teamBlueRotate;
|
||||
|
||||
int arenaYSize = blueCornerY - underBorder + schemsizeY + PreperationArea;
|
||||
|
||||
RedPasteRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
||||
BluePasteRegion = new Region(blueCornerX, blueCornerY, blueCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
||||
|
||||
RedExtendRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, arenaYSize, schemsizeZ, PreperationArea, PreperationArea, PreperationArea);
|
||||
BlueExtendRegion = new Region(blueCornerX, blueCornerY, blueCornerZ, schemsizeX, arenaYSize, schemsizeZ, PreperationArea, PreperationArea, PreperationArea);
|
||||
ArenaRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX - arenaMinX, arenaYSize, arenaMaxZ - arenaMinZ);
|
||||
RedExtendRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ, PreperationArea, PreperationArea, PreperationArea);
|
||||
BlueExtendRegion = new Region(blueCornerX, blueCornerY, blueCornerZ, schemsizeX, schemsizeY, schemsizeZ, PreperationArea, PreperationArea, PreperationArea);
|
||||
ArenaRegion = new Region(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
|
||||
PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX - arenaMinX, world.getMaxHeight() - underBorder, arenaMaxZ - arenaMinZ);
|
||||
|
||||
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||
if(EventKampfID >= 1){
|
||||
|
@ -26,7 +26,9 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.fightsystem.states.StateDependentTask;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -38,40 +40,39 @@ public class ArenaBorder implements Listener {
|
||||
|
||||
public ArenaBorder() {
|
||||
new StateDependentListener(ArenaMode.All, FightState.All, this);
|
||||
new StateDependentTask(ArenaMode.All, FightState.Running, this::damage, 2, 2);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void arenaBorder(PlayerMoveEvent event){
|
||||
Player player = event.getPlayer();
|
||||
if(Config.ArenaLeaveable && !Fight.fighting(player))
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
|
||||
if(Config.ArenaLeaveable && team == null)
|
||||
return;
|
||||
|
||||
Location to = event.getTo();
|
||||
assert to != null;
|
||||
|
||||
if(!Config.ArenaRegion.in2dRegion(to)){
|
||||
reset(event);
|
||||
if(Config.PlayerRegion.inRegion(to))
|
||||
return;
|
||||
}
|
||||
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
if(team == null || player.getGameMode() == GameMode.SPECTATOR){
|
||||
if(to.getY() <= Config.ArenaRegion.getMinY())
|
||||
reset(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if(to.getY() <= Config.ArenaRegion.getMinY()) {
|
||||
if(FightState.infight())
|
||||
player.damage(2);
|
||||
else if(!Config.GroundWalkable)
|
||||
if(to.getY() <= Config.PlayerRegion.getMinY() && player.getGameMode() != GameMode.SPECTATOR && team != null) {
|
||||
if(!Config.GroundWalkable && !FightState.infight())
|
||||
player.teleport(team.getSpawn());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private void reset(PlayerMoveEvent event){
|
||||
Player player = event.getPlayer();
|
||||
player.teleport(event.getFrom());
|
||||
FightSystem.getMessage().sendPrefixless("NO_ARENA_LEAVING", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
private void damage() {
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
if(team != null && player.getLocation().getY() <= Config.PlayerRegion.getMinY())
|
||||
player.damage(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren