Merge pull request 'Add NoGravity' (#61) from FightSystem/EnableNoGravityFights into main
All checks were successful
SteamWarCI Build successful
All checks were successful
SteamWarCI Build successful
Reviewed-on: #61 Reviewed-by: Lixfel <lixfel@noreply.localhost>
This commit is contained in:
@ -23,10 +23,7 @@ import com.comphenix.tinyprotocol.TinyProtocol;
|
|||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.fightsystem.commands.*;
|
import de.steamwar.fightsystem.commands.*;
|
||||||
import de.steamwar.fightsystem.countdown.*;
|
import de.steamwar.fightsystem.countdown.*;
|
||||||
import de.steamwar.fightsystem.event.HellsBells;
|
import de.steamwar.fightsystem.event.*;
|
||||||
import de.steamwar.fightsystem.event.Meteor;
|
|
||||||
import de.steamwar.fightsystem.event.PersistentDamage;
|
|
||||||
import de.steamwar.fightsystem.event.TNTDistributor;
|
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.fight.FightWorld;
|
import de.steamwar.fightsystem.fight.FightWorld;
|
||||||
@ -136,6 +133,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
new PersistentDamage();
|
new PersistentDamage();
|
||||||
new TNTDistributor();
|
new TNTDistributor();
|
||||||
new WinconditionAmongUs();
|
new WinconditionAmongUs();
|
||||||
|
new NoGravity();
|
||||||
|
|
||||||
new NoPlayersOnlineCountdown();
|
new NoPlayersOnlineCountdown();
|
||||||
new PreSchemCountdown();
|
new PreSchemCountdown();
|
||||||
|
|||||||
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -39,5 +39,6 @@ public enum Winconditions {
|
|||||||
METEOR,
|
METEOR,
|
||||||
AMONG_US,
|
AMONG_US,
|
||||||
PERSISTENT_DAMAGE,
|
PERSISTENT_DAMAGE,
|
||||||
TNT_DISTRIBUTION
|
TNT_DISTRIBUTION,
|
||||||
|
NO_GRAVITY,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user