Not stable version
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
6bef99e8e7
Commit
4dce49209c
@ -176,6 +176,8 @@ public class FightSystem extends JavaPlugin {
|
|||||||
pm.registerEvents(new BlockBreakListener(), plugin);
|
pm.registerEvents(new BlockBreakListener(), plugin);
|
||||||
pm.registerEvents(new PlayerMoveListener(), plugin);
|
pm.registerEvents(new PlayerMoveListener(), plugin);
|
||||||
pm.registerEvents(new EntityDamageByEntityListener(), plugin);
|
pm.registerEvents(new EntityDamageByEntityListener(), plugin);
|
||||||
|
pm.registerEvents(new FoodLevelChangeListener(), plugin);
|
||||||
|
pm.registerEvents(new PlayerRespawnListener(), plugin);
|
||||||
|
|
||||||
//WinConditions
|
//WinConditions
|
||||||
if(fileManager.getBooleanFromConfig("WinConditions.AllDead")) pm.registerEvents(new WinconditionAllDead(), plugin);
|
if(fileManager.getBooleanFromConfig("WinConditions.AllDead")) pm.registerEvents(new WinconditionAllDead(), plugin);
|
||||||
@ -228,6 +230,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
if(this.fightState != FightState.SETUP)
|
if(this.fightState != FightState.SETUP)
|
||||||
return;
|
return;
|
||||||
this.fightState = FightState.PRE_RUNNING;
|
this.fightState = FightState.PRE_RUNNING;
|
||||||
|
Countdown.cancelAllTimers(plugin);
|
||||||
|
|
||||||
int time = fileManager.getIntegerFromConfig("Times.PreFightDuration");
|
int time = fileManager.getIntegerFromConfig("Times.PreFightDuration");
|
||||||
Countdown countdown = new Countdown(time, new FinishPreRunning());
|
Countdown countdown = new Countdown(time, new FinishPreRunning());
|
||||||
@ -256,6 +259,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
if(this.fightState != FightState.PRE_RUNNING)
|
if(this.fightState != FightState.PRE_RUNNING)
|
||||||
return;
|
return;
|
||||||
this.fightState = FightState.RUNNING;
|
this.fightState = FightState.RUNNING;
|
||||||
|
Countdown.cancelAllTimers(plugin);
|
||||||
|
|
||||||
setAllPlayersGM(GameMode.SURVIVAL);
|
setAllPlayersGM(GameMode.SURVIVAL);
|
||||||
|
|
||||||
@ -271,6 +275,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
if(this.fightState != FightState.RUNNING)
|
if(this.fightState != FightState.RUNNING)
|
||||||
return;
|
return;
|
||||||
this.fightState = FightState.SPECTATE;
|
this.fightState = FightState.SPECTATE;
|
||||||
|
Countdown.cancelAllTimers(plugin);
|
||||||
|
|
||||||
setAllPlayersGM(GameMode.SPECTATOR);
|
setAllPlayersGM(GameMode.SPECTATOR);
|
||||||
entern = true;
|
entern = true;
|
||||||
|
15
src/me/yaruma/fightsystem/listener/FoodLevelChangeListener.java
Normale Datei
15
src/me/yaruma/fightsystem/listener/FoodLevelChangeListener.java
Normale Datei
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
28
src/me/yaruma/fightsystem/listener/PlayerRespawnListener.java
Normale Datei
28
src/me/yaruma/fightsystem/listener/PlayerRespawnListener.java
Normale Datei
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren