mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-27 15:31:22 +01:00
Fixed revid level issue
This commit is contained in:
parent
b8200c9f11
commit
33ba1828c4
@ -175,40 +175,22 @@ public class MMOItemBuilder {
|
||||
* with strictly higher priority. If there are none, adds modifier and
|
||||
* clears less priority modifiers
|
||||
*
|
||||
* @param modifier Name modifier which needs to be added
|
||||
* @param mod UUID of storage into the Stat History of name
|
||||
* @param modifier Name modifier which needs to be added
|
||||
* @param modifierId UUID of storage into the Stat History of name
|
||||
*/
|
||||
public void addModifier(@NotNull NameModifier modifier, @NotNull UUID mod) {
|
||||
public void addModifier(@NotNull NameModifier modifier, @NotNull UUID modifierId) {
|
||||
|
||||
// Might overwrite a modifier yes
|
||||
ArrayList<UUID> removedObs = new ArrayList<>();
|
||||
for (UUID cUID : nameModifiers.keySet()) {
|
||||
|
||||
// Remove obs?
|
||||
NameModifier obs = nameModifiers.get(cUID);
|
||||
|
||||
// Are they the same type?
|
||||
// Might overwrite a modifier
|
||||
final Iterator<NameModifier> ite = nameModifiers.values().iterator();
|
||||
while (ite.hasNext()) {
|
||||
final NameModifier obs = ite.next();
|
||||
if (obs.getType() == modifier.getType()) {
|
||||
|
||||
// Choose greater priority
|
||||
if (obs.getPriority() > modifier.getPriority()) {
|
||||
|
||||
// Keep old one
|
||||
return;
|
||||
|
||||
} else if (obs.getPriority() < modifier.getPriority()) {
|
||||
|
||||
// Remove old one and add new one
|
||||
removedObs.add(cUID);
|
||||
}
|
||||
if (obs.getPriority() > modifier.getPriority()) return;
|
||||
else if (obs.getPriority() < modifier.getPriority()) ite.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Remove
|
||||
for (UUID ro : removedObs) {
|
||||
nameModifiers.remove(ro);
|
||||
}
|
||||
nameModifiers.put(mod, modifier);
|
||||
nameModifiers.put(modifierId, modifier);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -373,30 +373,8 @@ public class MMOItemReforger {
|
||||
|
||||
this.player = player;
|
||||
|
||||
/*
|
||||
* This chunk will determine the level the item was, and
|
||||
* regenerate a new one based on that level ~ the "Item Level" which
|
||||
*
|
||||
*
|
||||
* which I honestly don't know how to use I've just been
|
||||
* copying and pasting this around, leaving this code untouched
|
||||
* since I first started polishing the RevID workings.
|
||||
*
|
||||
* - gunging
|
||||
*/
|
||||
int iLevel = MMOItemReforger.defaultItemLevel;
|
||||
|
||||
// What level with the regenerated item will be hmmmm.....
|
||||
generationItemLevel =
|
||||
|
||||
// No default level specified?
|
||||
(iLevel == -32767) ?
|
||||
|
||||
// Does the item have level?
|
||||
(getOldMMOItem().hasData(ItemStats.ITEM_LEVEL) ? (int) ((DoubleData) getOldMMOItem().getData(ItemStats.ITEM_LEVEL)).getValue() : 0)
|
||||
|
||||
// Default level was specified, use that.
|
||||
: iLevel;
|
||||
generationItemLevel = (getOldMMOItem().hasData(ItemStats.ITEM_LEVEL) ? (int) ((DoubleData) getOldMMOItem().getData(ItemStats.ITEM_LEVEL)).getValue() : 0);
|
||||
|
||||
// Identify tier.
|
||||
ItemTier tier =
|
||||
@ -455,12 +433,10 @@ public class MMOItemReforger {
|
||||
}
|
||||
|
||||
//region Config Values
|
||||
public static int defaultItemLevel = -32767;
|
||||
public static boolean keepTiersWhenReroll = true;
|
||||
public static boolean gemstonesRevIDWhenUnsocket = false;
|
||||
|
||||
public static void reload() {
|
||||
defaultItemLevel = MMOItems.plugin.getConfig().getInt("item-revision.default-item-level", -32767);
|
||||
keepTiersWhenReroll = MMOItems.plugin.getConfig().getBoolean("item-revision.keep-tiers");
|
||||
gemstonesRevIDWhenUnsocket = MMOItems.plugin.getConfig().getBoolean("item-revision.regenerate-gems-when-unsocketed", false);
|
||||
}
|
||||
|
@ -269,13 +269,6 @@ disable-vanilla-recipes: []
|
||||
# Options for the Item Revision System
|
||||
item-revision:
|
||||
|
||||
# This is the value to set the Item Level to when
|
||||
# items are updated by the revision system.
|
||||
# This can be set to -1 to use the items previous level.
|
||||
# Please note, that this value has no effect if
|
||||
# ´reroll-when-updated´ is set to true.
|
||||
default-item-level: -1
|
||||
|
||||
# Unsocketing gems picks them up with the stats they had
|
||||
# when first put into the item, disable this option to
|
||||
# force them to be regenerated.
|
||||
|
Loading…
Reference in New Issue
Block a user