SteamWar/FightSystem
Archiviert
13
1

Adding upper limit

Dieser Commit ist enthalten in:
Travis CI 2019-06-14 22:54:18 +02:00
Ursprung 3ca7c7049d
Commit 52c4976f09
3 geänderte Dateien mit 17 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -21,8 +21,9 @@ public class PistonListener implements Listener {
BlockFace b = e.getDirection(); BlockFace b = e.getDirection();
for(Block block : e.getBlocks()){ for(Block block : e.getBlocks()){
if( if(
!Region.isIn2DRange(block.getLocation(), Config.TeamBlueCornerX + b.getModX(), Config.TeamBlueCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic) && block.getY() > Config.upperArenaBorder ||
!Region.isIn2DRange(block.getLocation(), Config.TeamRedCornerX + b.getModX(), Config.TeamRedCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic) (!Region.isIn2DRange(block.getLocation(), Config.TeamBlueCornerX + b.getModX(), Config.TeamBlueCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic) &&
!Region.isIn2DRange(block.getLocation(), Config.TeamRedCornerX + b.getModX(), Config.TeamRedCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic))
){ ){
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -38,8 +39,9 @@ public class PistonListener implements Listener {
BlockFace b = e.getDirection(); BlockFace b = e.getDirection();
for(Block block : e.getBlocks()){ for(Block block : e.getBlocks()){
if( if(
!Region.isIn2DRange(block.getLocation(), Config.TeamBlueCornerX + b.getModX(), Config.TeamBlueCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic) && block.getY() > Config.upperArenaBorder ||
!Region.isIn2DRange(block.getLocation(), Config.TeamRedCornerX + b.getModX(), Config.TeamRedCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic) (!Region.isIn2DRange(block.getLocation(), Config.TeamBlueCornerX + b.getModX(), Config.TeamBlueCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic) &&
!Region.isIn2DRange(block.getLocation(), Config.TeamRedCornerX + b.getModX(), Config.TeamRedCornerZ + b.getModZ(), Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic))
){ ){
e.setCancelled(true); e.setCancelled(true);
return; return;

Datei anzeigen

@ -30,6 +30,8 @@ public class PlayerMoveListener implements Listener {
return; return;
} }
boolean inArenaY = to.getY() + 1.8 <= Config.upperArenaBorder;
//Check under Arena //Check under Arena
if(to.getY() <= Config.underArenaBorder) { if(to.getY() <= Config.underArenaBorder) {
if(fightTeam == null){ if(fightTeam == null){
@ -42,11 +44,15 @@ public class PlayerMoveListener implements Listener {
else else
player.teleport(Config.TeamBlueSpawn); player.teleport(Config.TeamBlueSpawn);
return; return;
}else if(fightTeam != null && !inArenaY){
player.teleport(from);
player.sendMessage(FightSystem.PREFIX + "§cDu darfst die Arena nicht verlassen!");
return;
} }
//Check TeamAreas //Check TeamAreas
boolean inBlueArea = Region.isIn2DRange(to, Config.TeamBlueCornerX, Config.TeamBlueCornerZ, Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic); boolean inBlueArea = inArenaY && Region.isIn2DRange(to, Config.TeamBlueCornerX, Config.TeamBlueCornerZ, Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic);
boolean inRedArea = Region.isIn2DRange(to, Config.TeamRedCornerX, Config.TeamRedCornerZ, Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic); boolean inRedArea = inArenaY && Region.isIn2DRange(to, Config.TeamRedCornerX, Config.TeamRedCornerZ, Config.SchemsizeX, Config.SchemsizeZ, Config.BorderFromSchematic);
if(inBlueArea || inRedArea) { if(inBlueArea || inRedArea) {
if(fightTeam == null){ if(fightTeam == null){

Datei anzeigen

@ -32,6 +32,7 @@ public class Config {
public static int Schem2BorderZ; public static int Schem2BorderZ;
public static int underArenaBorder; public static int underArenaBorder;
public static int BorderFromSchematic; public static int BorderFromSchematic;
public static int upperArenaBorder;
public static boolean OnlyPublicSchematics; public static boolean OnlyPublicSchematics;
public static String SchematicDirectory; public static String SchematicDirectory;
@ -163,6 +164,8 @@ public class Config {
TeamBlueCornerZ -= SchemsizeZ; TeamBlueCornerZ -= SchemsizeZ;
} }
upperArenaBorder = TeamBlueCornerY + SchemsizeY + BorderFromSchematic;
TeamRedCornerX = TeamBluetoReddistanceX + TeamBlueCornerX; TeamRedCornerX = TeamBluetoReddistanceX + TeamBlueCornerX;
TeamRedCornerY = TeamBluetoReddistanceY + TeamBlueCornerY; TeamRedCornerY = TeamBluetoReddistanceY + TeamBlueCornerY;
TeamRedCornerZ = TeamBluetoReddistanceZ + TeamBlueCornerZ; TeamRedCornerZ = TeamBluetoReddistanceZ + TeamBlueCornerZ;