Random fixes. Durability, fishing, digger(?), nullpointerexceptions, fix

Powersurge Zombie damage calculation, more debug commands.
dev
sigonasr2 11 years ago
parent 26d4b33a83
commit 7db09a34a1
  1. 12
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 2
      BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java
  3. 206
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  4. 133
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -54,11 +54,13 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Item;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.PigZombie;
@ -1975,6 +1977,16 @@ public void runTick() {
Location nearestwolf = null;
int minions=0;
for (int i=0;i<nearby.size();i++) {
if (nearby.get(i).getType()==EntityType.ENDERMAN) {
Creature l = (Creature)nearby.get(i);
if (l.getCustomName()!=null && l.getCustomName().equalsIgnoreCase(ChatColor.RED+"Lightning Mage") && l.getTarget()!=null) {
if (l.getTarget() instanceof Player) {
l.getTarget().getWorld().strikeLightning(l.getTarget().getLocation());
l.getTarget().getWorld().strikeLightning(l.getTarget().getLocation().add(-0.5,0,0.5));
l.getTarget().getWorld().strikeLightning(l.getTarget().getLocation().add(0.5,0,-0.5));
}
}
}
if (nearby.get(i).getType()==EntityType.CREEPER) {
Creature l = (Creature)nearby.get(i);
if (l.getCustomName()!=null && l.getCustomName().equalsIgnoreCase(ChatColor.RED+"Suicidal Creeper") && l.getTarget()!=null) {

@ -192,7 +192,7 @@ public class PlayerBuffData {
p.setHealth(p.getMaxHealth());
}
Bukkit.getLogger().info("Base hp level: "+base_hplv+" Max Health: "+p.getMaxHealth());
//Bukkit.getLogger().info("Base hp level: "+base_hplv+" Max Health: "+p.getMaxHealth());
if (base_hplv!=p.getMaxHealth()) {
double temphp=0;
temphp = p.getHealth();

@ -2629,9 +2629,10 @@ implements Listener
HOUND_CALLER_SPAWN_RATE = 0.01,
FISH_CALLER_SPAWN_RATE = 0.01,
SUICIDAL_CREEPER_SPAWN_RATE = 0.01,
POWER_SURGE_ZOMBIE_SPAWN_RATE = 0.2;
POWER_SURGE_ZOMBIE_SPAWN_RATE = 0.01,
LIGHTNING_MAGE_SPAWN_RATE = 0.01;
if (totallvs>80*levelsmult) {
if (totallvs>10*levelsmult) {
//Try to spawn a counter slime.
if (Math.random()<=COUNTER_SLIME_SPAWN_RATE) {
Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.SLIME);
@ -2663,7 +2664,7 @@ implements Listener
l.setMaxHealth(45);
l.setHealth(45);
ItemStack helm = new ItemStack(Material.DIAMOND_HELMET);
helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 32);
helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 24);
l.getEquipment().setHelmet(helm);
l.getEquipment().setHelmetDropChance(0.002f);
l.getEquipment().setItemInHand(new ItemStack(Material.BOW));
@ -2741,6 +2742,19 @@ implements Listener
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 2));
l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0));
}
//Try to spawn a Lightning Mage.
if (Math.random()<=POWER_SURGE_ZOMBIE_SPAWN_RATE) {
Location ent = e.getEntity().getLocation();
Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.ENDERMAN);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Lightning Mage");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Suicidal Creeper spawned at "+l.getLocation().toString());
l.setMaxHealth(105);
l.setHealth(105);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 4));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1));
}
}
@ -6833,9 +6847,6 @@ implements Listener
@EventHandler
public void onItemChange(PlayerItemHeldEvent e) {
Player p = e.getPlayer();
if (p.getInventory().getContents()[e.getNewSlot()]!=null) {
Bukkit.getLogger().info("Durability of this item is "+p.getInventory().getContents()[e.getNewSlot()].getDurability());
}
//**************************//Job Buffs begin here.
if (p.getInventory().getContents()[e.getNewSlot()]!=null) {
if (p.getInventory().getContents()[e.getNewSlot()].getType().name().toLowerCase().contains("pickaxe") && this.plugin.hasJobBuff("Miner", p, Job.JOB10)) {
@ -8247,9 +8258,9 @@ implements Listener
if (this.plugin.hasJobBuff("Fisherman", p, Job.JOB30B)) {
this.plugin.getPlayerData(p).fishingstreak++;
this.plugin.getPlayerData(p).fishingrodcatchrate+=this.plugin.getPlayerData(p).fishingrodcatchrate*0.05;
DecimalFormat df = new DecimalFormat("#0.00");
DecimalFormat df = new DecimalFormat("#0.0");
if (this.plugin.getPlayerData(p).fishingstreak%5==0) {
p.sendMessage(ChatColor.GREEN+""+this.plugin.getPlayerData(p).fishingstreak+" in a row! "+ChatColor.GRAY+""+ChatColor.ITALIC+"Current Fish Catch Rate: "+((this.plugin.getPlayerData(p).fishingrodcatchrate/0.002))+"%");
p.sendMessage(ChatColor.GREEN+""+this.plugin.getPlayerData(p).fishingstreak+" in a row! "+ChatColor.GRAY+""+ChatColor.ITALIC+"Current Fish Catch Rate: "+(df.format((this.plugin.getPlayerData(p).fishingrodcatchrate/0.002)*100))+"%");
}
}
if (this.plugin.PlayerinJob(p, "Fisherman")) {
@ -8913,6 +8924,14 @@ implements Listener
boolean blocked_hunter_buff=false; //Whether or not the block occurred due to the hunter buff.
//**********************************//Player buffs begin
if (e.getDamager() instanceof LightningStrike) {
if (e.getEntity() instanceof Enderman) {
LivingEntity l = (LivingEntity)e.getEntity();
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Lightning Mage")) {
e.setCancelled(true);
}
}
}
if (e.getDamager() instanceof Player) {
Player p = (Player)e.getDamager();
if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) {
@ -8950,95 +8969,149 @@ implements Listener
LivingEntity l2 = (LivingEntity)e.getDamager();
if (l2.getCustomName()!=null && l2.getCustomName().contains(ChatColor.RED+"Powersurge Zombie")) {
int dmgamt = 0; //How much the bonus damage rating to do.
double dmgamt1=0,dmgamt2=0,dmgamt3=0,dmgamt4=0;
ItemStack item = l.getEquipment().getHelmet();
if (item!=null) {
Map<Enchantment,Integer> map = item.getEnchantments();
for (Map.Entry<Enchantment,Integer> entry : map.entrySet()) {
dmgamt+=entry.getValue();
dmgamt1+=entry.getValue();
}
if (item.getType().name().toLowerCase().contains("diamond")) {
dmgamt+=5;
dmgamt1+=5;
if (l instanceof Player) {
Player p = (Player)l;
p.playSound(p.getLocation(), Sound.EXPLODE, 0.5f, 1.8f);
}
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt+=3;
dmgamt/=1.5;
dmgamt1+=3;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt+=1;
dmgamt/=8;
dmgamt1+=1;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt+=2;
dmgamt/=4;
dmgamt1+=2;
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt1/=1.5;
dmgamt+=1.5;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt1/=8;
dmgamt+=8;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt1/=4;
dmgamt+=4;
}
}
item = l.getEquipment().getChestplate();
if (item!=null) {
Map<Enchantment,Integer> map = item.getEnchantments();
for (Map.Entry<Enchantment,Integer> entry : map.entrySet()) {
dmgamt+=entry.getValue();
dmgamt2+=entry.getValue();
}
if (item.getType().name().toLowerCase().contains("diamond")) {
dmgamt+=7;
dmgamt2+=7;
if (l instanceof Player) {
Player p = (Player)l;
p.playSound(p.getLocation(), Sound.EXPLODE, 0.5f, 1.8f);
}
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt+=5;
dmgamt/=1.5;
dmgamt2+=5;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt+=2;
dmgamt/=8;
dmgamt2+=2;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt2+=4;
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt2/=1.5;
dmgamt+=1.5;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt2/=8;
dmgamt+=8;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt2/=4;
dmgamt+=4;
dmgamt/=4;
}
}
item = l.getEquipment().getLeggings();
if (item!=null) {
Map<Enchantment,Integer> map = item.getEnchantments();
for (Map.Entry<Enchantment,Integer> entry : map.entrySet()) {
dmgamt+=entry.getValue();
dmgamt3+=entry.getValue();
}
if (item.getType().name().toLowerCase().contains("diamond")) {
dmgamt+=4;
dmgamt3+=4;
if (l instanceof Player) {
Player p = (Player)l;
p.playSound(p.getLocation(), Sound.EXPLODE, 0.5f, 1.8f);
}
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt+=2;
dmgamt/=1.5;
dmgamt3+=2;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt+=1;
dmgamt/=8;
dmgamt3+=1;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt+=1;
dmgamt/=4;
dmgamt3+=1;
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt3/=1.5;
dmgamt+=1.5;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt3/=8;
dmgamt+=8;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt3/=4;
dmgamt+=4;
}
}
item = l.getEquipment().getBoots();
if (item!=null) {
Map<Enchantment,Integer> map = item.getEnchantments();
for (Map.Entry<Enchantment,Integer> entry : map.entrySet()) {
dmgamt+=entry.getValue();
dmgamt4+=entry.getValue();
}
if (item.getType().name().toLowerCase().contains("diamond")) {
dmgamt+=2;
dmgamt4+=2;
if (l instanceof Player) {
Player p = (Player)l;
p.playSound(p.getLocation(), Sound.EXPLODE, 0.5f, 1.8f);
}
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt4+=1;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt4+=0;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt4+=1;
}
if (item.getType().name().toLowerCase().contains("iron")) {
dmgamt+=1;
dmgamt/=1.5;
dmgamt4/=1.5;
dmgamt+=1.5;
}
if (item.getType().name().toLowerCase().contains("leather")) {
dmgamt+=0;
dmgamt/=8;
dmgamt4/=8;
dmgamt+=8;
}
if (item.getType().name().toLowerCase().contains("gold") || item.getType().name().toLowerCase().contains("chain")) {
dmgamt+=1;
dmgamt/=4;
dmgamt4/=4;
dmgamt+=4;
}
}
e.setDamage(e.getDamage()+dmgamt);
e.setDamage((e.getDamage()+dmgamt1+dmgamt2+dmgamt3+dmgamt4)/dmgamt);
e.setDamage(e.getDamage()+Math.pow(dmgamt,1.65));
}
}
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Wolf Minion")) {
@ -9423,7 +9496,7 @@ implements Listener
if (((Projectile)e.getDamager()).getShooter() instanceof LivingEntity) {
LivingEntity l = ((Projectile)e.getDamager()).getShooter();
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Silencer")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 90, 64));
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 64));
}
}
}
@ -9562,6 +9635,11 @@ implements Listener
e.setDamage(0);
//Choose a random set to mark off.
blocked_attack=true;
//Reduce all armor by one as if it was a normal hit.
if (p.getInventory().getHelmet()!=null) {p.getInventory().getHelmet().setDurability((short)(p.getInventory().getHelmet().getDurability()+1));}
if (p.getInventory().getChestplate()!=null) {p.getInventory().getChestplate().setDurability((short)(p.getInventory().getChestplate().getDurability()+1));}
if (p.getInventory().getLeggings()!=null) {p.getInventory().getLeggings().setDurability((short)(p.getInventory().getLeggings().getDurability()+1));}
if (p.getInventory().getBoots()!=null) {p.getInventory().getBoots().setDurability((short)(p.getInventory().getBoots().getDurability()+1));}
/*
if (blocks.size()>0) {
int armor = blocks.get((int)(Math.random()*blocks.size()));
@ -10354,6 +10432,12 @@ implements Listener
final boolean blocked = blocked_attack;
final boolean blocked_hunter = blocked_hunter_buff;
final Main plug = this.plugin;
int helm_dura=-1,chest_dura=-1,legs_dura=-1,boots_dura=-1;
if (p.getEquipment().getHelmet()!=null) {helm_dura=p.getEquipment().getHelmet().getDurability();}
if (p.getEquipment().getChestplate()!=null) {chest_dura=p.getEquipment().getChestplate().getDurability();}
if (p.getEquipment().getLeggings()!=null) {legs_dura=p.getEquipment().getLeggings().getDurability();}
if (p.getEquipment().getBoots()!=null) {boots_dura=p.getEquipment().getBoots().getDurability();}
final int prev_helm_dura=helm_dura,prev_chest_dura=chest_dura,prev_legs_dura=legs_dura,prev_boots_dura=boots_dura;
if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f) {
p.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
@ -10365,12 +10449,12 @@ implements Listener
int helm_dura=-1,chest_dura=-1,legs_dura=-1,boots_dura=-1;
boolean weak_helm=false,weak_chest=false,weak_legs=false,weak_boots=false;
if (p.getEquipment().getHelmet()!=null) {helm_dura=p.getEquipment().getHelmet().getDurability();}
if (p.getEquipment().getChestplate()!=null) {chest_dura=p.getEquipment().getChestplate().getDurability();}
if (p.getEquipment().getChestplate()!=null ) {chest_dura=p.getEquipment().getChestplate().getDurability();}
if (p.getEquipment().getLeggings()!=null) {legs_dura=p.getEquipment().getLeggings().getDurability();}
if (p.getEquipment().getBoots()!=null) {boots_dura=p.getEquipment().getBoots().getDurability();}
Bukkit.getLogger().info("Durability of items are: "+helm_dura+","+chest_dura+","+legs_dura+","+boots_dura);
int gained_back=0;
if (p.getEquipment().getHelmet()!=null && p.getEquipment().getHelmet().hasItemMeta() &&
if (p.getEquipment().getHelmet()!=null && helm_dura!=-1 && p.getEquipment().getHelmet().hasItemMeta() &&
p.getEquipment().getHelmet().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getHelmet().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
@ -10383,7 +10467,7 @@ implements Listener
}
}
}
if (p.getEquipment().getChestplate()!=null && p.getEquipment().getChestplate().hasItemMeta() &&
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1 && p.getEquipment().getChestplate().hasItemMeta() &&
p.getEquipment().getChestplate().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getChestplate().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
@ -10396,7 +10480,7 @@ implements Listener
}
}
}
if (p.getEquipment().getLeggings()!=null && p.getEquipment().getLeggings().hasItemMeta() &&
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1 && p.getEquipment().getLeggings().hasItemMeta() &&
p.getEquipment().getLeggings().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getLeggings().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
@ -10410,7 +10494,7 @@ implements Listener
}
}
}
if (p.getEquipment().getBoots()!=null && p.getEquipment().getBoots().hasItemMeta() &&
if (p.getEquipment().getBoots()!=null && boots_dura!=-1 && p.getEquipment().getBoots().hasItemMeta() &&
p.getEquipment().getBoots().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getBoots().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
@ -10423,13 +10507,13 @@ implements Listener
}
}
}
if (p.getEquipment().getHelmet()!=null && p.getEquipment().getHelmet().hasItemMeta() &&
if (p.getEquipment().getHelmet()!=null && helm_dura!=-1 && p.getEquipment().getHelmet().hasItemMeta() &&
p.getEquipment().getHelmet().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getHelmet().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb("Durability");
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
if (!weak_helm) {dura_numb+=300; /*Bukkit.getLogger().info("1 not weak.");*/}
if (Math.random()*dura_numb>100) {
@ -10437,13 +10521,13 @@ implements Listener
}
}
}
if (p.getEquipment().getChestplate()!=null && p.getEquipment().getChestplate().hasItemMeta() &&
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1 && p.getEquipment().getChestplate().hasItemMeta() &&
p.getEquipment().getChestplate().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getChestplate().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb("Durability");
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
if (!weak_chest) {dura_numb+=300; /*Bukkit.getLogger().info("2 not weak.");*/}
if (Math.random()*dura_numb>100) {
@ -10451,13 +10535,13 @@ implements Listener
}
}
}
if (p.getEquipment().getLeggings()!=null && p.getEquipment().getLeggings().hasItemMeta() &&
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1 && p.getEquipment().getLeggings().hasItemMeta() &&
p.getEquipment().getLeggings().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getLeggings().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb("Durability");
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
if (!weak_legs) {dura_numb+=300; /*Bukkit.getLogger().info("3 not weak.");*/}
if (Math.random()*dura_numb>100) {
@ -10465,13 +10549,13 @@ implements Listener
}
}
}
if (p.getEquipment().getBoots()!=null && p.getEquipment().getBoots().hasItemMeta() &&
if (p.getEquipment().getBoots()!=null && boots_dura!=-1 && p.getEquipment().getBoots().hasItemMeta() &&
p.getEquipment().getBoots().getItemMeta().hasLore()) {
List<String> lore = p.getEquipment().getBoots().getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
double dura_numb=0;
if (plug.containsEnchantment(lore.get(i), "Durability")) {
dura_numb+=plug.getEnchantmentNumb("Durability");
dura_numb+=plug.getEnchantmentNumb(lore.get(i));
}
if (!weak_boots) {dura_numb+=300; /*Bukkit.getLogger().info("4 not weak.");*/}
if (Math.random()*dura_numb>100) {
@ -10479,10 +10563,10 @@ implements Listener
}
}
}
if (p.getEquipment().getBoots()!=null) {ItemStack i = p.getEquipment().getBoots(); i.setDurability((short)boots_dura); p.getEquipment().setBoots(i);}
if (p.getEquipment().getLeggings()!=null) {ItemStack i = p.getEquipment().getLeggings(); i.setDurability((short)legs_dura); p.getEquipment().setLeggings(i);}
if (p.getEquipment().getChestplate()!=null) {ItemStack i = p.getEquipment().getChestplate(); i.setDurability((short)chest_dura); p.getEquipment().setChestplate(i);}
if (p.getEquipment().getHelmet()!=null) {ItemStack i = p.getEquipment().getHelmet(); i.setDurability((short)helm_dura); p.getEquipment().setHelmet(i);}
if (p.getEquipment().getBoots()!=null && boots_dura!=-1) {ItemStack i = p.getEquipment().getBoots(); i.setDurability((short)boots_dura); p.getEquipment().setBoots(i);}
if (p.getEquipment().getLeggings()!=null && legs_dura!=-1) {ItemStack i = p.getEquipment().getLeggings(); i.setDurability((short)legs_dura); p.getEquipment().setLeggings(i);}
if (p.getEquipment().getChestplate()!=null && chest_dura!=-1) {ItemStack i = p.getEquipment().getChestplate(); i.setDurability((short)chest_dura); p.getEquipment().setChestplate(i);}
if (p.getEquipment().getHelmet()!=null && helm_dura!=-1) {ItemStack i = p.getEquipment().getHelmet(); i.setDurability((short)helm_dura); p.getEquipment().setHelmet(i);}
Bukkit.getLogger().info("Durability of items now are: "+helm_dura+","+chest_dura+","+legs_dura+","+boots_dura);
}
},1);
@ -11428,12 +11512,12 @@ implements Listener
@EventHandler
public void onInventoryClickEvent(InventoryClickEvent event) {
Player p = (Player)event.getWhoClicked();
p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_GRAY+"");
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(ChatColor.DARK_GRAY+"");
if (p.hasPermission("group.moderator")) {
p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_GREEN+"");
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(ChatColor.DARK_GREEN+"");
}
if (p.hasPermission("group.administrators")) {
p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_PURPLE+"");
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(ChatColor.DARK_PURPLE+"");
}
//Bukkit.getLogger().info("Slot is "+event.getSlot());

