Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

部分情况下取消传送事件将导致UnsupportedOperationException #1459

Open
4 of 5 tasks
xjqsh opened this issue Aug 19, 2024 · 0 comments
Open
4 of 5 tasks

部分情况下取消传送事件将导致UnsupportedOperationException #1459

xjqsh opened this issue Aug 19, 2024 · 0 comments
Labels
Bug Something isn't working Plugin Specific plugin related issue Version: Trials (1.20/1.20.1)

Comments

@xjqsh
Copy link

xjqsh commented Aug 19, 2024

请确认您已完成以下几件事

  • 正在使用最新的 Arclight
  • 已为所有插件及模组安装依赖
  • 已为所有插件及模组更新至最新版
  • 不可在 Spigot 复现
  • 不可在 Forge 复现

Arclight 版本

arclight-1.20.1-1.0.5-1a8925b

Java 版本 | 操作系统

OS Windows Server 2022 arch amd64 version 10.0; java graalvm-jdk-17.0.11+7.1

相关 Mod/插件 的名称及版本

错误描述

@Overwrite
public void teleport(double x, double y, double z, float yaw, float pitch, Set<RelativeMovement> relativeSet) {
PlayerTeleportEvent.TeleportCause cause = arclight$cause == null ? PlayerTeleportEvent.TeleportCause.UNKNOWN : arclight$cause;
arclight$cause = null;
Player player = this.getCraftPlayer();
Location from = player.getLocation();
Location to = new Location(this.getCraftPlayer().getWorld(), x, y, z, yaw, pitch);
if (!from.equals(to)) {
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause);
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled() || !to.equals(event.getTo())) {
relativeSet.clear();
to = (event.isCancelled() ? event.getFrom() : event.getTo());
x = to.getX();
y = to.getY();
z = to.getZ();
yaw = to.getYaw();
pitch = to.getPitch();
}
}
if (Float.isNaN(yaw)) {
yaw = 0.0f;
}
if (Float.isNaN(pitch)) {
pitch = 0.0f;
}
this.internalTeleport(x, y, z, yaw, pitch, relativeSet);
}

此处传入的Set<RelativeMovement> relativeSet可能为不可变集合,比如旁观者模式下通过快捷键观战他人调用的setCamera方法(如下图),如果此时试图将传送事件取消调用relativeSet.clear() ,则会触发UnsupportedOperationException 导致服务器崩溃
已自行尝试解决 修改并编译了一份后,问题不再出现
粗看了一下其他版本可能也有相同问题(?),但是没有尝试过
set
set2

复现步骤

No response

报错信息

https://mclo.gs/RQzBQv9

复现用压缩包下载链接(可选)

No response

@xjqsh xjqsh added the Triage Default label, waiting for triage label Aug 19, 2024
@qyl27 qyl27 added Bug Something isn't working Plugin Specific plugin related issue Version: Trials (1.20/1.20.1) and removed Triage Default label, waiting for triage labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Plugin Specific plugin related issue Version: Trials (1.20/1.20.1)
Projects
None yet
Development

No branches or pull requests

2 participants