Java 州是';应为Minecraft记分板进行t更新

Java 州是';应为Minecraft记分板进行t更新,java,minecraft,bukkit,Java,Minecraft,Bukkit,我有一个函数接口,在执行时返回一个字符串。在这个函数接口中,我传递了一个类的实例,该实例在调用时应该引用该实例并获取该类中的当前值(该值在其他地方更新)。所以这个值会发生变化,每次我执行函数接口时,它也会更新,因为它引用了这个类和变量 有相当多的代码,所以为了简单起见 我的LineExecution界面: @FunctionalInterface public interface LineExecution { String execute(Player p); } 我的记分牌课:

我有一个函数接口,在执行时返回一个字符串。在这个函数接口中,我传递了一个类的实例,该实例在调用时应该引用该实例并获取该类中的当前值(该值在其他地方更新)。所以这个值会发生变化,每次我执行函数接口时,它也会更新,因为它引用了这个类和变量

有相当多的代码,所以为了简单起见

我的LineExecution界面:

@FunctionalInterface
public interface LineExecution {

    String execute(Player p);

}
我的记分牌课:

我在这里更新
状态#getReferencedTime
值:

@Override
public void run() {
    Logger.debug("setting referenced time");
    Logger.debug("EXECUTIONA: " + execution.execute(a.getPlayers().stream().findFirst().orElse(null).getPlayer()));
    state.setReferencedTime(i);
    Logger.debug("getting referenced time: " + state.getReferencedTime());
    a.getPlayers().forEach(p -> {
        Logger.debug("updating... state: " + state.getReferencedTime());
        GameBoard g = state.getGameBoard(p.getPlayer());
        g.update(p.getPlayer());
    });
    i--;
}
这是控制台中打印的内容:

这是我的“游戏板”课程:

public class GameBoard extends Scoreboard {

    public GameBoard(GameBoardType type, GameStateManager state) {
        super(type.getTitle());

        addLine(p -> {
            return "stateRef: " + state.getReferencedTime();
        }, Bukkit.getOfflinePlayer("Realmm").getPlayer());
    }

}
因此,我只想能够更新
state.getReferencedTime
,这是我在
run()
中做的,然后,当我通过调用
GameBoard\update(Player)
再次执行该功能界面时,它应该显示
9
,倒计时到
0
。但是它总是显示
10
,不管我是否更改值