SHARE
TWEET

Untitled

a guest Sep 21st, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package craft.wubwub.essentials.utils;
  2.  
  3. import craft.wubwub.sun.utils.*;
  4. import lombok.*;
  5. import org.bukkit.enchantments.*;
  6.  
  7. import java.util.*;
  8.  
  9. public class Enchantments {
  10.  
  11.     @Getter private static Map<String, Enchantment> enchantmentMap;
  12.     @Getter private static Map<String, Enchantment> aliasenchantMap;
  13.  
  14.     public static Enchantment getName(final String name) {
  15.         Enchantment enchantment;
  16.         if(NumberUtil.isInt(name)) {
  17.             enchantment = Enchantment.getById(Integer.parseInt(name));
  18.         } else {
  19.             enchantment = Enchantment.getByName(name.toUpperCase(Locale.ENGLISH));
  20.         }
  21.         if (enchantment == null) {
  22.             enchantment = Enchantments.enchantmentMap.get(name.toLowerCase(Locale.ENGLISH));
  23.         }
  24.         if (enchantment == null) {
  25.             enchantment = Enchantments.aliasenchantMap.get(name.toLowerCase(Locale.ENGLISH));
  26.         }
  27.         return enchantment;
  28.     }
  29.  
  30.     public static Set<Map.Entry<String, Enchantment>> entrySet() {
  31.         return Enchantments.enchantmentMap.entrySet();
  32.     }
  33.  
  34.     static {
  35.         enchantmentMap = new HashMap<>();
  36.         aliasenchantMap = new HashMap<>();
  37.         /* Armor */
  38.  
  39.         Enchantments.enchantmentMap.put("protection", Enchantment.PROTECTION_ENVIRONMENTAL);
  40.         Enchantments.aliasenchantMap.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL);
  41.         Enchantments.aliasenchantMap.put("prt", Enchantment.PROTECTION_ENVIRONMENTAL);
  42.  
  43.         Enchantments.enchantmentMap.put("fireprotection", Enchantment.PROTECTION_FIRE);
  44.         Enchantments.enchantmentMap.put("protectionfire", Enchantment.PROTECTION_FIRE);
  45.         Enchantments.aliasenchantMap.put("fireprot", Enchantment.PROTECTION_FIRE);
  46.         Enchantments.aliasenchantMap.put("frpt", Enchantment.PROTECTION_FIRE);
  47.  
  48.         Enchantments.enchantmentMap.put("featherfalling", Enchantment.PROTECTION_FALL);
  49.         Enchantments.enchantmentMap.put("featherfall", Enchantment.PROTECTION_FALL);
  50.         Enchantments.aliasenchantMap.put("fallsafe", Enchantment.PROTECTION_FALL);
  51.  
  52.         Enchantments.enchantmentMap.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS);
  53.         Enchantments.aliasenchantMap.put("blastprot", Enchantment.PROTECTION_EXPLOSIONS);
  54.         Enchantments.aliasenchantMap.put("protectionblast", Enchantment.PROTECTION_EXPLOSIONS);
  55.         Enchantments.aliasenchantMap.put("protectionexplosions", Enchantment.PROTECTION_EXPLOSIONS);
  56.  
  57.         Enchantments.enchantmentMap.put("projectileprojection", Enchantment.PROTECTION_PROJECTILE);
  58.         Enchantments.enchantmentMap.put("projectileprot", Enchantment.PROTECTION_PROJECTILE);
  59.         Enchantments.aliasenchantMap.put("projprot", Enchantment.PROTECTION_PROJECTILE);
  60.         Enchantments.aliasenchantMap.put("pp", Enchantment.PROTECTION_PROJECTILE);
  61.  
  62.         Enchantments.enchantmentMap.put("respiration", Enchantment.OXYGEN);
  63.         Enchantments.enchantmentMap.put("oxygen", Enchantment.OXYGEN);
  64.         Enchantments.aliasenchantMap.put("resp", Enchantment.OXYGEN);
  65.  
  66.         Enchantments.enchantmentMap.put("thorns", Enchantment.THORNS);
  67.         Enchantments.aliasenchantMap.put("backupoffme", Enchantment.THORNS);
  68.  
  69.  
  70.         Enchantments.enchantmentMap.put("alldamage", Enchantment.DAMAGE_ALL);
  71.         Enchantments.enchantmentMap.put("damageall", Enchantment.DAMAGE_ALL);
  72.         Enchantments.aliasenchantMap.put("sharpness", Enchantment.DAMAGE_ALL);
  73.         Enchantments.aliasenchantMap.put("alldmg", Enchantment.DAMAGE_ALL);
  74.         Enchantments.aliasenchantMap.put("dmgall", Enchantment.DAMAGE_ALL);
  75.         Enchantments.enchantmentMap.put("respiration", Enchantment.OXYGEN);
  76.  
  77.  
  78.     }
  79.  
  80. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top