mirror of https://github.com/LOOHP/Limbo.git
reorganize classes for a better future
This commit is contained in:
parent
e8a7d68e3b
commit
2d77a0e15c
2
pom.xml
2
pom.xml
|
|
@ -5,7 +5,7 @@
|
||||||
<groupId>com.loohp.limbo</groupId>
|
<groupId>com.loohp.limbo</groupId>
|
||||||
<artifactId>Limbo</artifactId>
|
<artifactId>Limbo</artifactId>
|
||||||
<name>Limbo</name>
|
<name>Limbo</name>
|
||||||
<version>0.4.1-ALPHA</version>
|
<version>0.4.2-ALPHA</version>
|
||||||
|
|
||||||
<description>Standalone Limbo Minecraft Server.</description>
|
<description>Standalone Limbo Minecraft Server.</description>
|
||||||
<url>https://github.com/LOOHP/Limbo</url>
|
<url>https://github.com/LOOHP/Limbo</url>
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,12 @@ public class Console implements CommandSender {
|
||||||
tabReader.setAutosuggestion(SuggestionType.NONE);
|
tabReader.setAutosuggestion(SuggestionType.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return CONSOLE;
|
return CONSOLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return Limbo.getInstance().getPermissionsManager().hasPermission(this, permission);
|
return Limbo.getInstance().getPermissionsManager().hasPermission(this, permission);
|
||||||
}
|
}
|
||||||
|
|
@ -121,6 +123,7 @@ public class Console implements CommandSender {
|
||||||
sendMessage(component);
|
sendMessage(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendMessage(String message, UUID uuid) {
|
public void sendMessage(String message, UUID uuid) {
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
@ -135,6 +138,7 @@ public class Console implements CommandSender {
|
||||||
sendMessage(String.join("", Arrays.asList(component).stream().map(each -> each.toLegacyText()).collect(Collectors.toList())));
|
sendMessage(String.join("", Arrays.asList(component).stream().map(each -> each.toLegacyText()).collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
stashLine();
|
stashLine();
|
||||||
String date = new SimpleDateFormat("HH':'mm':'ss").format(new Date());
|
String date = new SimpleDateFormat("HH':'mm':'ss").format(new Date());
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.loohp.limbo.Entity;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Location.Location;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
import com.loohp.limbo.Utils.NamespacedKey;
|
import com.loohp.limbo.Utils.NamespacedKey;
|
||||||
import com.loohp.limbo.World.World;
|
import com.loohp.limbo.World.World;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Events.Cancellable;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
||||||
public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Events.Event;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
||||||
public class PlayerEvent extends Event {
|
public class PlayerEvent extends Event {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
import com.loohp.limbo.Location.Location;
|
import com.loohp.limbo.Location.Location;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Events.Cancellable;
|
||||||
|
import com.loohp.limbo.Events.Event;
|
||||||
import com.loohp.limbo.Server.ClientConnection;
|
import com.loohp.limbo.Server.ClientConnection;
|
||||||
|
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Events.Cancellable;
|
||||||
import com.loohp.limbo.Location.Location;
|
import com.loohp.limbo.Location.Location;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Events.Cancellable;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
||||||
public class PlayerSelectedSlotChangeEvent extends PlayerEvent implements Cancellable {
|
public class PlayerSelectedSlotChangeEvent extends PlayerEvent implements Cancellable {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Player;
|
||||||
|
|
||||||
import com.loohp.limbo.Location.Location;
|
import com.loohp.limbo.Location.Location;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package com.loohp.limbo.Events;
|
package com.loohp.limbo.Events.Status;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Events.Event;
|
||||||
import com.loohp.limbo.Server.ClientConnection;
|
import com.loohp.limbo.Server.ClientConnection;
|
||||||
|
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
|
@ -42,6 +42,7 @@ public class ServerProperties {
|
||||||
private boolean bungeecord;
|
private boolean bungeecord;
|
||||||
private int viewDistance;
|
private int viewDistance;
|
||||||
private double ticksPerSecond;
|
private double ticksPerSecond;
|
||||||
|
private boolean handshakeVerbose;
|
||||||
|
|
||||||
Optional<BufferedImage> favicon;
|
Optional<BufferedImage> favicon;
|
||||||
|
|
||||||
|
|
@ -92,6 +93,7 @@ public class ServerProperties {
|
||||||
bungeecord = Boolean.parseBoolean(prop.getProperty("bungeecord"));
|
bungeecord = Boolean.parseBoolean(prop.getProperty("bungeecord"));
|
||||||
viewDistance = Integer.parseInt(prop.getProperty("view-distance"));
|
viewDistance = Integer.parseInt(prop.getProperty("view-distance"));
|
||||||
ticksPerSecond = Double.parseDouble(prop.getProperty("ticks-per-second"));
|
ticksPerSecond = Double.parseDouble(prop.getProperty("ticks-per-second"));
|
||||||
|
handshakeVerbose = Boolean.parseBoolean(prop.getProperty("handshake-verbose"));
|
||||||
|
|
||||||
File png = new File("server-icon.png");
|
File png = new File("server-icon.png");
|
||||||
if (png.exists()) {
|
if (png.exists()) {
|
||||||
|
|
@ -193,4 +195,8 @@ public class ServerProperties {
|
||||||
return ticksPerSecond;
|
return ticksPerSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean handshakeVerboseEnabled() {
|
||||||
|
return handshakeVerbose;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import com.loohp.limbo.Entity.DataWatcher.WatchableField;
|
||||||
import com.loohp.limbo.Entity.DataWatcher.WatchableObjectType;
|
import com.loohp.limbo.Entity.DataWatcher.WatchableObjectType;
|
||||||
import com.loohp.limbo.Entity.EntityType;
|
import com.loohp.limbo.Entity.EntityType;
|
||||||
import com.loohp.limbo.Entity.LivingEntity;
|
import com.loohp.limbo.Entity.LivingEntity;
|
||||||
import com.loohp.limbo.Events.PlayerChatEvent;
|
import com.loohp.limbo.Events.Player.PlayerChatEvent;
|
||||||
import com.loohp.limbo.Events.PlayerTeleportEvent;
|
import com.loohp.limbo.Events.Player.PlayerTeleportEvent;
|
||||||
import com.loohp.limbo.Location.Location;
|
import com.loohp.limbo.Location.Location;
|
||||||
import com.loohp.limbo.Server.ClientConnection;
|
import com.loohp.limbo.Server.ClientConnection;
|
||||||
import com.loohp.limbo.Server.Packets.PacketPlayOutChat;
|
import com.loohp.limbo.Server.Packets.PacketPlayOutChat;
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,13 @@ import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.loohp.limbo.DeclareCommands;
|
|
||||||
import com.loohp.limbo.Limbo;
|
import com.loohp.limbo.Limbo;
|
||||||
import com.loohp.limbo.Events.PlayerJoinEvent;
|
import com.loohp.limbo.Events.Player.PlayerJoinEvent;
|
||||||
import com.loohp.limbo.Events.PlayerLoginEvent;
|
import com.loohp.limbo.Events.Player.PlayerLoginEvent;
|
||||||
import com.loohp.limbo.Events.PlayerMoveEvent;
|
import com.loohp.limbo.Events.Player.PlayerMoveEvent;
|
||||||
import com.loohp.limbo.Events.PlayerQuitEvent;
|
import com.loohp.limbo.Events.Player.PlayerQuitEvent;
|
||||||
import com.loohp.limbo.Events.PlayerSelectedSlotChangeEvent;
|
import com.loohp.limbo.Events.Player.PlayerSelectedSlotChangeEvent;
|
||||||
import com.loohp.limbo.Events.StatusPingEvent;
|
import com.loohp.limbo.Events.Status.StatusPingEvent;
|
||||||
import com.loohp.limbo.File.ServerProperties;
|
import com.loohp.limbo.File.ServerProperties;
|
||||||
import com.loohp.limbo.Location.Location;
|
import com.loohp.limbo.Location.Location;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
|
|
@ -63,6 +62,7 @@ import com.loohp.limbo.Server.Packets.PacketStatusOutPong;
|
||||||
import com.loohp.limbo.Server.Packets.PacketStatusOutResponse;
|
import com.loohp.limbo.Server.Packets.PacketStatusOutResponse;
|
||||||
import com.loohp.limbo.Utils.CustomStringUtils;
|
import com.loohp.limbo.Utils.CustomStringUtils;
|
||||||
import com.loohp.limbo.Utils.DataTypeIO;
|
import com.loohp.limbo.Utils.DataTypeIO;
|
||||||
|
import com.loohp.limbo.Utils.DeclareCommands;
|
||||||
import com.loohp.limbo.Utils.GameMode;
|
import com.loohp.limbo.Utils.GameMode;
|
||||||
import com.loohp.limbo.Utils.MojangAPIUtils;
|
import com.loohp.limbo.Utils.MojangAPIUtils;
|
||||||
import com.loohp.limbo.Utils.MojangAPIUtils.SkinResponse;
|
import com.loohp.limbo.Utils.MojangAPIUtils.SkinResponse;
|
||||||
|
|
@ -157,7 +157,7 @@ public class ClientConnection extends Thread {
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnectDuringLogin(BaseComponent[] reason) {
|
private void disconnectDuringLogin(BaseComponent[] reason) {
|
||||||
try {
|
try {
|
||||||
PacketLoginOutDisconnect packet = new PacketLoginOutDisconnect(ComponentSerializer.toString(reason));
|
PacketLoginOutDisconnect packet = new PacketLoginOutDisconnect(ComponentSerializer.toString(reason));
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
@ -205,88 +205,95 @@ public class ClientConnection extends Thread {
|
||||||
UUID bungeeUUID = null;
|
UUID bungeeUUID = null;
|
||||||
SkinResponse bungeeSkin = null;
|
SkinResponse bungeeSkin = null;
|
||||||
|
|
||||||
switch (handshake.getHandshakeType()) {
|
try {
|
||||||
case STATUS:
|
switch (handshake.getHandshakeType()) {
|
||||||
state = ClientState.STATUS;
|
case STATUS:
|
||||||
while (client_socket.isConnected()) {
|
state = ClientState.STATUS;
|
||||||
DataTypeIO.readVarInt(input);
|
while (client_socket.isConnected()) {
|
||||||
int packetId = DataTypeIO.readVarInt(input);
|
DataTypeIO.readVarInt(input);
|
||||||
Class<? extends Packet> packetType = Packet.getStatusIn().get(packetId);
|
int packetId = DataTypeIO.readVarInt(input);
|
||||||
if (packetType == null) {
|
Class<? extends Packet> packetType = Packet.getStatusIn().get(packetId);
|
||||||
//do nothing
|
if (packetType == null) {
|
||||||
} else if (packetType.equals(PacketStatusInRequest.class)) {
|
//do nothing
|
||||||
String str = client_socket.getInetAddress().getHostName() + ":" + client_socket.getPort();
|
} else if (packetType.equals(PacketStatusInRequest.class)) {
|
||||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Handshake Status has pinged");
|
String str = client_socket.getInetAddress().getHostName() + ":" + client_socket.getPort();
|
||||||
ServerProperties p = Limbo.getInstance().getServerProperties();
|
if (Limbo.getInstance().getServerProperties().handshakeVerboseEnabled()) {
|
||||||
StatusPingEvent event = Limbo.getInstance().getEventsManager().callEvent(new StatusPingEvent(this, p.getVersionString(), p.getProtocol(), ComponentSerializer.parse(p.getMotdJson()), p.getMaxPlayers(), Limbo.getInstance().getPlayers().size(), p.getFavicon().orElse(null)));
|
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Handshake Status has pinged");
|
||||||
PacketStatusOutResponse packet = new PacketStatusOutResponse(Limbo.getInstance().buildServerListResponseJson(event.getVersion(), event.getProtocol(), event.getMotd(), event.getMaxPlayers(), event.getPlayersOnline(), event.getFavicon()));
|
}
|
||||||
sendPacket(packet);
|
ServerProperties p = Limbo.getInstance().getServerProperties();
|
||||||
} else if (packetType.equals(PacketStatusInPing.class)) {
|
StatusPingEvent event = Limbo.getInstance().getEventsManager().callEvent(new StatusPingEvent(this, p.getVersionString(), p.getProtocol(), ComponentSerializer.parse(p.getMotdJson()), p.getMaxPlayers(), Limbo.getInstance().getPlayers().size(), p.getFavicon().orElse(null)));
|
||||||
PacketStatusInPing ping = new PacketStatusInPing(input);
|
PacketStatusOutResponse packet = new PacketStatusOutResponse(Limbo.getInstance().buildServerListResponseJson(event.getVersion(), event.getProtocol(), event.getMotd(), event.getMaxPlayers(), event.getPlayersOnline(), event.getFavicon()));
|
||||||
PacketStatusOutPong packet = new PacketStatusOutPong(ping.getPayload());
|
sendPacket(packet);
|
||||||
sendPacket(packet);
|
} else if (packetType.equals(PacketStatusInPing.class)) {
|
||||||
break;
|
PacketStatusInPing ping = new PacketStatusInPing(input);
|
||||||
|
PacketStatusOutPong packet = new PacketStatusOutPong(ping.getPayload());
|
||||||
|
sendPacket(packet);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case LOGIN:
|
||||||
case LOGIN:
|
state = ClientState.LOGIN;
|
||||||
state = ClientState.LOGIN;
|
|
||||||
|
|
||||||
if (isBungeecord) {
|
|
||||||
try {
|
|
||||||
String[] data = bungeeForwarding.split("\\x00");
|
|
||||||
//String host = data[0];
|
|
||||||
String ip = data[1];
|
|
||||||
|
|
||||||
bungeeUUID = UUID.fromString(data[2].replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5"));
|
|
||||||
inetAddress = InetAddress.getByName(ip);
|
|
||||||
|
|
||||||
if (data.length > 3) {
|
|
||||||
String skinJson = data[3];
|
|
||||||
|
|
||||||
String skin = skinJson.split("\"value\":\"")[1].split("\"")[0];
|
|
||||||
String signature = skinJson.split("\"signature\":\"")[1].split("\"")[0];
|
|
||||||
bungeeSkin = new SkinResponse(skin, signature);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Limbo.getInstance().getConsole().sendMessage("If you wish to use bungeecord's IP forwarding, please enable that in your bungeecord config.yml as well!");
|
|
||||||
disconnectDuringLogin(new BaseComponent[] {new TextComponent(ChatColor.RED + "Please connect from the proxy!")});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (client_socket.isConnected()) {
|
|
||||||
int size = DataTypeIO.readVarInt(input);
|
|
||||||
int packetId = DataTypeIO.readVarInt(input);
|
|
||||||
Class<? extends Packet> packetType = Packet.getLoginIn().get(packetId);
|
|
||||||
|
|
||||||
if (packetType == null) {
|
if (isBungeecord) {
|
||||||
input.skipBytes(size - DataTypeIO.getVarIntLength(packetId));
|
try {
|
||||||
} else if (packetType.equals(PacketLoginInLoginStart.class)) {
|
String[] data = bungeeForwarding.split("\\x00");
|
||||||
PacketLoginInLoginStart start = new PacketLoginInLoginStart(input);
|
//String host = data[0];
|
||||||
String username = start.getUsername();
|
String ip = data[1];
|
||||||
UUID uuid = isBungeecord ? bungeeUUID : UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(StandardCharsets.UTF_8));
|
|
||||||
|
bungeeUUID = UUID.fromString(data[2].replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5"));
|
||||||
|
inetAddress = InetAddress.getByName(ip);
|
||||||
|
|
||||||
|
if (data.length > 3) {
|
||||||
|
String skinJson = data[3];
|
||||||
|
|
||||||
|
String skin = skinJson.split("\"value\":\"")[1].split("\"")[0];
|
||||||
|
String signature = skinJson.split("\"signature\":\"")[1].split("\"")[0];
|
||||||
|
bungeeSkin = new SkinResponse(skin, signature);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Limbo.getInstance().getConsole().sendMessage("If you wish to use bungeecord's IP forwarding, please enable that in your bungeecord config.yml as well!");
|
||||||
|
disconnectDuringLogin(new BaseComponent[] {new TextComponent(ChatColor.RED + "Please connect from the proxy!")});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (client_socket.isConnected()) {
|
||||||
|
int size = DataTypeIO.readVarInt(input);
|
||||||
|
int packetId = DataTypeIO.readVarInt(input);
|
||||||
|
Class<? extends Packet> packetType = Packet.getLoginIn().get(packetId);
|
||||||
|
|
||||||
PacketLoginOutLoginSuccess success = new PacketLoginOutLoginSuccess(uuid, username);
|
if (packetType == null) {
|
||||||
sendPacket(success);
|
input.skipBytes(size - DataTypeIO.getVarIntLength(packetId));
|
||||||
|
} else if (packetType.equals(PacketLoginInLoginStart.class)) {
|
||||||
state = ClientState.PLAY;
|
PacketLoginInLoginStart start = new PacketLoginInLoginStart(input);
|
||||||
|
String username = start.getUsername();
|
||||||
player = new Player(this, username, uuid, Limbo.getInstance().getNextEntityId(), Limbo.getInstance().getServerProperties().getWorldSpawn(), new PlayerInteractManager());
|
UUID uuid = isBungeecord ? bungeeUUID : UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(StandardCharsets.UTF_8));
|
||||||
player.setSkinLayers((byte) (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));
|
|
||||||
Limbo.getInstance().addPlayer(player);
|
PacketLoginOutLoginSuccess success = new PacketLoginOutLoginSuccess(uuid, username);
|
||||||
|
sendPacket(success);
|
||||||
break;
|
|
||||||
} else {
|
state = ClientState.PLAY;
|
||||||
input.skipBytes(size - DataTypeIO.getVarIntLength(packetId));
|
|
||||||
|
player = new Player(this, username, uuid, Limbo.getInstance().getNextEntityId(), Limbo.getInstance().getServerProperties().getWorldSpawn(), new PlayerInteractManager());
|
||||||
|
player.setSkinLayers((byte) (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));
|
||||||
|
Limbo.getInstance().addPlayer(player);
|
||||||
|
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
input.skipBytes(size - DataTypeIO.getVarIntLength(packetId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerLoginEvent event = Limbo.getInstance().getEventsManager().callEvent(new PlayerLoginEvent(this, false));
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
disconnectDuringLogin(event.getCancelReason());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
break;
|
||||||
PlayerLoginEvent event = Limbo.getInstance().getEventsManager().callEvent(new PlayerLoginEvent(this, false));
|
}
|
||||||
if (event.isCancelled()) {
|
} catch (Exception e) {
|
||||||
disconnectDuringLogin(event.getCancelReason());
|
client_socket.close();
|
||||||
}
|
state = ClientState.DISCONNECTED;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == ClientState.PLAY) {
|
if (state == ClientState.PLAY) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class KeepAliveSender extends Thread {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
for (ClientConnection client : Limbo.getInstance().getServerConnection().getClients()) {
|
for (ClientConnection client : Limbo.getInstance().getServerConnection().getClients()) {
|
||||||
if (client.getClientState().equals(ClientState.PLAY)) {
|
if (client.getClientState() != null && client.getClientState().equals(ClientState.PLAY)) {
|
||||||
try {
|
try {
|
||||||
PacketPlayOutKeepAlive packet = new PacketPlayOutKeepAlive(random.nextLong());
|
PacketPlayOutKeepAlive packet = new PacketPlayOutKeepAlive(random.nextLong());
|
||||||
client.setLastKeepAlivePayLoad(packet.getPayload());
|
client.setLastKeepAlivePayLoad(packet.getPayload());
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.loohp.limbo;
|
package com.loohp.limbo.Utils;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|
@ -6,9 +6,9 @@ import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Limbo;
|
||||||
import com.loohp.limbo.Commands.CommandSender;
|
import com.loohp.limbo.Commands.CommandSender;
|
||||||
import com.loohp.limbo.Server.Packets.PacketPlayOutDeclareCommands;
|
import com.loohp.limbo.Server.Packets.PacketPlayOutDeclareCommands;
|
||||||
import com.loohp.limbo.Utils.DataTypeIO;
|
|
||||||
|
|
||||||
public class DeclareCommands {
|
public class DeclareCommands {
|
||||||
|
|
||||||
|
|
@ -34,6 +34,9 @@ view-distance=6
|
||||||
#Ticks per second of the server
|
#Ticks per second of the server
|
||||||
ticks-per-second=5
|
ticks-per-second=5
|
||||||
|
|
||||||
|
#Should a message be printed to the console when a handshake occurs
|
||||||
|
handshake-verbose=true
|
||||||
|
|
||||||
#Server list message in Json
|
#Server list message in Json
|
||||||
motd={"text":"","extra":[{"text":"Limbo Server!","color":"yellow"}]}
|
motd={"text":"","extra":[{"text":"Limbo Server!","color":"yellow"}]}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue