SteamWar/MissileWars
Archiviert
13
0

Add SpaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-12-28 18:40:10 +01:00
Ursprung 04ef766fb4
Commit b8da1a3d24
3 geänderte Dateien mit 53 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -57,6 +57,7 @@ public class Config {
private static final int EventKampfID;
public static final boolean Barrier;
public static final boolean Space;
static {
File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
@ -106,6 +107,7 @@ public class Config {
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
Barrier = config.getBoolean("Barrier", false);
Space = config.getBoolean("Space", false);
}
public static boolean isChallenge() {

Datei anzeigen

@ -29,6 +29,7 @@ import de.steamwar.misslewars.items.CustomItem;
import de.steamwar.misslewars.items.Missile;
import de.steamwar.misslewars.listener.*;
import de.steamwar.misslewars.listener.special.BarrierListener;
import de.steamwar.misslewars.listener.special.SpaceListener;
import de.steamwar.misslewars.slowmo.SlowMoRunner;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -94,6 +95,7 @@ public class MissileWars extends JavaPlugin {
StateDependent.setupState(fightState);
new BarrierListener();
new SpaceListener();
Bukkit.getScheduler().runTaskTimer(this, new FightInfoPacketSender(), 20, 20);
}

Datei anzeigen

@ -0,0 +1,49 @@
/*
*
* 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.misslewars.listener.special;
import de.steamwar.misslewars.Config;
import de.steamwar.misslewars.FightState;
import de.steamwar.misslewars.listener.BasicListener;
import org.bukkit.entity.Entity;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import java.util.EnumSet;
public class SpaceListener extends BasicListener {
public SpaceListener() {
super(EnumSet.allOf(FightState.class));
}
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
if (!Config.Space) return;
Entity entity = event.getEntity();
if (!(entity instanceof TNTPrimed)) {
TNTPrimed tnt = (TNTPrimed) entity;
tnt.setGravity(false);
}
}
}