mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
more verbose logging for alchemy potion lookups
This commit is contained in:
parent
fc66c9f3fd
commit
e6ff219a5c
@ -1,3 +1,10 @@
|
|||||||
|
Version 2.2.011
|
||||||
|
Improved logging for Alchemy potion look up (see notes)
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
Added detailed logging when multiple configured potions match an ItemStack.
|
||||||
|
This will help identify issues with potion configuration.
|
||||||
|
|
||||||
Version 2.2.010
|
Version 2.2.010
|
||||||
Fixed being unable to load REGEN potion type on new versions of Paper/Spigot 1.20.6
|
Fixed being unable to load REGEN potion type on new versions of Paper/Spigot 1.20.6
|
||||||
Fixed some potions not gaining XP when brewed (Level 2 potions, etc)
|
Fixed some potions not gaining XP when brewed (Level 2 potions, etc)
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.2.010</version>
|
<version>2.2.011-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -342,7 +342,11 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
.filter(potion -> potion.isSimilarPotion(item))
|
.filter(potion -> potion.isSimilarPotion(item))
|
||||||
.toList();
|
.toList();
|
||||||
if(potionList.size() > 1) {
|
if(potionList.size() > 1) {
|
||||||
mcMMO.p.getLogger().severe("Multiple child potions matched for item, when there should only be one: " + item);
|
mcMMO.p.getLogger().severe("Multiple potions defined in config have match this potion, for mcMMO to behave" +
|
||||||
|
" properly there should only be one match found.");
|
||||||
|
mcMMO.p.getLogger().severe("Potion ItemStack:" + item.toString());
|
||||||
|
mcMMO.p.getLogger().severe("Alchemy Potions from config matching this item: "
|
||||||
|
+ potionList.stream().map(AlchemyPotion::toString).collect(Collectors.joining(", ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
return potionList.isEmpty() ? null : potionList.get(0);
|
return potionList.isEmpty() ? null : potionList.get(0);
|
||||||
|
@ -19,11 +19,11 @@ public class AlchemyPotion {
|
|||||||
private final @NotNull ItemStack potionItemStack;
|
private final @NotNull ItemStack potionItemStack;
|
||||||
private final @NotNull Map<ItemStack, String> alchemyPotionChildren;
|
private final @NotNull Map<ItemStack, String> alchemyPotionChildren;
|
||||||
|
|
||||||
public AlchemyPotion(@NotNull String potionConfigName, @NotNull ItemStack potionItemStack, @NotNull Map<ItemStack, String> alchemyPotionChildren) {
|
public AlchemyPotion(@NotNull String potionConfigName, @NotNull ItemStack potionItemStack,
|
||||||
|
@NotNull Map<ItemStack, String> alchemyPotionChildren) {
|
||||||
this.potionConfigName = requireNonNull(potionConfigName, "potionConfigName cannot be null");
|
this.potionConfigName = requireNonNull(potionConfigName, "potionConfigName cannot be null");
|
||||||
this.potionItemStack = requireNonNull(potionItemStack, "potionItemStack cannot be null");
|
this.potionItemStack = requireNonNull(potionItemStack, "potionItemStack cannot be null");
|
||||||
this.alchemyPotionChildren = requireNonNull(alchemyPotionChildren, "alchemyPotionChildren cannot be null");
|
this.alchemyPotionChildren = requireNonNull(alchemyPotionChildren, "alchemyPotionChildren cannot be null");
|
||||||
// mcMMO.p.getLogger().info("AlchemyPotion created: " + potionConfigName + ", with children: " + alchemyPotionChildren);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull ItemStack toItemStack(int amount) {
|
public @NotNull ItemStack toItemStack(int amount) {
|
||||||
@ -32,7 +32,7 @@ public class AlchemyPotion {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<ItemStack, String> getAlchemyPotionChildren() {
|
public @NotNull Map<ItemStack, String> getAlchemyPotionChildren() {
|
||||||
return alchemyPotionChildren;
|
return alchemyPotionChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +58,10 @@ public class AlchemyPotion {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compare custom effects on both potions.
|
||||||
|
*/
|
||||||
|
|
||||||
final PotionMeta otherPotionMeta = (PotionMeta) otherPotion.getItemMeta();
|
final PotionMeta otherPotionMeta = (PotionMeta) otherPotion.getItemMeta();
|
||||||
// compare custom effects on both potions, this has to be done in two traversals
|
// compare custom effects on both potions, this has to be done in two traversals
|
||||||
// comparing thisPotionMeta -> otherPotionMeta and otherPotionMeta -> thisPotionMeta
|
// comparing thisPotionMeta -> otherPotionMeta and otherPotionMeta -> thisPotionMeta
|
||||||
@ -70,17 +74,18 @@ public class AlchemyPotion {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If one potion has lore and the other does not, then they are not the same potion.
|
||||||
|
* If both have lore, compare the lore.
|
||||||
|
* If neither have lore, they may be the same potion.
|
||||||
|
*/
|
||||||
if (!otherPotionMeta.hasLore() && getAlchemyPotionMeta().hasLore()
|
if (!otherPotionMeta.hasLore() && getAlchemyPotionMeta().hasLore()
|
||||||
|| !getAlchemyPotionMeta().hasLore() && otherPotionMeta.hasLore()) {
|
|| !getAlchemyPotionMeta().hasLore() && otherPotionMeta.hasLore()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otherPotionMeta.hasLore() && getAlchemyPotionMeta().hasLore()
|
return !otherPotionMeta.hasLore() || !getAlchemyPotionMeta().hasLore()
|
||||||
&& !otherPotionMeta.getLore().equals(getAlchemyPotionMeta().getLore())) {
|
|| otherPotionMeta.getLore().equals(getAlchemyPotionMeta().getLore());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasDifferingCustomEffects(PotionMeta potionMeta, PotionMeta otherPotionMeta) {
|
private boolean hasDifferingCustomEffects(PotionMeta potionMeta, PotionMeta otherPotionMeta) {
|
||||||
|
Loading…
Reference in New Issue
Block a user