From 369975a027a007bc5f73a1f6add73a9aedd1b2cc Mon Sep 17 00:00:00 2001 From: ikos3k Date: Tue, 5 Jan 2021 15:18:20 +0100 Subject: [PATCH] some fixes --- .../java/me/ANONIMUS/proxy/BetterProxy.java | 8 +++--- .../proxy/command/CommandManager.java | 8 +++--- .../proxy/command/impl/CommandHelp.java | 8 +++--- .../proxy/command/impl/CommandLogin.java | 4 +-- .../command/impl/admins/CommandAlert.java | 6 ++--- .../command/impl/admins/CommandFree.java | 2 +- .../command/impl/admins/CommandKick.java | 6 ++--- .../command/impl/admins/CommandStatus.java | 6 ++--- .../command/impl/admins/CommandThreads.java | 4 +-- .../command/impl/bots/CommandBotQuit.java | 8 +++--- .../command/impl/bots/CommandMother.java | 4 ++- .../proxy/command/impl/cheats/CommandFly.java | 4 +-- .../command/impl/cheats/CommandSpeed.java | 6 ++--- .../command/impl/more/CommandBypass.java | 20 -------------- .../proxy/command/impl/more/CommandLobby.java | 6 ++--- .../command/impl/more/CommandMsgall.java | 6 ++--- .../command/impl/more/CommandOptions.java | 12 ++++----- .../command/impl/more/CommandPlayers.java | 6 ++--- .../command/impl/more/CommandPlugins.java | 6 ++--- .../command/impl/more/CommandPortScanner.java | 2 +- .../proxy/command/impl/more/CommandTime.java | 6 ++--- .../command/impl/normal/CommandJoin.java | 4 +-- .../command/impl/normal/CommandJoinBot.java | 6 ++--- .../command/impl/normal/CommandQuit.java | 6 ++--- .../command/impl/normal/CommandStay.java | 10 +++---- .../me/ANONIMUS/proxy/enums/BypassType.java | 25 ------------------ .../me/ANONIMUS/proxy/enums/GroupType.java | 2 +- .../me/ANONIMUS/proxy/enums/ThemeType.java | 5 ---- .../handler/impl/ServerLoginHandler.java | 18 ++++++------- .../proxy/handler/impl/ServerPlayHandler.java | 14 +++++----- .../handler/impl/ServerStatusHandler.java | 11 ++++---- .../me/ANONIMUS/proxy/objects/Option.java | 2 +- .../ANONIMUS/proxy/protocol/ProxyServer.java | 12 ++++----- .../protocol/connection/BotConnection.java | 26 +++++++++---------- .../protocol/connection/PlayerConnection.java | 25 ++++++++---------- .../protocol/connection/ServerPinger.java | 23 ++++++++-------- .../proxy/protocol/data/util/NetUtil.java | 5 ++-- ...meDecoder.java => VarInt21FrameCodec.java} | 20 +++++++++++--- .../handlers/VarInt21FrameEncoder.java | 22 ---------------- .../proxy/protocol/objects/Player.java | 13 ++++------ .../proxy/protocol/packet/PacketRegistry.java | 22 +++++++--------- .../impl/server/play/ServerChatPacket.java | 2 +- .../ANONIMUS/proxy/threads/MessageThread.java | 2 +- .../proxy/threads/TitleLagThread.java | 2 +- .../proxy/utils/{proxy => }/ChatUtil.java | 8 +++--- .../proxy/utils/{java => }/FileUtil.java | 2 +- .../proxy/utils/{proxy => }/ItemUtil.java | 4 +-- .../proxy/utils/{proxy => }/PacketUtil.java | 2 +- .../proxy/utils/{proxy => }/SRVResolver.java | 2 +- .../utils/{proxy => }/ScoreboardUtil.java | 4 +-- .../proxy/utils/{proxy => }/WorldUtil.java | 4 +-- 51 files changed, 184 insertions(+), 257 deletions(-) delete mode 100644 src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandBypass.java delete mode 100644 src/main/java/me/ANONIMUS/proxy/enums/BypassType.java delete mode 100644 src/main/java/me/ANONIMUS/proxy/enums/ThemeType.java rename src/main/java/me/ANONIMUS/proxy/protocol/handlers/{Varint21FrameDecoder.java => VarInt21FrameCodec.java} (63%) delete mode 100644 src/main/java/me/ANONIMUS/proxy/protocol/handlers/VarInt21FrameEncoder.java rename src/main/java/me/ANONIMUS/proxy/utils/{proxy => }/ChatUtil.java (98%) rename src/main/java/me/ANONIMUS/proxy/utils/{java => }/FileUtil.java (96%) rename src/main/java/me/ANONIMUS/proxy/utils/{proxy => }/ItemUtil.java (97%) rename src/main/java/me/ANONIMUS/proxy/utils/{proxy => }/PacketUtil.java (98%) rename src/main/java/me/ANONIMUS/proxy/utils/{proxy => }/SRVResolver.java (96%) rename src/main/java/me/ANONIMUS/proxy/utils/{proxy => }/ScoreboardUtil.java (98%) rename src/main/java/me/ANONIMUS/proxy/utils/{proxy => }/WorldUtil.java (97%) diff --git a/src/main/java/me/ANONIMUS/proxy/BetterProxy.java b/src/main/java/me/ANONIMUS/proxy/BetterProxy.java index 90ffeb4..3cf708d 100644 --- a/src/main/java/me/ANONIMUS/proxy/BetterProxy.java +++ b/src/main/java/me/ANONIMUS/proxy/BetterProxy.java @@ -1,15 +1,15 @@ package me.ANONIMUS.proxy; import lombok.Data; -import me.ANONIMUS.proxy.protocol.ProxyServer; -import me.ANONIMUS.proxy.threads.MemoryFreeThread; -import me.ANONIMUS.proxy.threads.MessageThread; import me.ANONIMUS.proxy.command.CommandManager; import me.ANONIMUS.proxy.config.ConfigManager; import me.ANONIMUS.proxy.objects.Account; +import me.ANONIMUS.proxy.protocol.ProxyServer; import me.ANONIMUS.proxy.protocol.packet.PacketRegistry; +import me.ANONIMUS.proxy.threads.MemoryFreeThread; +import me.ANONIMUS.proxy.threads.MessageThread; import me.ANONIMUS.proxy.threads.TitleLagThread; -import me.ANONIMUS.proxy.utils.java.FileUtil; +import me.ANONIMUS.proxy.utils.FileUtil; import java.io.File; import java.util.ArrayList; diff --git a/src/main/java/me/ANONIMUS/proxy/command/CommandManager.java b/src/main/java/me/ANONIMUS/proxy/command/CommandManager.java index 474522f..30ecb76 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/CommandManager.java +++ b/src/main/java/me/ANONIMUS/proxy/command/CommandManager.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.ScoreboardUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.enums.GroupType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.ScoreboardUtil; import org.reflections.Reflections; import java.util.ArrayList; @@ -18,7 +18,7 @@ public class CommandManager { private final List commands = new ArrayList<>(); public void init() { - new Reflections("me.AlshainTeam.proxy.command.impl").getSubTypesOf(Command.class).forEach(cmd -> { + new Reflections("me.ANONIMUS.proxy.command.impl").getSubTypesOf(Command.class).forEach(cmd -> { try { commands.add(cmd.newInstance()); } catch (InstantiationException | IllegalAccessException e) { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/CommandHelp.java b/src/main/java/me/ANONIMUS/proxy/command/impl/CommandHelp.java index 6d3bbf4..2d2c9e7 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/CommandHelp.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/CommandHelp.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl; -import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerChatPacket; import me.ANONIMUS.proxy.BetterProxy; +import me.ANONIMUS.proxy.command.Command; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerChatPacket; +import me.ANONIMUS.proxy.utils.ChatUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; @@ -16,7 +16,7 @@ public class CommandHelp extends Command { public CommandHelp() { - super("help", "pomoc", "helpful commands", "[page]", null, ConnectedType.NONE); + super("help", null, "helpful commands", "[page]", null, ConnectedType.NONE); } @Override diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/CommandLogin.java b/src/main/java/me/ANONIMUS/proxy/command/impl/CommandLogin.java index 958afd4..65f6ab7 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/CommandLogin.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/CommandLogin.java @@ -1,10 +1,10 @@ package me.ANONIMUS.proxy.command.impl; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.WorldUtil; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.WorldUtil; public class CommandLogin extends Command { public CommandLogin() { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandAlert.java b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandAlert.java index c302e5d..76e170f 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandAlert.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandAlert.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.admins; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.managers.PlayerManager; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.managers.PlayerManager; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; public class CommandAlert extends Command { public CommandAlert() { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandFree.java b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandFree.java index 91f4785..28bf155 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandFree.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandFree.java @@ -4,7 +4,7 @@ import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.utils.ChatUtil; public class CommandFree extends Command { public CommandFree() { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandKick.java b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandKick.java index 9b28aaa..3bd377e 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandKick.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandKick.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.admins; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.managers.PlayerManager; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.managers.PlayerManager; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; public class CommandKick extends Command { public CommandKick() { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandStatus.java b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandStatus.java index f979a70..c187148 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandStatus.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandStatus.java @@ -1,10 +1,10 @@ package me.ANONIMUS.proxy.command.impl.admins; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; import javax.management.Attribute; import javax.management.AttributeList; @@ -58,7 +58,7 @@ private String humanReadableByteCount(long bytes) { if (bytes < 1536L) { return bytes + " B"; } - int exp = (int) (Math.log((double) bytes) / Math.log((double) 1536.0)); + int exp = (int) (Math.log((double) bytes) / Math.log(1536.0)); String pre = String.valueOf("KMGTPE".charAt(exp - 1)); return String.format("%.2f %sB", (double) bytes / Math.pow(1024.0, exp), pre); } diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandThreads.java b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandThreads.java index 6036cd9..03a05e0 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandThreads.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/admins/CommandThreads.java @@ -1,10 +1,10 @@ package me.ANONIMUS.proxy.command.impl.admins; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; import java.util.Set; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandBotQuit.java b/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandBotQuit.java index 1d5370f..b2d013a 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandBotQuit.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandBotQuit.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.bots; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Bot; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Bot; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; public class CommandBotQuit extends Command { public CommandBotQuit() { @@ -32,7 +32,7 @@ public void onCommand(Player sender, String cmd, String[] args) throws Exception } } if (b == null) { - ChatUtil.sendChatMessage("&cThe bot you provided with the nickname &4" + args[1] + " &cdoes not exist", sender, true); + ChatUtil.sendChatMessage("&cThe bot with a nickname &4" + args[1] + " &cdoes not exist", sender, true); return; } b.getSession().getChannel().close(); diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandMother.java b/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandMother.java index dd2ac15..0d5c916 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandMother.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/bots/CommandMother.java @@ -1,9 +1,10 @@ package me.ANONIMUS.proxy.command.impl.bots; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; public class CommandMother extends Command { public CommandMother() { @@ -13,5 +14,6 @@ public CommandMother() { @Override public void onCommand(Player sender, String cmd, String[] args) throws Exception { sender.setMother(!sender.isMother()); + ChatUtil.sendTitle(sender, "[MOTHER]", String.valueOf(sender.isMother())); } } \ No newline at end of file diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandFly.java b/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandFly.java index 92343e2..75156c6 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandFly.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandFly.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.cheats; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.PacketUtil; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.PacketUtil; public class CommandFly extends Command { public CommandFly() { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandSpeed.java b/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandSpeed.java index 637f6cc..8b56793 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandSpeed.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/cheats/CommandSpeed.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.cheats; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.PacketUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.PacketUtil; public class CommandSpeed extends Command { public CommandSpeed() { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandBypass.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandBypass.java deleted file mode 100644 index 9ba3a67..0000000 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandBypass.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.ANONIMUS.proxy.command.impl.more; - -import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.enums.BypassType; -import me.ANONIMUS.proxy.enums.CommandType; -import me.ANONIMUS.proxy.enums.ConnectedType; - -import java.util.Arrays; - -public class CommandBypass extends Command { - public CommandBypass() { super("bypass", null, null, Arrays.toString(BypassType.values()).toLowerCase(), CommandType.MORE, ConnectedType.DISCONNECTED); } - - @Override - public void onCommand(Player sender, String cmd, String[] args) throws Exception { - sender.setBypassType(BypassType.valueOf(args[1].toUpperCase())); - ChatUtil.sendChatMessage("&7You have set the bypass to: &6" + args[1].toUpperCase(), sender, true); - } -} diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandLobby.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandLobby.java index aaf620d..f7bfd53 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandLobby.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandLobby.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.more; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.WorldUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.WorldUtil; public class CommandLobby extends Command { public CommandLobby() { super("lobby", null, "teleport to lobby", "", CommandType.MORE, ConnectedType.DISCONNECTED); } diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandMsgall.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandMsgall.java index c7cab38..46e96b9 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandMsgall.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandMsgall.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.more; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientChatPacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientChatPacket; +import me.ANONIMUS.proxy.utils.ChatUtil; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandOptions.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandOptions.java index 380ba85..ff1dd9d 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandOptions.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandOptions.java @@ -1,16 +1,16 @@ package me.ANONIMUS.proxy.command.impl.more; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.data.ItemStack; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerOpenWindowPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerWindowItemsPacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.ItemUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.objects.Option; +import me.ANONIMUS.proxy.protocol.data.ItemStack; import me.ANONIMUS.proxy.protocol.data.WindowType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerOpenWindowPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerWindowItemsPacket; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.ItemUtil; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlayers.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlayers.java index 5caf621..ad3945e 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlayers.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlayers.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.more; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientTabCompletePacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientTabCompletePacket; +import me.ANONIMUS.proxy.utils.ChatUtil; import javax.json.*; import java.io.BufferedReader; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlugins.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlugins.java index b59c077..ceb16c3 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlugins.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPlugins.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.more; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientTabCompletePacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientTabCompletePacket; +import me.ANONIMUS.proxy.utils.ChatUtil; public class CommandPlugins extends Command { public CommandPlugins() { super("plugins", "pl", null, "[tabcomplete]", CommandType.MORE, ConnectedType.CONNECTED); } diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPortScanner.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPortScanner.java index 198173b..0661742 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPortScanner.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandPortScanner.java @@ -1,10 +1,10 @@ package me.ANONIMUS.proxy.command.impl.more; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; import java.net.InetSocketAddress; import java.net.Socket; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandTime.java b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandTime.java index 88e0ee5..531613c 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandTime.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/more/CommandTime.java @@ -1,12 +1,12 @@ package me.ANONIMUS.proxy.command.impl.more; import me.ANONIMUS.proxy.command.Command; +import me.ANONIMUS.proxy.enums.CommandType; +import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.enums.TimeType; import me.ANONIMUS.proxy.protocol.objects.Player; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerTimeUpdatePacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.enums.CommandType; -import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.utils.ChatUtil; import java.util.Arrays; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoin.java b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoin.java index 59d5360..1ea6f81 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoin.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoin.java @@ -6,8 +6,8 @@ import me.ANONIMUS.proxy.protocol.connection.PlayerConnection; import me.ANONIMUS.proxy.protocol.connection.ServerPinger; import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.SRVResolver; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.SRVResolver; import java.net.InetSocketAddress; import java.net.Proxy; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoinBot.java b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoinBot.java index fa72e13..f4ad369 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoinBot.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandJoinBot.java @@ -1,14 +1,14 @@ package me.ANONIMUS.proxy.command.impl.normal; import me.ANONIMUS.proxy.command.Command; +import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.protocol.connection.BotConnection; import me.ANONIMUS.proxy.protocol.connection.ServerPinger; import me.ANONIMUS.proxy.protocol.objects.Bot; import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.SRVResolver; -import me.ANONIMUS.proxy.enums.CommandType; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.SRVResolver; import java.net.InetSocketAddress; import java.net.Proxy; diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandQuit.java b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandQuit.java index 8170e25..85ed739 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandQuit.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandQuit.java @@ -1,11 +1,11 @@ package me.ANONIMUS.proxy.command.impl.normal; import me.ANONIMUS.proxy.command.Command; -import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.WorldUtil; import me.ANONIMUS.proxy.enums.CommandType; import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.WorldUtil; public class CommandQuit extends Command { public CommandQuit() { diff --git a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandStay.java b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandStay.java index d675e1a..3d80222 100644 --- a/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandStay.java +++ b/src/main/java/me/ANONIMUS/proxy/command/impl/normal/CommandStay.java @@ -5,6 +5,8 @@ import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.nio.NioEventLoopGroup; import me.ANONIMUS.proxy.command.Command; +import me.ANONIMUS.proxy.enums.CommandType; +import me.ANONIMUS.proxy.enums.ConnectedType; import me.ANONIMUS.proxy.protocol.data.ConnectionState; import me.ANONIMUS.proxy.protocol.objects.Bot; import me.ANONIMUS.proxy.protocol.objects.Player; @@ -18,10 +20,8 @@ import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerDisconnectPacket; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerJoinGamePacket; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerKeepAlivePacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.WorldUtil; -import me.ANONIMUS.proxy.enums.CommandType; -import me.ANONIMUS.proxy.enums.ConnectedType; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.WorldUtil; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; public class CommandStay extends Command { @@ -44,7 +44,7 @@ public void channelInactive(ChannelHandlerContext ctx) { } @Override - protected void channelRead0(ChannelHandlerContext channelHandlerContext, Packet packet) throws Exception { + protected void channelRead0(ChannelHandlerContext channelHandlerContext, Packet packet) { if (packet instanceof ServerLoginSetCompressionPacket) { bot.getSession().setCompressionThreshold(((ServerLoginSetCompressionPacket) packet).getThreshold()); } else if (packet instanceof ServerLoginSuccessPacket) { diff --git a/src/main/java/me/ANONIMUS/proxy/enums/BypassType.java b/src/main/java/me/ANONIMUS/proxy/enums/BypassType.java deleted file mode 100644 index df43c31..0000000 --- a/src/main/java/me/ANONIMUS/proxy/enums/BypassType.java +++ /dev/null @@ -1,25 +0,0 @@ -package me.ANONIMUS.proxy.enums; - -public enum BypassType { - MSPACK("MC|SMKrzak", "SMKrzak"); - - private final String channel; - private final byte[] data; - - BypassType(String channel, byte[] data) { - this.channel = channel; - this.data = data; - } - - BypassType(String channel, String data) { - this(channel, data.getBytes()); - } - - public String getChannel() { - return channel; - } - - public byte[] getData() { - return data; - } -} \ No newline at end of file diff --git a/src/main/java/me/ANONIMUS/proxy/enums/GroupType.java b/src/main/java/me/ANONIMUS/proxy/enums/GroupType.java index 8fac008..17db52f 100644 --- a/src/main/java/me/ANONIMUS/proxy/enums/GroupType.java +++ b/src/main/java/me/ANONIMUS/proxy/enums/GroupType.java @@ -30,7 +30,7 @@ public int getDelayCMD() { return delayCMD; } - public static GroupType getByPermissionLevel(int permission) { + public static GroupType getByPermission(int permission) { return Arrays.stream(GroupType.values()).filter(gp -> gp.permission == permission).findFirst().orElse(GroupType.USER); } } \ No newline at end of file diff --git a/src/main/java/me/ANONIMUS/proxy/enums/ThemeType.java b/src/main/java/me/ANONIMUS/proxy/enums/ThemeType.java deleted file mode 100644 index 5377d16..0000000 --- a/src/main/java/me/ANONIMUS/proxy/enums/ThemeType.java +++ /dev/null @@ -1,5 +0,0 @@ -package me.ANONIMUS.proxy.enums; - -public enum ThemeType { - DEFAULT -} \ No newline at end of file diff --git a/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerLoginHandler.java b/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerLoginHandler.java index f9b7a6e..44e2e10 100644 --- a/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerLoginHandler.java +++ b/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerLoginHandler.java @@ -1,20 +1,19 @@ package me.ANONIMUS.proxy.handler.impl; import me.ANONIMUS.proxy.BetterProxy; -import me.ANONIMUS.proxy.protocol.objects.GameProfile; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.protocol.packet.ProtocolType; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginDisconnectPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSetCompressionPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSuccessPacket; -import me.ANONIMUS.proxy.utils.proxy.ScoreboardUtil; import me.ANONIMUS.proxy.handler.ServerHandler; import me.ANONIMUS.proxy.objects.Account; import me.ANONIMUS.proxy.protocol.data.ConnectionState; import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.protocol.packet.Packet; +import me.ANONIMUS.proxy.protocol.packet.ProtocolType; import me.ANONIMUS.proxy.protocol.packet.impl.client.login.ClientLoginStartPacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.WorldUtil; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginDisconnectPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSetCompressionPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSuccessPacket; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.ScoreboardUtil; +import me.ANONIMUS.proxy.utils.WorldUtil; import net.kyori.adventure.text.Component; import java.util.UUID; @@ -41,7 +40,6 @@ public void handlePacket(Packet packet) { player.getSession().sendPacket(new ServerLoginSuccessPacket(UUID.randomUUID(), account.getUsername())); player.getSession().setConnectionState(ConnectionState.PLAY); player.getSession().setPacketHandler(new ServerPlayHandler(player)); - player.setGameProfile(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + account.getUsername()).getBytes()), account.getUsername())); player.setAccount(account); WorldUtil.emptyWorld(player); diff --git a/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerPlayHandler.java b/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerPlayHandler.java index 4815651..355f098 100644 --- a/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerPlayHandler.java +++ b/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerPlayHandler.java @@ -4,19 +4,19 @@ import me.ANONIMUS.proxy.handler.ServerHandler; import me.ANONIMUS.proxy.protocol.data.ItemStack; import me.ANONIMUS.proxy.protocol.data.WindowAction; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.protocol.packet.ProtocolType; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerOpenWindowPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerWindowItemsPacket; import me.ANONIMUS.proxy.protocol.data.WindowType; import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.protocol.packet.Packet; +import me.ANONIMUS.proxy.protocol.packet.ProtocolType; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientChatPacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientKeepAlivePacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientPlayerPlaceBlockPacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientPlayerWindowActionPacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.ItemUtil; -import me.ANONIMUS.proxy.utils.proxy.PacketUtil; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerOpenWindowPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerWindowItemsPacket; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.ItemUtil; +import me.ANONIMUS.proxy.utils.PacketUtil; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerStatusHandler.java b/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerStatusHandler.java index 0d7aff4..5ffcfa6 100644 --- a/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerStatusHandler.java +++ b/src/main/java/me/ANONIMUS/proxy/handler/impl/ServerStatusHandler.java @@ -1,18 +1,18 @@ package me.ANONIMUS.proxy.handler.impl; import me.ANONIMUS.proxy.BetterProxy; -import me.ANONIMUS.proxy.protocol.objects.GameProfile; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusPongPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusResponsePacket; import me.ANONIMUS.proxy.handler.ServerHandler; import me.ANONIMUS.proxy.protocol.data.status.PlayerInfo; import me.ANONIMUS.proxy.protocol.data.status.ServerStatusInfo; import me.ANONIMUS.proxy.protocol.data.status.VersionInfo; +import me.ANONIMUS.proxy.protocol.objects.GameProfile; import me.ANONIMUS.proxy.protocol.objects.Player; +import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.impl.client.status.ClientStatusPingPacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.status.ClientStatusRequestPacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusPongPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusResponsePacket; +import me.ANONIMUS.proxy.utils.ChatUtil; import net.kyori.adventure.text.Component; import javax.imageio.ImageIO; @@ -55,6 +55,7 @@ public void handlePacket(Packet packet) { final PlayerInfo playerInfo = new PlayerInfo(0, 0, gp); final Component desc = Component.text(ChatUtil.fixColor(BetterProxy.getInstance().getConfigManager().getConfig().line1 + "&r\n" + BetterProxy.getInstance().getConfigManager().getConfig().line2)); final ByteArrayOutputStream os = new ByteArrayOutputStream(); + assert bufferedImage != null; ImageIO.write(bufferedImage, "png", Base64.getEncoder().wrap(os)); player.getSession().sendPacket(new ServerStatusResponsePacket(new ServerStatusInfo(versionInfo, playerInfo, desc, statusFile.exists() ? "data:image/png;base64," + os.toString(StandardCharsets.ISO_8859_1.name()) : null))); diff --git a/src/main/java/me/ANONIMUS/proxy/objects/Option.java b/src/main/java/me/ANONIMUS/proxy/objects/Option.java index 4b88fce..777c24b 100644 --- a/src/main/java/me/ANONIMUS/proxy/objects/Option.java +++ b/src/main/java/me/ANONIMUS/proxy/objects/Option.java @@ -1,7 +1,7 @@ package me.ANONIMUS.proxy.objects; import me.ANONIMUS.proxy.protocol.objects.Player; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.utils.ChatUtil; public class Option { private Player player; diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/ProxyServer.java b/src/main/java/me/ANONIMUS/proxy/protocol/ProxyServer.java index 5672ed5..22ac19a 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/ProxyServer.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/ProxyServer.java @@ -8,15 +8,14 @@ import io.netty.handler.timeout.ReadTimeoutHandler; import lombok.Data; import lombok.RequiredArgsConstructor; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerKeepAlivePacket; import me.ANONIMUS.proxy.managers.PlayerManager; import me.ANONIMUS.proxy.protocol.data.ConnectionState; import me.ANONIMUS.proxy.protocol.handlers.PacketCodec; -import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameEncoder; -import me.ANONIMUS.proxy.protocol.handlers.Varint21FrameDecoder; +import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameCodec; import me.ANONIMUS.proxy.protocol.objects.Session; +import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.PacketDirection; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerKeepAlivePacket; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -36,11 +35,10 @@ public void bind() { .childOption(ChannelOption.SO_KEEPALIVE, true) .childHandler(new ChannelInitializer() { @Override - protected void initChannel(SocketChannel socketChannel) throws Exception { + protected void initChannel(SocketChannel socketChannel) { final ChannelPipeline pipeline = socketChannel.pipeline(); pipeline.addLast("timer", new ReadTimeoutHandler(10)); - pipeline.addLast("varintEncoder", new VarInt21FrameEncoder()); - pipeline.addLast("varintDecoder", new Varint21FrameDecoder()); + pipeline.addLast("frameCodec", new VarInt21FrameCodec()); pipeline.addLast("packetCodec", new PacketCodec(ConnectionState.HANDSHAKE, PacketDirection.SERVERBOUND)); pipeline.addLast(new SimpleChannelInboundHandler() { @Override diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/connection/BotConnection.java b/src/main/java/me/ANONIMUS/proxy/protocol/connection/BotConnection.java index fbba0c6..ac2db94 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/connection/BotConnection.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/connection/BotConnection.java @@ -9,27 +9,26 @@ import io.netty.handler.timeout.ReadTimeoutHandler; import lombok.Data; import lombok.RequiredArgsConstructor; -import me.ANONIMUS.proxy.protocol.objects.Bot; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginDisconnectPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSetCompressionPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSuccessPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerDisconnectPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerJoinGamePacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerKeepAlivePacket; import me.ANONIMUS.proxy.objects.ServerData; import me.ANONIMUS.proxy.protocol.data.ConnectionState; import me.ANONIMUS.proxy.protocol.handlers.PacketCodec; -import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameEncoder; -import me.ANONIMUS.proxy.protocol.handlers.Varint21FrameDecoder; +import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameCodec; +import me.ANONIMUS.proxy.protocol.objects.Bot; import me.ANONIMUS.proxy.protocol.objects.Session; +import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.PacketDirection; import me.ANONIMUS.proxy.protocol.packet.impl.client.HandshakePacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.login.ClientLoginStartPacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientCustomPayloadPacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientKeepAlivePacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientSettingsPacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginDisconnectPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSetCompressionPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSuccessPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerDisconnectPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerJoinGamePacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerKeepAlivePacket; +import me.ANONIMUS.proxy.utils.ChatUtil; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import java.net.Proxy; @@ -46,14 +45,13 @@ public void connect(String host, int port, Proxy proxy, Bot bot) { .channel(NioSocketChannel.class) .handler(new ChannelInitializer() { @Override - protected void initChannel(SocketChannel socketChannel) throws Exception { + protected void initChannel(SocketChannel socketChannel) { final ChannelPipeline pipeline = socketChannel.pipeline(); if (proxy != Proxy.NO_PROXY) { pipeline.addFirst(new Socks4ProxyHandler(proxy.address())); } pipeline.addLast("timer", new ReadTimeoutHandler(20)); - pipeline.addLast("frameEncoder", new VarInt21FrameEncoder()); - pipeline.addLast("frameDecoder", new Varint21FrameDecoder()); + pipeline.addLast("frameCodec", new VarInt21FrameCodec()); pipeline.addLast("packetCodec", new PacketCodec(ConnectionState.LOGIN, PacketDirection.CLIENTBOUND)); pipeline.addLast("handler", new SimpleChannelInboundHandler() { @Override diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/connection/PlayerConnection.java b/src/main/java/me/ANONIMUS/proxy/protocol/connection/PlayerConnection.java index 45876f1..dda7911 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/connection/PlayerConnection.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/connection/PlayerConnection.java @@ -9,27 +9,25 @@ import io.netty.handler.timeout.ReadTimeoutHandler; import lombok.Data; import lombok.RequiredArgsConstructor; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginDisconnectPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSetCompressionPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSuccessPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.play.*; import me.ANONIMUS.proxy.enums.TimeType; import me.ANONIMUS.proxy.objects.ServerData; import me.ANONIMUS.proxy.protocol.data.ConnectionState; import me.ANONIMUS.proxy.protocol.handlers.PacketCodec; -import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameEncoder; -import me.ANONIMUS.proxy.protocol.handlers.Varint21FrameDecoder; +import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameCodec; import me.ANONIMUS.proxy.protocol.objects.Player; import me.ANONIMUS.proxy.protocol.objects.Session; +import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.PacketDirection; import me.ANONIMUS.proxy.protocol.packet.impl.client.HandshakePacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.login.ClientLoginStartPacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.play.ClientKeepAlivePacket; -import me.AlshainTeam.proxy.protocol.packet.impl.server.play.*; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; -import me.ANONIMUS.proxy.utils.proxy.ScoreboardUtil; -import me.ANONIMUS.proxy.utils.proxy.WorldUtil; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginDisconnectPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSetCompressionPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.login.ServerLoginSuccessPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.play.*; +import me.ANONIMUS.proxy.utils.ChatUtil; +import me.ANONIMUS.proxy.utils.ScoreboardUtil; +import me.ANONIMUS.proxy.utils.WorldUtil; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import java.net.Proxy; @@ -51,14 +49,13 @@ public void connect(String host, int port, Proxy proxy) { .channel(NioSocketChannel.class) .handler(new ChannelInitializer() { @Override - protected void initChannel(SocketChannel socketChannel) throws Exception { + protected void initChannel(SocketChannel socketChannel) { final ChannelPipeline pipeline = socketChannel.pipeline(); if (proxy != Proxy.NO_PROXY) { pipeline.addFirst(new Socks4ProxyHandler(proxy.address())); } pipeline.addLast("timer", new ReadTimeoutHandler(20)); - pipeline.addLast("frameEncoder", new VarInt21FrameEncoder()); - pipeline.addLast("frameDecoder", new Varint21FrameDecoder()); + pipeline.addLast("frameCodec", new VarInt21FrameCodec()); pipeline.addLast("packetCodec", new PacketCodec(ConnectionState.LOGIN, PacketDirection.CLIENTBOUND)); pipeline.addLast("handler", new SimpleChannelInboundHandler() { @Override diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/connection/ServerPinger.java b/src/main/java/me/ANONIMUS/proxy/protocol/connection/ServerPinger.java index 97353ef..7072f62 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/connection/ServerPinger.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/connection/ServerPinger.java @@ -9,19 +9,18 @@ import io.netty.handler.timeout.ReadTimeoutHandler; import lombok.Data; import lombok.RequiredArgsConstructor; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusPongPacket; -import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusResponsePacket; import me.ANONIMUS.proxy.protocol.data.ConnectionState; import me.ANONIMUS.proxy.protocol.handlers.PacketCodec; -import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameEncoder; -import me.ANONIMUS.proxy.protocol.handlers.Varint21FrameDecoder; +import me.ANONIMUS.proxy.protocol.handlers.VarInt21FrameCodec; import me.ANONIMUS.proxy.protocol.objects.Player; import me.ANONIMUS.proxy.protocol.objects.Session; +import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.PacketDirection; import me.ANONIMUS.proxy.protocol.packet.impl.client.HandshakePacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.status.ClientStatusRequestPacket; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusPongPacket; +import me.ANONIMUS.proxy.protocol.packet.impl.server.status.ServerStatusResponsePacket; +import me.ANONIMUS.proxy.utils.ChatUtil; import java.net.Proxy; import java.util.concurrent.TimeUnit; @@ -42,20 +41,20 @@ public void connect(String host, int port, Proxy proxy) { .channel(NioSocketChannel.class) .handler(new ChannelInitializer() { @Override - protected void initChannel(SocketChannel socketChannel) throws Exception { + protected void initChannel(SocketChannel socketChannel) { final ChannelPipeline pipeline = socketChannel.pipeline(); if (proxy != Proxy.NO_PROXY) { pipeline.addFirst(new Socks4ProxyHandler(proxy.address())); } pipeline.addLast("timer", new ReadTimeoutHandler(20)); - pipeline.addLast("frameEncoder", new VarInt21FrameEncoder()); - pipeline.addLast("frameDecoder", new Varint21FrameDecoder()); + pipeline.addLast("frameCodec", new VarInt21FrameCodec()); pipeline.addLast("packetCodec", new PacketCodec(ConnectionState.LOGIN, PacketDirection.CLIENTBOUND)); pipeline.addLast("handler", new SimpleChannelInboundHandler() { @Override - public void channelInactive(ChannelHandlerContext ctx) throws Exception { - group.shutdownGracefully(); } + public void channelInactive(ChannelHandlerContext ctx) { + group.shutdownGracefully(); + } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { @@ -74,7 +73,7 @@ protected void channelRead0(ChannelHandlerContext channelHandlerContext, Packet group.shutdownGracefully(); } else if (packet instanceof ServerStatusPongPacket) { session.getChannel().close(); - group.shutdownGracefully();; + group.shutdownGracefully(); } } }); diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/data/util/NetUtil.java b/src/main/java/me/ANONIMUS/proxy/protocol/data/util/NetUtil.java index fee6fe0..58cf14f 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/data/util/NetUtil.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/data/util/NetUtil.java @@ -1,7 +1,6 @@ package me.ANONIMUS.proxy.protocol.data.util; import me.ANONIMUS.proxy.protocol.data.*; -import me.AlshainTeam.proxy.protocol.data.*; import me.ANONIMUS.proxy.protocol.packet.PacketBuffer; import java.io.IOException; @@ -10,13 +9,13 @@ public class NetUtil { public static EntityMetadata[] readEntityMetadata(final PacketBuffer in) throws IOException { - final List ret = new ArrayList(); + final List ret = new ArrayList<>(); byte b; while ((b = in.readByte()) != 127) { final int typeId = (b & 0xE0) >> 5; final int id = b & 0x1F; final MetadataType type = MetadataType.getActionById(typeId); - Object value = null; + Object value; switch (type) { case BYTE: { value = in.readByte(); diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/handlers/Varint21FrameDecoder.java b/src/main/java/me/ANONIMUS/proxy/protocol/handlers/VarInt21FrameCodec.java similarity index 63% rename from src/main/java/me/ANONIMUS/proxy/protocol/handlers/Varint21FrameDecoder.java rename to src/main/java/me/ANONIMUS/proxy/protocol/handlers/VarInt21FrameCodec.java index f451c08..5f36da9 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/handlers/Varint21FrameDecoder.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/handlers/VarInt21FrameCodec.java @@ -3,15 +3,29 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; +import io.netty.handler.codec.ByteToMessageCodec; import io.netty.handler.codec.CorruptedFrameException; import me.ANONIMUS.proxy.protocol.packet.PacketBuffer; import java.util.List; -public class Varint21FrameDecoder extends ByteToMessageDecoder { +public class VarInt21FrameCodec extends ByteToMessageCodec { @Override - protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List list) throws Exception { + protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) { + final int size = byteBuf.readableBytes(); + final int j = PacketBuffer.getVarIntSize(size); + if (j > 3) { + throw new IllegalArgumentException("unable to fit " + size + " into 3"); + } + + final PacketBuffer packetbuffer = new PacketBuffer(byteBuf2); + packetbuffer.ensureWritable(j + size); + packetbuffer.writeVarInt(size); + packetbuffer.writeBytes(byteBuf, byteBuf.readerIndex(), size); + } + + @Override + protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List list) { byteBuf.markReaderIndex(); final byte[] bytes = new byte[3]; diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/handlers/VarInt21FrameEncoder.java b/src/main/java/me/ANONIMUS/proxy/protocol/handlers/VarInt21FrameEncoder.java deleted file mode 100644 index 07def3b..0000000 --- a/src/main/java/me/ANONIMUS/proxy/protocol/handlers/VarInt21FrameEncoder.java +++ /dev/null @@ -1,22 +0,0 @@ -package me.ANONIMUS.proxy.protocol.handlers; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; -import me.ANONIMUS.proxy.protocol.packet.PacketBuffer; - -public class VarInt21FrameEncoder extends MessageToByteEncoder { - @Override - protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) throws Exception { - final int size = byteBuf.readableBytes(); - final int j = PacketBuffer.getVarIntSize(size); - if (j > 3) { - throw new IllegalArgumentException("unable to fit " + size + " into 3"); - } - - final PacketBuffer packetbuffer = new PacketBuffer(byteBuf2); - packetbuffer.ensureWritable(j + size); - packetbuffer.writeVarInt(size); - packetbuffer.writeBytes(byteBuf, byteBuf.readerIndex(), size); - } -} \ No newline at end of file diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/objects/Player.java b/src/main/java/me/ANONIMUS/proxy/protocol/objects/Player.java index 4604a64..5418101 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/objects/Player.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/objects/Player.java @@ -1,18 +1,17 @@ package me.ANONIMUS.proxy.protocol.objects; import lombok.Data; +import me.ANONIMUS.proxy.enums.TimeType; import me.ANONIMUS.proxy.handler.impl.ServerLoginHandler; import me.ANONIMUS.proxy.handler.impl.ServerStatusHandler; -import me.ANONIMUS.proxy.managers.PlayerManager; -import me.ANONIMUS.proxy.protocol.data.ConnectionState; -import me.ANONIMUS.proxy.protocol.data.playerlist.PlayerListEntry; -import me.ANONIMUS.proxy.protocol.packet.Packet; -import me.ANONIMUS.proxy.enums.BypassType; -import me.ANONIMUS.proxy.enums.TimeType; import me.ANONIMUS.proxy.managers.OptionsManager; +import me.ANONIMUS.proxy.managers.PlayerManager; import me.ANONIMUS.proxy.objects.Account; import me.ANONIMUS.proxy.objects.LastPacket; import me.ANONIMUS.proxy.objects.ServerData; +import me.ANONIMUS.proxy.protocol.data.ConnectionState; +import me.ANONIMUS.proxy.protocol.data.playerlist.PlayerListEntry; +import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.impl.client.HandshakePacket; import java.util.ArrayList; @@ -23,7 +22,6 @@ public class Player { private final Session session; private TimeType timeType = TimeType.DEFAULT; private Session remoteSession; - private BypassType bypassType; private Account account; private boolean mother; private boolean pluginsState; @@ -37,7 +35,6 @@ public class Player { private List players = new ArrayList<>(); private List tabList = new ArrayList<>(); private List bots = new ArrayList<>(); - private GameProfile gameProfile; public void packetReceived(final Packet packet) { if (packet instanceof HandshakePacket) { diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/packet/PacketRegistry.java b/src/main/java/me/ANONIMUS/proxy/protocol/packet/PacketRegistry.java index 45ecd3e..08f3a60 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/packet/PacketRegistry.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/packet/PacketRegistry.java @@ -1,7 +1,7 @@ package me.ANONIMUS.proxy.protocol.packet; -import me.ANONIMUS.proxy.protocol.packet.impl.CustomPacket; import me.ANONIMUS.proxy.protocol.data.ConnectionState; +import me.ANONIMUS.proxy.protocol.packet.impl.CustomPacket; import me.ANONIMUS.proxy.protocol.packet.impl.client.HandshakePacket; import org.reflections.Reflections; @@ -19,7 +19,7 @@ public class PacketRegistry { private final HashMap SERVER_PLAY = new HashMap<>(); public void registerPacket(ConnectionState connectionState, PacketDirection direction, Packet packet) { - for(Protocol protocol : packet.getProtocolList()) { + packet.getProtocolList().forEach(protocol -> { switch (direction) { case SERVERBOUND: switch (connectionState) { @@ -48,19 +48,17 @@ public void registerPacket(ConnectionState connectionState, PacketDirection dire } break; } - } + }); } public void load() { - Arrays.asList(PacketDirection.values()).forEach(direction -> Arrays.stream(ConnectionState.values()).filter(connectionState -> connectionState != ConnectionState.HANDSHAKE).forEach(state -> { - new Reflections("me.AlshainTeam.proxy.protocol.packet.impl." + direction.packetsPackageName.toLowerCase() + "." + state.name().toLowerCase()).getSubTypesOf(Packet.class).forEach(p -> { - try { - registerPacket(state, direction, p.newInstance()); - } catch (InstantiationException | IllegalAccessException e) { - e.printStackTrace(); - } - }); - })); + Arrays.asList(PacketDirection.values()).forEach(direction -> Arrays.stream(ConnectionState.values()).filter(connectionState -> connectionState != ConnectionState.HANDSHAKE).forEach(state -> new Reflections("me.ANONIMUS.proxy.protocol.packet.impl." + direction.packetsPackageName.toLowerCase() + "." + state.name().toLowerCase()).getSubTypesOf(Packet.class).forEach(p -> { + try { + registerPacket(state, direction, p.newInstance()); + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + }))); } public Packet createPacket(ConnectionState connectionState, PacketDirection direction, int id, int protocol){ diff --git a/src/main/java/me/ANONIMUS/proxy/protocol/packet/impl/server/play/ServerChatPacket.java b/src/main/java/me/ANONIMUS/proxy/protocol/packet/impl/server/play/ServerChatPacket.java index 781d72b..d7059ca 100644 --- a/src/main/java/me/ANONIMUS/proxy/protocol/packet/impl/server/play/ServerChatPacket.java +++ b/src/main/java/me/ANONIMUS/proxy/protocol/packet/impl/server/play/ServerChatPacket.java @@ -6,7 +6,7 @@ import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.PacketBuffer; import me.ANONIMUS.proxy.protocol.packet.Protocol; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.utils.ChatUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; diff --git a/src/main/java/me/ANONIMUS/proxy/threads/MessageThread.java b/src/main/java/me/ANONIMUS/proxy/threads/MessageThread.java index c184b65..af18de5 100644 --- a/src/main/java/me/ANONIMUS/proxy/threads/MessageThread.java +++ b/src/main/java/me/ANONIMUS/proxy/threads/MessageThread.java @@ -1,7 +1,7 @@ package me.ANONIMUS.proxy.threads; import me.ANONIMUS.proxy.managers.PlayerManager; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.utils.ChatUtil; import java.util.TimerTask; diff --git a/src/main/java/me/ANONIMUS/proxy/threads/TitleLagThread.java b/src/main/java/me/ANONIMUS/proxy/threads/TitleLagThread.java index 2f270f5..65661d7 100644 --- a/src/main/java/me/ANONIMUS/proxy/threads/TitleLagThread.java +++ b/src/main/java/me/ANONIMUS/proxy/threads/TitleLagThread.java @@ -1,7 +1,7 @@ package me.ANONIMUS.proxy.threads; import me.ANONIMUS.proxy.managers.PlayerManager; -import me.ANONIMUS.proxy.utils.proxy.ChatUtil; +import me.ANONIMUS.proxy.utils.ChatUtil; import java.util.TimerTask; diff --git a/src/main/java/me/ANONIMUS/proxy/utils/proxy/ChatUtil.java b/src/main/java/me/ANONIMUS/proxy/utils/ChatUtil.java similarity index 98% rename from src/main/java/me/ANONIMUS/proxy/utils/proxy/ChatUtil.java rename to src/main/java/me/ANONIMUS/proxy/utils/ChatUtil.java index 1a56a62..f05302a 100644 --- a/src/main/java/me/ANONIMUS/proxy/utils/proxy/ChatUtil.java +++ b/src/main/java/me/ANONIMUS/proxy/utils/ChatUtil.java @@ -1,12 +1,12 @@ -package me.ANONIMUS.proxy.utils.proxy; +package me.ANONIMUS.proxy.utils; +import me.ANONIMUS.proxy.managers.PlayerManager; +import me.ANONIMUS.proxy.protocol.data.MessagePosition; import me.ANONIMUS.proxy.protocol.data.TitleAction; +import me.ANONIMUS.proxy.protocol.objects.Player; import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerChatPacket; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerTitlePacket; -import me.ANONIMUS.proxy.managers.PlayerManager; -import me.ANONIMUS.proxy.protocol.data.MessagePosition; -import me.ANONIMUS.proxy.protocol.objects.Player; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.HoverEvent; diff --git a/src/main/java/me/ANONIMUS/proxy/utils/java/FileUtil.java b/src/main/java/me/ANONIMUS/proxy/utils/FileUtil.java similarity index 96% rename from src/main/java/me/ANONIMUS/proxy/utils/java/FileUtil.java rename to src/main/java/me/ANONIMUS/proxy/utils/FileUtil.java index e172777..dd72638 100644 --- a/src/main/java/me/ANONIMUS/proxy/utils/java/FileUtil.java +++ b/src/main/java/me/ANONIMUS/proxy/utils/FileUtil.java @@ -1,4 +1,4 @@ -package me.ANONIMUS.proxy.utils.java; +package me.ANONIMUS.proxy.utils; import me.ANONIMUS.proxy.BetterProxy; import me.ANONIMUS.proxy.enums.GroupType; diff --git a/src/main/java/me/ANONIMUS/proxy/utils/proxy/ItemUtil.java b/src/main/java/me/ANONIMUS/proxy/utils/ItemUtil.java similarity index 97% rename from src/main/java/me/ANONIMUS/proxy/utils/proxy/ItemUtil.java rename to src/main/java/me/ANONIMUS/proxy/utils/ItemUtil.java index 65b2d0e..7f795ac 100644 --- a/src/main/java/me/ANONIMUS/proxy/utils/proxy/ItemUtil.java +++ b/src/main/java/me/ANONIMUS/proxy/utils/ItemUtil.java @@ -1,9 +1,9 @@ -package me.ANONIMUS.proxy.utils.proxy; +package me.ANONIMUS.proxy.utils; +import me.ANONIMUS.proxy.objects.Option; import me.ANONIMUS.proxy.protocol.data.ItemStack; import me.ANONIMUS.proxy.protocol.objects.Player; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerSetSlotPacket; -import me.ANONIMUS.proxy.objects.Option; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/me/ANONIMUS/proxy/utils/proxy/PacketUtil.java b/src/main/java/me/ANONIMUS/proxy/utils/PacketUtil.java similarity index 98% rename from src/main/java/me/ANONIMUS/proxy/utils/proxy/PacketUtil.java rename to src/main/java/me/ANONIMUS/proxy/utils/PacketUtil.java index cb578ad..18ff0be 100644 --- a/src/main/java/me/ANONIMUS/proxy/utils/proxy/PacketUtil.java +++ b/src/main/java/me/ANONIMUS/proxy/utils/PacketUtil.java @@ -1,4 +1,4 @@ -package me.ANONIMUS.proxy.utils.proxy; +package me.ANONIMUS.proxy.utils; import me.ANONIMUS.proxy.protocol.data.playerlist.PlayerListEntry; import me.ANONIMUS.proxy.protocol.data.playerlist.PlayerListEntryAction; diff --git a/src/main/java/me/ANONIMUS/proxy/utils/proxy/SRVResolver.java b/src/main/java/me/ANONIMUS/proxy/utils/SRVResolver.java similarity index 96% rename from src/main/java/me/ANONIMUS/proxy/utils/proxy/SRVResolver.java rename to src/main/java/me/ANONIMUS/proxy/utils/SRVResolver.java index 3e27e8a..4f0a01d 100644 --- a/src/main/java/me/ANONIMUS/proxy/utils/proxy/SRVResolver.java +++ b/src/main/java/me/ANONIMUS/proxy/utils/SRVResolver.java @@ -1,4 +1,4 @@ -package me.ANONIMUS.proxy.utils.proxy; +package me.ANONIMUS.proxy.utils; import javax.naming.directory.Attributes; import javax.naming.directory.InitialDirContext; diff --git a/src/main/java/me/ANONIMUS/proxy/utils/proxy/ScoreboardUtil.java b/src/main/java/me/ANONIMUS/proxy/utils/ScoreboardUtil.java similarity index 98% rename from src/main/java/me/ANONIMUS/proxy/utils/proxy/ScoreboardUtil.java rename to src/main/java/me/ANONIMUS/proxy/utils/ScoreboardUtil.java index 1ff65db..9fd70a5 100644 --- a/src/main/java/me/ANONIMUS/proxy/utils/proxy/ScoreboardUtil.java +++ b/src/main/java/me/ANONIMUS/proxy/utils/ScoreboardUtil.java @@ -1,11 +1,11 @@ -package me.ANONIMUS.proxy.utils.proxy; +package me.ANONIMUS.proxy.utils; import me.ANONIMUS.proxy.protocol.data.scoreboard.ObjectiveMode; import me.ANONIMUS.proxy.protocol.data.scoreboard.ObjectiveType; +import me.ANONIMUS.proxy.protocol.objects.Player; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerDisplayScoreboardPacket; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerScoreboardObjectivePacket; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.ServerUpdateScorePacket; -import me.ANONIMUS.proxy.protocol.objects.Player; import java.text.DecimalFormat; diff --git a/src/main/java/me/ANONIMUS/proxy/utils/proxy/WorldUtil.java b/src/main/java/me/ANONIMUS/proxy/utils/WorldUtil.java similarity index 97% rename from src/main/java/me/ANONIMUS/proxy/utils/proxy/WorldUtil.java rename to src/main/java/me/ANONIMUS/proxy/utils/WorldUtil.java index 27f2ce4..602a8c0 100644 --- a/src/main/java/me/ANONIMUS/proxy/utils/proxy/WorldUtil.java +++ b/src/main/java/me/ANONIMUS/proxy/utils/WorldUtil.java @@ -1,4 +1,4 @@ -package me.ANONIMUS.proxy.utils.proxy; +package me.ANONIMUS.proxy.utils; import me.ANONIMUS.proxy.BetterProxy; import me.ANONIMUS.proxy.protocol.data.*; @@ -9,8 +9,6 @@ import me.ANONIMUS.proxy.protocol.packet.Packet; import me.ANONIMUS.proxy.protocol.packet.impl.CustomPacket; import me.ANONIMUS.proxy.protocol.packet.impl.server.play.*; -import me.AlshainTeam.proxy.protocol.data.*; -import me.AlshainTeam.proxy.protocol.packet.impl.server.play.*; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser;