Add: 全局代码格式化

This commit is contained in:
SerendipityR 2024-02-03 01:02:11 +08:00 committed by GitHub
parent 851601f37d
commit 0605c8f355
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 119 additions and 106 deletions

View File

@ -58,7 +58,7 @@ public class AnotherStarAntiCheat {
private byte[] stcDecode(ByteBuf buf) { private byte[] stcDecode(ByteBuf buf) {
try { try {
CompoundTag nbt = (CompoundTag) NBTIO.readTag(new DataInputStream(new ByteBufInputStream(buf))); CompoundTag nbt = (CompoundTag) NBTIO.readTag(new DataInputStream(new ByteBufInputStream(buf)));
return ((ByteArrayTag) nbt.get("salt")).getValue(); return ((ByteArrayTag) nbt.get("salt")).getValue();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -40,7 +40,8 @@ public class CatAntiCheat {
out.writeBytes(new byte[]{sendPacketID, 0, clientVersion, salt}); out.writeBytes(new byte[]{sendPacketID, 0, clientVersion, salt});
// LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(buf.toByteArray()), "CatAntiCheat"); // LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(buf.toByteArray()), "CatAntiCheat");
session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray())); session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray()));
} catch (IOException ignored) {} } catch (IOException ignored) {
}
break; break;
case 1: case 1:
// File Check packet reply // File Check packet reply
@ -87,7 +88,7 @@ public class CatAntiCheat {
out.writeByte(sendPacketID); out.writeByte(sendPacketID);
out.writeShort(foundClassList.size()); out.writeShort(foundClassList.size());
for (String s:foundClassList) { for (String s : foundClassList) {
writeUTF8String(out, s); writeUTF8String(out, s);
} }
@ -156,7 +157,7 @@ public class CatAntiCheat {
public static List<String> getFileHashList(File filesDir) { public static List<String> getFileHashList(File filesDir) {
List<String> fileHashList = new ArrayList<>(); List<String> fileHashList = new ArrayList<>();
for (File file: Objects.requireNonNull(filesDir.listFiles())) { for (File file : Objects.requireNonNull(filesDir.listFiles())) {
fileHashList.add(getFileHash(file)); fileHashList.add(getFileHash(file));
} }
@ -168,7 +169,8 @@ public class CatAntiCheat {
try (InputStream in = Files.newInputStream(file.toPath())) { try (InputStream in = Files.newInputStream(file.toPath())) {
return calcHash(in) + "\0" + file.getName(); return calcHash(in) + "\0" + file.getName();
} }
} catch (IOException ignored) { } } catch (IOException ignored) {
}
return null; return null;
} }
@ -198,7 +200,7 @@ public class CatAntiCheat {
} }
public static void writeVarInt(StreamNetOutput to, int toWrite) throws IOException { public static void writeVarInt(StreamNetOutput to, int toWrite) throws IOException {
while((toWrite & -128) != 0) { while ((toWrite & -128) != 0) {
to.writeByte(toWrite & 127 | 128); to.writeByte(toWrite & 127 | 128);
toWrite >>>= 7; toWrite >>>= 7;
} }
@ -214,7 +216,8 @@ public class CatAntiCheat {
ImageIO.write(bufferedImage, "png", gzipOutputStream); ImageIO.write(bufferedImage, "png", gzipOutputStream);
gzipOutputStream.flush(); gzipOutputStream.flush();
gzipOutputStream.close(); gzipOutputStream.close();
} catch (Exception ignored) {} } catch (Exception ignored) {
}
return out.toByteArray(); return out.toByteArray();
} }

View File

@ -47,17 +47,17 @@ public class MCForge {
public void handle(ServerPluginMessagePacket packet) { public void handle(ServerPluginMessagePacket packet) {
switch (packet.getChannel()) { switch (packet.getChannel()) {
case "FML|HS": case "FML|HS":
this.handshake.handle(packet); this.handshake.handle(packet);
break; break;
case "REGISTER": case "REGISTER":
case "minecraft:register": // 1.13 case "minecraft:register": // 1.13
this.session.send(new ClientPluginMessagePacket(packet.getChannel(), packet.getData())); this.session.send(new ClientPluginMessagePacket(packet.getChannel(), packet.getData()));
break; break;
case "MC|Brand": case "MC|Brand":
case "minecraft:brand": // 1.13 case "minecraft:brand": // 1.13
this.session.send(new ClientPluginMessagePacket(packet.getChannel(), "fml,forge".getBytes())); this.session.send(new ClientPluginMessagePacket(packet.getChannel(), "fml,forge".getBytes()));
break; break;
} }
} }

View File

@ -10,5 +10,6 @@ public abstract class MCForgeHandShake {
} }
public abstract void handle(Packet recvPacket); public abstract void handle(Packet recvPacket);
public abstract String getFMLVersion(); public abstract String getFMLVersion();
} }

