Skip to content

Commit

Permalink
Changes placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Apr 17, 2020
1 parent de9b54c commit 62edbe6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/world/bentobox/aoneblock/AOneBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ public void onEnable(){
registerListener(listener);
registerListener(new NoBlockHandler(this));
// Register placeholders
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"phase", this::getPhaseByUser);
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"count", this::getCountByUser);
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"visited_island_phase", this::getPhaseByUser);
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"visited_island_count", this::getCountByUser);
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"my_island_phase", this::getPhaseByIsland);
getPlugin().getPlaceholdersManager().registerPlaceholder(this,"my_island_count", this::getCountByIsland);
} catch (IOException | InvalidConfigurationException e) {
// Disable
logError("AOneBlock settings could not load (oneblock.yml error)! Addon disabled.");
Expand All @@ -100,6 +102,16 @@ private String getCountByUser(User user) {
.orElse("");
}

private String getPhaseByIsland(User user) {
Island i = getIslands().getIsland(getOverWorld(), user);
return i == null ? "" : getOneBlocksIsland(i).getPhaseName();
}

private String getCountByIsland(User user) {
Island i = getIslands().getIsland(getOverWorld(), user);
return i == null ? "" : String.valueOf(getOneBlocksIsland(i).getBlockNumber());
}

@Override
public void onDisable() {
// save cache
Expand Down

0 comments on commit 62edbe6

Please sign in to comment.