Kick all nonparticipants if Event with SpectateSystem
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
acb83e7fbb
Commit
55b27082cb
@ -140,6 +140,7 @@ public class Config {
|
|||||||
public static final int EventTeamRedID;
|
public static final int EventTeamRedID;
|
||||||
public static final boolean BothTeamsPublic;
|
public static final boolean BothTeamsPublic;
|
||||||
public static final int MaximumTeamMembers;
|
public static final int MaximumTeamMembers;
|
||||||
|
public static final boolean SpectateSystem;
|
||||||
|
|
||||||
//check parameter
|
//check parameter
|
||||||
public static final int CheckSchemID;
|
public static final int CheckSchemID;
|
||||||
@ -370,6 +371,7 @@ public class Config {
|
|||||||
OnlyPublicSchematics = event.publicSchemsOnly();
|
OnlyPublicSchematics = event.publicSchemsOnly();
|
||||||
MaximumTeamMembers = event.getMaximumTeamMembers();
|
MaximumTeamMembers = event.getMaximumTeamMembers();
|
||||||
}
|
}
|
||||||
|
SpectateSystem = event.spectateSystem();
|
||||||
}else{
|
}else{
|
||||||
//No event
|
//No event
|
||||||
TeamRedName = config.getString("Output.TeamRedName");
|
TeamRedName = config.getString("Output.TeamRedName");
|
||||||
@ -379,6 +381,7 @@ public class Config {
|
|||||||
EventTeamRedID = 0;
|
EventTeamRedID = 0;
|
||||||
BothTeamsPublic = true;
|
BothTeamsPublic = true;
|
||||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||||
|
SpectateSystem = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String blueLeader = System.getProperty("blueLeader", null);
|
String blueLeader = System.getProperty("blueLeader", null);
|
||||||
|
@ -29,6 +29,7 @@ import de.steamwar.sql.SteamwarUser;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
@ -39,6 +40,21 @@ public class EventJoinListener extends BasicListener {
|
|||||||
super(Config.event() ? EnumSet.of(FightState.PRE_LEADER_SETUP, FightState.PRE_SCHEM_SETUP, FightState.POST_SCHEM_SETUP) : EnumSet.noneOf(FightState.class));
|
super(Config.event() ? EnumSet.of(FightState.PRE_LEADER_SETUP, FightState.PRE_SCHEM_SETUP, FightState.POST_SCHEM_SETUP) : EnumSet.noneOf(FightState.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void playerLogin(PlayerLoginEvent event) {
|
||||||
|
if(!Config.SpectateSystem)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
if(user.getTeam() == Config.EventTeamBlueID ||
|
||||||
|
user.getTeam() == Config.EventTeamRedID ||
|
||||||
|
user.getId() == FightSystem.getEventFight().getKampfleiter())
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "§cDu bist kein Kampfteilnehmer");
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren