Merge remote-tracking branch 'refs/remotes/mcMMO-Dev/master'

This commit is contained in:
Dor 2016-03-16 15:11:51 +02:00
commit d942cedb8e
7 changed files with 103 additions and 27 deletions

View File

@ -236,7 +236,7 @@ public class PotionConfig extends ConfigLoader {
} }
public boolean isValidPotion(ItemStack item) { public boolean isValidPotion(ItemStack item) {
return potionMap.containsKey(item.getDurability()); return getPotion(item) != null;
} }
public AlchemyPotion getPotion(String name) { public AlchemyPotion getPotion(String name) {

View File

@ -139,15 +139,15 @@ public class AlchemyPotion {
return false; return false;
} }
} }
if (!meta.hasLore()) { if (!meta.hasLore() && !lore.isEmpty()) {
return false; return false;
} }
if (!meta.getLore().equals(lore)) { if (!(lore.isEmpty() && !meta.hasLore()) && !meta.getLore().equals(lore)) {
return false; return false;
} }
if (!meta.hasDisplayName()) { if (!meta.hasDisplayName() && name != null) {
return false; return false;
} }
return meta.getDisplayName().equals(name); return (name == null && !meta.hasDisplayName()) || meta.getDisplayName().equals(name);
} }
} }

View File

