closes #91 added spec hider #97
@ -266,10 +266,10 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
private static void setAllPlayersGM(GameMode gm) {
|
||||
for(FightPlayer fightPlayer: Fight.getBlueTeam().getPlayers()){
|
||||
fightPlayer.getPlayer().setGameMode(gm);
|
||||
Fight.setPlayerGamemode(fightPlayer.getPlayer(), gm);
|
||||
}
|
||||
for(FightPlayer fightPlayer: Fight.getRedTeam().getPlayers()){
|
||||
fightPlayer.getPlayer().setGameMode(gm);
|
||||
Fight.setPlayerGamemode(fightPlayer.getPlayer(), gm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -83,4 +85,26 @@ public class Fight {
|
||||
Fight.getRedTeam().replaceSync(Config.ReplaceBedrock, Material.BEDROCK, Material.SLIME_BLOCK);
|
||||
Fight.getBlueTeam().replaceSync(Config.ReplaceBedrock, Material.BEDROCK, Material.SLIME_BLOCK);
|
||||
}
|
||||
|
||||
public static void setPlayerGamemode(Player player, GameMode gameMode) {
|
||||
player.setGameMode(gameMode);
|
||||
|
||||
if(gameMode == GameMode.SPECTATOR) {
|
||||
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if(currentPlayer.getUniqueId() != player.getUniqueId() && currentPlayer.getGameMode() == GameMode.SPECTATOR) {
|
||||
currentPlayer.hidePlayer(FightSystem.getPlugin(), player);
|
||||
player.hidePlayer(FightSystem.getPlugin(), currentPlayer);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(gameMode == GameMode.SURVIVAL) {
|
||||
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if(currentPlayer.getUniqueId() != player.getUniqueId() && currentPlayer.getGameMode() == GameMode.SPECTATOR) {
|
||||
currentPlayer.showPlayer(FightSystem.getPlugin(), player);
|
||||
player.showPlayer(FightSystem.getPlugin(), currentPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class FightTeam implements IFightTeam{
|
||||
invited.remove(player);
|
||||
team.addEntry(player.getName());
|
||||
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
Fight.setPlayerGamemode(player, GameMode.SURVIVAL);
|
||||
player.teleport(spawn);
|
||||
if(KitManager.getKits(false).size() > 1)
|
||||
player.getInventory().setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit wählen").build());
|
||||
@ -167,7 +167,7 @@ public class FightTeam implements IFightTeam{
|
||||
if(fightPlayer.equals(leader) && FightSystem.getFightState().setup())
|
||||
setLeader(null);
|
||||
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||
player.teleport(Config.SpecSpawn);
|
||||
TechHider.reloadChunks(player, chunksToReload);
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ public class PlayerStateListener extends BasicListener{
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
|
||||
if (fightTeam == null) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||
player.teleport(Config.SpecSpawn);
|
||||
} else {
|
||||
player.teleport(fightTeam.getSpawn());
|
||||
if(FightSystem.getFightState().setup())
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
Fight.setPlayerGamemode(player, GameMode.SURVIVAL);
|
||||
else
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class PlayerStateListener extends BasicListener{
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §cist gestorben!");
|
||||
event.setDeathMessage(null);
|
||||
fightTeam.getFightPlayer(player).setOut();
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||
player.teleport(fightTeam.getSpawn());
|
||||
Fight.playSound(Countdown.getSound(SWSound.ENTITY_WITHER_DEATH), 100.0F, 1.0F);
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Diese Befehle gibts in der 1.8 noch nicht, da gibts nur die Variante ohne Plugin als Argument.
gefixt. Habe das für jede Version hinzugefügt, da wir uns mal geeinigt haben, dass wir das so machen absofort, da man sonst vlt nicht weiß welche Version man nutzen soll. Bsp: Habe eine 1.8 und eine 1.12 Klasse aber keine für 1.9-1.10. Jetzt weiß man nicht direkt ob man die 1.8 oder 1.12 nutzen muss für die dazwischenliegenden Versionen. Deshalb habe ich das jetzt so "ausführlich" gemacht