Gamemode 1 packet
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
92a3eaefb9
Commit
de0d7d7340
@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -27,7 +30,9 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class Fight {
|
public class Fight {
|
||||||
private Fight(){}
|
private Fight(){}
|
||||||
@ -36,8 +41,12 @@ public class Fight {
|
|||||||
public static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBluePrefix, Config.TeamBlueSpawn, Config.TeamBlueCornerX, Config.TeamBlueCornerY, Config.TeamBlueCornerZ, Config.TeamBlueRotate, true, Config.BlueLeader);
|
public static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBluePrefix, Config.TeamBlueSpawn, Config.TeamBlueCornerX, Config.TeamBlueCornerY, Config.TeamBlueCornerZ, Config.TeamBlueRotate, true, Config.BlueLeader);
|
||||||
private static int schemRank;
|
private static int schemRank;
|
||||||
|
|
||||||
|
private static final PacketContainer gm_1_packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.GAME_STATE_CHANGE);
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
IFight.init(redTeam, blueTeam);
|
IFight.init(redTeam, blueTeam);
|
||||||
|
gm_1_packet.getBytes().write(0, (byte)3);
|
||||||
|
gm_1_packet.getFloat().write(0, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FightTeam getPlayerTeam(Player player) {
|
public static FightTeam getPlayerTeam(Player player) {
|
||||||
@ -112,6 +121,11 @@ public class Fight {
|
|||||||
player.setGameMode(gameMode);
|
player.setGameMode(gameMode);
|
||||||
|
|
||||||
if(gameMode == GameMode.SPECTATOR) {
|
if(gameMode == GameMode.SPECTATOR) {
|
||||||
|
try {
|
||||||
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, gm_1_packet);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
Bukkit.getLogger().log(Level.SEVERE, "Invocation target exception", e);
|
||||||
|
}
|
||||||
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
if(currentPlayer.getUniqueId() != player.getUniqueId() && currentPlayer.getGameMode() == GameMode.SPECTATOR) {
|
if(currentPlayer.getUniqueId() != player.getUniqueId() && currentPlayer.getGameMode() == GameMode.SPECTATOR) {
|
||||||
currentPlayer.hidePlayer(player);
|
currentPlayer.hidePlayer(player);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren