Added an option to prevent item tiers from being kept when updating with revision ids

This commit is contained in:
ASangarin 2020-12-19 21:54:53 +01:00
parent aa361dc63b
commit d32920089e
2 changed files with 8 additions and 2 deletions

View File

@ -94,7 +94,8 @@ public class ItemModInstance {
if (player == null) {
final int iLevel = MMOItems.plugin.getConfig().getInt("item-revision.default-item-level", -1);
int level = iLevel == -1 ? (mmoItem.hasData(ItemStats.ITEM_LEVEL) ? (int) ((DoubleData) mmoItem.getData(ItemStats.ITEM_LEVEL)).getValue() : 0) : iLevel;
ItemTier tier = mmoItem.hasData(ItemStats.TIER) ? MMOItems.plugin.getTiers().get(mmoItem.getData(ItemStats.TIER).toString()) : null;
ItemTier tier = (mmoItem.hasData(ItemStats.TIER) &&
MMOItems.plugin.getConfig().getBoolean("item-revision.keep-tiers")) ? MMOItems.plugin.getTiers().get(mmoItem.getData(ItemStats.TIER).toString()) : null;
mmoItem = template.newBuilder(level, tier).build();
} else mmoItem = template.newBuilder(player).build();
}

View File

@ -8,7 +8,7 @@
# a Spigot Plugin by Team Requiem
# DO NOT TOUCH
config-version: 6
config-version: 7
# Notifies players with the 'mmoitems.update-notify' perm node when
# they join the server if a new update is available for download.
@ -256,6 +256,11 @@ item-revision:
# Please note, that this value has no effect if
# ´reroll-when-updated´ is set to true.
default-item-level: -1
# Whether or not the current tier of the item should
# be carried over.
# Please note, that this value has no effect if
# ´reroll-when-updated´ is set to true.
keep-tiers: true
# Whether the updated items should reroll stats
# according to the players current level or if
# they should keep the level and tier from when