closes #91 added spec hider #97
@ -266,10 +266,10 @@ public class FightSystem extends JavaPlugin {
|
|||||||
|
|
||||||
private static void setAllPlayersGM(GameMode gm) {
|
private static void setAllPlayersGM(GameMode gm) {
|
||||||
for(FightPlayer fightPlayer: Fight.getBlueTeam().getPlayers()){
|
for(FightPlayer fightPlayer: Fight.getBlueTeam().getPlayers()){
|
||||||
fightPlayer.getPlayer().setGameMode(gm);
|
Fight.setPlayerGamemode(fightPlayer.getPlayer(), gm);
|
||||||
}
|
}
|
||||||
for(FightPlayer fightPlayer: Fight.getRedTeam().getPlayers()){
|
for(FightPlayer fightPlayer: Fight.getRedTeam().getPlayers()){
|
||||||
fightPlayer.getPlayer().setGameMode(gm);
|
Fight.setPlayerGamemode(fightPlayer.getPlayer(), gm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -83,4 +86,26 @@ public class Fight {
|
|||||||
Fight.getRedTeam().replaceSync(Config.ReplaceBedrock, Material.BEDROCK, Material.SLIME_BLOCK);
|
Fight.getRedTeam().replaceSync(Config.ReplaceBedrock, Material.BEDROCK, Material.SLIME_BLOCK);
|
||||||
Fight.getBlueTeam().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(player);
|
||||||
|
player.hidePlayer(currentPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gameMode == GameMode.SURVIVAL) {
|
||||||
|
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
if(currentPlayer.getUniqueId() != player.getUniqueId() && currentPlayer.getGameMode() == GameMode.SPECTATOR) {
|
||||||
|
currentPlayer.showPlayer(player);
|
||||||
|
player.showPlayer(currentPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public class FightTeam implements IFightTeam{
|
|||||||
invited.remove(player);
|
invited.remove(player);
|
||||||
team.addEntry(player.getName());
|
team.addEntry(player.getName());
|
||||||
|
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
Fight.setPlayerGamemode(player, GameMode.SURVIVAL);
|
||||||
player.teleport(spawn);
|
player.teleport(spawn);
|
||||||
if(KitManager.getKits(false).size() > 1)
|
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());
|
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())
|
if(fightPlayer.equals(leader) && FightSystem.getFightState().setup())
|
||||||
setLeader(null);
|
setLeader(null);
|
||||||
|
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||||
player.teleport(Config.SpecSpawn);
|
player.teleport(Config.SpecSpawn);
|
||||||
TechHider.reloadChunks(player, chunksToReload);
|
TechHider.reloadChunks(player, chunksToReload);
|
||||||
}
|
}
|
||||||
|
@ -40,14 +40,14 @@ public class PlayerStateListener extends BasicListener{
|
|||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
|
|
||||||
if (fightTeam == null) {
|
if (fightTeam == null) {
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||||
player.teleport(Config.SpecSpawn);
|
player.teleport(Config.SpecSpawn);
|
||||||
} else {
|
} else {
|
||||||
player.teleport(fightTeam.getSpawn());
|
player.teleport(fightTeam.getSpawn());
|
||||||
if(FightSystem.getFightState().setup())
|
if(FightSystem.getFightState().setup())
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
Fight.setPlayerGamemode(player, GameMode.SURVIVAL);
|
||||||
else
|
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!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §cist gestorben!");
|
||||||
event.setDeathMessage(null);
|
event.setDeathMessage(null);
|
||||||
fightTeam.getFightPlayer(player).setOut();
|
fightTeam.getFightPlayer(player).setOut();
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||||
player.teleport(fightTeam.getSpawn());
|
player.teleport(fightTeam.getSpawn());
|
||||||
Fight.playSound(Countdown.getSound(SWSound.ENTITY_WITHER_DEATH), 100.0F, 1.0F);
|
Fight.playSound(Countdown.getSound(SWSound.ENTITY_WITHER_DEATH), 100.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren