mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-04 08:49:55 +01:00
Replacing the potion data avoids the NPE and appears to avoid applying the main effect as desired.
This commit is contained in:
parent
66297bd2e5
commit
03c00f258e
@ -7,6 +7,8 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
// Workaround to remove unwanted potion effects
|
||||
public class Compat1_9 implements Listener {
|
||||
@ -20,12 +22,10 @@ public class Compat1_9 implements Listener {
|
||||
}
|
||||
|
||||
if (item.getType() == Material.POTION) {
|
||||
try {
|
||||
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
||||
// Throw away former "base" effect and replace with MUNDANE.
|
||||
meta.setBasePotionData(new PotionData(PotionType.MUNDANE, false, false));
|
||||
item.setItemMeta(meta);
|
||||
} catch (Exception exception) {}
|
||||
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
||||
// Throw away former "base" effect and replace with MUNDANE.
|
||||
meta.setBasePotionData(new PotionData(PotionType.MUNDANE, false, false));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user