Skip to content

Commit

Permalink
Change menu chunk titles
Browse files Browse the repository at this point in the history
  • Loading branch information
leelawd committed Feb 14, 2019
1 parent 5133c36 commit 14aedb2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ public MessagesConfig(BetterChunkLoader main) throws IOException {
public String chunksReloadSuccess = "&aReload success for: &e{type}&a.";
public String chunksReloadFailure = "&cReload failed for: &e{type}&c, check console for more information.";

public String menuChunkTitle1 = "Size: 1x1 Chunks";
public String menuChunkTitle2 = "Size: 3x3 Chunks";
public String menuChunkTitle3 = "Size: 5x5 Chunks";
public String menuChunkTitle4 = "Size: 7x7 Chunks";
public String menuChunkTitle5 = "Size: 9x9 Chunks";
public String menuChunkTitle6 = "Size: 11x11 Chunks";
public String menuChunkTitle7 = "Size: 13x13 Chunks";


private void configCheck() throws IOException, ObjectMappingException {
Expand All @@ -201,6 +208,15 @@ private void configCheck() throws IOException, ObjectMappingException {

serverNameError = check(config.getNode("ChunkLoader", "ServerNameError"), serverNameError).getString();

//Menu
menuChunkTitle1 = check(config.getNode("Menu", "Chunks", "1"), menuChunkTitle1).getString();
menuChunkTitle2 = check(config.getNode("Menu", "Chunks", "2"), menuChunkTitle2).getString();
menuChunkTitle3 = check(config.getNode("Menu", "Chunks", "3"), menuChunkTitle3).getString();
menuChunkTitle4 = check(config.getNode("Menu", "Chunks", "4"), menuChunkTitle4).getString();
menuChunkTitle5 = check(config.getNode("Menu", "Chunks", "5"), menuChunkTitle5).getString();
menuChunkTitle6 = check(config.getNode("Menu", "Chunks", "6"), menuChunkTitle6).getString();
menuChunkTitle7 = check(config.getNode("Menu", "Chunks", "7"), menuChunkTitle7).getString();

//ChunkLoader
creationHelp = check(config.getNode("ChunkLoader", "CreationHelp"), creationHelp).getString();
noPermissionCreate = check(config.getNode("ChunkLoader", "NoPermissionCreate"), noPermissionCreate).getString();
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/net/moddedminecraft/betterchunkloader/menu/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void showMenu(Player player, ChunkLoader chunkLoader) {
lores.add(Text.of("Radius: " + radius));
lores.add(Text.of("Chunks: " + chunks));
keys.put(Keys.ITEM_LORE, lores);
keys.put(Keys.DISPLAY_NAME, Text.of((chunkLoader.getRadius() == radius ? "Size: " + getReadableSize(radius + 1) + " [Active]" : "Size: " + getReadableSize(radius + 1))));
keys.put(Keys.DISPLAY_NAME, Text.of((chunkLoader.getRadius() == radius ? getReadableSize(radius + 1) + " [Active]" : getReadableSize(radius + 1))));
addMenuOption(inventory, slotPos, (chunkLoader.getRadius() == radius ? ACTIVE_TYPE : INACTIVE_TYPE), keys);
pos++;
radius++;
Expand Down Expand Up @@ -115,7 +115,7 @@ public void updateMenu(Player player, ChunkLoader chunkLoader, Inventory invento
lores.add(Text.of("Radius: " + radius));
lores.add(Text.of("Chunks: " + chunks));
keys.put(Keys.ITEM_LORE, lores);
keys.put(Keys.DISPLAY_NAME, Text.of((chunkLoader.getRadius() == radius ? "Size: " + getReadableSize(radius + 1) + " [Active]" : "Size: " + getReadableSize(radius + 1))));
keys.put(Keys.DISPLAY_NAME, Text.of((chunkLoader.getRadius() == radius ? getReadableSize(radius + 1) + " [Active]" : getReadableSize(radius + 1))));
addMenuOption(inventory, slotPos, (chunkLoader.getRadius() == radius ? ACTIVE_TYPE : INACTIVE_TYPE), keys);
pos++;
radius++;
Expand All @@ -127,21 +127,21 @@ public void updateMenu(Player player, ChunkLoader chunkLoader, Inventory invento
private String getReadableSize(int i) {
switch (i) {
case 1:
return "1x1";
return plugin.getConfig().getMessages().menuChunkTitle1;
case 2:
return "3x3";
return plugin.getConfig().getMessages().menuChunkTitle2;
case 3:
return "5x5";
return plugin.getConfig().getMessages().menuChunkTitle3;
case 4:
return "7x7";
return plugin.getConfig().getMessages().menuChunkTitle4;
case 5:
return "9x9";
return plugin.getConfig().getMessages().menuChunkTitle5;
case 6:
return "11x11";
return plugin.getConfig().getMessages().menuChunkTitle6;
case 7:
return "13x13";
return plugin.getConfig().getMessages().menuChunkTitle7;
default:
return "" + i;
return "Size: " + i;
}
}

Expand Down

0 comments on commit 14aedb2

Please sign in to comment.