1.0.0-SNAPSHOT-U156

+ Fixed the issue with the NewPosition button on GiveRewardRewardsListPanel
This commit is contained in:
Charles 2018-12-31 01:18:58 +08:00
parent 7bb452020a
commit b4b9f4bf72
2 changed files with 8 additions and 7 deletions

View File

@ -135,19 +135,20 @@ public class GiveRewardRewardsListPanel extends SubSubVariablePanelHandler<DropT
private ClickAction getNewRewardSectionAction(DropTable dropTable, GiveTableElement giveTableElement, String key) {
return event -> {
Map<String, Map<String, GiveTableSubElement>> rewards = giveTableElement.getGiveRewards();
Map<String, GiveTableSubElement> rewardSections = rewards.get(key);
List<String> keys = new ArrayList<>(giveTableElement.getGiveRewards().keySet());
Map<String, Map<String, GiveTableSubElement>> rewardSections = giveTableElement.getGiveRewards();
Map<String, GiveTableSubElement> rewards = rewardSections.get(key);
List<String> keys = new ArrayList<>(rewards.keySet());
int nextAvailable = NumberUtils.get().getNextAvailablePosition(keys);
String nextKey = ""+nextAvailable;
if(rewardSections.containsKey(nextKey)) {
if(rewards.containsKey(nextKey)) {
Debug.FAILED_TO_CREATE_NEWPOSITION.debug(nextKey, BossAPI.getDropTableName(dropTable));
return;
}
rewardSections.put(nextKey, new GiveTableSubElement(new HashMap<>(), new HashMap<>(), 3, 3, false, false, 0.0));
giveTableElement.setGiveRewards(rewards);
rewards.put(nextKey, new GiveTableSubElement(new HashMap<>(), new HashMap<>(), 3, 3, false, false, 0.0));
rewardSections.put(key, rewards);
giveTableElement.setGiveRewards(rewardSections);
saveDropTable((Player) event.getWhoClicked(), dropTable, giveTableElement, key);
};
}

View File

@ -20,7 +20,7 @@
<properties>
<!--<plugin.version>maven-version-number-SNAPSHOT-U90</plugin.version>-->
<plugin.version>1.0.0-U155</plugin.version>
<plugin.version>1.0.0-U156</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>