mirror of
https://github.com/SerendipityR-2022/EndMinecraftPlusV2.git
synced 2024-10-18 05:28:05 +00:00
Add: 全局代码格式化
This commit is contained in:
parent
851601f37d
commit
0605c8f355
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,5 +10,6 @@ public abstract class MCForgeHandShake {
|
||||
}
|
||||
|
||||
public abstract void handle(Packet recvPacket);
|
||||
|
||||
public abstract String getFMLVersion();
|
||||
}
|
||||
|
@ -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:
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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<>());
|
||||
|
@ -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) {
|
||||
|
@ -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<>());
|
||||
|
@ -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<>());
|
||||
|
@ -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<>());
|
||||
|
@ -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<>());
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user