@ -33,10 +33,15 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Wolf;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -577,6 +582,9 @@ public String convertToItemName(String val) {
}
this.plugin.saveConfig();
}
if (args[0].equalsIgnoreCase("newmobs")) {
p.sendMessage("/event newmobs <type>. <type> can be COUNTER_SLIME, VIRAL_SPIDER, SILENCER, HOUND_CALLER, FISH_CALLER, SUICIDAL_CREEPER, POWER_SURGE_ZOMBIE, LIGHTNING_MAGE");
}
if (args[0].equalsIgnoreCase("diablodrops")) {
//Generates a random diablodrops item. Just like if you did /diablodrops
p.getWorld().dropItemNaturally(p.getLocation(), DiabloDropsHook.getRandomItem());
@ -1207,6 +1215,131 @@ public String convertToItemName(String val) {
this.plugin.harrowing_night=true;
this.plugin.saveConfig();
}
if (args[0].equalsIgnoreCase("newmobs") && args.length>1) {
//Try to spawn a counter slime.
if (args[1].equalsIgnoreCase("COUNTER_SLIME")) {
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.SLIME);
Slime s = (Slime)entity;
//Bukkit.getLogger().info("Counter Slime spawned at "+s.getLocation().toString());
s.setSize((int)(Math.random()*3)+2);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Counter Slime");
l.setCustomNameVisible(false);
}
//Try to spawn a Viral Spider.
if (args[1].equalsIgnoreCase("VIRAL_SPIDER")) {
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.SPIDER);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Viral Spider");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Viral Spider spawned at "+l.getLocation().toString());
l.setMaxHealth(85);
l.setHealth(85);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3));
}
//Try to spawn a Silencer.
if (args[1].equalsIgnoreCase("SILENCER")) {
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.SKELETON);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Silencer");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Silencer spawned at "+l.getLocation().toString());
l.setMaxHealth(45);
l.setHealth(45);
ItemStack helm = new ItemStack(Material.DIAMOND_HELMET);
helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 24);
l.getEquipment().setHelmet(helm);
l.getEquipment().setHelmetDropChance(0.002f);
l.getEquipment().setItemInHand(new ItemStack(Material.BOW));
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3));
}
//Try to spawn a Hound Caller.
if (args[1].equalsIgnoreCase("HOUND_CALLER")) {
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.WOLF);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Hound Caller");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Hound Caller spawned at "+l.getLocation().toString());
l.setMaxHealth(65);
l.setHealth(65);
Wolf w = (Wolf)l;
//helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 32);
//l.getEquipment().setHelmet(helm);
//l.getEquipment().setHelmetDropChance(0.002f);
//l.getEquipment().setItemInHand(new ItemStack(Material.BOW));
//w.setAngry(true);
w.setAdult();
l.setRemoveWhenFarAway(true);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3));
l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 1));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 2));
l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0));
}
//Try to spawn a Fish Caller.
if (args[1].equalsIgnoreCase("FISH_CALLER")) {
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.ENDERMAN);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Fish Caller");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Hound Caller spawned at "+l.getLocation().toString());
l.setMaxHealth(50);
l.setHealth(50);
Enderman end = (Enderman)l;
//helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 32);
//l.getEquipment().setHelmet(helm);
//l.getEquipment().setHelmetDropChance(0.002f);
//l.getEquipment().setItemInHand(new ItemStack(Material.BOW));
//w.setAngry(true);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 4));
l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 1));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1));
}
//Try to spawn a Suicidal Creeper.
if (args[1].equalsIgnoreCase("SUICIDAL_CREEPER")) {
Location ent = p.getLocation();
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.CREEPER);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Suicidal Creeper");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Suicidal Creeper spawned at "+l.getLocation().toString());
l.setMaxHealth(5);
l.setHealth(5);
Creeper creep = (Creeper)l;
creep.setPowered(true);
l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 3));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 2));
l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 4));
l.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 0));
}
//Try to spawn a Powersurge Zombie.
if (args[1].equalsIgnoreCase("POWER_SURGE_ZOMBIE")) {
Location ent = p.getLocation();
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.ZOMBIE);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Powersurge Zombie");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Suicidal Creeper spawned at "+l.getLocation().toString());
l.setMaxHealth(60);
l.setHealth(60);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 3));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 2));
l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0));
}
//Try to spawn a Lightning Mage.
if (args[1].equalsIgnoreCase("LIGHTNING_MAGE")) {
Location ent = p.getLocation();
Entity entity = p.getWorld().spawnEntity(p.getLocation(), EntityType.ENDERMAN);
LivingEntity l = (LivingEntity)entity;
l.setCustomName(ChatColor.RED+"Lightning Mage");
l.setCustomNameVisible(false);
//Bukkit.getLogger().info("Suicidal Creeper spawned at "+l.getLocation().toString());
l.setMaxHealth(105);
l.setHealth(105);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 4));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1));
}
}
if (args[0].equalsIgnoreCase("spawn_dungeon") && args[1].equalsIgnoreCase("boss")) {
//Empty the whole area.
double xoffset = Math.random()*10+15;

Loading…
Cancel
Save