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

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

View File

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

View File

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

View File

@ -22,46 +22,46 @@ public class MCForgeHandShakeV1 extends MCForgeHandShake {
int packetID = data[0];
switch (packetID) {
case 0: // Hello
sendPluginMessage(session, packet.getChannel(), new byte[] { 0x01, 0x02 });
case 0: // Hello
sendPluginMessage(session, packet.getChannel(), new byte[]{0x01, 0x02});
// ModList
ByteArrayOutputStream buf = new ByteArrayOutputStream();
StreamNetOutput out = new StreamNetOutput(buf);
try {
out.writeVarInt(2);
out.writeByte(forge.modList.size());
forge.modList.forEach((k, v) -> {
try {
out.writeString(k);
out.writeString(v);
} catch (IOException e) {
e.printStackTrace();
}
});
} catch (IOException e) {
e.printStackTrace();
}
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
// ModList
ByteArrayOutputStream buf = new ByteArrayOutputStream();
StreamNetOutput out = new StreamNetOutput(buf);
try {
out.writeVarInt(2);
out.writeByte(forge.modList.size());
forge.modList.forEach((k, v) -> {
try {
out.writeString(k);
out.writeString(v);
} catch (IOException e) {
e.printStackTrace();
}
});
} catch (IOException e) {
e.printStackTrace();
}
sendPluginMessage(session, packet.getChannel(), buf.toByteArray());
break;
case 3: // COMPLETE
sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x05 }); // COMPLETE
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;
case 3: // COMPLETE
sendPluginMessage(session, packet.getChannel(), new byte[]{-0x1, 0x05}); // COMPLETE
break;
default:
}
default:
}
default:
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -71,11 +71,11 @@ public class OtherUtils {
}
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) {
return (float) (Math.random()*(max-min)+min);
return (float) (Math.random() * (max - min) + min);
}
public static String getRandomUser(boolean isDoubleAttack) {

View File

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

View File

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

View File

@ -232,7 +232,7 @@ public class BotManager {
@Override
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;
}

View File

@ -181,7 +181,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
public boolean checkSpawnPlayerName(Object packet, String checkName) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
for (EntityMetadata metadata:playerPacket.getMetadata()) {
for (EntityMetadata metadata : playerPacket.getMetadata()) {
if (metadata.getValue().toString().contains(checkName)) {
return true;
}
@ -347,7 +347,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -376,7 +376,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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();
ItemStack item = (ItemStack) itemStack;
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) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
for (EntityMetadata metadata:playerPacket.getMetadata()) {
for (EntityMetadata metadata : playerPacket.getMetadata()) {
if (metadata.getValue().toString().contains(checkName)) {
return true;
}
@ -343,7 +343,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -372,7 +372,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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();
ItemStack item = (ItemStack) itemStack;
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) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
for (EntityMetadata metadata:playerPacket.getMetadata()) {
for (EntityMetadata metadata : playerPacket.getMetadata()) {
if (metadata.getValue().toString().contains(checkName)) {
return true;
}
@ -335,7 +335,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
List<Tag> itemLore = ((ListTag) hashMap.get("Lore")).getValue();
List<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -364,7 +364,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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();
ItemStack item = (ItemStack) itemStack;
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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();
ItemStack item = (ItemStack) itemStack;
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -344,7 +344,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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();
ItemStack item = (ItemStack) itemStack;
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -345,7 +345,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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;
ItemStack item = (ItemStack) itemStack;
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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;
ItemStack item = (ItemStack) itemStack;
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
public void handleOtherPacket(Object packet) {}
public void handleOtherPacket(Object packet) {
}
@Override
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -347,7 +347,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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;
ItemStack item = (ItemStack) itemStack;
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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;
ItemStack item = (ItemStack) itemStack;
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -348,7 +348,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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;
ItemStack item = (ItemStack) itemStack;
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<String> loreList = new ArrayList<>();
for (Tag tag:itemLore) {
for (Tag tag : itemLore) {
loreList.add((String) tag.getValue());
}
return loreList;
@ -361,7 +361,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
}
@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;
ItemStack item = (ItemStack) itemStack;
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) {
ServerSpawnPlayerPacket playerPacket = (ServerSpawnPlayerPacket) packet;
List<Object> metaData = new ArrayList<>();
for (EntityMetadata metadata:playerPacket.getMetadata()) {
for (EntityMetadata metadata : playerPacket.getMetadata()) {
metaData.add(metadata.getValue());
}
return metaData;

View File

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