Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

Commit

Permalink
Fixed removePage
Browse files Browse the repository at this point in the history
+Now properly saves to disk
+Fixed error where you could try and delete a page to high
  • Loading branch information
elgbar committed Sep 10, 2016
1 parent a3eeabc commit 11c0d46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/com/kh498/main/trader/TradeMerchant.java
Expand Up @@ -38,6 +38,9 @@ public TradeMerchant(String name, @Nullable ArrayList<ItemStack> traders)
public void saveMerchant(ConfigurationSection conf)
{
ConfigurationSection mainSection = ConfigManager.getSectionOrCreate(conf, internalName);
if (mainSection.contains("Items")){
mainSection.set("Items", null);
}
ConfigurationSection tradesSection = ConfigManager.getSectionOrCreate(mainSection, "Items");

mainSection.set("DisplayName", displayName);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/kh498/main/trader/Trader.java
Expand Up @@ -133,7 +133,7 @@ public static void TraderRemovePage(TradeMerchant trader, int page)
{ // there is not page below 0
Skript.error("The requested page number is too low, it cannot be lower than 0");
return;
} else if (page > pages)
} else if (page >= pages)
{ // Requested page to remove is higher
// than nr of pages
Skript.error("The requested page number is too high, it cannot be higher than " + pages);
Expand Down

0 comments on commit 11c0d46

Please sign in to comment.