mirror of
https://github.com/SerendipityR-2022/EndMinecraftPlusV2.git
synced 2024-09-07 17:33:18 +00:00
Add: 绕过LimboFilter下落检查、默认配置调优
This commit is contained in:
parent
cd13d2f33c
commit
851601f37d
@ -6,8 +6,8 @@ import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
|
||||
import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle;
|
||||
|
||||
public class EndMinecraftPlusV2 {
|
||||
public static String ver = "2.0.6";
|
||||
public static Integer CfgVer = 12;
|
||||
public static String ver = "2.0.7";
|
||||
public static Integer CfgVer = 13;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("=======================-Designed by SerendipityR-=======================");
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Designed by SerendipityR #
|
||||
###############################
|
||||
|
||||
CfgVer: 12
|
||||
CfgVer: 13
|
||||
|
||||
AttackSettings:
|
||||
Address: "example.com"
|
||||
@ -24,7 +24,7 @@ AttackSettings:
|
||||
# 进行无代理Motd压测时不建议大于32
|
||||
MaxConnections: 2500
|
||||
# 旧版漏洞利用,大概率无效
|
||||
AntiAttackMode: true
|
||||
AntiAttackMode: false
|
||||
DoubleExploitPlayer: "ImOldSix_666"
|
||||
# 假人调试模式
|
||||
DebugPlayer: "Genshin_Activate"
|
||||
@ -39,6 +39,7 @@ AttackSettings:
|
||||
# crashPacket - 发送崩服数据包:<数量>
|
||||
# goToLobby - 尝试寻找并与加入大厅NPC交互
|
||||
# moveToLocation - 向目标位置移动:<X>_<Y>_<Z>
|
||||
# bypassFallCheck - 发送下落检测数据包
|
||||
Actions:
|
||||
- "wait:2000"
|
||||
- "register&Login:genshinImpact"
|
||||
@ -52,13 +53,14 @@ AttackSettings:
|
||||
#- "backTeleport"
|
||||
#- "wait:1000"
|
||||
#- "crashPacket:20"
|
||||
# 输出错误信息
|
||||
ShowFails: false
|
||||
|
||||
AdvancedSettings:
|
||||
# 启用Forge支持
|
||||
ForgeSupport:
|
||||
# 从mods文件夹中读取modId:version信息
|
||||
Enable: true
|
||||
Enable: false
|
||||
ReadFromFiles: true
|
||||
ModList:
|
||||
- "exampleMod:1.0.0"
|
||||
@ -86,6 +88,53 @@ AdvancedSettings:
|
||||
# 5 - PEX
|
||||
Mode: 1
|
||||
PacketDelay: 100
|
||||
# 在此处控制数据包响应单元
|
||||
PacketHandler:
|
||||
# 是否回复KeepAlive数据包
|
||||
# 如果你发现假人断开连接的原因与"Timeout"相关,请尝试切换此项。
|
||||
KeepAlive: false
|
||||
# 是否响应服务器位置数据包
|
||||
# 如果你发现假人断开连接的原因与"位置异常"相关,请尝试切换此项。
|
||||
Move: false
|
||||
# 自动重连设置
|
||||
Rejoin:
|
||||
# 重新加入前模拟刷新服务器列表
|
||||
GetMotdBeforeRejoin: true
|
||||
GetMotdCount: 5
|
||||
GetMotdDelay: 500
|
||||
# 自动重连次数/间隔
|
||||
RejoinCount: 5
|
||||
RejoinDelay: 3500
|
||||
# 若踢出信息为空,则无条件执行重连
|
||||
EmptyMsgRejoin: true
|
||||
# 若踢出信息中检测到以下字段,则执行重连
|
||||
RejoinDetect:
|
||||
- "AntiAttack"
|
||||
# 检测可交互聊天信息包含的命令
|
||||
# 针对特定服务器,利用全服喊话跳出登录大厅
|
||||
ServerShoutDetect:
|
||||
- "tpserver"
|
||||
# 自动加入大厅
|
||||
GoToLobby:
|
||||
# 检测出生点附近的NPC名称
|
||||
# 实现通过NPC加入服务器大厅
|
||||
JoinNPCDetect:
|
||||
- "点击加入"
|
||||
# 与NPC交互后可能返回交互界面
|
||||
# 若界面内存在匹配的物品,则尝试模拟物品点击
|
||||
JoinLobbyItem:
|
||||
- "LEFT:点击加入"
|
||||
# 针对特定服务器绕过下落状态检测
|
||||
BypassFallCheck:
|
||||
# 受到检测的游戏刻,默认与服务端设置保持一致
|
||||
# 若检测超时可尝试适当调大此项。
|
||||
Ticks: 128
|
||||
DetectMsg: "反假人检查已开始"
|
||||
# 从服务器返回信息判断是否成功登录
|
||||
# 接收到符合条件的信息才赋予 Flag:login
|
||||
LoginCheck:
|
||||
Enable: true
|
||||
LoginSuccessMsg: "成功登录"
|
||||
|
||||
BotSettings:
|
||||
# 可用占位符:
|
||||
@ -102,38 +151,6 @@ BotSettings:
|
||||
RandomFlag: 1
|
||||
RandomMinLength: 6
|
||||
RandomMaxLength: 8
|
||||
# 在此处控制数据包响应单元
|
||||
PacketHandler:
|
||||
# 是否回复KeepAlive数据包
|
||||
# 如果你发现假人断开连接的原因与"Timeout"相关,请尝试切换此项。
|
||||
KeepAlive: false
|
||||
# 是否响应服务器位置数据包
|
||||
# 如果你发现假人断开连接的原因与"位置异常"相关,请尝试切换此项。
|
||||
Move: true
|
||||
# 重新加入前模拟刷新服务器列表
|
||||
GetMotdBeforeRejoin: true
|
||||
GetMotdCount: 5
|
||||
GetMotdDelay: 500
|
||||
# 自动重连次数/间隔
|
||||
RejoinCount: 5
|
||||
RejoinDelay: 3500
|
||||
# 若踢出信息中检测到以下字段,则执行重连
|
||||
RejoinDetect:
|
||||
- "AntiAttack"
|
||||
# 若踢出信息为空,则无条件执行重连
|
||||
EmptyMsgRejoin: true
|
||||
# 检测可交互聊天信息包含的命令
|
||||
# 针对特定服务器,利用全服喊话跳出登录大厅
|
||||
ServerShoutDetect:
|
||||
- "tpserver"
|
||||
# 检测出生点附近的NPC名称
|
||||
# 实现通过NPC加入服务器大厅
|
||||
JoinNPCDetect:
|
||||
- "点击加入"
|
||||
# 与NPC交互后可能返回交互界面
|
||||
# 若界面内存在匹配的物品,则尝试模拟物品点击
|
||||
JoinLobbyItem:
|
||||
- "LEFT:点击加入"
|
||||
# 若聊天信息中检测到以下字段,则尝试进行点击验证
|
||||
ClickVerifiesDetect:
|
||||
- "点击验证"
|
||||
@ -156,14 +173,17 @@ BotSettings:
|
||||
# chatSpam - 随机发送聊天信息:<次数>_<间隔(ms)>_<flag/none>
|
||||
# randomTeleport - 随机传送:<次数>_<间隔(ms)>_<flag/none>
|
||||
# backTeleport - 回到重生点_<flag/none>
|
||||
# register&Login - 执行注册/登录:<是否使用已生成密码>_<自定义密码> - Flag:login
|
||||
# register&Login - 执行注册/登录:<是否使用已生成密码>_<自定义密码>_<flag/none> - Flag:login
|
||||
# crashPacket - 发送崩服数据包:<数量>_<flag/none>
|
||||
# tabAttack - 执行Tab补全:<数量>_<间隔(ms)>_<flag/none>
|
||||
# moveToLocation - 向目标位置移动:<只执行一次>_<X>_<Y>_<Z>_<flag/none>
|
||||
# goToLobby - 尝试寻找并与加入大厅NPC交互:<flag/none> (只执行一次)
|
||||
# bypassFallCheck - 发送下落检测数据包:<flag/none> - Flag:bypassFallCheck
|
||||
Actions:
|
||||
#- "bypassFallCheck:none"
|
||||
- "wait:3000_none"
|
||||
- "register&Login:true_genshinImpact"
|
||||
- "register&Login:true_genshinImpact_none"
|
||||
#- "register&Login:true_genshinImpact_bypassFallCheck"
|
||||
- "async|chatSpam:10_3000_login"
|
||||
#- "async|randomTeleport:25_100_login"
|
||||
- "wait:3000_login"
|
||||
|
@ -40,6 +40,8 @@ public class ConfigUtil {
|
||||
public static Integer RandomMaxLength;
|
||||
public static Boolean KeepAlive;
|
||||
public static Boolean PacketHandlerMove;
|
||||
public static Boolean LoginCheck;
|
||||
public static String LoginSuccessMsg;
|
||||
public static Integer BotCount;
|
||||
public static List<String> RegisterCommands;
|
||||
public static Boolean GetMotdBeforeRejoin;
|
||||
@ -51,6 +53,8 @@ public class ConfigUtil {
|
||||
public static List<String> ServerShoutDetect;
|
||||
public static List<String> JoinNPCDetect;
|
||||
public static List<String> JoinLobbyItem;
|
||||
public static List<String> BypassFallCheck;
|
||||
public static int BypassFallCheckTicks;
|
||||
public static Long RejoinDelay;
|
||||
public static List<String> ClickVerifiesDetect;
|
||||
public static List<String> CustomChat;
|
||||
@ -105,19 +109,23 @@ public class ConfigUtil {
|
||||
RandomFlag = config.getInt("BotSettings.RandomFlag");
|
||||
RandomMinLength = config.getInt("BotSettings.RandomMinLength");
|
||||
RandomMaxLength = config.getInt("BotSettings.RandomMaxLength");
|
||||
KeepAlive = config.getBoolean("BotSettings.PacketHandler.KeepAlive");
|
||||
PacketHandlerMove = config.getBoolean("BotSettings.PacketHandler.Move");
|
||||
KeepAlive = config.getBoolean("AdvancedSettings.PacketHandler.KeepAlive");
|
||||
PacketHandlerMove = config.getBoolean("AdvancedSettings.PacketHandler.Move");
|
||||
RegisterCommands = config.getStringList("BotSettings.RegisterCommands");
|
||||
GetMotdBeforeRejoin = config.getBoolean("BotSettings.GetMotdBeforeRejoin");
|
||||
GetMotdCount = config.getInt("BotSettings.GetMotdCount");
|
||||
GetMotdDelay = config.getLong("BotSettings.GetMotdDelay");
|
||||
RejoinCount = config.getInt("BotSettings.RejoinCount");
|
||||
RejoinDetect = config.getStringList("BotSettings.RejoinDetect");
|
||||
EmptyMsgRejoin = config.getBoolean("BotSettings.EmptyMsgRejoin");
|
||||
ServerShoutDetect = config.getStringList("BotSettings.ServerShoutDetect");
|
||||
JoinNPCDetect = config.getStringList("BotSettings.JoinNPCDetect");
|
||||
JoinLobbyItem = config.getStringList("BotSettings.JoinLobbyItem");
|
||||
RejoinDelay = config.getLong("BotSettings.RejoinDelay");
|
||||
GetMotdBeforeRejoin = config.getBoolean("AdvancedSettings.Rejoin.GetMotdBeforeRejoin");
|
||||
GetMotdCount = config.getInt("AdvancedSettings.Rejoin.GetMotdCount");
|
||||
GetMotdDelay = config.getLong("AdvancedSettings.Rejoin.GetMotdDelay");
|
||||
RejoinCount = config.getInt("AdvancedSettings.Rejoin.RejoinCount");
|
||||
RejoinDetect = config.getStringList("AdvancedSettings.Rejoin.RejoinDetect");
|
||||
EmptyMsgRejoin = config.getBoolean("AdvancedSettings.Rejoin.EmptyMsgRejoin");
|
||||
ServerShoutDetect = config.getStringList("AdvancedSettings.ServerShoutDetect");
|
||||
JoinNPCDetect = config.getStringList("AdvancedSettings.GoToLobby.JoinNPCDetect");
|
||||
JoinLobbyItem = config.getStringList("AdvancedSettings.GoToLobby.JoinLobbyItem");
|
||||
RejoinDelay = config.getLong("AdvancedSettings.Rejoin.RejoinDelay");
|
||||
BypassFallCheck = config.getStringList("AdvancedSettings.BypassFallCheck.DetectMsg");
|
||||
BypassFallCheckTicks = config.getInt("AdvancedSettings.BypassFallCheck.Ticks");
|
||||
LoginCheck = config.getBoolean("AdvancedSettings.LoginCheck.Enable");
|
||||
LoginSuccessMsg = config.getString("AdvancedSettings.LoginCheck.LoginSuccessMsg");
|
||||
ClickVerifiesDetect = config.getStringList("BotSettings.ClickVerifiesDetect");
|
||||
CustomChat = config.getStringList("BotSettings.CustomChat");
|
||||
BotActionDetails = config.getBoolean("BotSettings.DetailMsg");
|
||||
|
@ -112,6 +112,10 @@ public class BotManager {
|
||||
LogUtil.doLog(0, "[DEBUG] [行动] 尝试与NPC交互: " + Arrays.toString(npcLoc), "BotAttack");
|
||||
packetHandler.sendPlayerInteractEntityPacket(client, packetHandler.getSpawnPlayerEntityId(npc), new float[]{npcLoc[0].floatValue(), npcLoc[1].floatValue(), npcLoc[2].floatValue()});
|
||||
break;
|
||||
case "bypassFallCheck":
|
||||
LogUtil.doLog(0, "[DEBUG] [行动] 尝试发送下落检测数据包。", "BotAttack");
|
||||
PacketManager.bypassFallCheckHandle(packetHandler, client, null, userName, true);
|
||||
break;
|
||||
default:
|
||||
LogUtil.doLog(0, "[DEBUG] [行动] 无法识别的action语句: " + action, "BotAttack");
|
||||
}
|
||||
@ -313,7 +317,8 @@ public class BotManager {
|
||||
String[] loginArgs = _action[1].split("_");
|
||||
boolean randomPwd = Boolean.parseBoolean(loginArgs[0]);
|
||||
String pwd = loginArgs[1];
|
||||
if (!botHandler.hasClientFlag(client, "login")) {
|
||||
String loginFlag = loginArgs[2];
|
||||
if (!botHandler.hasClientFlag(client, "login") && ("none".equals(loginFlag) || botHandler.hasClientFlag(client, loginFlag))) {
|
||||
if (randomPwd) {
|
||||
pwd = DataUtil.botRegPasswordsMap.get(userName);
|
||||
}
|
||||
@ -395,6 +400,16 @@ public class BotManager {
|
||||
packetHandler.sendPlayerInteractEntityPacket(client, packetHandler.getSpawnPlayerEntityId(npc), new float[]{npcLoc[0].floatValue(), npcLoc[1].floatValue(), npcLoc[2].floatValue()});
|
||||
}
|
||||
break;
|
||||
case "bypassFallCheck":
|
||||
String[] bypassFCArgs = _action[1].split("_");
|
||||
String bypassFCFlag = bypassFCArgs[0];
|
||||
if ("none".equals(bypassFCFlag) || botHandler.hasClientFlag(client, bypassFCFlag)) {
|
||||
if (ConfigUtil.BotActionDetails) {
|
||||
LogUtil.doLog(0, "[" + userName + "] [行动] 尝试发送下落检测数据包。", "BotAttack");
|
||||
}
|
||||
PacketManager.bypassFallCheckHandle(packetHandler, client, null, userName, true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LogUtil.doLog(0, "[" + userName + "] [行动] 无法识别的action语句: " + action, "BotAttack");
|
||||
}
|
||||
@ -449,6 +464,7 @@ public class BotManager {
|
||||
// 处理连接断开
|
||||
String failMsg = botHandler.getClientDisconnectMsg(client);
|
||||
clientList.remove(client);
|
||||
positionList.remove(client);
|
||||
|
||||
LogUtil.doLog(0, "[假人重连失败] [" + userName + "] [" + proxy + "] " + failMsg, "BotAttack");
|
||||
|
||||
@ -459,7 +475,10 @@ public class BotManager {
|
||||
}
|
||||
|
||||
public static void doRegisterLogin(Object client, String userName, long delay, String password) {
|
||||
botHandler.setClientFlag(client, "login", "");
|
||||
if (!ConfigUtil.LoginCheck) {
|
||||
botHandler.setClientFlag(client, "login", "");
|
||||
}
|
||||
|
||||
new Thread(() -> {
|
||||
for (String text : ConfigUtil.RegisterCommands) {
|
||||
String cmd = text;
|
||||
|
@ -55,10 +55,14 @@ public interface PacketHandler {
|
||||
|
||||
String getItemName(Object itemStack);
|
||||
|
||||
double[] getLocationFromPacket(Object packet);
|
||||
|
||||
List<String> getItemLore(Object itemStack);
|
||||
|
||||
void sendPlayerInteractEntityPacket(Object client, int entityId, float[] location);
|
||||
|
||||
void sendPlayerPositionPacket(Object client, boolean onGround, double[] location);
|
||||
|
||||
void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack);
|
||||
|
||||
void sendRightClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack);
|
||||
|
@ -1,8 +1,10 @@
|
||||
package cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet;
|
||||
|
||||
import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Bot.BotHandler;
|
||||
import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Bot.BotManager;
|
||||
import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil;
|
||||
import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
|
||||
import cn.serendipityr.EndMinecraftPlusV2.Tools.OtherUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -33,8 +35,20 @@ public class PacketManager {
|
||||
// 聊天信息包
|
||||
packetHandler.handleServerChatPacket(client, packet, username);
|
||||
Object message = packetHandler.getMessageFromPacket(packet);
|
||||
String msg = packetHandler.getMessageText(message);
|
||||
|
||||
// 处理点击信息
|
||||
clickVerifiesHandle(packetHandler, client, message, username);
|
||||
|
||||
// 下落检测绕过
|
||||
if (!ConfigUtil.BypassFallCheck.isEmpty()) {
|
||||
bypassFallCheckHandle(packetHandler, client, msg, username, false);
|
||||
}
|
||||
|
||||
// 检查登录信息
|
||||
if (ConfigUtil.LoginCheck && !BotManager.botHandler.hasClientFlag(client, "login")) {
|
||||
checkLoginMsg(client, msg, username);
|
||||
}
|
||||
} else if (packetHandler.checkServerPlayerHealthPacket(packet)) {
|
||||
// 血量数据包
|
||||
packetHandler.handleServerPlayerHealthPacket(client, packet, username);
|
||||
@ -43,21 +57,17 @@ public class PacketManager {
|
||||
packetHandler.handleServerPlayerPositionRotationPacket(client, packet, username);
|
||||
BotManager.positionList.put(client, packet);
|
||||
} else if (packetHandler.checkServerSpawnPlayerPacket(packet)) {
|
||||
// 其他玩家位置数据包
|
||||
boolean add = true;
|
||||
// 玩家生成数据包
|
||||
// 高版本返回皆为null
|
||||
if (BotManager.protocolVersion > 498) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigUtil.AttackMethod.equals(5)) {
|
||||
LogUtil.doLog(0, "[DEBUG] 接收到其他玩家位置: " + packetHandler.getSpawnPlayerMetadata(packet), "BotAttack");
|
||||
}
|
||||
for (String checkName : ConfigUtil.JoinNPCDetect) {
|
||||
if (!packetHandler.checkSpawnPlayerName(packet, checkName)) {
|
||||
add = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (add && !npcDetect.contains(packet)) {
|
||||
LogUtil.doLog(0, "存在符合条件的NPC: " + Arrays.toString(packetHandler.getSpawnPlayerLocation(packet)), "NPCDetect");
|
||||
npcDetect.add(packet);
|
||||
}
|
||||
|
||||
npcDetectHandle(packetHandler, client, packet);
|
||||
} else if (packetHandler.checkServerOpenWindowPacket(packet)) {
|
||||
// 收到打开Inventory数据包
|
||||
if (ConfigUtil.BotActionDetails) {
|
||||
@ -147,4 +157,58 @@ public class PacketManager {
|
||||
packetHandler.handleMessageExtra(packetHandler, message, client, username);
|
||||
}
|
||||
}
|
||||
|
||||
public static void npcDetectHandle(PacketHandler packetHandler, Object client, Object packet) {
|
||||
boolean add = false;
|
||||
for (String checkName : ConfigUtil.JoinNPCDetect) {
|
||||
if (packetHandler.checkSpawnPlayerName(packet, checkName)) {
|
||||
add = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (add && !npcDetect.contains(packet)) {
|
||||
LogUtil.doLog(0, "存在符合条件的NPC: " + Arrays.toString(packetHandler.getSpawnPlayerLocation(packet)), "NPCDetect");
|
||||
npcDetect.add(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public static void bypassFallCheckHandle(PacketHandler packetHandler, Object client, String msg, String username, boolean forceRun) {
|
||||
if (!forceRun && BotManager.botHandler.hasClientFlag(client, "bypassFallCheck")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!BotManager.positionList.containsKey(client)) {
|
||||
LogUtil.doLog(0, "[" + username + "] [行动] 尝试发送下落检测数据包时发生错误! 无法确定原点位置。", "BotAttack");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String bypassDetect : ConfigUtil.BypassFallCheck) {
|
||||
if (forceRun || msg.contains(bypassDetect)) {
|
||||
double[] location = packetHandler.getLocationFromPacket(BotManager.positionList.get(client));
|
||||
|
||||
// 必须禁用默认处理方式
|
||||
boolean moveHandler = ConfigUtil.PacketHandlerMove;
|
||||
|
||||
for (int i = 0; i < ConfigUtil.BypassFallCheckTicks; i++) {
|
||||
double fallHeight = -((Math.pow(0.98, i) - 1) * 3.92);
|
||||
location[2] = location[2] - fallHeight;
|
||||
packetHandler.sendPlayerPositionPacket(client, false, location);
|
||||
OtherUtils.doSleep(50);
|
||||
}
|
||||
|
||||
ConfigUtil.PacketHandlerMove = moveHandler;
|
||||
|
||||
BotManager.botHandler.setClientFlag(client, "bypassFallCheck", true);
|
||||
LogUtil.doLog(0, "[" + username + "] 已发送下落检测数据包。", "BotAttack");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkLoginMsg(Object client, String message, String username) {
|
||||
if (message.contains(ConfigUtil.LoginSuccessMsg)) {
|
||||
LogUtil.doLog(0, "[" + username + "] 成功完成登录。", "BotAttack");
|
||||
BotManager.botHandler.setClientFlag(client, "login", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,10 +51,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -125,9 +121,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
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());
|
||||
@ -237,6 +231,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -264,10 +263,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -328,6 +328,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -354,6 +360,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
|
@ -47,10 +47,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -121,9 +117,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
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());
|
||||
@ -233,6 +227,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -260,10 +259,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -324,6 +324,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -350,6 +356,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
|
@ -46,10 +46,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -114,9 +110,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
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());
|
||||
@ -226,6 +220,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -253,10 +252,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -316,6 +316,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -342,6 +348,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
|
@ -43,10 +43,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -111,9 +107,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
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());
|
||||
@ -210,6 +204,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -237,10 +236,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -300,6 +300,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -326,6 +332,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
|
@ -40,10 +40,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -107,9 +103,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
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());
|
||||
@ -206,6 +200,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -233,10 +232,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -296,6 +296,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -322,6 +328,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
|
@ -40,10 +40,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -108,9 +104,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
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());
|
||||
@ -207,6 +201,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -234,10 +233,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -297,6 +297,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -323,6 +329,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
|
@ -43,10 +43,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ClientboundCustomPayloadPacket;
|
||||
@ -111,9 +107,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
|
||||
if (ConfigUtil.PacketHandlerMove) {
|
||||
sendClientPlayerMovementPacket(session, true);
|
||||
ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(positionRotationPacket.getTeleportId());
|
||||
@ -210,6 +204,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -237,10 +236,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ServerboundMovePlayerPosPacket playerPositionPacket = new ServerboundMovePlayerPosPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -300,6 +300,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -326,6 +332,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ServerboundMovePlayerPosPacket positionPacket = new ServerboundMovePlayerPosPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
|
@ -43,10 +43,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ClientboundCustomPayloadPacket;
|
||||
@ -111,9 +107,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
|
||||
if (ConfigUtil.PacketHandlerMove) {
|
||||
sendClientPlayerMovementPacket(session, true);
|
||||
ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(positionRotationPacket.getTeleportId());
|
||||
@ -191,7 +185,6 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return playerPacket.getEntityId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void moveToLocation(Object client, Double[] targetLocation, double moveSpeed) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
@ -210,6 +203,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -237,10 +235,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ServerboundMovePlayerPosPacket playerPositionPacket = new ServerboundMovePlayerPosPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -300,6 +299,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -326,6 +331,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ServerboundMovePlayerPosPacket positionPacket = new ServerboundMovePlayerPosPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
|
@ -43,10 +43,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ClientboundCustomPayloadPacket;
|
||||
@ -111,9 +107,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
|
||||
if (ConfigUtil.PacketHandlerMove) {
|
||||
sendClientPlayerMovementPacket(session, true);
|
||||
ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(positionRotationPacket.getTeleportId());
|
||||
@ -210,6 +204,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -237,10 +236,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ServerboundMovePlayerPosPacket playerPositionPacket = new ServerboundMovePlayerPosPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -300,6 +300,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -326,6 +332,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ServerboundMovePlayerPosPacket positionPacket = new ServerboundMovePlayerPosPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
|
@ -43,10 +43,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ClientboundCustomPayloadPacket;
|
||||
@ -111,9 +107,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
|
||||
if (ConfigUtil.PacketHandlerMove) {
|
||||
sendClientPlayerMovementPacket(session, true);
|
||||
ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(positionRotationPacket.getTeleportId());
|
||||
@ -210,6 +204,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -237,10 +236,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ServerboundMovePlayerPosPacket playerPositionPacket = new ServerboundMovePlayerPosPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -300,6 +300,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -326,6 +332,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ServerboundMovePlayerPosPacket positionPacket = new ServerboundMovePlayerPosPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
|
@ -50,10 +50,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ClientboundCustomPayloadPacket;
|
||||
@ -118,9 +114,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
|
||||
if (ConfigUtil.PacketHandlerMove) {
|
||||
sendClientPlayerMovementPacket(session, true);
|
||||
ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(positionRotationPacket.getTeleportId());
|
||||
@ -217,6 +211,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -244,10 +243,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ServerboundMovePlayerPosPacket playerPositionPacket = new ServerboundMovePlayerPosPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -310,6 +310,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ClientboundPlayerPositionPacket positionRotationPacket = (ClientboundPlayerPositionPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -339,6 +345,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
ServerboundMovePlayerPosPacket positionPacket = new ServerboundMovePlayerPosPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
TcpClientSession session = (TcpClientSession) client;
|
||||
|
@ -40,10 +40,6 @@ import java.io.DataOutputStream;
|
||||
import java.util.*;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -114,9 +110,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
|
||||
if (ConfigUtil.PacketHandlerMove) {
|
||||
sendClientPlayerMovementPacket(session, true);
|
||||
}
|
||||
@ -223,6 +217,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -250,10 +249,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -314,6 +314,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -340,6 +346,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
|
@ -49,10 +49,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -123,9 +119,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
session.setFlag("location", new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()});
|
||||
if (ConfigUtil.PacketHandlerMove) {
|
||||
sendClientPlayerMovementPacket(session, true);
|
||||
}
|
||||
@ -232,6 +226,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -259,10 +258,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -323,6 +323,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -349,6 +355,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
|
@ -51,10 +51,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler {
|
||||
private double selfX = 0;
|
||||
private double selfY = 0;
|
||||
private double selfZ = 0;
|
||||
|
||||
@Override
|
||||
public boolean checkServerPluginMessagePacket(Object packet) {
|
||||
return packet instanceof ServerPluginMessagePacket;
|
||||
@ -125,9 +121,7 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
public void handleServerPlayerPositionRotationPacket(Object client, Object recvPacket, String username) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
selfX = positionRotationPacket.getX();
|
||||
selfY = positionRotationPacket.getY();
|
||||
selfZ = positionRotationPacket.getZ();
|
||||
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());
|
||||
@ -187,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;
|
||||
}
|
||||
@ -237,6 +231,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
|
||||
// 持续移动直到接近目标位置
|
||||
while (true) {
|
||||
double[] location = session.getFlag("location");
|
||||
double selfX = location[0];
|
||||
double selfY = location[1];
|
||||
double selfZ = location[2];
|
||||
|
||||
double previousX = selfX;
|
||||
double previousY = selfY;
|
||||
double previousZ = selfZ;
|
||||
@ -264,10 +263,11 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
moveYFirst = !moveYFirst; // 下次尝试另一个方向
|
||||
}
|
||||
|
||||
session.setFlag("location", new double[]{selfX, selfY, selfZ, location[3], location[4]});
|
||||
ClientPlayerPositionPacket playerPositionPacket = new ClientPlayerPositionPacket(true, selfX, selfY, selfZ);
|
||||
session.send(playerPositionPacket);
|
||||
|
||||
OtherUtils.doSleep(100); // 暂停以等待服务器响应
|
||||
OtherUtils.doSleep(50); // 暂停以等待服务器响应
|
||||
|
||||
// 检查是否成功移动
|
||||
movedLastTime = (previousX != selfX || previousY != selfY || previousZ != selfZ);
|
||||
@ -328,6 +328,12 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
return ((StringTag) hashMap.get("Name")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getLocationFromPacket(Object packet) {
|
||||
ServerPlayerPositionRotationPacket positionRotationPacket = (ServerPlayerPositionRotationPacket) packet;
|
||||
return new double[]{positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), positionRotationPacket.getYaw(), positionRotationPacket.getPitch()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getItemLore(Object itemStack) {
|
||||
if (itemStack == null) {
|
||||
@ -341,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;
|
||||
@ -354,6 +360,13 @@ public class PacketHandler implements cn.serendipityr.EndMinecraftPlusV2.Multipl
|
||||
session.send(interactEntityPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlayerPositionPacket(Object client, boolean onGround, double[] location) {
|
||||
Session session = ((Client) client).getSession();
|
||||
ClientPlayerPositionPacket positionPacket = new ClientPlayerPositionPacket(onGround, location[0], location[1], location[2]);
|
||||
session.send(positionPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLeftClickWindowItemPacket(Object client, int windowId, int slot, Object itemStack) {
|
||||
Session session = ((Client) client).getSession();
|
||||
@ -363,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);
|
||||
|
Loading…
Reference in New Issue
Block a user