Dieser Commit ist enthalten in:
Ursprung
ef236311b0
Commit
24b974d032
@ -20,10 +20,8 @@
|
|||||||
package de.steamwar.lobby;
|
package de.steamwar.lobby;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import de.steamwar.comms.BungeeReceiver;
|
|
||||||
import de.steamwar.comms.PacketIdManager;
|
|
||||||
import de.steamwar.comms.packets.FightInfoPacket;
|
|
||||||
import de.steamwar.lobby.portal.FightserverPortal;
|
import de.steamwar.lobby.portal.FightserverPortal;
|
||||||
|
import de.steamwar.network.packets.common.FightInfoPacket;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@ -36,17 +34,15 @@ public class Fightserver {
|
|||||||
private static final Map<String, Fightserver> servers = new HashMap<>();
|
private static final Map<String, Fightserver> servers = new HashMap<>();
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
BungeeReceiver.registerHandler(PacketIdManager.FIGHT_INFO, Fightserver::newFightInfo);
|
|
||||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), Fightserver::removeStopped, 20, 20);
|
Bukkit.getScheduler().runTaskTimer(LobbySystem.getPlugin(), Fightserver::removeStopped, 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void newFightInfo(ByteArrayDataInput in) {
|
public static void newFightInfo(FightInfoPacket in) {
|
||||||
FightInfoPacket fightInfo = new FightInfoPacket(in);
|
Fightserver server = servers.get(in.getServerName());
|
||||||
Fightserver server = servers.get(fightInfo.getServerName());
|
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
new Fightserver(fightInfo);
|
new Fightserver(in);
|
||||||
} else {
|
} else {
|
||||||
server.update(fightInfo);
|
server.update(in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/de/steamwar/lobby/LobbyPacketHandler.java
Normale Datei
18
src/de/steamwar/lobby/LobbyPacketHandler.java
Normale Datei
@ -0,0 +1,18 @@
|
|||||||
|
package de.steamwar.lobby;
|
||||||
|
|
||||||
|
import de.steamwar.network.packets.PacketHandler;
|
||||||
|
import de.steamwar.network.packets.common.FightInfoPacket;
|
||||||
|
|
||||||
|
public class LobbyPacketHandler extends PacketHandler {
|
||||||
|
|
||||||
|
public LobbyPacketHandler() {
|
||||||
|
super();
|
||||||
|
this.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Handler
|
||||||
|
public void handleFightserver(FightInfoPacket packet) {
|
||||||
|
Fightserver.newFightInfo(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -68,6 +68,7 @@ public class LobbySystem extends JavaPlugin {
|
|||||||
new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X);
|
new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X);
|
||||||
new AlphaWall(l -> l.getZ() > 892, AlphaWall.REFLECT_Z);
|
new AlphaWall(l -> l.getZ() > 892, AlphaWall.REFLECT_Z);
|
||||||
new AlphaWall(l -> l.getZ() < 1794, AlphaWall.REFLECT_Z);
|
new AlphaWall(l -> l.getZ() < 1794, AlphaWall.REFLECT_Z);
|
||||||
|
new LobbyPacketHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,19 +19,20 @@
|
|||||||
|
|
||||||
package de.steamwar.lobby;
|
package de.steamwar.lobby;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import de.steamwar.network.packets.PacketHandler;
|
||||||
import de.steamwar.comms.BungeeReceiver;
|
|
||||||
import de.steamwar.comms.PacketIdManager;
|
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
|
import de.steamwar.network.packets.server.StartingServerPacket;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
|
||||||
public class WaitingHall {
|
public class WaitingHall extends PacketHandler {
|
||||||
public WaitingHall() {
|
public WaitingHall() {
|
||||||
BungeeReceiver.registerHandler(PacketIdManager.STARTING_SERVER, this::serverStarting);
|
super();
|
||||||
|
this.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void serverStarting(ByteArrayDataInput in) {
|
@Handler
|
||||||
Bukkit.getPlayer(SteamwarUser.get(in.readInt()).getUUID()).teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
private void serverStarting(StartingServerPacket in) {
|
||||||
|
Bukkit.getPlayer(SteamwarUser.get(in.getUser()).getUUID()).teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,10 @@
|
|||||||
|
|
||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
import de.steamwar.comms.packets.ImALobbyPacket;
|
|
||||||
import de.steamwar.lobby.LobbySystem;
|
import de.steamwar.lobby.LobbySystem;
|
||||||
import de.steamwar.lobby.util.ItemBuilder;
|
import de.steamwar.lobby.util.ItemBuilder;
|
||||||
|
import de.steamwar.network.NetworkSender;
|
||||||
|
import de.steamwar.network.packets.client.ImALobbyPacket;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -57,7 +58,7 @@ public class PlayerSpawn extends BasicListener {
|
|||||||
player.setFoodLevel(20);
|
player.setFoodLevel(20);
|
||||||
giveItems(player);
|
giveItems(player);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> new ImALobbyPacket().send(player), 20);
|
Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> NetworkSender.send(new ImALobbyPacket()), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void giveItems(Player player) {
|
private void giveItems(Player player) {
|
||||||
|
@ -19,10 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.lobby.portal;
|
package de.steamwar.lobby.portal;
|
||||||
|
|
||||||
import de.steamwar.comms.packets.ExecuteCommandPacket;
|
|
||||||
import de.steamwar.lobby.LobbySystem;
|
import de.steamwar.lobby.LobbySystem;
|
||||||
import de.steamwar.lobby.command.ModifyCommand;
|
import de.steamwar.lobby.command.ModifyCommand;
|
||||||
import de.steamwar.lobby.listener.Portals;
|
import de.steamwar.lobby.listener.Portals;
|
||||||
|
import de.steamwar.network.NetworkSender;
|
||||||
|
import de.steamwar.network.packets.client.ExecuteCommandPacket;
|
||||||
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ public class CommandPortal implements PortalHandler {
|
|||||||
|
|
||||||
if(ModifyCommand.modifying(player))
|
if(ModifyCommand.modifying(player))
|
||||||
player.sendMessage("/" + cmd);
|
player.sendMessage("/" + cmd);
|
||||||
new ExecuteCommandPacket(player, cmd.toString()).send(player);
|
NetworkSender.send(new ExecuteCommandPacket(SteamwarUser.get(player).getId(), cmd.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
package de.steamwar.lobby.portal;
|
package de.steamwar.lobby.portal;
|
||||||
|
|
||||||
import de.steamwar.comms.packets.FightInfoPacket;
|
|
||||||
import de.steamwar.lobby.Fightserver;
|
import de.steamwar.lobby.Fightserver;
|
||||||
import de.steamwar.lobby.LobbySystem;
|
import de.steamwar.lobby.LobbySystem;
|
||||||
import de.steamwar.lobby.display.Hologram;
|
import de.steamwar.lobby.display.Hologram;
|
||||||
import de.steamwar.lobby.display.NPC;
|
import de.steamwar.lobby.display.NPC;
|
||||||
|
import de.steamwar.network.packets.common.FightInfoPacket;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren