Guest User

Untitled

a guest
Jun 22nd, 2020
18
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package freyja_pack;
  2.  
  3.  
  4. import java.io.File;
  5. import java.io.IOException;
  6. import java.util.ArrayList;
  7. import java.util.HashMap;
  8. import java.util.Random;
  9.  
  10. import org.bukkit.Bukkit;
  11. import org.bukkit.Material;
  12. import org.bukkit.configuration.file.FileConfiguration;
  13. import org.bukkit.configuration.file.YamlConfiguration;
  14. import org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity;
  15. import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
  16. import org.bukkit.enchantments.Enchantment;
  17. import org.bukkit.entity.Blaze;
  18. import org.bukkit.entity.Creeper;
  19. import org.bukkit.entity.Drowned;
  20. import org.bukkit.entity.ElderGuardian;
  21. import org.bukkit.entity.EnderDragon;
  22. import org.bukkit.entity.Endermite;
  23. import org.bukkit.entity.Entity;
  24. import org.bukkit.entity.EntityType;
  25. import org.bukkit.entity.Evoker;
  26. import org.bukkit.entity.Ghast;
  27. import org.bukkit.entity.Guardian;
  28. import org.bukkit.entity.Husk;
  29. import org.bukkit.entity.LivingEntity;
  30. import org.bukkit.entity.MagmaCube;
  31. import org.bukkit.entity.Phantom;
  32. import org.bukkit.entity.Pillager;
  33. import org.bukkit.entity.Player;
  34. import org.bukkit.entity.Ravager;
  35. import org.bukkit.entity.Shulker;
  36. import org.bukkit.entity.Silverfish;
  37. import org.bukkit.entity.Skeleton;
  38. import org.bukkit.entity.SkeletonHorse;
  39. import org.bukkit.entity.Slime;
  40. import org.bukkit.entity.Spider;
  41. import org.bukkit.entity.Stray;
  42. import org.bukkit.entity.Vex;
  43. import org.bukkit.entity.Villager;
  44. import org.bukkit.entity.Villager.Profession;
  45. import org.bukkit.entity.Vindicator;
  46. import org.bukkit.entity.Witch;
  47. import org.bukkit.entity.Wither;
  48. import org.bukkit.entity.WitherSkeleton;
  49. import org.bukkit.entity.Zombie;
  50. import org.bukkit.entity.ZombieVillager;
  51. import org.bukkit.event.EventHandler;
  52. import org.bukkit.event.Listener;
  53. import org.bukkit.event.entity.CreatureSpawnEvent;
  54. import org.bukkit.inventory.ItemStack;
  55. import org.bukkit.inventory.MerchantRecipe;
  56. import org.bukkit.plugin.Plugin;
  57.  
  58.  
  59. public class custom_mob implements Listener {
  60.  
  61. //Test enchantments on armor, move mob_conf to main,
  62. //Move onto Potions and Weapons
  63.  
  64. public FileConfiguration mob_conf;
  65. public File mob_file;
  66.  
  67. public Plugin main;
  68. public custom_item ci;
  69. public void main_ref() {
  70. main = freyja_class.plugin;
  71. ci = new custom_item();
  72. }
  73.  
  74. public void custom_villager(Player p) {
  75. Villager v = (Villager) p.getWorld().spawnEntity(p.getLocation().add(1, 0, -1), EntityType.VILLAGER);
  76. }
  77.  
  78.  
  79. @EventHandler
  80. public void spawn(CreatureSpawnEvent e) {
  81. main_ref();
  82.  
  83. Entity E = e.getEntity();
  84. Boolean A = false;
  85. Boolean W = false;
  86. Boolean P = false;
  87. Random r = new Random();
  88. Integer rank = r.nextInt(101);
  89.  
  90. //Armor Weapons Potions
  91. if(E instanceof Zombie) {A = true; W = true; P = true; Zombie z = (Zombie) E; zombie_gear(z, rank);}
  92. if(E instanceof Skeleton) {A = true; W = true; P = true;}
  93. if(E instanceof Husk) {A = true; W = true; P = true;}
  94. if(E instanceof ZombieVillager) {A = true; W = true; P = true;}
  95. if(E instanceof Stray) {A = true; W = true; P = true;}
  96. if(E instanceof WitherSkeleton) {A = true; W = true; P = true;}
  97. if(E instanceof Vindicator) {A = true; W = true; P = true;}
  98. if(E instanceof Drowned) {A = true; W = true; P = true;}
  99.  
  100. //Weapons Potions
  101. if(E instanceof Witch) {W = true; P = true;}
  102. if(E instanceof Vex) {W = true; P = true;}
  103.  
  104. //Potions Armor
  105. if(E instanceof Pillager) {P = true; A = true;}
  106.  
  107. //Potions
  108. if(E instanceof Slime) {P = true;}
  109. if(E instanceof Spider) {P = true;}
  110. if(E instanceof Silverfish) {P = true;}
  111. if(E instanceof SkeletonHorse) {P = true;}
  112. if(E instanceof Shulker) {P = true;}
  113. if(E instanceof Ravager) {P = true;}
  114. if(E instanceof Phantom) {P = true;}
  115. if(E instanceof MagmaCube) {P = true;}
  116. if(E instanceof Guardian) {P = true;}
  117. if(E instanceof Ghast) {P = true;}
  118. if(E instanceof Evoker) {P = true;}
  119. if(E instanceof Endermite) {P = true;}
  120. if(E instanceof ElderGuardian) {P = true;}
  121. if(E instanceof Creeper) {P = true;}
  122. if(E instanceof Blaze) {P = true;}
  123. if(E instanceof EnderDragon) {P = true;}
  124. if(E instanceof Wither) {P = true;}
  125. }
  126.  
  127. public String rank(Integer rank) {
  128.  
  129. String R = null;
  130. if(rank <= 65) {R = "F";}
  131. if(rank > 65 && rank <= 85) {R = "D";}
  132. if(rank > 85 && rank <= 95) {R = "C";}
  133. if(rank > 95 && rank <= 99) {R = "B";}
  134. if(rank > 99 && rank <= 100) {R = "A";}
  135. return R;
  136. }
  137.  
  138. public void zombie_gear(Zombie z, Integer rank) {
  139. String r = rank(rank);
  140. Bukkit.broadcastMessage("B4");
  141. ArrayList<ItemStack> armor = freyja_class.plugin.A.get(rank);
  142. Bukkit.broadcastMessage(armor.get(0).getType().name());
  143. Bukkit.broadcastMessage("AFTER");
  144.  
  145. ItemStack H = null;
  146. ItemStack C = null;
  147. ItemStack L = null;
  148. ItemStack B = null;
  149.  
  150. for(int a = 0; a < armor.size(); a++) {
  151. if(armor.get(a).getType().name().endsWith("_HELMET")) {H = armor.get(a);}
  152. if(armor.get(a).getType().name().endsWith("_CHESTPLATE")) {C = armor.get(a);}
  153. if(armor.get(a).getType().name().endsWith("_LEGGINGS")) {L = armor.get(a);}
  154. if(armor.get(a).getType().name().endsWith("_BOOTS")) {B = armor.get(a);}
  155. }
  156.  
  157. if(H != null) {z.getEquipment().setHelmet(H);}
  158. if(C != null) {z.getEquipment().setChestplate(C);}
  159. if(L != null) {z.getEquipment().setLeggings(L);}
  160. if(B != null) {z.getEquipment().setBoots(B);}
  161. }
  162.  
  163. }
RAW Paste Data