玩家当前坐标实时刷新
This commit is contained in:
@@ -109,6 +109,6 @@ public class PlayerData {
|
||||
|
||||
/// 玩家位置信息发生改变
|
||||
public void updateLocal() {
|
||||
|
||||
ui.playerMove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,25 @@ public class ScoreboardUI {
|
||||
flashLocations();
|
||||
}
|
||||
|
||||
protected boolean isLocal(Location l1, Location l2) {
|
||||
if ((long) l1.getX() != (long) l2.getX())
|
||||
return true;
|
||||
if ((long) l1.getY() != (long) l2.getY())
|
||||
return true;
|
||||
return (long) l1.getZ() != (long) l2.getZ();
|
||||
}
|
||||
|
||||
protected void playerMove() {
|
||||
Location local = player.getLocation();
|
||||
if (!isLocal(this.location, local)) {
|
||||
return;
|
||||
}
|
||||
this.scoreboard.resetScores(this.meLocation.getEntry());
|
||||
this.location = local;
|
||||
meLocation = this.objective.getScore(getLocationString());
|
||||
meLocation.setScore(999);
|
||||
}
|
||||
|
||||
protected void closeUI() {
|
||||
var manager = Bukkit.getScoreboardManager();
|
||||
assert manager != null;
|
||||
|
||||
Reference in New Issue
Block a user