SteamWar/FightSystem
Archiviert
13
1

The big refactoring #238

Manuell gemergt
Lixfel hat 16 Commits von refactoring nach master 2021-03-31 20:08:07 +02:00 zusammengeführt
3 geänderte Dateien mit 38 neuen und 16 gelöschten Zeilen
Nur Änderungen aus Commit 947afe7e1f werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -58,14 +58,12 @@ public class Fight {
} }
public static FightTeam getOpposite(FightTeam fightTeam) { public static FightTeam getOpposite(FightTeam fightTeam) {
if(fightTeam == null){
throw new IllegalArgumentException();
}
if(fightTeam == redTeam) if(fightTeam == redTeam)
return blueTeam; return blueTeam;
else else if(fightTeam == blueTeam)
return redTeam; return redTeam;
throw new IllegalArgumentException();
} }
public static FightTeam getInvitedTeam(Player player){ public static FightTeam getInvitedTeam(Player player){

Datei anzeigen

@ -58,7 +58,6 @@ public class EventJoin implements Listener {
@EventHandler @EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) { public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
//player.setResourcePack("https://steamwar.de/antixray.zip");
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(FightState.Setup.contains(FightState.getFightState())){ if(FightState.Setup.contains(FightState.getFightState())){
@ -101,14 +100,4 @@ public class EventJoin implements Listener {
if(player == FightSystem.getEventLeiter()) if(player == FightSystem.getEventLeiter())
FightSystem.setEventLeiter(null); FightSystem.setEventLeiter(null);
} }
/*@EventHandler
public void onResourcepack(PlayerResourcePackStatusEvent e){
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.ACCEPTED || e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED)
return;
Player player = e.getPlayer();
player.sendMessage(FightSystem.PREFIX + "§cAuf Eventserver kann nur mit dem SteamWar-Resourcepack beigetreten werden");
player.kickPlayer(null);
}*/
} }

Datei anzeigen

@ -0,0 +1,35 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
public class ResourcePack implements Listener {
public ResourcePack(){
new StateDependentListener(ArenaMode.Event, FightState.All, this);
}
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
player.setResourcePack("https://steamwar.de/antixray.zip");
}
@EventHandler
public void onResourcepack(PlayerResourcePackStatusEvent e){
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.ACCEPTED || e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED)
return;
Player player = e.getPlayer();
player.sendMessage(FightSystem.PREFIX + "§cAuf Eventserver kann nur mit dem SteamWar-Resourcepack beigetreten werden");
player.sendMessage(FightSystem.PREFIX + "§cDa du abgelehnt hast, musst du nun in der Serverliste erstmal wieder Ressourcenpakete von SteamWar aktivieren.");
player.kickPlayer(null);
}
}