SteamWar/FightSystem
Archiviert
13
1

Not stable version

Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-02-23 21:09:57 +01:00
Ursprung 6bef99e8e7
Commit 4dce49209c
3 geänderte Dateien mit 48 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -176,6 +176,8 @@ public class FightSystem extends JavaPlugin {
pm.registerEvents(new BlockBreakListener(), plugin);
pm.registerEvents(new PlayerMoveListener(), plugin);
pm.registerEvents(new EntityDamageByEntityListener(), plugin);
pm.registerEvents(new FoodLevelChangeListener(), plugin);
pm.registerEvents(new PlayerRespawnListener(), plugin);
//WinConditions
if(fileManager.getBooleanFromConfig("WinConditions.AllDead")) pm.registerEvents(new WinconditionAllDead(), plugin);
@ -228,6 +230,7 @@ public class FightSystem extends JavaPlugin {
if(this.fightState != FightState.SETUP)
return;
this.fightState = FightState.PRE_RUNNING;
Countdown.cancelAllTimers(plugin);
int time = fileManager.getIntegerFromConfig("Times.PreFightDuration");
Countdown countdown = new Countdown(time, new FinishPreRunning());
@ -256,6 +259,7 @@ public class FightSystem extends JavaPlugin {
if(this.fightState != FightState.PRE_RUNNING)
return;
this.fightState = FightState.RUNNING;
Countdown.cancelAllTimers(plugin);
setAllPlayersGM(GameMode.SURVIVAL);
@ -271,6 +275,7 @@ public class FightSystem extends JavaPlugin {
if(this.fightState != FightState.RUNNING)
return;
this.fightState = FightState.SPECTATE;
Countdown.cancelAllTimers(plugin);
setAllPlayersGM(GameMode.SPECTATOR);
entern = true;

Datei anzeigen

@ -0,0 +1,15 @@
package me.yaruma.fightsystem.listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.FoodLevelChangeEvent;
public class FoodLevelChangeListener implements Listener {
@EventHandler
public void handleFoodLevelChange(FoodLevelChangeEvent event) {
event.setCancelled(true);
}
}

Datei anzeigen

@ -0,0 +1,28 @@
package me.yaruma.fightsystem.listener;
import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.fight.Fight;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
public class PlayerRespawnListener implements Listener {
FightSystem instance = FightSystem.getPlugin();
@EventHandler
public void handlePlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
if(Fight.getPlayerTeam(player) != null) {
player.teleport(instance.getSpecSpawnLoc());
} else {
if(Fight.getPlayerTeam(player) == Fight.redTeam)
player.teleport(instance.getTeam1SpawnLoc());
else
player.teleport(instance.getTeam2SpawnLoc());
}
}
}