diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index b32a41b9..bff38170 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -23,10 +23,7 @@ import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.core.Core; import de.steamwar.fightsystem.commands.*; import de.steamwar.fightsystem.countdown.*; -import de.steamwar.fightsystem.event.HellsBells; -import de.steamwar.fightsystem.event.Meteor; -import de.steamwar.fightsystem.event.PersistentDamage; -import de.steamwar.fightsystem.event.TNTDistributor; +import de.steamwar.fightsystem.event.*; import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightWorld; @@ -136,6 +133,7 @@ public class FightSystem extends JavaPlugin { new PersistentDamage(); new TNTDistributor(); new WinconditionAmongUs(); + new NoGravity(); new NoPlayersOnlineCountdown(); new PreSchemCountdown(); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/NoGravity.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/NoGravity.java new file mode 100644 index 00000000..12246f8e --- /dev/null +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/NoGravity.java @@ -0,0 +1,41 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.fightsystem.event; + +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentListener; +import de.steamwar.fightsystem.winconditions.Winconditions; +import org.bukkit.entity.EntityType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntitySpawnEvent; + +public class NoGravity implements Listener { + + public NoGravity() { + new StateDependentListener(Winconditions.NO_GRAVITY, FightState.All, this); + } + + @EventHandler + public void onEntitySpawn(EntitySpawnEvent event) { + if (event.getEntityType() == EntityType.PLAYER) return; + event.getEntity().setGravity(false); + } +} diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java index 296cf97e..2aaecae6 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java @@ -39,5 +39,6 @@ public enum Winconditions { METEOR, AMONG_US, PERSISTENT_DAMAGE, - TNT_DISTRIBUTION + TNT_DISTRIBUTION, + NO_GRAVITY, }