SteamWar/MissileWars
Archiviert
13
0

Test fix fireball finish

Dieser Commit ist enthalten in:
Lixfel 2020-07-25 10:27:22 +02:00
Ursprung 2eb4acf4b9
Commit b261741db3

Datei anzeigen

@ -1,11 +1,14 @@
package de.steamwar.misslewars.listener; package de.steamwar.misslewars.listener;
import de.steamwar.misslewars.Config;
import de.steamwar.misslewars.FightState; import de.steamwar.misslewars.FightState;
import de.steamwar.misslewars.MissileWars; import de.steamwar.misslewars.MissileWars;
import de.steamwar.misslewars.WinReasons; import de.steamwar.misslewars.WinReasons;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import java.util.EnumSet; import java.util.EnumSet;
@ -25,4 +28,16 @@ public class PortalDestructListener extends BasicListener {
if (z == MissileWars.getBlueTeam().getPortalZ()) if (z == MissileWars.getBlueTeam().getPortalZ())
MissileWars.end(WinReasons.PORTAL_DESTROYED, MissileWars.getRedTeam()); MissileWars.end(WinReasons.PORTAL_DESTROYED, MissileWars.getRedTeam());
} }
@EventHandler
public void onExplosion(EntityExplodeEvent e){
if(e.getEntityType() != EntityType.FIREBALL)
return;
double z = e.getLocation().getZ();
double distRed = Math.abs(Config.RedPortalZ - z);
double distBlue = Math.abs(Config.BluePortalZ - z);
if(distRed < 1 || distBlue < 1)
e.setCancelled(true);
}
} }