Skip to content

Commit

Permalink
maxhomes in config.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Szymon3eK committed Aug 2, 2023
1 parent 099ad3c commit d51db06
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main/java/xyz/szymon3ek/betterhomes/BetterHomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
Player player = (Player) sender;
Inventory menu = player.getServer().createInventory(null, InventoryType.HOPPER, "§cBetterHomes");
FileConfiguration config = getConfig();
int maxhomes = config.getInt("config.maxhomes");

for (int i = 1; i <= 3; i++) {
for (int i = 1; i <= maxhomes; i++) {

if(config.contains("homes." + player.getName() + '.'+ i + ".x")) {

Expand Down Expand Up @@ -85,6 +86,21 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
}


}

for (int i = 3; i > maxhomes; i--) {

ItemStack maxhomesbanner = new ItemStack(Material.BLACK_BANNER);

ItemMeta maxhomesmeta = maxhomesbanner.getItemMeta();
maxhomesmeta.setDisplayName("§7» §c§l✗ ");
List<String> maxhomeslore = new ArrayList<>(); maxhomeslore.add("§7Nie mozesz ustawic wiecej homow!");
maxhomesmeta.setLore(maxhomeslore);
maxhomesbanner.setItemMeta(maxhomesmeta);

menu.setItem(i, maxhomesbanner);


}

menu.setItem(0, new ItemStack(Material.BLACK_STAINED_GLASS_PANE));
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
homes:

config:
maxhomes: 3
3 changes: 3 additions & 0 deletions target/classes/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
homes:

config:
maxhomes: 3
Binary file modified target/classes/xyz/szymon3ek/betterhomes/BetterHomes.class
Binary file not shown.

0 comments on commit d51db06

Please sign in to comment.