SteamWar/FightSystem
Archiviert
13
1

Merge branch 'player_hider' of SteamWar/FightSystem into master

Dieser Commit ist enthalten in:
Lixfel 2020-01-16 17:04:41 +01:00 committet von Gitea
Commit 45305ee3cc
4 geänderte Dateien mit 33 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -1,7 +1,10 @@
package de.steamwar.fightsystem.fight;
import de.steamwar.core.Core;
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 +86,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(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);
}
}
}
}
}

Datei anzeigen

@ -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);
}

Datei anzeigen

@ -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);
}