View File

@ -22,46 +22,46 @@ public class MCForgeHandShakeV1 extends MCForgeHandShake {
int packetID = data[0]; int packetID = data[0];
switch (packetID) { switch (packetID) {
case 0: // Hello case 0: // Hello
sendPluginMessage(session, packet.getChannel(), new byte[] { 0x01, 0x02 }); sendPluginMessage(session, packet.getChannel(), new byte[]{0x01, 0x02});
// ModList // ModList
ByteArrayOutputStream buf = new ByteArrayOutputStream(); ByteArrayOutputStream buf = new ByteArrayOutputStream();
StreamNetOutput out = new StreamNetOutput(buf); StreamNetOutput out = new StreamNetOutput(buf);
try { try {
out.writeVarInt(2); out.writeVarInt(2);
out.writeByte(forge.modList.size()); out.writeByte(forge.modList.size());
forge.modList.forEach((k, v) -> { forge.modList.forEach((k, v) -> {
try { try {
out.writeString(k); out.writeString(k);
out.writeString(v); out.writeString(v);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}); });
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
sendPluginMessage(session, packet.getChannel(), buf.toByteArray()); sendPluginMessage(session, packet.getChannel(), buf.toByteArray());
break;
case 2: // ModList
sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x02 }); // ACK(WAITING SERVER DATA)
break;
case 3: // RegistryData
sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x03 }); // ACK(WAITING SERVER COMPLETE)
break;
case -1: // HandshakeAck
int ackID = data[1];
switch (ackID) {
case 2: // WAITING CACK
sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x04 }); // PENDING COMPLETE
break; break;
case 3: // COMPLETE case 2: // ModList
sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x05 }); // COMPLETE sendPluginMessage(session, packet.getChannel(), new byte[]{-0x1, 0x02}); // ACK(WAITING SERVER DATA)
break; break;
case 3: // RegistryData
sendPluginMessage(session, packet.getChannel(), new byte[]{-0x1, 0x03}); // ACK(WAITING SERVER COMPLETE)
break;
case -1: // HandshakeAck
int ackID = data[1];
switch (ackID) {
case 2: // WAITING CACK
sendPluginMessage(session, packet.getChannel(), new byte[]{-0x1, 0x04}); // PENDING COMPLETE
break;
case 3: // COMPLETE
sendPluginMessage(session, packet.getChannel(), new byte[]{-0x1, 0x05}); // COMPLETE
break;
default:
}
default: default:
}
default:
} }
} }

View File

