mirror of https://github.com/LOOHP/Limbo.git
Polished tab header footer & default command handling & other internal code
This commit is contained in:
parent
a3b25de473
commit
6847f46a3b
2
pom.xml
2
pom.xml
|
|
@ -5,7 +5,7 @@
|
||||||
<groupId>com.loohp</groupId>
|
<groupId>com.loohp</groupId>
|
||||||
<artifactId>Limbo</artifactId>
|
<artifactId>Limbo</artifactId>
|
||||||
<name>Limbo</name>
|
<name>Limbo</name>
|
||||||
<version>0.6.3-ALPHA</version>
|
<version>0.6.4-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>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import org.json.simple.parser.ParseException;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.loohp.limbo.commands.CommandSender;
|
import com.loohp.limbo.commands.CommandSender;
|
||||||
import com.loohp.limbo.commands.Defaults;
|
import com.loohp.limbo.commands.DefaultCommands;
|
||||||
import com.loohp.limbo.consolegui.GUI;
|
import com.loohp.limbo.consolegui.GUI;
|
||||||
import com.loohp.limbo.events.EventsManager;
|
import com.loohp.limbo.events.EventsManager;
|
||||||
import com.loohp.limbo.file.ServerProperties;
|
import com.loohp.limbo.file.ServerProperties;
|
||||||
|
|
@ -292,16 +292,7 @@ public class Limbo {
|
||||||
pluginFolder = new File("plugins");
|
pluginFolder = new File("plugins");
|
||||||
pluginFolder.mkdirs();
|
pluginFolder.mkdirs();
|
||||||
|
|
||||||
// File defaultCommandsJar = new File(pluginFolder, "LimboDefaultCmd.jar");
|
pluginManager = new PluginManager(new DefaultCommands(), pluginFolder);
|
||||||
// defaultCommandsJar.delete();
|
|
||||||
// console.sendMessage("Loading limbo default commands module...");
|
|
||||||
// try (InputStream in = Limbo.class.getClassLoader().getResourceAsStream("LimboDefaultCmd.jar")) {
|
|
||||||
// Files.copy(in, defaultCommandsJar.toPath());
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
|
|
||||||
pluginManager = new PluginManager(pluginFolder);
|
|
||||||
try {
|
try {
|
||||||
Method loadPluginsMethod = PluginManager.class.getDeclaredMethod("loadPlugins");
|
Method loadPluginsMethod = PluginManager.class.getDeclaredMethod("loadPlugins");
|
||||||
loadPluginsMethod.setAccessible(true);
|
loadPluginsMethod.setAccessible(true);
|
||||||
|
|
@ -323,9 +314,7 @@ public class Limbo {
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
Limbo.getInstance().terminate();
|
Limbo.getInstance().terminate();
|
||||||
}));
|
}));
|
||||||
console.sendMessage("Enabling Commands");
|
|
||||||
registerDefaultCommands();
|
|
||||||
console.sendMessage("Default Commands Enabled");
|
|
||||||
console.run();
|
console.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -415,11 +404,6 @@ public class Limbo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerDefaultCommands() {
|
|
||||||
LimboPlugin plug = new LimboPlugin();
|
|
||||||
getPluginManager().registerCommands(plug, new Defaults());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerProperties getServerProperties() {
|
public ServerProperties getServerProperties() {
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,222 @@
|
||||||
|
package com.loohp.limbo.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.loohp.limbo.Console;
|
||||||
|
import com.loohp.limbo.Limbo;
|
||||||
|
import com.loohp.limbo.player.Player;
|
||||||
|
import com.loohp.limbo.utils.GameMode;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import net.md_5.bungee.api.chat.TranslatableComponent;
|
||||||
|
|
||||||
|
public class DefaultCommands implements CommandExecutor, TabCompletor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("spawn")) {
|
||||||
|
if (sender.hasPermission("limboserver.spawn")) {
|
||||||
|
if (args.length == 1 && sender instanceof Player) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
player.teleport(Limbo.getInstance().getServerProperties().getWorldSpawn());
|
||||||
|
player.sendMessage(ChatColor.GOLD + "Teleporting you to spawn!");
|
||||||
|
} else if (args.length == 2) {
|
||||||
|
Player player = Limbo.getInstance().getPlayer(args[1]);
|
||||||
|
if (player != null) {
|
||||||
|
player.teleport(Limbo.getInstance().getServerProperties().getWorldSpawn());
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Teleporting " + player.getName() + " to spawn!");
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Player not found!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Invalid command usage!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("stop")) {
|
||||||
|
if (sender.hasPermission("limboserver.stop")) {
|
||||||
|
Limbo.getInstance().stopServer();
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("kick")) {
|
||||||
|
if (sender.hasPermission("limboserver.kick")) {
|
||||||
|
BaseComponent reason = new TranslatableComponent("multiplayer.disconnect.kicked");
|
||||||
|
boolean customReason = false;
|
||||||
|
Player player = args.length > 1 ? Limbo.getInstance().getPlayer(args[1]) : null;
|
||||||
|
if (player != null) {
|
||||||
|
if (args.length < 2) {
|
||||||
|
player.disconnect(reason);
|
||||||
|
} else {
|
||||||
|
reason = new TextComponent(String.join(" ", Arrays.copyOfRange(args, 2, args.length)));
|
||||||
|
customReason = true;
|
||||||
|
player.disconnect(reason);
|
||||||
|
}
|
||||||
|
if (customReason) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Kicked the player " + player.getName() + " for the reason: " + reason.toLegacyText());
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Kicked the player " + player.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Player is not online!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("gamemode")) {
|
||||||
|
if (sender.hasPermission("limboserver.gamemode")) {
|
||||||
|
if (args.length > 1) {
|
||||||
|
Player player = args.length > 2 ? Limbo.getInstance().getPlayer(args[2]) : (sender instanceof Player ? (Player) sender : null);
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You have to specifiy a player!");
|
||||||
|
} else if (player != null) {
|
||||||
|
try {
|
||||||
|
player.setGamemode(GameMode.fromId(Integer.parseInt(args[1])));
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
player.setGamemode(GameMode.fromName(args[1]));
|
||||||
|
} catch (Exception e1) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Invalid usage!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Updated gamemode to " + player.getGamemode().getName());
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Player is not online!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Invalid usage!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("say")) {
|
||||||
|
if (sender.hasPermission("limboserver.say")) {
|
||||||
|
if (sender instanceof Console) {
|
||||||
|
if (args.length > 1) {
|
||||||
|
String message = "[Server] " + String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
Limbo.getInstance().getConsole().sendMessage(message);
|
||||||
|
for (Player each : Limbo.getInstance().getPlayers()) {
|
||||||
|
each.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (args.length > 1) {
|
||||||
|
String message = "[" + sender.getName() + "] " + String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
Limbo.getInstance().getConsole().sendMessage(message);
|
||||||
|
for (Player each : Limbo.getInstance().getPlayers()) {
|
||||||
|
each.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> tabComplete(CommandSender sender, String[] args) {
|
||||||
|
List<String> tab = new ArrayList<>();
|
||||||
|
switch (args.length) {
|
||||||
|
case 0:
|
||||||
|
if (sender.hasPermission("limboserver.spawn")) {
|
||||||
|
tab.add("spawn");
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.kick")) {
|
||||||
|
tab.add("kick");
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.stop")) {
|
||||||
|
tab.add("stop");
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.say")) {
|
||||||
|
tab.add("say");
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.gamemode")) {
|
||||||
|
tab.add("gamemode");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (sender.hasPermission("limboserver.spawn")) {
|
||||||
|
if ("spawn".startsWith(args[0].toLowerCase())) {
|
||||||
|
tab.add("spawn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.kick")) {
|
||||||
|
if ("kick".startsWith(args[0].toLowerCase())) {
|
||||||
|
tab.add("kick");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.stop")) {
|
||||||
|
if ("stop".startsWith(args[0].toLowerCase())) {
|
||||||
|
tab.add("stop");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.say")) {
|
||||||
|
if ("say".startsWith(args[0].toLowerCase())) {
|
||||||
|
tab.add("say");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.gamemode")) {
|
||||||
|
if ("gamemode".startsWith(args[0].toLowerCase())) {
|
||||||
|
tab.add("gamemode");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (sender.hasPermission("limboserver.kick")) {
|
||||||
|
if (args[0].equalsIgnoreCase("kick")) {
|
||||||
|
for (Player player : Limbo.getInstance().getPlayers()) {
|
||||||
|
if (player.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||||
|
tab.add(player.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("limboserver.gamemode")) {
|
||||||
|
if (args[0].equalsIgnoreCase("gamemode")) {
|
||||||
|
for (GameMode mode : GameMode.values()) {
|
||||||
|
if (mode.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||||
|
tab.add(mode.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (sender.hasPermission("limboserver.gamemode")) {
|
||||||
|
if (args[0].equalsIgnoreCase("gamemode")) {
|
||||||
|
for (Player player : Limbo.getInstance().getPlayers()) {
|
||||||
|
if (player.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
|
||||||
|
tab.add(player.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,179 +0,0 @@
|
||||||
package com.loohp.limbo.commands;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.loohp.limbo.Limbo;
|
|
||||||
import com.loohp.limbo.player.Player;
|
|
||||||
import com.loohp.limbo.utils.GameMode;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
|
|
||||||
public class Defaults implements CommandExecutor, TabCompletor {
|
|
||||||
public List<String> tabComplete(CommandSender sender, String[] args) {
|
|
||||||
List<String> tab = new ArrayList<>();
|
|
||||||
switch (args.length) {
|
|
||||||
case 0:
|
|
||||||
if (sender.hasPermission("limboserver.spawn"))
|
|
||||||
tab.add("spawn");
|
|
||||||
if (sender.hasPermission("limboserver.kick"))
|
|
||||||
tab.add("kick");
|
|
||||||
if (sender.hasPermission("limboserver.stop"))
|
|
||||||
tab.add("stop");
|
|
||||||
if (sender.hasPermission("limboserver.say"))
|
|
||||||
tab.add("say");
|
|
||||||
if (sender.hasPermission("limboserver.gamemode"))
|
|
||||||
tab.add("gamemode");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (sender.hasPermission("limboserver.spawn") &&
|
|
||||||
"spawn".startsWith(args[0].toLowerCase()))
|
|
||||||
tab.add("spawn");
|
|
||||||
if (sender.hasPermission("limboserver.kick") &&
|
|
||||||
"kick".startsWith(args[0].toLowerCase()))
|
|
||||||
tab.add("kick");
|
|
||||||
if (sender.hasPermission("limboserver.stop") &&
|
|
||||||
"stop".startsWith(args[0].toLowerCase()))
|
|
||||||
tab.add("stop");
|
|
||||||
if (sender.hasPermission("limboserver.say") &&
|
|
||||||
"say".startsWith(args[0].toLowerCase()))
|
|
||||||
tab.add("say");
|
|
||||||
if (sender.hasPermission("limboserver.gamemode") &&
|
|
||||||
"gamemode".startsWith(args[0].toLowerCase()))
|
|
||||||
tab.add("gamemode");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (sender.hasPermission("limboserver.kick") &&
|
|
||||||
args[0].equalsIgnoreCase("kick"))
|
|
||||||
for (Player player : Limbo.getInstance().getPlayers()) {
|
|
||||||
if (player.getName().toLowerCase().startsWith(args[1].toLowerCase()))
|
|
||||||
tab.add(player.getName());
|
|
||||||
}
|
|
||||||
if (sender.hasPermission("limboserver.gamemode") &&
|
|
||||||
args[0].equalsIgnoreCase("gamemode")) {
|
|
||||||
byte b;
|
|
||||||
int i;
|
|
||||||
GameMode[] arrayOfGameMode;
|
|
||||||
for (i = (arrayOfGameMode = GameMode.values()).length, b = 0; b < i; ) {
|
|
||||||
GameMode mode = arrayOfGameMode[b];
|
|
||||||
if (mode.getName().toLowerCase().startsWith(args[1].toLowerCase()))
|
|
||||||
tab.add(mode.getName());
|
|
||||||
b++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (sender.hasPermission("limboserver.gamemode") &&
|
|
||||||
args[0].equalsIgnoreCase("gamemode"))
|
|
||||||
for (Player player : Limbo.getInstance().getPlayers()) {
|
|
||||||
if (player.getName().toLowerCase().startsWith(args[2].toLowerCase()))
|
|
||||||
tab.add(player.getName());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void execute(CommandSender sender, String[] args) {
|
|
||||||
if (args.length == 0)
|
|
||||||
return;
|
|
||||||
if (args[0].equalsIgnoreCase("spawn")) {
|
|
||||||
if (sender.hasPermission("limboserver.spawn")) {
|
|
||||||
if (args.length == 1 && sender instanceof Player) {
|
|
||||||
Player player = (Player)sender;
|
|
||||||
player.teleport(Limbo.getInstance().getServerProperties().getWorldSpawn());
|
|
||||||
player.sendMessage(ChatColor.GOLD + "Teleporting you to spawn!");
|
|
||||||
} else if (args.length == 2) {
|
|
||||||
Player player = Limbo.getInstance().getPlayer(args[1]);
|
|
||||||
if (player != null) {
|
|
||||||
player.teleport(Limbo.getInstance().getServerProperties().getWorldSpawn());
|
|
||||||
sender.sendMessage(ChatColor.GOLD + "Teleporting " + player.getName() + " to spawn!");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Player not found!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid command usage!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("stop")) {
|
|
||||||
if (sender.hasPermission("limboserver.stop")) {
|
|
||||||
Limbo.getInstance().stopServer();
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("kick")) {
|
|
||||||
if (sender.hasPermission("limboserver.kick")) {
|
|
||||||
String reason = "Disconnected!";
|
|
||||||
Player player = (args.length > 1) ? Limbo.getInstance().getPlayer(args[1]) : null;
|
|
||||||
if (player != null) {
|
|
||||||
if (args.length < 2) {
|
|
||||||
player.disconnect();
|
|
||||||
} else {
|
|
||||||
reason = String.join(" ", Arrays.<CharSequence>copyOfRange((CharSequence[])args, 2, args.length));
|
|
||||||
player.disconnect(reason);
|
|
||||||
}
|
|
||||||
sender.sendMessage(ChatColor.RED + "Kicked the player " + args[1] + " for the reason: " + reason);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Player is not online!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("gamemode")) {
|
|
||||||
if (sender.hasPermission("limboserver.gamemode")) {
|
|
||||||
if (args.length > 1) {
|
|
||||||
Player player = (args.length > 2) ? Limbo.getInstance().getPlayer(args[2]) : ((sender instanceof Player) ? (Player)sender : null);
|
|
||||||
if (player != null) {
|
|
||||||
try {
|
|
||||||
player.setGamemode(GameMode.fromId(Integer.parseInt(args[1])));
|
|
||||||
} catch (Exception e) {
|
|
||||||
try {
|
|
||||||
player.setGamemode(GameMode.fromName(args[1]));
|
|
||||||
} catch (Exception e1) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid usage!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(ChatColor.GOLD + "Updated gamemode to " + player.getGamemode().getName());
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Player is not online!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid usage!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("say")) {
|
|
||||||
if (sender.hasPermission("limboserver.say")) {
|
|
||||||
if (sender instanceof com.loohp.limbo.Console) {
|
|
||||||
if (args.length > 1) {
|
|
||||||
String message = "[Server] " + String.join(" ", Arrays.<CharSequence>copyOfRange((CharSequence[])args, 1, args.length));
|
|
||||||
Limbo.getInstance().getConsole().sendMessage(message);
|
|
||||||
for (Player each : Limbo.getInstance().getPlayers())
|
|
||||||
each.sendMessage(message);
|
|
||||||
}
|
|
||||||
} else if (args.length > 1) {
|
|
||||||
String message = "[" + sender.getName() + "] " + String.join(" ", Arrays.<CharSequence>copyOfRange((CharSequence[])args, 1, args.length));
|
|
||||||
Limbo.getInstance().getConsole().sendMessage(message);
|
|
||||||
for (Player each : Limbo.getInstance().getPlayers())
|
|
||||||
each.sendMessage(message);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command!");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -23,9 +23,14 @@ import com.loohp.limbo.utils.GameMode;
|
||||||
import com.loohp.limbo.utils.NamespacedKey;
|
import com.loohp.limbo.utils.NamespacedKey;
|
||||||
import com.loohp.limbo.world.World;
|
import com.loohp.limbo.world.World;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
|
|
||||||
public class ServerProperties {
|
public class ServerProperties {
|
||||||
|
|
||||||
public static final String COMMENT = "For explaination of what each of the options does, please visit:\nhttps://github.com/LOOHP/Limbo/blob/master/src/main/resources/server.properties";
|
public static final String COMMENT = "For explaination of what each of the options does, please visit:\nhttps://github.com/LOOHP/Limbo/blob/master/src/main/resources/server.properties";
|
||||||
|
public static final BaseComponent[] EMPTY_CHAT_COMPONENT = new BaseComponent[] {new TextComponent("")};
|
||||||
|
|
||||||
private File file;
|
private File file;
|
||||||
private int maxPlayers;
|
private int maxPlayers;
|
||||||
|
|
@ -39,7 +44,7 @@ public class ServerProperties {
|
||||||
private boolean reducedDebugInfo;
|
private boolean reducedDebugInfo;
|
||||||
private boolean allowFlight;
|
private boolean allowFlight;
|
||||||
private boolean allowChat;
|
private boolean allowChat;
|
||||||
private String motdJson;
|
private BaseComponent[] motd;
|
||||||
private String versionString;
|
private String versionString;
|
||||||
private int protocol;
|
private int protocol;
|
||||||
private boolean bungeecord;
|
private boolean bungeecord;
|
||||||
|
|
@ -53,10 +58,10 @@ public class ServerProperties {
|
||||||
private String resourcePackSHA1;
|
private String resourcePackSHA1;
|
||||||
private String resourcePackLink;
|
private String resourcePackLink;
|
||||||
private boolean resourcePackRequired;
|
private boolean resourcePackRequired;
|
||||||
private String resourcePackPromptJson;
|
private BaseComponent[] resourcePackPrompt;
|
||||||
|
|
||||||
private String tabHeader;
|
private BaseComponent[] tabHeader;
|
||||||
private String tabFooter;
|
private BaseComponent[] tabFooter;
|
||||||
|
|
||||||
Optional<BufferedImage> favicon;
|
Optional<BufferedImage> favicon;
|
||||||
|
|
||||||
|
|
@ -103,7 +108,8 @@ public class ServerProperties {
|
||||||
reducedDebugInfo = Boolean.parseBoolean(prop.getProperty("reduced-debug-info"));
|
reducedDebugInfo = Boolean.parseBoolean(prop.getProperty("reduced-debug-info"));
|
||||||
allowFlight = Boolean.parseBoolean(prop.getProperty("allow-flight"));
|
allowFlight = Boolean.parseBoolean(prop.getProperty("allow-flight"));
|
||||||
allowChat = Boolean.parseBoolean(prop.getProperty("allow-chat"));
|
allowChat = Boolean.parseBoolean(prop.getProperty("allow-chat"));
|
||||||
motdJson = prop.getProperty("motd");
|
String motdJson = prop.getProperty("motd");
|
||||||
|
motd = motdJson.equals("") ? EMPTY_CHAT_COMPONENT : ComponentSerializer.parse(motdJson);
|
||||||
versionString = prop.getProperty("version");
|
versionString = prop.getProperty("version");
|
||||||
bungeecord = Boolean.parseBoolean(prop.getProperty("bungeecord"));
|
bungeecord = Boolean.parseBoolean(prop.getProperty("bungeecord"));
|
||||||
velocityModern = Boolean.parseBoolean(prop.getProperty("velocity-modern"));
|
velocityModern = Boolean.parseBoolean(prop.getProperty("velocity-modern"));
|
||||||
|
|
@ -134,10 +140,13 @@ public class ServerProperties {
|
||||||
resourcePackLink = prop.getProperty("resource-pack");
|
resourcePackLink = prop.getProperty("resource-pack");
|
||||||
resourcePackSHA1 = prop.getProperty("resource-pack-sha1");
|
resourcePackSHA1 = prop.getProperty("resource-pack-sha1");
|
||||||
resourcePackRequired = Boolean.parseBoolean(prop.getProperty("required-resource-pack"));
|
resourcePackRequired = Boolean.parseBoolean(prop.getProperty("required-resource-pack"));
|
||||||
resourcePackPromptJson = prop.getProperty("resource-pack-prompt");
|
String resourcePackPromptJson = prop.getProperty("resource-pack-prompt");
|
||||||
|
resourcePackPrompt = resourcePackPromptJson.equals("") ? null : ComponentSerializer.parse(resourcePackPromptJson);
|
||||||
|
|
||||||
tabHeader = prop.getProperty("tab-header");
|
String tabHeaderJson = prop.getProperty("tab-header");
|
||||||
tabFooter = prop.getProperty("tab-footer");
|
tabHeader = tabHeaderJson.equals("") ? EMPTY_CHAT_COMPONENT : ComponentSerializer.parse(tabHeaderJson);
|
||||||
|
String tabFooterJson = prop.getProperty("tab-footer");
|
||||||
|
tabFooter = tabFooterJson.equals("") ? EMPTY_CHAT_COMPONENT : ComponentSerializer.parse(tabFooterJson);
|
||||||
|
|
||||||
File png = new File("server-icon.png");
|
File png = new File("server-icon.png");
|
||||||
if (png.exists()) {
|
if (png.exists()) {
|
||||||
|
|
@ -235,8 +244,8 @@ public class ServerProperties {
|
||||||
return this.allowChat;
|
return this.allowChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMotdJson() {
|
public BaseComponent[] getMotd() {
|
||||||
return motdJson;
|
return motd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersionString() {
|
public String getVersionString() {
|
||||||
|
|
@ -271,15 +280,15 @@ public class ServerProperties {
|
||||||
return resourcePackRequired;
|
return resourcePackRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResourcePackPromptJson() {
|
public BaseComponent[] getResourcePackPrompt() {
|
||||||
return resourcePackPromptJson;
|
return resourcePackPrompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTabHeader() {
|
public BaseComponent[] getTabHeader() {
|
||||||
return tabHeader;
|
return tabHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTabFooter() {
|
public BaseComponent[] getTabFooter() {
|
||||||
return tabFooter;
|
return tabFooter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,15 @@ import com.loohp.limbo.server.packets.PacketPlayOutResourcePackSend;
|
||||||
import com.loohp.limbo.server.packets.PacketPlayOutRespawn;
|
import com.loohp.limbo.server.packets.PacketPlayOutRespawn;
|
||||||
import com.loohp.limbo.utils.GameMode;
|
import com.loohp.limbo.utils.GameMode;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.chat.TranslatableComponent;
|
import net.md_5.bungee.api.chat.TranslatableComponent;
|
||||||
import net.md_5.bungee.chat.ComponentSerializer;
|
|
||||||
|
|
||||||
public class Player extends LivingEntity implements CommandSender {
|
public class Player extends LivingEntity implements CommandSender {
|
||||||
|
|
||||||
public static final String CHAT_DEFAULT_FORMAT = "<%name%> %message%";
|
public static final String CHAT_DEFAULT_FORMAT = "<%name%> %message%";
|
||||||
|
public static final BaseComponent[] EMPTY_CHAT_COMPONENT = new BaseComponent[] {new TextComponent("")};
|
||||||
|
|
||||||
public final ClientConnection clientConnection;
|
public final ClientConnection clientConnection;
|
||||||
public final PlayerInteractManager playerInteractManager;
|
public final PlayerInteractManager playerInteractManager;
|
||||||
|
|
@ -210,7 +211,7 @@ public class Player extends LivingEntity implements CommandSender {
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(BaseComponent[] component, UUID uuid) {
|
public void sendMessage(BaseComponent[] component, UUID uuid) {
|
||||||
try {
|
try {
|
||||||
PacketPlayOutChat chat = new PacketPlayOutChat(ComponentSerializer.toString(component), 0, uuid);
|
PacketPlayOutChat chat = new PacketPlayOutChat(component, 0, uuid);
|
||||||
clientConnection.sendPacket(chat);
|
clientConnection.sendPacket(chat);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -228,7 +229,7 @@ public class Player extends LivingEntity implements CommandSender {
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(BaseComponent[] component) {
|
public void sendMessage(BaseComponent[] component) {
|
||||||
try {
|
try {
|
||||||
PacketPlayOutChat chat = new PacketPlayOutChat(ComponentSerializer.toString(component), 0, new UUID(0, 0));
|
PacketPlayOutChat chat = new PacketPlayOutChat(component, 0, new UUID(0, 0));
|
||||||
clientConnection.sendPacket(chat);
|
clientConnection.sendPacket(chat);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -252,32 +253,44 @@ public class Player extends LivingEntity implements CommandSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void chat(String message) {
|
public void chat(String message) {
|
||||||
|
chat(message, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void chat(String message, boolean verbose) {
|
||||||
if (Limbo.getInstance().getServerProperties().isAllowChat()) {
|
if (Limbo.getInstance().getServerProperties().isAllowChat()) {
|
||||||
PlayerChatEvent event = (PlayerChatEvent) Limbo.getInstance().getEventsManager().callEvent(new PlayerChatEvent(this, CHAT_DEFAULT_FORMAT, message, false));
|
PlayerChatEvent event = (PlayerChatEvent) Limbo.getInstance().getEventsManager().callEvent(new PlayerChatEvent(this, CHAT_DEFAULT_FORMAT, message, false));
|
||||||
if (!event.isCancelled() && this.hasPermission("limboserver.chat")) {
|
if (!event.isCancelled()) {
|
||||||
String chat = event.getFormat().replace("%name%", username).replace("%message%", event.getMessage());
|
if (hasPermission("limboserver.chat")) {
|
||||||
Limbo.getInstance().getConsole().sendMessage(chat);
|
String chat = event.getFormat().replace("%name%", username).replace("%message%", event.getMessage());
|
||||||
if (event.getFormat().equals(CHAT_DEFAULT_FORMAT)) {
|
Limbo.getInstance().getConsole().sendMessage(chat);
|
||||||
TranslatableComponent translatable = new TranslatableComponent("chat.type.text", username, event.getMessage());
|
if (event.getFormat().equals(CHAT_DEFAULT_FORMAT)) {
|
||||||
for (Player each : Limbo.getInstance().getPlayers()) {
|
TranslatableComponent translatable = new TranslatableComponent("chat.type.text", username, event.getMessage());
|
||||||
each.sendMessage(translatable, uuid);
|
for (Player each : Limbo.getInstance().getPlayers()) {
|
||||||
}
|
each.sendMessage(translatable, uuid);
|
||||||
} else {
|
}
|
||||||
for (Player each : Limbo.getInstance().getPlayers()) {
|
} else {
|
||||||
each.sendMessage(chat, uuid);
|
for (Player each : Limbo.getInstance().getPlayers()) {
|
||||||
|
each.sendMessage(chat, uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else if (verbose) {
|
||||||
|
sendMessage(ChatColor.RED + "You do not have permission to chat!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResourcePack(String url, String hash, boolean forced) {
|
||||||
|
setResourcePack(url, hash, forced, (BaseComponent[]) null);
|
||||||
|
}
|
||||||
|
|
||||||
public void setResourcePack(String url, String hash, boolean forced, BaseComponent promptmessage) {
|
public void setResourcePack(String url, String hash, boolean forced, BaseComponent promptmessage) {
|
||||||
setResourcePack(url, hash, forced, new BaseComponent[] {promptmessage});
|
setResourcePack(url, hash, forced, new BaseComponent[] {promptmessage});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResourcePack(String url, String hash, boolean forced, BaseComponent[] promptmessage) {
|
public void setResourcePack(String url, String hash, boolean forced, BaseComponent[] promptmessage) {
|
||||||
try {
|
try {
|
||||||
PacketPlayOutResourcePackSend packsend = new PacketPlayOutResourcePackSend(url, hash, forced, promptmessage != null, promptmessage != null ? promptmessage : null);
|
PacketPlayOutResourcePackSend packsend = new PacketPlayOutResourcePackSend(url, hash, forced, promptmessage != null, promptmessage);
|
||||||
clientConnection.sendPacket(packsend);
|
clientConnection.sendPacket(packsend);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -286,35 +299,19 @@ public class Player extends LivingEntity implements CommandSender {
|
||||||
|
|
||||||
public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
||||||
try {
|
try {
|
||||||
PacketPlayOutPlayerListHeaderFooter packsend = new PacketPlayOutPlayerListHeaderFooter(
|
PacketPlayOutPlayerListHeaderFooter packsend = new PacketPlayOutPlayerListHeaderFooter(header == null ? EMPTY_CHAT_COMPONENT : header, footer == null ? EMPTY_CHAT_COMPONENT : footer);
|
||||||
ComponentSerializer.toString(header),
|
|
||||||
ComponentSerializer.toString(footer));
|
|
||||||
clientConnection.sendPacket(packsend);
|
clientConnection.sendPacket(packsend);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerListHeader(BaseComponent[] header) {
|
public void setPlayerListHeaderFooter(BaseComponent header, BaseComponent footer) {
|
||||||
try {
|
setPlayerListHeaderFooter(header == null ? EMPTY_CHAT_COMPONENT : new BaseComponent[] {header}, footer == null ? EMPTY_CHAT_COMPONENT : new BaseComponent[] {footer});
|
||||||
PacketPlayOutPlayerListHeaderFooter packsend = new PacketPlayOutPlayerListHeaderFooter(
|
|
||||||
ComponentSerializer.toString(header),
|
|
||||||
null);
|
|
||||||
clientConnection.sendPacket(packsend);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerListFooter(BaseComponent[] footer) {
|
public void setPlayerListHeaderFooter(String header, String footer) {
|
||||||
try {
|
setPlayerListHeaderFooter(header == null ? EMPTY_CHAT_COMPONENT : new BaseComponent[] {new TextComponent(header)}, footer == null ? EMPTY_CHAT_COMPONENT : new BaseComponent[] {new TextComponent(footer)});
|
||||||
PacketPlayOutPlayerListHeaderFooter packsend = new PacketPlayOutPlayerListHeaderFooter(
|
|
||||||
null,
|
|
||||||
ComponentSerializer.toString(footer));
|
|
||||||
clientConnection.sendPacket(packsend);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,19 @@ import java.util.zip.ZipInputStream;
|
||||||
import com.loohp.limbo.Limbo;
|
import com.loohp.limbo.Limbo;
|
||||||
import com.loohp.limbo.commands.CommandExecutor;
|
import com.loohp.limbo.commands.CommandExecutor;
|
||||||
import com.loohp.limbo.commands.CommandSender;
|
import com.loohp.limbo.commands.CommandSender;
|
||||||
|
import com.loohp.limbo.commands.DefaultCommands;
|
||||||
import com.loohp.limbo.commands.TabCompletor;
|
import com.loohp.limbo.commands.TabCompletor;
|
||||||
import com.loohp.limbo.file.FileConfiguration;
|
import com.loohp.limbo.file.FileConfiguration;
|
||||||
|
|
||||||
public class PluginManager {
|
public class PluginManager {
|
||||||
|
|
||||||
private Map<String, LimboPlugin> plugins;
|
private Map<String, LimboPlugin> plugins;
|
||||||
|
private DefaultCommands defaultExecutor;
|
||||||
private List<Executor> executors;
|
private List<Executor> executors;
|
||||||
private File pluginFolder;
|
private File pluginFolder;
|
||||||
|
|
||||||
public PluginManager(File pluginFolder) {
|
public PluginManager(DefaultCommands defaultExecutor, File pluginFolder) {
|
||||||
|
this.defaultExecutor = defaultExecutor;
|
||||||
this.pluginFolder = pluginFolder;
|
this.pluginFolder = pluginFolder;
|
||||||
this.executors = new ArrayList<>();
|
this.executors = new ArrayList<>();
|
||||||
this.plugins = new LinkedHashMap<>();
|
this.plugins = new LinkedHashMap<>();
|
||||||
|
|
@ -83,6 +86,12 @@ public class PluginManager {
|
||||||
|
|
||||||
public void fireExecutors(CommandSender sender, String[] args) throws Exception {
|
public void fireExecutors(CommandSender sender, String[] args) throws Exception {
|
||||||
Limbo.getInstance().getConsole().sendMessage(sender.getName() + " executed server command: /" + String.join(" ", args));
|
Limbo.getInstance().getConsole().sendMessage(sender.getName() + " executed server command: /" + String.join(" ", args));
|
||||||
|
try {
|
||||||
|
defaultExecutor.execute(sender, args);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("Error while running default command \"" + args[0] + "\"");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
for (Executor entry : executors) {
|
for (Executor entry : executors) {
|
||||||
try {
|
try {
|
||||||
entry.executor.execute(sender, args);
|
entry.executor.execute(sender, args);
|
||||||
|
|
@ -95,12 +104,18 @@ public class PluginManager {
|
||||||
|
|
||||||
public List<String> getTabOptions(CommandSender sender, String[] args) {
|
public List<String> getTabOptions(CommandSender sender, String[] args) {
|
||||||
List<String> options = new ArrayList<>();
|
List<String> options = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
options.addAll(defaultExecutor.tabComplete(sender, args));
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("Error while getting default command tab completions");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
for (Executor entry : executors) {
|
for (Executor entry : executors) {
|
||||||
if (entry.tab.isPresent()) {
|
if (entry.tab.isPresent()) {
|
||||||
try {
|
try {
|
||||||
options.addAll(entry.tab.get().tabComplete(sender, args));
|
options.addAll(entry.tab.get().tabComplete(sender, args));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Error while passing tab completion to the plugin \"" + entry.plugin.getName() + "\"");
|
System.err.println("Error while getting tab completions to the plugin \"" + entry.plugin.getName() + "\"");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ import com.loohp.limbo.utils.ForwardingUtils;
|
||||||
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;
|
||||||
import com.loohp.limbo.utils.NamespacedKey;
|
|
||||||
import com.loohp.limbo.world.BlockPosition;
|
import com.loohp.limbo.world.BlockPosition;
|
||||||
import com.loohp.limbo.world.World;
|
import com.loohp.limbo.world.World;
|
||||||
|
|
||||||
|
|
@ -87,7 +86,6 @@ import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.chat.TranslatableComponent;
|
import net.md_5.bungee.api.chat.TranslatableComponent;
|
||||||
import net.md_5.bungee.chat.ComponentSerializer;
|
|
||||||
|
|
||||||
public class ClientConnection extends Thread {
|
public class ClientConnection extends Thread {
|
||||||
|
|
||||||
|
|
@ -165,7 +163,7 @@ public class ClientConnection extends Thread {
|
||||||
|
|
||||||
public void disconnect(BaseComponent[] reason) {
|
public void disconnect(BaseComponent[] reason) {
|
||||||
try {
|
try {
|
||||||
PacketPlayOutDisconnect packet = new PacketPlayOutDisconnect(ComponentSerializer.toString(reason));
|
PacketPlayOutDisconnect packet = new PacketPlayOutDisconnect(reason);
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {}
|
||||||
try {
|
try {
|
||||||
|
|
@ -175,7 +173,7 @@ public class ClientConnection extends Thread {
|
||||||
|
|
||||||
private void disconnectDuringLogin(BaseComponent[] reason) {
|
private void disconnectDuringLogin(BaseComponent[] reason) {
|
||||||
try {
|
try {
|
||||||
PacketLoginOutDisconnect packet = new PacketLoginOutDisconnect(ComponentSerializer.toString(reason));
|
PacketLoginOutDisconnect packet = new PacketLoginOutDisconnect(reason);
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {}
|
||||||
try {
|
try {
|
||||||
|
|
@ -201,7 +199,7 @@ public class ClientConnection extends Thread {
|
||||||
String str = inetAddress.getHostName() + ":" + client_socket.getPort();
|
String str = inetAddress.getHostName() + ":" + client_socket.getPort();
|
||||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Legacy Status has pinged");
|
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Legacy Status has pinged");
|
||||||
ServerProperties p = Limbo.getInstance().getServerProperties();
|
ServerProperties p = Limbo.getInstance().getServerProperties();
|
||||||
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)));
|
StatusPingEvent event = Limbo.getInstance().getEventsManager().callEvent(new StatusPingEvent(this, p.getVersionString(), p.getProtocol(), p.getMotd(), p.getMaxPlayers(), Limbo.getInstance().getPlayers().size(), p.getFavicon().orElse(null)));
|
||||||
String response = Limbo.getInstance().buildLegacyPingResponse(event.getVersion(), event.getMotd(), event.getMaxPlayers(), event.getPlayersOnline());
|
String response = Limbo.getInstance().buildLegacyPingResponse(event.getVersion(), event.getMotd(), event.getMaxPlayers(), event.getPlayersOnline());
|
||||||
byte[] bytes = response.getBytes(StandardCharsets.UTF_16BE);
|
byte[] bytes = response.getBytes(StandardCharsets.UTF_16BE);
|
||||||
output.writeShort(response.length());
|
output.writeShort(response.length());
|
||||||
|
|
@ -239,7 +237,7 @@ public class ClientConnection extends Thread {
|
||||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Handshake Status has pinged");
|
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Handshake Status has pinged");
|
||||||
}
|
}
|
||||||
ServerProperties p = Limbo.getInstance().getServerProperties();
|
ServerProperties p = Limbo.getInstance().getServerProperties();
|
||||||
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)));
|
StatusPingEvent event = Limbo.getInstance().getEventsManager().callEvent(new StatusPingEvent(this, p.getVersionString(), p.getProtocol(), p.getMotd(), p.getMaxPlayers(), Limbo.getInstance().getPlayers().size(), p.getFavicon().orElse(null)));
|
||||||
PacketStatusOutResponse packet = new PacketStatusOutResponse(Limbo.getInstance().buildServerListResponseJson(event.getVersion(), event.getProtocol(), event.getMotd(), event.getMaxPlayers(), event.getPlayersOnline(), event.getFavicon()));
|
PacketStatusOutResponse packet = new PacketStatusOutResponse(Limbo.getInstance().buildServerListResponseJson(event.getVersion(), event.getProtocol(), event.getMotd(), event.getMaxPlayers(), event.getPlayersOnline(), event.getFavicon()));
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
} else if (packetType.equals(PacketStatusInPing.class)) {
|
} else if (packetType.equals(PacketStatusInPing.class)) {
|
||||||
|
|
@ -376,7 +374,7 @@ public class ClientConnection extends Thread {
|
||||||
worldSpawn = joinEvent.getSpawnLocation();
|
worldSpawn = joinEvent.getSpawnLocation();
|
||||||
World world = worldSpawn.getWorld();
|
World world = worldSpawn.getWorld();
|
||||||
|
|
||||||
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, properties.getDefaultGamemode(), Limbo.getInstance().getWorlds().stream().map(each -> new NamespacedKey(each.getName()).toString()).collect(Collectors.toList()).toArray(new String[Limbo.getInstance().getWorlds().size()]), Limbo.getInstance().getDimensionRegistry().getCodec(), world, 0, (byte) properties.getMaxPlayers(), 8, properties.isReducedDebugInfo(), true, false, true);
|
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, properties.getDefaultGamemode(), Limbo.getInstance().getWorlds(), Limbo.getInstance().getDimensionRegistry().getCodec(), world, 0, (byte) properties.getMaxPlayers(), 8, properties.isReducedDebugInfo(), true, false, true);
|
||||||
sendPacket(join);
|
sendPacket(join);
|
||||||
Limbo.getInstance().getUnsafe().setPlayerGameModeSilently(player, properties.getDefaultGamemode());
|
Limbo.getInstance().getUnsafe().setPlayerGameModeSilently(player, properties.getDefaultGamemode());
|
||||||
|
|
||||||
|
|
@ -421,14 +419,11 @@ public class ClientConnection extends Thread {
|
||||||
sendPacket(state);
|
sendPacket(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RESOURCEPACK CODE ADDED BY GAMERDUCK123
|
// RESOURCEPACK CODE CONRIBUTED BY GAMERDUCK123
|
||||||
|
if (!properties.getResourcePackLink().equalsIgnoreCase("")) {
|
||||||
if (properties.getResourcePackLink() != null && !properties.getResourcePackLink().equalsIgnoreCase("")) {
|
if (!properties.getResourcePackSHA1().equalsIgnoreCase("")) {
|
||||||
if (properties.getResourcePackSHA1() != null && !properties.getResourcePackSHA1().equalsIgnoreCase("")) {
|
|
||||||
//SEND RESOURCEPACK
|
//SEND RESOURCEPACK
|
||||||
player.setResourcePack(properties.getResourcePackLink(),
|
player.setResourcePack(properties.getResourcePackLink(), properties.getResourcePackSHA1(), properties.getResourcePackRequired(), properties.getResourcePackPrompt());
|
||||||
properties.getResourcePackSHA1(), properties.getResourcePackRequired(),
|
|
||||||
ComponentSerializer.parse(properties.getResourcePackPromptJson()));
|
|
||||||
} else {
|
} else {
|
||||||
//NO SHA
|
//NO SHA
|
||||||
Limbo.getInstance().getConsole().sendMessage("ResourcePacks require SHA1s");
|
Limbo.getInstance().getConsole().sendMessage("ResourcePacks require SHA1s");
|
||||||
|
|
@ -437,19 +432,8 @@ public class ClientConnection extends Thread {
|
||||||
//RESOURCEPACK NOT ENABLED
|
//RESOURCEPACK NOT ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
// PLAYER LIST HEADER AND FOOTER CODE ADDED BY GAMERDUCK123
|
// PLAYER LIST HEADER AND FOOTER CODE CONRIBUTED BY GAMERDUCK123
|
||||||
// Sadly due to the limitations of minecraft (?) I cannot get the footer to work alone, it needs a header to have a footer, BUT
|
player.setPlayerListHeaderFooter(properties.getTabHeader(), properties.getTabFooter());
|
||||||
// You can have just a header with no footer (which is weird!)
|
|
||||||
String tabHeader = "";
|
|
||||||
String tabFooter = "";
|
|
||||||
if (properties.getTabHeader() != null && !properties.getTabHeader().equalsIgnoreCase("")) {
|
|
||||||
tabHeader = properties.getTabHeader();
|
|
||||||
}
|
|
||||||
if (properties.getTabFooter() != null && !properties.getTabFooter().equalsIgnoreCase("")) {
|
|
||||||
tabFooter = properties.getTabFooter();
|
|
||||||
}
|
|
||||||
player.setPlayerListHeaderFooter(ComponentSerializer.parse(tabHeader),
|
|
||||||
ComponentSerializer.parse(tabFooter));
|
|
||||||
|
|
||||||
ready = true;
|
ready = true;
|
||||||
|
|
||||||
|
|
@ -529,7 +513,7 @@ public class ClientConnection extends Thread {
|
||||||
if (chat.getMessage().startsWith("/")) {
|
if (chat.getMessage().startsWith("/")) {
|
||||||
Limbo.getInstance().dispatchCommand(player, chat.getMessage());
|
Limbo.getInstance().dispatchCommand(player, chat.getMessage());
|
||||||
} else {
|
} else {
|
||||||
player.chat(chat.getMessage());
|
player.chat(chat.getMessage(), true);
|
||||||
}
|
}
|
||||||
} else if (packetType.equals(PacketPlayInHeldItemChange.class)) {
|
} else if (packetType.equals(PacketPlayInHeldItemChange.class)) {
|
||||||
PacketPlayInHeldItemChange change = new PacketPlayInHeldItemChange(input);
|
PacketPlayInHeldItemChange change = new PacketPlayInHeldItemChange(input);
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,19 @@ import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import com.loohp.limbo.utils.DataTypeIO;
|
import com.loohp.limbo.utils.DataTypeIO;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
|
|
||||||
public class PacketLoginOutDisconnect extends PacketOut {
|
public class PacketLoginOutDisconnect extends PacketOut {
|
||||||
|
|
||||||
private String jsonReason;
|
private BaseComponent[] reason;
|
||||||
|
|
||||||
public PacketLoginOutDisconnect(String jsonReason) {
|
public PacketLoginOutDisconnect(BaseComponent[] reason) {
|
||||||
this.jsonReason = jsonReason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJsonReason() {
|
public BaseComponent[] getReason() {
|
||||||
return jsonReason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -25,7 +28,7 @@ public class PacketLoginOutDisconnect extends PacketOut {
|
||||||
|
|
||||||
DataOutputStream output = new DataOutputStream(buffer);
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
output.writeByte(Packet.getLoginOut().get(getClass()));
|
output.writeByte(Packet.getLoginOut().get(getClass()));
|
||||||
DataTypeIO.writeString(output, jsonReason, StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, ComponentSerializer.toString(reason), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
return buffer.toByteArray();
|
return buffer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,20 +8,23 @@ import java.util.UUID;
|
||||||
|
|
||||||
import com.loohp.limbo.utils.DataTypeIO;
|
import com.loohp.limbo.utils.DataTypeIO;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
|
|
||||||
public class PacketPlayOutChat extends PacketOut {
|
public class PacketPlayOutChat extends PacketOut {
|
||||||
|
|
||||||
private String json;
|
private BaseComponent[] message;
|
||||||
private int position;
|
private int position;
|
||||||
private UUID sender;
|
private UUID sender;
|
||||||
|
|
||||||
public PacketPlayOutChat(String json, int position, UUID sender) {
|
public PacketPlayOutChat(BaseComponent[] message, int position, UUID sender) {
|
||||||
this.json = json;
|
this.message = message;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJson() {
|
public BaseComponent[] getMessage() {
|
||||||
return json;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPosition() {
|
public int getPosition() {
|
||||||
|
|
@ -38,7 +41,7 @@ public class PacketPlayOutChat extends PacketOut {
|
||||||
|
|
||||||
DataOutputStream output = new DataOutputStream(buffer);
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
output.writeByte(Packet.getPlayOut().get(getClass()));
|
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||||
DataTypeIO.writeString(output, json, StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, ComponentSerializer.toString(message), StandardCharsets.UTF_8);
|
||||||
output.writeByte(position);
|
output.writeByte(position);
|
||||||
DataTypeIO.writeUUID(output, sender);
|
DataTypeIO.writeUUID(output, sender);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,19 @@ import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import com.loohp.limbo.utils.DataTypeIO;
|
import com.loohp.limbo.utils.DataTypeIO;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
|
|
||||||
public class PacketPlayOutDisconnect extends PacketOut {
|
public class PacketPlayOutDisconnect extends PacketOut {
|
||||||
|
|
||||||
private String jsonReason;
|
private BaseComponent[] reason;
|
||||||
|
|
||||||
public PacketPlayOutDisconnect(String jsonReason) {
|
public PacketPlayOutDisconnect(BaseComponent[] reason) {
|
||||||
this.jsonReason = jsonReason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJsonReason() {
|
public BaseComponent[] getReason() {
|
||||||
return jsonReason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -25,7 +28,7 @@ public class PacketPlayOutDisconnect extends PacketOut {
|
||||||
|
|
||||||
DataOutputStream output = new DataOutputStream(buffer);
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
output.writeByte(Packet.getPlayOut().get(getClass()));
|
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||||
DataTypeIO.writeString(output, jsonReason, StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, ComponentSerializer.toString(reason), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
return buffer.toByteArray();
|
return buffer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class PacketPlayOutKeepAlive extends PacketOut {
|
public class PacketPlayOutKeepAlive extends PacketOut {
|
||||||
|
|
||||||
long payload;
|
private long payload;
|
||||||
|
|
||||||
public PacketPlayOutKeepAlive(long payload) {
|
public PacketPlayOutKeepAlive(long payload) {
|
||||||
this.payload = payload;
|
this.payload = payload;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.loohp.limbo.utils.DataTypeIO;
|
import com.loohp.limbo.utils.DataTypeIO;
|
||||||
import com.loohp.limbo.utils.GameMode;
|
import com.loohp.limbo.utils.GameMode;
|
||||||
|
|
@ -19,10 +20,10 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
private int entityId;
|
private int entityId;
|
||||||
private boolean isHardcore;
|
private boolean isHardcore;
|
||||||
private GameMode gamemode;
|
private GameMode gamemode;
|
||||||
private String[] worldsNames;
|
private List<World> worlds;
|
||||||
private CompoundTag dimensionCodec;
|
private CompoundTag dimensionCodec;
|
||||||
private Environment dimension;
|
private Environment dimension;
|
||||||
private String worldName;
|
private World world;
|
||||||
private long hashedSeed;
|
private long hashedSeed;
|
||||||
private byte maxPlayers;
|
private byte maxPlayers;
|
||||||
private int viewDistance;
|
private int viewDistance;
|
||||||
|
|
@ -31,14 +32,14 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
private boolean isDebug;
|
private boolean isDebug;
|
||||||
private boolean isFlat;
|
private boolean isFlat;
|
||||||
|
|
||||||
public PacketPlayOutLogin(int entityId, boolean isHardcore, GameMode gamemode, String[] worldsNames, CompoundTag dimensionCodec, World world, long hashedSeed, byte maxPlayers, int viewDistance, boolean reducedDebugInfo, boolean enableRespawnScreen, boolean isDebug, boolean isFlat) {
|
public PacketPlayOutLogin(int entityId, boolean isHardcore, GameMode gamemode, List<World> worlds, CompoundTag dimensionCodec, World world, long hashedSeed, byte maxPlayers, int viewDistance, boolean reducedDebugInfo, boolean enableRespawnScreen, boolean isDebug, boolean isFlat) {
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
this.isHardcore = isHardcore;
|
this.isHardcore = isHardcore;
|
||||||
this.gamemode = gamemode;
|
this.gamemode = gamemode;
|
||||||
this.worldsNames = worldsNames;
|
this.worlds = worlds;
|
||||||
this.dimensionCodec = dimensionCodec;
|
this.dimensionCodec = dimensionCodec;
|
||||||
this.dimension = world.getEnvironment();
|
this.dimension = world.getEnvironment();
|
||||||
this.worldName = new NamespacedKey(world.getName()).toString();
|
this.world = world;
|
||||||
this.hashedSeed = hashedSeed;
|
this.hashedSeed = hashedSeed;
|
||||||
this.maxPlayers = maxPlayers;
|
this.maxPlayers = maxPlayers;
|
||||||
this.viewDistance = viewDistance;
|
this.viewDistance = viewDistance;
|
||||||
|
|
@ -60,8 +61,8 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
return gamemode;
|
return gamemode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getWorldsNames() {
|
public List<World> getWorldsNames() {
|
||||||
return worldsNames;
|
return worlds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag getDimensionCodec() {
|
public CompoundTag getDimensionCodec() {
|
||||||
|
|
@ -72,8 +73,8 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
return dimension;
|
return dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWorldName() {
|
public World getWorld() {
|
||||||
return worldName;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getHashedSeed() {
|
public long getHashedSeed() {
|
||||||
|
|
@ -114,9 +115,9 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
output.writeBoolean(isHardcore);
|
output.writeBoolean(isHardcore);
|
||||||
output.writeByte((byte) gamemode.getId());
|
output.writeByte((byte) gamemode.getId());
|
||||||
output.writeByte((byte) gamemode.getId());
|
output.writeByte((byte) gamemode.getId());
|
||||||
DataTypeIO.writeVarInt(output, worldsNames.length);
|
DataTypeIO.writeVarInt(output, worlds.size());
|
||||||
for (int u = 0; u < worldsNames.length; u++) {
|
for (int u = 0; u < worlds.size(); u++) {
|
||||||
DataTypeIO.writeString(output, worldsNames[u], StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, new NamespacedKey(worlds.get(u).getName()).toString(), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
DataTypeIO.writeCompoundTag(output, dimensionCodec);
|
DataTypeIO.writeCompoundTag(output, dimensionCodec);
|
||||||
CompoundTag tag = null;
|
CompoundTag tag = null;
|
||||||
|
|
@ -128,7 +129,7 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DataTypeIO.writeCompoundTag(output, tag != null ? tag : list.get(0).getCompoundTag("element"));
|
DataTypeIO.writeCompoundTag(output, tag != null ? tag : list.get(0).getCompoundTag("element"));
|
||||||
DataTypeIO.writeString(output, worldName, StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, new NamespacedKey(world.getName()).toString(), StandardCharsets.UTF_8);
|
||||||
output.writeLong(hashedSeed);
|
output.writeLong(hashedSeed);
|
||||||
DataTypeIO.writeVarInt(output, maxPlayers);
|
DataTypeIO.writeVarInt(output, maxPlayers);
|
||||||
DataTypeIO.writeVarInt(output, viewDistance);
|
DataTypeIO.writeVarInt(output, viewDistance);
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,24 @@ import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import com.loohp.limbo.utils.DataTypeIO;
|
import com.loohp.limbo.utils.DataTypeIO;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
|
|
||||||
public class PacketPlayOutPlayerListHeaderFooter extends PacketOut{
|
public class PacketPlayOutPlayerListHeaderFooter extends PacketOut{
|
||||||
|
|
||||||
private String header;
|
private BaseComponent[] header;
|
||||||
private String footer;
|
private BaseComponent[] footer;
|
||||||
|
|
||||||
public PacketPlayOutPlayerListHeaderFooter(String header, String footer) {
|
public PacketPlayOutPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
||||||
this.header = header;
|
this.header = header;
|
||||||
this.footer = footer;
|
this.footer = footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHeader() {
|
public BaseComponent[] getHeader() {
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFooter() {
|
public BaseComponent[] getFooter() {
|
||||||
return footer;
|
return footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,8 +35,8 @@ public class PacketPlayOutPlayerListHeaderFooter extends PacketOut{
|
||||||
|
|
||||||
DataOutputStream output = new DataOutputStream(buffer);
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
output.writeByte(Packet.getPlayOut().get(getClass()));
|
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||||
DataTypeIO.writeString(output, header, StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, ComponentSerializer.toString(header), StandardCharsets.UTF_8);
|
||||||
DataTypeIO.writeString(output, footer, StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, ComponentSerializer.toString(footer), StandardCharsets.UTF_8);
|
||||||
return buffer.toByteArray();
|
return buffer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue