Fix join listener
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
a95800e815
Commit
7858a87b60
@ -14,7 +14,7 @@ import java.util.EnumSet;
|
||||
public class NormalJoinListener extends BasicListener {
|
||||
|
||||
public NormalJoinListener() {
|
||||
super(Config.event() || Config.test() ? EnumSet.noneOf(FightState.class) : EnumSet.of(FightState.PRE_LEADER_SETUP));
|
||||
super(Config.event() || Config.test() || Config.Ranked ? EnumSet.noneOf(FightState.class) : EnumSet.of(FightState.PRE_LEADER_SETUP));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -0,0 +1,32 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class RankedJoinListener extends BasicListener {
|
||||
|
||||
public RankedJoinListener() {
|
||||
super(!Config.event() && Config.Ranked ? EnumSet.of(FightState.PRE_SCHEM_SETUP) : EnumSet.noneOf(FightState.class));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
|
||||
if (fightTeam == null) {
|
||||
if(!player.getUniqueId().equals(Config.RedLeader) && Fight.getBlueTeam().canbeLeader(player)) {
|
||||
Fight.getBlueTeam().setLeader(Fight.getBlueTeam().addMember(player));
|
||||
}else if(Fight.getRedTeam().canbeLeader(player)) {
|
||||
Fight.getRedTeam().setLeader(Fight.getRedTeam().addMember(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren