Java Code Examples for org.bukkit.potion.PotionEffectType#getName()

The following examples show how to use org.bukkit.potion.PotionEffectType#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListenerPotions.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
private boolean isBlocked(PotionEffectType type) {
    FileConfiguration config = this.expansion.getConfig("cheat-prevention.yml");
    List<String> blockedPotionList = config.getStringList("blocked-potion-list");

    String typeName = type.getName();
    return blockedPotionList.contains(typeName);
}
 
Example 2
Source File: GenericPotionInfo.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public String getIdentifier() {
  PotionEffectType effectType = getPotionEffect();
  return effectType != null ? effectType.getName() : "EMPTY";
}
 
Example 3
Source File: GenericPotionInfo.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public String getIdentifier() {
    PotionEffectType effectType = getPotionEffect();
    return effectType != null ? effectType.getName() : "EMPTY";
}
 
Example 4
Source File: PotionEffectTypeFlag.java    From WorldGuardExtraFlagsPlugin with MIT License 4 votes vote down vote up
@Override
public Object marshal(PotionEffectType o)
{
	return o.getName();
}
 
Example 5
Source File: UMaterial.java    From TradePlus with GNU General Public License v3.0 4 votes vote down vote up
public static UMaterial matchPotion(ItemStack potion) {
  if(potion != null && potion.getItemMeta() instanceof PotionMeta) {
    final PotionMeta p = (PotionMeta) potion.getItemMeta();
    final List<PotionEffect> ce = p.getCustomEffects();
    if(ce.size() == 0) {
      final String base;
      final PotionEffectType t;
      final int l, max;
      final boolean extended;
      if(EIGHT) {
        final Potion po = Potion.fromItemStack(potion);
        base = po.isSplash() ? "SPLASH_POTION_" : "POTION_";
        final Collection<PotionEffect> e = po.getEffects();
        t = e.size() > 0 ? ((PotionEffect) e.toArray()[0]).getType() : null;
        l = po.getLevel();
        final PotionType ty = po.getType();
        max = ty != null ? ty.getMaxLevel() : 0;
        extended = po.hasExtendedDuration();
      } else {
        final org.bukkit.potion.PotionData pd = p.getBasePotionData();
        final PotionType type = pd.getType();
        base = potion.getType().name() + "_";
        t = type.getEffectType();
        l = type.isUpgradeable() && pd.isUpgraded() ? 2 : 1;
        max = type.getMaxLevel();
        extended = type.isExtendable() && pd.isExtended();
      }
      final String a = t != null ? t.getName() : null,
          type = a != null ? a.equals("SPEED") ? "SWIFTNESS"
                                 : a.equals("SLOW") ? "SLOWNESS"
                                       : a.equals("INCREASE_DAMAGE") ? "STRENGTH"
                                             : a.equals("HEAL") ? "HEALING"
                                                   : a.equals("HARM") ? "HARMING"
                                                         : a.equals("JUMP") ? "LEAPING"
                                                               : a : null;
      if(type != null) {
        final String g = base + type + (max != 1 && l <= max ? "_" + l : "") + (extended ? "_EXTENDED" : "");
        return valueOf(g);
      } else {
        return UMaterial.POTION;
      }
    }
  }
  return null;
}