0

我需要一点帮助,我想不通为什么我不能重视我想要的东西。这是我想要做的代码

RouletteExtension.java

public class RouletteExtension extends SFSExtension {
   private ConcurrentHashMap<Integer,PlayerHandler> players = null;
   @Override
   public void init() {
      players = new ConcurrentHashMap<Integer,PlayerHandler>();
   }
   public ConcurrentHashMap<Integer, PlayerHandler> getPlayers() {
      return players;
   }
   public void setPlayers(ConcurrentHashMap<Integer, PlayerHandler> players) {
      this.players = players;
   }
}

PlayerHandler.java

public class PlayerHandler {
   private int id = 0;
   User sfsUser = null;
   public PlayerHandler() {}
   public PlayerHandler(int id, User sfsUser) {
      this.id = id;
      this.sfsUser = sfsUser;
   }

   public int getId() {
      return id;
   }
   public void setId(int id) {
      this.id = id;
   }

   public User getSfsUser() {
      return sfsUser;
   }
   public void setSfsUser(User sfsUser) {
      this.sfsUser = sfsUser;
   }
}

BettingHandler.java

public class BettingHandler extends BaseClientRequestHandler {
   @Override
   public void handleClientRequest(User user, ISFSObject params) {
      RouletteExtension gameExt = (RouletteExtension) getParentExtension();
      PlayerHandler a = gameExt.getPlayers().get(user.getId());
      trace ("testOne = ", gameExt.getPlayers());
      trace ("testTwo = ",user.getId());
      trace ("testThree = ", a);
   }
}

这个 SFS2X 服务器端的脚本,我实际上是 java 新手,所以我想知道什么是值a,当我在区域监视器中跟踪时只显示这个

{RouletteExt}: testOne =  {}
{RouletteExt}: testTwo =  1

testThree没有出现,所以有问题,有人可以告诉我如何解决这个问题,并解释这里发生了什么,谢谢

4

0 回答 0