public void addPlayerType(String name, Class playerType) { PlayerType type = PlayerType.getByDescription(name); if (type != null) { if (playerType != null) { this.playerTypes.put(type, playerType); } } }
public static PlayerType getByDescription(String description) { for (PlayerType type : values()) { if (type.description.equals(description)) { return type; } } throw new IllegalArgumentException(String.format("PlayerType (%s) is not configured", description)); } }
public TourneyPlayerProto toProto() { return TourneyPlayerProto.newBuilder() .setName(this.player.getName()) .setPlayerType(this.playerType.toString()) .setQuit(this.quitStatus) .build(); } }
public PlayerType getPlayerType() { return PlayerType.getByDescription(this.cbPlayerType.getSelectedItem().toString()); }
prefPlayerTypes.clear(); for (String pType : playerTypes.split(",")) { prefPlayerTypes.add(PlayerType.getByDescription(pType));