Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clues: use builder for cryptic clues
The code for this was dumped via a test: @test public void dump() throws IllegalAccessException { Map<Integer, String> map = new HashMap<>(); for (Field f : ObjectID.class.getDeclaredFields()) { map.put(f.getInt(null), f.getName()); } for (CrypticClue cc : CrypticClue.CLUES) { System.out.println("CrypticClue.builder()"); System.out.println(".text(\"" + cc.getText() + "\")"); if (!"Viggora".equals(cc.getNpc())) { WorldPoint wp = cc.getLocation(plugin); if (wp != null) { int plane = wp.getPlane(); int x = wp.getX(); int y = wp.getY(); System.out.println(".location(new WorldPoint(" + x + ", " + y + ", " + plane + "))"); } } else { System.out.println(".locationProvider(CrypticClue::getViggoraLocation)"); } if (cc.getNpc() != null) { System.out.println(".npc(\"" + cc.getNpc() + "\")"); } if (cc.getObjectId() != -1) { var name = map.get(cc.getObjectId()); if (name != null) { System.out.println(".objectId(ObjectID." + name + ")"); } else { System.out.println(".objectId(NullObjectID.NULL_" + cc.getObjectId() + ")"); } } System.out.println(".solution(\"" + cc.getSolution() + "\")"); if (cc.isRequiresLight()) { System.out.println(".requiresLight(true)"); } if (cc.getQuestionText() != null) { System.out.println(".questionText(\"" + cc.getQuestionText() + "\")"); } System.out.println(".build(),"); } }
- Loading branch information