Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package freyja_pack;
- import java.io.File;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.Random;
- import org.bukkit.Bukkit;
- import org.bukkit.Material;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity;
- import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Blaze;
- import org.bukkit.entity.Creeper;
- import org.bukkit.entity.Drowned;
- import org.bukkit.entity.ElderGuardian;
- import org.bukkit.entity.EnderDragon;
- import org.bukkit.entity.Endermite;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Evoker;
- import org.bukkit.entity.Ghast;
- import org.bukkit.entity.Guardian;
- import org.bukkit.entity.Husk;
- import org.bukkit.entity.LivingEntity;
- import org.bukkit.entity.MagmaCube;
- import org.bukkit.entity.Phantom;
- import org.bukkit.entity.Pillager;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.Ravager;
- import org.bukkit.entity.Shulker;
- import org.bukkit.entity.Silverfish;
- import org.bukkit.entity.Skeleton;
- import org.bukkit.entity.SkeletonHorse;
- import org.bukkit.entity.Slime;
- import org.bukkit.entity.Spider;
- import org.bukkit.entity.Stray;
- import org.bukkit.entity.Vex;
- import org.bukkit.entity.Villager;
- import org.bukkit.entity.Villager.Profession;
- import org.bukkit.entity.Vindicator;
- import org.bukkit.entity.Witch;
- import org.bukkit.entity.Wither;
- import org.bukkit.entity.WitherSkeleton;
- import org.bukkit.entity.Zombie;
- import org.bukkit.entity.ZombieVillager;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.CreatureSpawnEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.MerchantRecipe;
- import org.bukkit.plugin.Plugin;
- public class custom_mob implements Listener {
- //Test enchantments on armor, move mob_conf to main,
- //Move onto Potions and Weapons
- public FileConfiguration mob_conf;
- public File mob_file;
- public Plugin main;
- public custom_item ci;
- public void main_ref() {
- main = freyja_class.plugin;
- ci = new custom_item();
- }
- public void custom_villager(Player p) {
- Villager v = (Villager) p.getWorld().spawnEntity(p.getLocation().add(1, 0, -1), EntityType.VILLAGER);
- }
- @EventHandler
- public void spawn(CreatureSpawnEvent e) {
- main_ref();
- Entity E = e.getEntity();
- Boolean A = false;
- Boolean W = false;
- Boolean P = false;
- Random r = new Random();
- Integer rank = r.nextInt(101);
- //Armor Weapons Potions
- if(E instanceof Zombie) {A = true; W = true; P = true; Zombie z = (Zombie) E; zombie_gear(z, rank);}
- if(E instanceof Skeleton) {A = true; W = true; P = true;}
- if(E instanceof Husk) {A = true; W = true; P = true;}
- if(E instanceof ZombieVillager) {A = true; W = true; P = true;}
- if(E instanceof Stray) {A = true; W = true; P = true;}
- if(E instanceof WitherSkeleton) {A = true; W = true; P = true;}
- if(E instanceof Vindicator) {A = true; W = true; P = true;}
- if(E instanceof Drowned) {A = true; W = true; P = true;}
- //Weapons Potions
- if(E instanceof Witch) {W = true; P = true;}
- if(E instanceof Vex) {W = true; P = true;}
- //Potions Armor
- if(E instanceof Pillager) {P = true; A = true;}
- //Potions
- if(E instanceof Slime) {P = true;}
- if(E instanceof Spider) {P = true;}
- if(E instanceof Silverfish) {P = true;}
- if(E instanceof SkeletonHorse) {P = true;}
- if(E instanceof Shulker) {P = true;}
- if(E instanceof Ravager) {P = true;}
- if(E instanceof Phantom) {P = true;}
- if(E instanceof MagmaCube) {P = true;}
- if(E instanceof Guardian) {P = true;}
- if(E instanceof Ghast) {P = true;}
- if(E instanceof Evoker) {P = true;}
- if(E instanceof Endermite) {P = true;}
- if(E instanceof ElderGuardian) {P = true;}
- if(E instanceof Creeper) {P = true;}
- if(E instanceof Blaze) {P = true;}
- if(E instanceof EnderDragon) {P = true;}
- if(E instanceof Wither) {P = true;}
- }
- public String rank(Integer rank) {
- String R = null;
- if(rank <= 65) {R = "F";}
- if(rank > 65 && rank <= 85) {R = "D";}
- if(rank > 85 && rank <= 95) {R = "C";}
- if(rank > 95 && rank <= 99) {R = "B";}
- if(rank > 99 && rank <= 100) {R = "A";}
- return R;
- }
- public void zombie_gear(Zombie z, Integer rank) {
- String r = rank(rank);
- Bukkit.broadcastMessage("B4");
- ArrayList<ItemStack> armor = freyja_class.plugin.A.get(rank);
- Bukkit.broadcastMessage(armor.get(0).getType().name());
- Bukkit.broadcastMessage("AFTER");
- ItemStack H = null;
- ItemStack C = null;
- ItemStack L = null;
- ItemStack B = null;
- for(int a = 0; a < armor.size(); a++) {
- if(armor.get(a).getType().name().endsWith("_HELMET")) {H = armor.get(a);}
- if(armor.get(a).getType().name().endsWith("_CHESTPLATE")) {C = armor.get(a);}
- if(armor.get(a).getType().name().endsWith("_LEGGINGS")) {L = armor.get(a);}
- if(armor.get(a).getType().name().endsWith("_BOOTS")) {B = armor.get(a);}
- }
- if(H != null) {z.getEquipment().setHelmet(H);}
- if(C != null) {z.getEquipment().setChestplate(C);}
- if(L != null) {z.getEquipment().setLeggings(L);}
- if(B != null) {z.getEquipment().setBoots(B);}
- }
- }
RAW Paste Data