@ -124,7 +124,9 @@ public class MCForgeHandShakeV2 extends MCForgeHandShake {
private String targetNetworkReceiver; private String targetNetworkReceiver;
private byte[] payload; private byte[] payload;
public LoginWrapper() {} public LoginWrapper() {
}
public LoginWrapper(String targetNetworkReceiver, byte[] payload) { public LoginWrapper(String targetNetworkReceiver, byte[] payload) {
this.targetNetworkReceiver = targetNetworkReceiver; this.targetNetworkReceiver = targetNetworkReceiver;
this.payload = payload; this.payload = payload;

View File

@ -18,7 +18,7 @@ public class MCForgeMOTD {
Socket socket = new Socket(); Socket socket = new Socket();
try { try {
socket.connect(new InetSocketAddress(ip, port)); socket.connect(new InetSocketAddress(ip, port));
if(socket.isConnected()) { if (socket.isConnected()) {
DataOutputStream out = new DataOutputStream(socket.getOutputStream()); DataOutputStream out = new DataOutputStream(socket.getOutputStream());
ByteArrayOutputStream packet = new ByteArrayOutputStream(); ByteArrayOutputStream packet = new ByteArrayOutputStream();
@ -62,7 +62,8 @@ public class MCForgeMOTD {
try { try {
if (socket.isConnected()) if (socket.isConnected())
socket.close(); socket.close();
} catch (IOException ignored) {} } catch (IOException ignored) {
}
} }
return modList; return modList;
} }

View File

@ -145,7 +145,7 @@ public class ConfigUtil {
if (ReadFromFiles) { if (ReadFromFiles) {
ForgeModList.putAll(readModInfo("mods")); ForgeModList.putAll(readModInfo("mods"));
} }
for (String modInfo:config.getStringList("AdvancedSettings.ForgeSupport.ModList")) { for (String modInfo : config.getStringList("AdvancedSettings.ForgeSupport.ModList")) {
String modName = modInfo.split(":")[0]; String modName = modInfo.split(":")[0];
String modVersion = modInfo.split(":")[1]; String modVersion = modInfo.split(":")[1];
ForgeModList.put(modName, modVersion); ForgeModList.put(modName, modVersion);
@ -234,7 +234,7 @@ public class ConfigUtil {
return 0; return 0;
} }
LogUtil.doLog(0, "任务完成。转换前编码: " + currentCharset + " | 转换后编码: " + getFileCharset(configFile) , "CFGUtil"); LogUtil.doLog(0, "任务完成。转换前编码: " + currentCharset + " | 转换后编码: " + getFileCharset(configFile), "CFGUtil");
} }
loadConfig(cfgVer); loadConfig(cfgVer);
@ -308,13 +308,13 @@ public class ConfigUtil {
return charset; return charset;
} }
public static int convertFileCharset(File inputFile, File outputFile,String currentCharset ,String targetCharset) { public static int convertFileCharset(File inputFile, File outputFile, String currentCharset, String targetCharset) {
try { try {
InputStreamReader isr = new InputStreamReader(Files.newInputStream(inputFile.toPath()) ,currentCharset); InputStreamReader isr = new InputStreamReader(Files.newInputStream(inputFile.toPath()), currentCharset);
OutputStreamWriter osw = new OutputStreamWriter(Files.newOutputStream(outputFile.toPath()) ,targetCharset); OutputStreamWriter osw = new OutputStreamWriter(Files.newOutputStream(outputFile.toPath()), targetCharset);
int len; int len;
while((len = isr.read())!=-1){ while ((len = isr.read()) != -1) {
osw.write(len); osw.write(len);
} }
@ -379,10 +379,10 @@ public class ConfigUtil {
if (attribute != null) { if (attribute != null) {
String[] re = attribute.get().toString().split(" ", 4); String[] re = attribute.get().toString().split(" ", 4);
LogUtil.doLog(0, "=============================================================", "CheckSRV"); LogUtil.doLog(0, "=============================================================", "CheckSRV");
LogUtil.doLog(0,"域名: " + AttackAddress, "CheckSRV"); LogUtil.doLog(0, "域名: " + AttackAddress, "CheckSRV");
LogUtil.doLog(0,"源地址: " + re[3], "CheckSRV"); LogUtil.doLog(0, "源地址: " + re[3], "CheckSRV");
LogUtil.doLog(0,"源端口: " + re[2], "CheckSRV"); LogUtil.doLog(0, "源端口: " + re[2], "CheckSRV");
LogUtil.doLog(-1,"检测到服务器存在SRV记录是否替换地址为SRV解析记录[y/n]: ", "CheckSRV"); LogUtil.doLog(-1, "检测到服务器存在SRV记录是否替换地址为SRV解析记录[y/n]: ", "CheckSRV");
Scanner scanner = new Scanner(System.in); Scanner scanner = new Scanner(System.in);
String cmd = scanner.nextLine(); String cmd = scanner.nextLine();
@ -391,7 +391,8 @@ public class ConfigUtil {
AttackPort = Integer.parseInt(re[2]); AttackPort = Integer.parseInt(re[2]);
} }
} }
} catch (Exception ignored) {} } catch (Exception ignored) {
}
} }
public static HashMap<String, String> readModInfo(String directoryPath) { public static HashMap<String, String> readModInfo(String directoryPath) {

View File

@ -12,7 +12,7 @@ import java.util.Scanner;
public class DataUtil { public class DataUtil {
public static boolean notModify = false; public static boolean notModify = false;
public static List<String> botRegPasswords; public static List<String> botRegPasswords;
public static HashMap<String,String> botRegPasswordsMap = new HashMap<>(); public static HashMap<String, String> botRegPasswordsMap = new HashMap<>();
public static void loadData() { public static void loadData() {
File dataFile = new File("data.yml"); File dataFile = new File("data.yml");
@ -59,30 +59,31 @@ public class DataUtil {
switch (ConfigUtil.RandomFlag) { switch (ConfigUtil.RandomFlag) {
case 2: case 2:
newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Ili(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Ili(ConfigUtil.RandomMinLength, ConfigUtil.RandomMaxLength));
break; break;
case 3: case 3:
newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Abc(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Abc(ConfigUtil.RandomMinLength, ConfigUtil.RandomMaxLength));
break; break;
case 4: case 4:
newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_123(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_123(ConfigUtil.RandomMinLength, ConfigUtil.RandomMaxLength));
break; break;
case 1: case 1:
default: default:
newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString(ConfigUtil.RandomMinLength, ConfigUtil.RandomMaxLength));
break; break;
} }
String newBotPwd = OtherUtils.getRandomString(8,10); String newBotPwd = OtherUtils.getRandomString(8, 10);
botRegPasswords.add(newBotName + "@" + newBotPwd); botRegPasswords.add(newBotName + "@" + newBotPwd);
} }
} }
for (String PwdData:botRegPasswords) { for (String PwdData : botRegPasswords) {
try { try {
String[] aPwdData = PwdData.split("@"); String[] aPwdData = PwdData.split("@");
botRegPasswordsMap.put(aPwdData[0], aPwdData[1]); botRegPasswordsMap.put(aPwdData[0], aPwdData[1]);
} catch (Exception ignored) {} } catch (Exception ignored) {
}
} }
updateData(botRegPasswords); updateData(botRegPasswords);

View File

@ -71,11 +71,11 @@ public class OtherUtils {
} }
public static Integer getRandomInt(int min, int max) { public static Integer getRandomInt(int min, int max) {
return (int)(Math.random()*(max-min+1)+min); return (int) (Math.random() * (max - min + 1) + min);
} }
public static float getRandomFloat(double min, double max) { public static float getRandomFloat(double min, double max) {
return (float) (Math.random()*(max-min)+min); return (float) (Math.random() * (max - min) + min);
} }
public static String getRandomUser(boolean isDoubleAttack) { public static String getRandomUser(boolean isDoubleAttack) {

View File

@ -6,5 +6,6 @@ import com.sun.jna.Platform;
public interface SetTitle extends Library { public interface SetTitle extends Library {
SetTitle INSTANCE = Native.loadLibrary((Platform.isWindows() ? "kernel32" : "c"), SetTitle.class); SetTitle INSTANCE = Native.loadLibrary((Platform.isWindows() ? "kernel32" : "c"), SetTitle.class);
boolean SetConsoleTitleA(String title); boolean SetConsoleTitleA(String title);
} }

View File

@ -20,6 +20,7 @@ public interface BotHandler {
boolean hasClientFlag(Object client, String flag); boolean hasClientFlag(Object client, String flag);
void setClientFlag(Object client, String flag, Object value); void setClientFlag(Object client, String flag, Object value);
Object getClientFlag(Object client, String flag); Object getClientFlag(Object client, String flag);
void setClientTimeout(Object client, int timeout); void setClientTimeout(Object client, int timeout);

View File

@ -232,7 +232,7 @@ public class BotManager {
@Override @Override
public void run() { public void run() {
if (botHandler.hasClientFlag(client, "activity") && botHandler.getClientFlag(client,"activity").equals(true)) { if (botHandler.hasClientFlag(client, "activity") && botHandler.getClientFlag(client, "activity").equals(true)) {
return; return;
} }

View File

@ -181,7 +181,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public boolean checkSpawnPlayerName(Object packet, String checkName) { public boolean checkSpawnPlayerName(Object packet, String checkName) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet; ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
for (EntityMetadata metadata:playerPacket.getMetadata()) { for (EntityMetadata metadata : playerPacket.getMetadata()) {
if (metadata.getValue().toString().contains(checkName)) { if (metadata.getValue().toString().contains(checkName)) {
return true; return true;
} }
@ -347,7 +347,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -376,7 +376,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
Session session = ((Client) client).getSession(); Session session = ((Client) client).getSession();
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK); ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK);

View File

@ -177,7 +177,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public boolean checkSpawnPlayerName(Object packet, String checkName) { public boolean checkSpawnPlayerName(Object packet, String checkName) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet; ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
for (EntityMetadata metadata:playerPacket.getMetadata()) { for (EntityMetadata metadata : playerPacket.getMetadata()) {
if (metadata.getValue().toString().contains(checkName)) { if (metadata.getValue().toString().contains(checkName)) {
return true; return true;
} }
@ -343,7 +343,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -372,7 +372,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
Session session = ((Client) client).getSession(); Session session = ((Client) client).getSession();
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK); ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK);

View File

@ -170,7 +170,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public boolean checkSpawnPlayerName(Object packet, String checkName) { public boolean checkSpawnPlayerName(Object packet, String checkName) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet; ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
for (EntityMetadata metadata:playerPacket.getMetadata()) { for (EntityMetadata metadata : playerPacket.getMetadata()) {
if (metadata.getValue().toString().contains(checkName)) { if (metadata.getValue().toString().contains(checkName)) {
return true; return true;
} }
@ -335,7 +335,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -364,7 +364,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
Session session = ((Client) client).getSession(); Session session = ((Client) client).getSession();
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK); ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK);

View File

@ -319,7 +319,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
Session session = ((Client) client).getSession(); Session session = ((Client) client).getSession();
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK); ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK);

View File

@ -315,7 +315,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -344,7 +344,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
Session session = ((Client) client).getSession(); Session session = ((Client) client).getSession();
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK); ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, item, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK);

View File

@ -316,7 +316,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -345,7 +345,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
TcpClientSession session = (TcpClientSession) client; TcpClientSession session = (TcpClientSession) client;
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK, item, new HashMap<>()); ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(windowId, 6, slot, WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK, item, new HashMap<>());

View File

@ -319,7 +319,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
TcpClientSession session = (TcpClientSession) client; TcpClientSession session = (TcpClientSession) client;
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>()); ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>());
@ -356,7 +356,8 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void handleOtherPacket(Object packet) {} public void handleOtherPacket(Object packet) {
}
@Override @Override
public void sendChatPacket(Object client, String text) { public void sendChatPacket(Object client, String text) {

View File

@ -318,7 +318,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -347,7 +347,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
TcpClientSession session = (TcpClientSession) client; TcpClientSession session = (TcpClientSession) client;
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>()); ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>());

View File

@ -319,7 +319,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
TcpClientSession session = (TcpClientSession) client; TcpClientSession session = (TcpClientSession) client;
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>()); ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>());

View File

@ -319,7 +319,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
TcpClientSession session = (TcpClientSession) client; TcpClientSession session = (TcpClientSession) client;
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>()); ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>());

View File

@ -332,7 +332,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue(); List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>(); List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) { for (Tag tag : itemLore) {
loreList.add((String) tag.getValue()); loreList.add((String) tag.getValue());
} }
return loreList; return loreList;
@ -361,7 +361,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
} }
@Override @Override
public void sendRightClickWindowItemPacket(Object client,int windowId, int slot, Object itemStack) { public void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
TcpClientSession session = (TcpClientSession) client; TcpClientSession session = (TcpClientSession) client;
ItemStack item = (ItemStack) itemStack; ItemStack item = (ItemStack) itemStack;
ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>()); ServerboundContainerClickPacket windowActionPacket = new ServerboundContainerClickPacket(windowId, 6, slot, ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK, item, new HashMap<>());

View File

@ -189,7 +189,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public List<Object> getSpawnPlayerMetadata(Object packet) { public List<Object> getSpawnPlayerMetadata(Object packet) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet; ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
List<Object> metaData = new ArrayList<>(); List<Object> metaData = new ArrayList<>();
for (EntityMetadata metadata:playerPacket.getMetadata()) { for (EntityMetadata metadata : playerPacket.getMetadata()) {
metaData.add(metadata.getValue()); metaData.add(metadata.getValue());
} }
return metaData; return metaData;

View File

@ -122,6 +122,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
Session session = ((Client) client).getSession(); Session session = ((Client) client).getSession();
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket; ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()}); session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
if (ConfigUtil.PacketHandlerMove) { if (ConfigUtil.PacketHandlerMove) {
sendClientPlayerMovementPacket(session, true); sendClientPlayerMovementPacket(session, true);
ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(positionRotationPacket.getTeleportId()); ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(positionRotationPacket.getTeleportId());