@ -54,8 +54,8 @@ public enum PotionStage {
int stage = 1; int stage = 1;
// Check if potion has base effect // Check if potion has an effect of any sort
if (data.getType().getEffectType() != null) { if (data.getType().getEffectType() != null || !effects.isEmpty()) {
stage++; stage++;
} }
@ -63,8 +63,7 @@ public enum PotionStage {
// Else check if the potion has a custom effect with an amplifier added by mcMMO // Else check if the potion has a custom effect with an amplifier added by mcMMO
if (data.isUpgraded()) { if (data.isUpgraded()) {
stage++; stage++;
} } else if(!effects.isEmpty()) {
if(!effects.isEmpty()){
for (PotionEffect effect : effects){ for (PotionEffect effect : effects){
if(effect.getAmplifier() > 0){ if(effect.getAmplifier() > 0){
stage++; stage++;

View File

@ -165,7 +165,7 @@ public class InventoryListener implements Listener {
ItemStack clicked = event.getCurrentItem(); ItemStack clicked = event.getCurrentItem();
ItemStack cursor = event.getCursor(); ItemStack cursor = event.getCursor();
if ((clicked != null && clicked.getType() == Material.POTION) || (cursor != null && cursor.getType() == Material.POTION)) { if ((clicked != null && (clicked.getType() == Material.POTION || clicked.getType() == Material.SPLASH_POTION || clicked.getType() == Material.LINGERING_POTION)) || (cursor != null && (cursor.getType() == Material.POTION || cursor.getType() == Material.SPLASH_POTION || cursor.getType() == Material.LINGERING_POTION))) {
AlchemyPotionBrewer.scheduleCheck(player, stand); AlchemyPotionBrewer.scheduleCheck(player, stand);
return; return;
} }
@ -296,12 +296,12 @@ public class InventoryListener implements Listener {
ItemStack item = event.getItem(); ItemStack item = event.getItem();
if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION) { if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION && item.getType() != Material.SPLASH_POTION && item.getType() != Material.LINGERING_POTION) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (Config.getInstance().getPreventHopperTransferBottles() && item.getType() == Material.POTION) { if (Config.getInstance().getPreventHopperTransferBottles() && (item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }

View File

@ -32,7 +32,7 @@ public final class AlchemyPotionBrewer {
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (contents[i] == null || contents[i].getType() != Material.POTION) { if (contents[i] == null || contents[i].getType() != Material.POTION && contents[i].getType() != Material.SPLASH_POTION && contents[i].getType() != Material.LINGERING_POTION) {
continue; continue;
} }

View File

@ -405,6 +405,16 @@ Potions:
SULPHUR: SPLASH_POTION_OF_HASTE SULPHUR: SPLASH_POTION_OF_HASTE
REDSTONE: POTION_OF_HASTE_EXTENDED REDSTONE: POTION_OF_HASTE_EXTENDED
GLOWSTONE_DUST: POTION_OF_HASTE_II GLOWSTONE_DUST: POTION_OF_HASTE_II
POTION_OF_HEALTH_BOOST:
Name: Potion Of Health Boost
Material: POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 0 1800"]
Children:
GLOWSTONE_DUST: POTION_OF_HEALTH_BOOST_II
SULPHUR: SPLASH_POTION_OF_HEALTH_BOOST
REDSTONE: POTION_OF_HEALTH_BOOST_EXTENDED
POTION_OF_HUNGER: POTION_OF_HUNGER:
Name: Potion Of Hunger Name: Potion Of Hunger
Material: POTION Material: POTION
@ -475,6 +485,12 @@ Potions:
PotionData: PotionData:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["FAST_DIGGING 0 7200"] Effects: ["FAST_DIGGING 0 7200"]
POTION_OF_HEALTH_BOOST_EXTENDED:
Name: Potion Of Health Boost Extended
Material: POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 0 3600"]
POTION_OF_HUNGER_EXTENDED: POTION_OF_HUNGER_EXTENDED:
Name: Potion Of Hunger Extended Name: Potion Of Hunger Extended
Material: POTION Material: POTION
@ -529,6 +545,12 @@ Potions:
PotionData: PotionData:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["FAST_DIGGING 1 1800"] Effects: ["FAST_DIGGING 1 1800"]
POTION_OF_HEALTH_BOOST_II:
Name: Potion Of Health Boost II
Material: POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 1 900"]
POTION_OF_HUNGER_II: POTION_OF_HUNGER_II:
Name: Potion Of Hunger II Name: Potion Of Hunger II
Material: POTION Material: POTION
@ -862,9 +884,9 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["ABSORPTION 0 1350"] Effects: ["ABSORPTION 0 1350"]
Children: Children:
REDSTONE: SPLASH_POTION_OF_ABSORPTION_EXTENDED
GLOWSTONE_DUST: SPLASH_POTION_OF_ABSORPTION_II
DRAGONS_BREATH: LINGERING_POTION_OF_ABSORPTION DRAGONS_BREATH: LINGERING_POTION_OF_ABSORPTION
GLOWSTONE_DUST: SPLASH_POTION_OF_ABSORPTION_II
REDSTONE: SPLASH_POTION_OF_ABSORPTION_EXTENDED
SPLASH_POTION_OF_BLINDNESS: SPLASH_POTION_OF_BLINDNESS:
Name: Splash Potion Of Blindness Name: Splash Potion Of Blindness
Material: SPLASH_POTION Material: SPLASH_POTION
@ -872,9 +894,9 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["BLINDNESS 0 168"] Effects: ["BLINDNESS 0 168"]
Children: Children:
DRAGONS_BREATH: LINGERING_POTION_OF_BLINDNESS
REDSTONE: SPLASH_POTION_OF_BLINDNESS_EXTENDED
GLOWSTONE_DUST: SPLASH_POTION_OF_BLINDNESS_II GLOWSTONE_DUST: SPLASH_POTION_OF_BLINDNESS_II
REDSTONE: SPLASH_POTION_OF_BLINDNESS_EXTENDED
DRAGONS_BREATH: LINGERING_POTION_OF_BLINDNESS
SPLASH_POTION_OF_DECAY: SPLASH_POTION_OF_DECAY:
Name: Splash Potion Of Decay Name: Splash Potion Of Decay
Material: SPLASH_POTION Material: SPLASH_POTION
@ -902,9 +924,19 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["FAST_DIGGING 0 2700"] Effects: ["FAST_DIGGING 0 2700"]
Children: Children:
GLOWSTONE_DUST: SPLASH_POTION_OF_HASTE_II
DRAGONS_BREATH: LINGERING_POTION_OF_HASTE DRAGONS_BREATH: LINGERING_POTION_OF_HASTE
REDSTONE: SPLASH_POTION_OF_HASTE_EXTENDED REDSTONE: SPLASH_POTION_OF_HASTE_EXTENDED
GLOWSTONE_DUST: SPLASH_POTION_OF_HASTE_II SPLASH_POTION_OF_HEALTH_BOOST:
Name: Splash Potion Of Health Boost
Material: SPLASH_POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 0 1350"]
Children:
GLOWSTONE_DUST: SPLASH_POTION_OF_HEALTH_BOOST_II
REDSTONE: SPLASH_POTION_OF_HEALTH_BOOST_EXTENDED
DRAGONS_BREATH: LINGERING_POTION_OF_HEALTH_BOOST
SPLASH_POTION_OF_HUNGER: SPLASH_POTION_OF_HUNGER:
Name: Splash Potion Of Hunger Name: Splash Potion Of Hunger
Material: SPLASH_POTION Material: SPLASH_POTION
@ -912,8 +944,8 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["HUNGER 0 675"] Effects: ["HUNGER 0 675"]
Children: Children:
GLOWSTONE_DUST: SPLASH_POTION_OF_HUNGER_II
REDSTONE: SPLASH_POTION_OF_HUNGER_EXTENDED REDSTONE: SPLASH_POTION_OF_HUNGER_EXTENDED
GLOWSTONE_DUST: SPLASH_POTION_OF_HUNGER_II
DRAGONS_BREATH: LINGERING_POTION_OF_HUNGER DRAGONS_BREATH: LINGERING_POTION_OF_HUNGER
SPLASH_POTION_OF_NAUSEA: SPLASH_POTION_OF_NAUSEA:
Name: Splash Potion Of Nausea Name: Splash Potion Of Nausea
@ -922,9 +954,9 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["CONFUSION 0 337"] Effects: ["CONFUSION 0 337"]
Children: Children:
GLOWSTONE_DUST: SPLASH_POTION_OF_NAUSEA_II
DRAGONS_BREATH: LINGERING_POTION_OF_NAUSEA DRAGONS_BREATH: LINGERING_POTION_OF_NAUSEA
REDSTONE: SPLASH_POTION_OF_NAUSEA_EXTENDED REDSTONE: SPLASH_POTION_OF_NAUSEA_EXTENDED
GLOWSTONE_DUST: SPLASH_POTION_OF_NAUSEA_II
SPLASH_POTION_OF_RESISTANCE: SPLASH_POTION_OF_RESISTANCE:
Name: Splash Potion Of Resistance Name: Splash Potion Of Resistance
Material: SPLASH_POTION Material: SPLASH_POTION
@ -932,9 +964,9 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["DAMAGE_RESISTANCE 0 337"] Effects: ["DAMAGE_RESISTANCE 0 337"]
Children: Children:
GLOWSTONE_DUST: SPLASH_POTION_OF_RESISTANCE_II
DRAGONS_BREATH: LINGERING_POTION_OF_RESISTANCE DRAGONS_BREATH: LINGERING_POTION_OF_RESISTANCE
REDSTONE: SPLASH_POTION_OF_RESISTANCE_EXTENDED REDSTONE: SPLASH_POTION_OF_RESISTANCE_EXTENDED
GLOWSTONE_DUST: SPLASH_POTION_OF_RESISTANCE_II
SPLASH_POTION_OF_SATURATION: SPLASH_POTION_OF_SATURATION:
Name: Splash Potion Of Saturation Name: Splash Potion Of Saturation
Material: SPLASH_POTION Material: SPLASH_POTION
@ -975,6 +1007,12 @@ Potions:
PotionData: PotionData:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["FAST_DIGGING 0 5400"] Effects: ["FAST_DIGGING 0 5400"]
SPLASH_POTION_OF_HEALTH_BOOST_EXTENDED:
Name: Splash Potion Of Health Boost Extended
Material: SPLASH_POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 0 2700"]
SPLASH_POTION_OF_HUNGER_EXTENDED: SPLASH_POTION_OF_HUNGER_EXTENDED:
Name: Splash Potion Of Hunger Extended Name: Splash Potion Of Hunger Extended
Material: SPLASH_POTION Material: SPLASH_POTION
@ -1029,6 +1067,12 @@ Potions:
PotionData: PotionData:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["FAST_DIGGING 1 1350"] Effects: ["FAST_DIGGING 1 1350"]
SPLASH_POTION_OF_HEALTH_BOOST_II:
Name: Splash Potion Of Health Boost II
Material: SPLASH_POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 1 675"]
SPLASH_POTION_OF_HUNGER_II: SPLASH_POTION_OF_HUNGER_II:
Name: Splash Potion Of Hunger II Name: Splash Potion Of Hunger II
Material: SPLASH_POTION Material: SPLASH_POTION
@ -1310,8 +1354,8 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["ABSORPTION 0 450"] Effects: ["ABSORPTION 0 450"]
Children: Children:
REDSTONE: LINGERING_POTION_OF_ABSORPTION_EXTENDED
GLOWSTONE_DUST: LINGERING_POTION_OF_ABSORPTION_II GLOWSTONE_DUST: LINGERING_POTION_OF_ABSORPTION_II
REDSTONE: LINGERING_POTION_OF_ABSORPTION_EXTENDED
LINGERING_POTION_OF_BLINDNESS: LINGERING_POTION_OF_BLINDNESS:
Name: Lingering Potion Of Blindness Name: Lingering Potion Of Blindness
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1319,8 +1363,8 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["BLINDNESS 0 56"] Effects: ["BLINDNESS 0 56"]
Children: Children:
GLOWSTONE_DUST: LINGERING_POTION_OF_BLINDNESS_II
REDSTONE: LINGERING_POTION_OF_BLINDNESS_EXTENDED REDSTONE: LINGERING_POTION_OF_BLINDNESS_EXTENDED
GLOWSTONE_DUST: LINGERING_POTION_OF_BLINDNESS_II
LINGERING_POTION_OF_DECAY: LINGERING_POTION_OF_DECAY:
Name: Lingering Potion Of Decay Name: Lingering Potion Of Decay
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1328,8 +1372,8 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["WITHER 0 112"] Effects: ["WITHER 0 112"]
Children: Children:
REDSTONE: LINGERING_POTION_OF_DECAY_EXTENDED
GLOWSTONE_DUST: LINGERING_POTION_OF_DECAY_II GLOWSTONE_DUST: LINGERING_POTION_OF_DECAY_II
REDSTONE: LINGERING_POTION_OF_DECAY_EXTENDED
LINGERING_POTION_OF_DULLNESS: LINGERING_POTION_OF_DULLNESS:
Name: Lingering Potion Of Dullness Name: Lingering Potion Of Dullness
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1337,8 +1381,8 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["SLOW_DIGGING 0 900"] Effects: ["SLOW_DIGGING 0 900"]
Children: Children:
GLOWSTONE_DUST: LINGERING_POTION_OF_DULLNESS_II
REDSTONE: LINGERING_POTION_OF_DULLNESS_EXTENDED REDSTONE: LINGERING_POTION_OF_DULLNESS_EXTENDED
GLOWSTONE_DUST: LINGERING_POTION_OF_DULLNESS_II
LINGERING_POTION_OF_HASTE: LINGERING_POTION_OF_HASTE:
Name: Lingering Potion Of Haste Name: Lingering Potion Of Haste
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1348,6 +1392,15 @@ Potions:
Children: Children:
GLOWSTONE_DUST: LINGERING_POTION_OF_HASTE_II GLOWSTONE_DUST: LINGERING_POTION_OF_HASTE_II
REDSTONE: LINGERING_POTION_OF_HASTE_EXTENDED REDSTONE: LINGERING_POTION_OF_HASTE_EXTENDED
LINGERING_POTION_OF_HEALTH_BOOST:
Name: Lingering Potion Of Health Boost
Material: LINGERING_POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 0 450"]
Children:
GLOWSTONE_DUST: LINGERING_POTION_OF_HEALTH_BOOST_II
REDSTONE: LINGERING_POTION_OF_HEALTH_BOOST_EXTENDED
LINGERING_POTION_OF_HUNGER: LINGERING_POTION_OF_HUNGER:
Name: Lingering Potion Of Hunger Name: Lingering Potion Of Hunger
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1355,8 +1408,8 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["HUNGER 0 225"] Effects: ["HUNGER 0 225"]
Children: Children:
REDSTONE: LINGERING_POTION_OF_HUNGER_EXTENDED
GLOWSTONE_DUST: LINGERING_POTION_OF_HUNGER_II GLOWSTONE_DUST: LINGERING_POTION_OF_HUNGER_II
REDSTONE: LINGERING_POTION_OF_HUNGER_EXTENDED
LINGERING_POTION_OF_NAUSEA: LINGERING_POTION_OF_NAUSEA:
Name: Lingering Potion Of Nausea Name: Lingering Potion Of Nausea
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1373,8 +1426,8 @@ Potions:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["DAMAGE_RESISTANCE 0 112"] Effects: ["DAMAGE_RESISTANCE 0 112"]
Children: Children:
GLOWSTONE_DUST: LINGERING_POTION_OF_RESISTANCE_II
REDSTONE: LINGERING_POTION_OF_RESISTANCE_EXTENDED REDSTONE: LINGERING_POTION_OF_RESISTANCE_EXTENDED
GLOWSTONE_DUST: LINGERING_POTION_OF_RESISTANCE_II
LINGERING_POTION_OF_SATURATION: LINGERING_POTION_OF_SATURATION:
Name: Lingering Potion Of Saturation Name: Lingering Potion Of Saturation
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1414,6 +1467,12 @@ Potions:
PotionData: PotionData:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["FAST_DIGGING 0 1800"] Effects: ["FAST_DIGGING 0 1800"]
LINGERING_POTION_OF_HEALTH_BOOST_EXTENDED:
Name: Lingering Potion Of Health Boost Extended
Material: LINGERING_POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 0 900"]
LINGERING_POTION_OF_HUNGER_EXTENDED: LINGERING_POTION_OF_HUNGER_EXTENDED:
Name: Lingering Potion Of Hunger Extended Name: Lingering Potion Of Hunger Extended
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1468,6 +1527,12 @@ Potions:
PotionData: PotionData:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["FAST_DIGGING 1 450"] Effects: ["FAST_DIGGING 1 450"]
LINGERING_POTION_OF_HEALTH_BOOST_II:
Name: Lingering Potion Of Health Boost II
Material: LINGERING_POTION
PotionData:
PotionType: UNCRAFTABLE
Effects: ["HEALTH_BOOST 1 225"]
LINGERING_POTION_OF_HUNGER_II: LINGERING_POTION_OF_HUNGER_II:
Name: Lingering Potion Of Hunger II Name: Lingering Potion Of Hunger II
Material: LINGERING_POTION Material: LINGERING_POTION
@ -1492,3 +1557,4 @@ Potions:
PotionData: PotionData:
PotionType: UNCRAFTABLE PotionType: UNCRAFTABLE
Effects: ["SATURATION 1 1"] Effects: ["SATURATION 1 1"]

View File

@ -638,6 +638,17 @@ public class PotionConfigGenerator {
children.put(new Ingredient(Material.REDSTONE), new WriteablePotion(material, PotionType.UNCRAFTABLE, new PotionEffect(data.effect.getType(), data.effect.getDuration() * 2, 0), data.baseName + "_EXTENDED")); children.put(new Ingredient(Material.REDSTONE), new WriteablePotion(material, PotionType.UNCRAFTABLE, new PotionEffect(data.effect.getType(), data.effect.getDuration() * 2, 0), data.baseName + "_EXTENDED"));
mcMMOPotions.put(data, children); mcMMOPotions.put(data, children);
data = new WriteablePotion(material, PotionType.UNCRAFTABLE, new PotionEffect(PotionEffectType.HEALTH_BOOST, (int) (1800 * mod), 0), "HEALTH_BOOST"); data = new WriteablePotion(material, PotionType.UNCRAFTABLE, new PotionEffect(PotionEffectType.HEALTH_BOOST, (int) (1800 * mod), 0), "HEALTH_BOOST");
children = new HashMap<Ingredient, WriteablePotion>();
if (material == Material.POTION) {
PotionEffect effect = new PotionEffect(data.effect.getType(), (int) (data.effect.getDuration() * 0.75), data.effect.getAmplifier());
children.put(new Ingredient(Material.SULPHUR), new WriteablePotion(Material.SPLASH_POTION, data.data, effect, data.baseName));
} else if (material == Material.SPLASH_POTION) {
PotionEffect effect = new PotionEffect(data.effect.getType(), (int) (data.effect.getDuration() * 0.33), data.effect.getAmplifier());
children.put(new Ingredient(Material.DRAGONS_BREATH), new WriteablePotion(Material.LINGERING_POTION, data.data, effect, data.baseName));
}
children.put(new Ingredient(Material.GLOWSTONE_DUST), new WriteablePotion(material, PotionType.UNCRAFTABLE, new PotionEffect(data.effect.getType(), data.effect.getDuration() / 2, 1), data.baseName + "_II"));
children.put(new Ingredient(Material.REDSTONE), new WriteablePotion(material, PotionType.UNCRAFTABLE, new PotionEffect(data.effect.getType(), data.effect.getDuration() * 2, 0), data.baseName + "_EXTENDED"));
mcMMOPotions.put(data, children);
} }
} }
} }