r259 with Halloween ending updates! Polymorph wand! WHOO!

anvil_rework
sigonasr2 11 years ago
parent 06d924c5bc
commit 23ff12f9b7
  1. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$1.class
  2. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$2.class
  3. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$3.class
  4. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$4.class
  5. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main.class
  6. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class
  7. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class
  8. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class
  9. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class
  10. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class
  11. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class
  12. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class
  13. BIN
      BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class
  14. 29
      BankEconomyMod/src/me/kaZep/Base/Main.java
  15. 388
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  16. 534
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -106,6 +106,7 @@ public class Main extends JavaPlugin
public long check_nether_time=0; public long check_nether_time=0;
public long check_lights_time=0; public long check_lights_time=0;
public long check_spleef_game=0; public long check_spleef_game=0;
public boolean harrowing_night=false;
public int REVIVE_EFFECT=0; public int REVIVE_EFFECT=0;
public Location REVIVE_EFFECT_LOC; public Location REVIVE_EFFECT_LOC;
@ -2853,7 +2854,16 @@ public void checkJukeboxes() {
//Bukkit.getPlayer("sigonasr2").sendMessage("Entered 2."); //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 2.");
if (p2!=p) { if (p2!=p) {
if (supportlv>=20) { if (supportlv>=20) {
if (!p2.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { int get_resistance_level=-1;
Iterator<PotionEffect> effects = p2.getActivePotionEffects().iterator();
while (effects.hasNext()) {
PotionEffect pot = effects.next();
if (pot.getType()==PotionEffectType.DAMAGE_RESISTANCE) {
get_resistance_level=pot.getAmplifier();
break;
}
}
if (get_resistance_level<1) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Entered 4."); //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 4.");
p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Damage reduction buff (40%) from Support "+ChatColor.DARK_RED+p.getName()); p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Damage reduction buff (40%) from Support "+ChatColor.DARK_RED+p.getName());
p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Food Exhaustion buff (50% less food consumption) from Support "+ChatColor.DARK_RED+p.getName()); p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Food Exhaustion buff (50% less food consumption) from Support "+ChatColor.DARK_RED+p.getName());
@ -2866,7 +2876,16 @@ public void checkJukeboxes() {
if (supportlv>=5) { if (supportlv>=5) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Entered 3."); //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 3.");
//Give them a resistance buff. //Give them a resistance buff.
if (!p2.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { int get_resistance_level=-1;
Iterator<PotionEffect> effects = p2.getActivePotionEffects().iterator();
while (effects.hasNext()) {
PotionEffect pot = effects.next();
if (pot.getType()==PotionEffectType.DAMAGE_RESISTANCE) {
get_resistance_level=pot.getAmplifier();
break;
}
}
if (get_resistance_level<0) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Entered 4."); //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 4.");
p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Damage reduction buff (20%) from Support "+ChatColor.DARK_RED+p.getName()); p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Damage reduction buff (20%) from Support "+ChatColor.DARK_RED+p.getName());
p2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 601, 0, false)); p2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 601, 0, false));
@ -3219,7 +3238,11 @@ public void updateTime() {
last_world_time+=2; last_world_time+=2;
raisecount++; raisecount++;
} }
Bukkit.getWorld("world").setFullTime(Bukkit.getWorld("world").getFullTime()-raisecount); if (!harrowing_night) {
Bukkit.getWorld("world").setFullTime(Bukkit.getWorld("world").getFullTime()-raisecount);
} else {
Bukkit.getWorld("world").setFullTime(last_world_time);
}
/* /*
if (Bukkit.getWorld("world").getFullTime()-last_world_time+hold_diff>=2) { if (Bukkit.getWorld("world").getFullTime()-last_world_time+hold_diff>=2) {
last_world_time = Bukkit.getWorld("world").getFullTime()+((Bukkit.getWorld("world").getFullTime()-last_world_time+(hold_diff/2))/2); last_world_time = Bukkit.getWorld("world").getFullTime()+((Bukkit.getWorld("world").getFullTime()-last_world_time+(hold_diff/2))/2);

@ -1613,6 +1613,18 @@ public class PlayerListener
book.setItemMeta(bookdata); book.setItemMeta(bookdata);
p.getInventory().addItem(book); p.getInventory().addItem(book);
} }
if (!this.plugin.getAccountsConfig().contains(p.getName() + ".join.halloween_vote_signs")) {
this.plugin.getAccountsConfig().set(p.getName() + ".join.halloween_vote_signs", Boolean.valueOf(true));
this.plugin.saveAccountsConfig();
ItemStack sign = new ItemStack(Material.SIGN,2);
ItemMeta meta = sign.getItemMeta();
meta.setDisplayName(ChatColor.BLUE+p.getName());
sign.setItemMeta(meta);
p.getInventory().addItem(sign);
p.sendMessage("You have received 2 vote signs. Go vote at the Pumpkin Patch for the best pumpkin! (Note that voting for yourself does not count. Please vote the best of the others' pumpkins.)");
} else {
p.sendMessage("You do not have enough room in your inventory to receive Pumpkin vote signs. Clear some of your inventory and then rejoin.");
}
} }
if (!this.plugin.getAccountsConfig().contains(p.getName() + ".halloween.chest1")) { if (!this.plugin.getAccountsConfig().contains(p.getName() + ".halloween.chest1")) {
this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest1", Boolean.valueOf(false)); this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest1", Boolean.valueOf(false));
@ -1625,10 +1637,16 @@ public class PlayerListener
this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest8", Boolean.valueOf(false)); this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest8", Boolean.valueOf(false));
this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest9", Boolean.valueOf(false)); this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest9", Boolean.valueOf(false));
this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest10", Boolean.valueOf(false)); this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest10", Boolean.valueOf(false));
this.plugin.saveAccountsConfig();
} }
if (!this.plugin.getAccountsConfig().contains(p.getName() + ".jobs.ultimate")) { if (!this.plugin.getAccountsConfig().contains(p.getName() + ".jobs.ultimate")) {
this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimate", String.valueOf("None")); this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimate", String.valueOf("None"));
this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimatesealed", Boolean.valueOf(false)); this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimatesealed", Boolean.valueOf(false));
this.plugin.saveAccountsConfig();
}
if (!this.plugin.getAccountsConfig().contains(p.getName() + ".halloween.wand")) {
this.plugin.getAccountsConfig().set(p.getName() + ".halloween.wand", Long.valueOf(Bukkit.getWorld("world").getFullTime()));
this.plugin.saveAccountsConfig();
} }
} }
//Check if this player has unallocated stat points. //Check if this player has unallocated stat points.
@ -1729,34 +1747,115 @@ public class PlayerListener
@EventHandler @EventHandler
public void onPlayerInteract(PlayerInteractEntityEvent ev) { public void onPlayerInteract(PlayerInteractEntityEvent ev) {
Entity theAnimal = ev.getRightClicked(); Entity theAnimal = ev.getRightClicked();
if (theAnimal.getType() == EntityType.WOLF) { if (ev.getPlayer().getItemInHand().getType()==Material.getMaterial(127)) {
Wolf dog = (Wolf)theAnimal; if (this.plugin.getAccountsConfig().getLong(ev.getPlayer().getName()+".halloween.wand")<Bukkit.getWorld("world").getFullTime())
DyeColor dogcolor = dog.getCollarColor(); if (theAnimal.getType()!=EntityType.PLAYER) {
Player p = ev.getPlayer(); if (theAnimal instanceof LivingEntity) {
if (dog.getOwner() == null) { LivingEntity l = (LivingEntity)theAnimal;
return; if (l.getCustomName()==null) {
} //This is not a boss. Convert it to something else.
if (p != dog.getOwner()) { Location oldloc = theAnimal.getLocation();
return; EntityType newtype = null;
} theAnimal.remove();
if (!dog.isAngry()) { EntityType types[] = {EntityType.ZOMBIE,
//Switch state of wolf. EntityType.BAT,
//dog.setSitting(!dog.isSitting()); EntityType.CHICKEN,
return; EntityType.COW,
} EntityType.CREEPER,
ev.setCancelled(true); EntityType.ENDERMAN,
double oldhealth = dog.getHealth(); EntityType.GIANT,
dog.setSitting(true); EntityType.HORSE,
dog.remove(); EntityType.IRON_GOLEM,
Location wolfloc = dog.getLocation(); EntityType.MINECART,
World world = Bukkit.getWorld("world"); EntityType.MUSHROOM_COW,
Entity newAnimal = world.spawnEntity(wolfloc, EntityType.WOLF); EntityType.OCELOT,
Wolf newdog = (Wolf)newAnimal; EntityType.PIG,
newdog.setOwner(p); EntityType.PIG_ZOMBIE,
newdog.setHealth(oldhealth); EntityType.SHEEP,
newdog.setSitting(true); EntityType.SILVERFISH,
newdog.setCollarColor(dogcolor); EntityType.SKELETON,
p.sendMessage(ChatColor.GREEN + "This dog is now happy!"); EntityType.SNOWMAN,
EntityType.SPIDER,
EntityType.SQUID,
EntityType.VILLAGER,
EntityType.WITCH,
EntityType.WOLF};
World world = Bukkit.getWorld("world");
Entity newAnimal = world.spawnEntity(oldloc, types[(int)(Math.random()*types.length)]);
if (newAnimal instanceof LivingEntity) {
LivingEntity l2 = (LivingEntity)newAnimal;
l2.setCustomName(ChatColor.DARK_AQUA+"Polymorphed Creature");
}
this.plugin.getAccountsConfig().set(ev.getPlayer().getName()+".halloween.wand",Long.valueOf(Bukkit.getWorld("world").getFullTime()+1200));
} else {
if (!l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) {
//This is not a boss. Convert it to something else.
Location oldloc = theAnimal.getLocation();
EntityType newtype = null;
theAnimal.remove();
EntityType types[] = {EntityType.ZOMBIE,
EntityType.BAT,
EntityType.CHICKEN,
EntityType.COW,
EntityType.CREEPER,
EntityType.ENDERMAN,
EntityType.GIANT,
EntityType.HORSE,
EntityType.IRON_GOLEM,
EntityType.MUSHROOM_COW,
EntityType.OCELOT,
EntityType.PIG,
EntityType.PIG_ZOMBIE,
EntityType.SHEEP,
EntityType.SILVERFISH,
EntityType.SKELETON,
EntityType.SPIDER,
EntityType.SQUID,
EntityType.VILLAGER,
EntityType.WITCH,
EntityType.WOLF};
World world = Bukkit.getWorld("world");
Entity newAnimal = world.spawnEntity(oldloc, types[(int)(Math.random()*types.length)]);
if (newAnimal instanceof LivingEntity) {
LivingEntity l2 = (LivingEntity)newAnimal;
l2.setCustomName(ChatColor.DARK_AQUA+"Polymorphed Creature");
}
this.plugin.getAccountsConfig().set(ev.getPlayer().getName()+".halloween.wand",Long.valueOf(Bukkit.getWorld("world").getFullTime()+1200));
}
}
}
}
} else {
//Make sure we're not polymporphin, otherwise do other things in here.
if (theAnimal.getType() == EntityType.WOLF) {
Wolf dog = (Wolf)theAnimal;
DyeColor dogcolor = dog.getCollarColor();
Player p = ev.getPlayer();
if (dog.getOwner() == null) {
return;
}
if (p != dog.getOwner()) {
return;
}
if (!dog.isAngry()) {
//Switch state of wolf.
//dog.setSitting(!dog.isSitting());
return;
}
ev.setCancelled(true);
double oldhealth = dog.getHealth();
dog.setSitting(true);
dog.remove();
Location wolfloc = dog.getLocation();
World world = Bukkit.getWorld("world");
Entity newAnimal = world.spawnEntity(wolfloc, EntityType.WOLF);
Wolf newdog = (Wolf)newAnimal;
newdog.setOwner(p);
newdog.setHealth(oldhealth);
newdog.setSitting(true);
newdog.setCollarColor(dogcolor);
p.sendMessage(ChatColor.GREEN + "This dog is now happy!");
}
} }
} }
@ -1806,7 +1905,7 @@ public class PlayerListener
if (entity instanceof Monster) { if (entity instanceof Monster) {
LivingEntity test = (LivingEntity)entity; LivingEntity test = (LivingEntity)entity;
boolean block=false; boolean block=false;
if (test.getCustomName()!=null && test.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { if (test.getCustomName()!=null && (test.getCustomName().contains(ChatColor.DARK_PURPLE+"") || test.getCustomName().contains(ChatColor.DARK_AQUA+"Polymorphed Creature"))) {
for (int i=-2;i<3;i++) { for (int i=-2;i<3;i++) {
for (int j=-2;j<3;j++) { for (int j=-2;j<3;j++) {
for (int k=-2;k<3;k++) { for (int k=-2;k<3;k++) {
@ -2045,23 +2144,29 @@ public class PlayerListener
} }
} }
} }
if (Bukkit.getWorld("world").getHighestBlockYAt(entity.getLocation())>=96) { if (!this.plugin.harrowing_night) {
//This is a tall world. if (Bukkit.getWorld("world").getHighestBlockYAt(entity.getLocation())>=96) {
if (entity.getLocation().getBlockY()>104) { //This is a tall world.
despawnchancer*=(Math.random()*3.0d)+1; if (entity.getLocation().getBlockY()>104) {
despawnchancer*=(Math.random()*3.0d)+1;
} else {
for (int i=104-entity.getLocation().getBlockY();i>0;i--) {
despawnchancer/=1.0175d;
}
}
} else { } else {
for (int i=104-entity.getLocation().getBlockY();i>0;i--) { //This is a short world.
despawnchancer/=1.0175d; if (entity.getLocation().getBlockY()>52) {
despawnchancer*=(Math.random()*3.0d)+1;
} else {
for (int i=52-entity.getLocation().getBlockY();i>0;i--) {
despawnchancer/=1.025d;
}
} }
} }
} else { } else {
//This is a short world. for (int i=52;i>0;i--) {
if (entity.getLocation().getBlockY()>52) { despawnchancer/=1.025d;
despawnchancer*=(Math.random()*3.0d)+1;
} else {
for (int i=52-entity.getLocation().getBlockY();i>0;i--) {
despawnchancer/=1.025d;
}
} }
} }
//if (e.getSpawnReason()!=SpawnReason.NATURAL) { //If it's a natural spawn, we gotta do it. Ignore our checking stuff. //if (e.getSpawnReason()!=SpawnReason.NATURAL) { //If it's a natural spawn, we gotta do it. Ignore our checking stuff.
@ -5538,24 +5643,8 @@ public ItemStack getGoodie() {
if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) {
e.setDroppedExp(e.getDroppedExp()*2); e.setDroppedExp(e.getDroppedExp()*2);
} }
Player p = null; if (f.getKiller()!=null && f.getKiller().getType()==EntityType.PLAYER) {
for (int i=0;i<this.plugin.hitmoblist.size();i++) { Player p = f.getKiller();
for (int j=0;j<this.plugin.hitmoblist.get(i).id.size();j++) {
if (this.plugin.hitmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
//This is the player that killed. Also identify them.
p = this.plugin.hitmoblist.get(i).p;
//Bukkit.getPlayer("sigonasr2").sendMessage("Found: "+e.getEntity().getUniqueId().toString());
//this.plugin.gainMoneyExp(this.plugin.hitmoblist.get(i).p,"Support",0.025,3);
this.plugin.hitmoblist.get(i).id.remove(e.getEntity().getUniqueId());
this.plugin.hitmoblist.get(i).p.giveExp(e.getDroppedExp());
if (e.getDroppedExp()!=0) {
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 0.9f, 1f);
}
break;
}
}
}
if (p!=null) {
for (int x=-10;x<10;x++) { for (int x=-10;x<10;x++) {
for (int y=-3;y<3;y++) { for (int y=-3;y<3;y++) {
for (int z=-10;z<10;z++) { for (int z=-10;z<10;z++) {
@ -5586,7 +5675,7 @@ public ItemStack getGoodie() {
if (this.plugin.supportmoblist.get(i).id.contains(e.getEntity().getUniqueId())) { if (this.plugin.supportmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
//Award the support player. //Award the support player.
//Bukkit.getPlayer("sigonasr2").sendMessage("Found: "+e.getEntity().getUniqueId().toString()); //Bukkit.getPlayer("sigonasr2").sendMessage("Found: "+e.getEntity().getUniqueId().toString());
this.plugin.gainMoneyExp(this.plugin.supportmoblist.get(i).p,"Support",0.05,6); this.plugin.gainMoneyExp(this.plugin.supportmoblist.get(i).p,"Support",0.025,3);
this.plugin.supportmoblist.get(i).id.remove(e.getEntity().getUniqueId()); this.plugin.supportmoblist.get(i).id.remove(e.getEntity().getUniqueId());
this.plugin.supportmoblist.get(i).p.giveExp(e.getDroppedExp()/2); this.plugin.supportmoblist.get(i).p.giveExp(e.getDroppedExp()/2);
if (e.getDroppedExp()/2!=0) { if (e.getDroppedExp()/2!=0) {
@ -5678,53 +5767,6 @@ public ItemStack getGoodie() {
} }
} }
} }
} else {
//We're going to see if a player killed it themselves then.
Player pp = null;
for (int i=0;i<this.plugin.hitmoblist.size();i++) {
for (int j=0;j<this.plugin.hitmoblist.get(i).id.size();j++) {
if (this.plugin.hitmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
//This is the player that killed. Also identify them.
pp = this.plugin.hitmoblist.get(i).p;
//Bukkit.getPlayer("sigonasr2").sendMessage("Found: "+e.getEntity().getUniqueId().toString());
//this.plugin.gainMoneyExp(this.plugin.hitmoblist.get(i).p,"Support",0.025,3);
this.plugin.hitmoblist.get(i).id.remove(e.getEntity().getUniqueId());
this.plugin.hitmoblist.get(i).p.giveExp(e.getDroppedExp());
if (e.getDroppedExp()!=0) {
pp.playSound(p.getLocation(), Sound.ORB_PICKUP, 0.9f, 1f);
}
break;
}
}
}
//Check other players and give them assist experience.
for (int i=0;i<this.plugin.hitmoblist.size();i++) {
for (int j=0;j<this.plugin.hitmoblist.get(i).id.size();j++) {
if (this.plugin.hitmoblist.get(i).id.contains(e.getEntity().getUniqueId()) && this.plugin.hitmoblist.get(i).p!=pp) {
//This is the player that killed. Also identify them.
Player tempp = this.plugin.hitmoblist.get(i).p;
if (this.plugin.PlayerinJob(tempp, "Support")) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Found: "+e.getEntity().getUniqueId().toString());
//this.plugin.gainMoneyExp(this.plugin.hitmoblist.get(i).p,"Support",0.025,3);
this.plugin.hitmoblist.get(i).id.remove(e.getEntity().getUniqueId());
this.plugin.hitmoblist.get(i).p.giveExp(e.getDroppedExp()/4);
if (e.getDroppedExp()/4!=0) {
tempp.playSound(p.getLocation(), Sound.ORB_PICKUP, 0.4f, 0.6f);
}
} else {
this.plugin.hitmoblist.get(i).id.remove(e.getEntity().getUniqueId());
this.plugin.hitmoblist.get(i).p.giveExp(e.getDroppedExp()/2);
if (e.getDroppedExp()/2!=0) {
tempp.playSound(p.getLocation(), Sound.ORB_PICKUP, 0.4f, 0.6f);
}
}
break;
}
}
}
} }
e.setDroppedExp(0); e.setDroppedExp(0);
/* /*
@ -6024,70 +6066,72 @@ public ItemStack getGoodie() {
} }
} }
} }
for (int m=0;m<p.getInventory().getContents().length;m++) { if (this.plugin.getConfig().getBoolean("halloween-enabled")) {
if (p.getInventory().getContents()[m]!=null && p.getInventory().getContents()[m].getType()==Material.PUMPKIN_PIE) { for (int m=0;m<p.getInventory().getContents().length;m++) {
//First see if it's a magical pumpkin pie. if (p.getInventory().getContents()[m]!=null && p.getInventory().getContents()[m].getType()==Material.PUMPKIN_PIE) {
if (p.getInventory().getContents()[m].getItemMeta().getLore()!=null) { //First see if it's a magical pumpkin pie.
//It has lore! See if we can get the number of pumpkin pies from it. if (p.getInventory().getContents()[m].getItemMeta().getLore()!=null) {
int pies=0; //It has lore! See if we can get the number of pumpkin pies from it.
List<String> data = p.getInventory().getContents()[m].getItemMeta().getLore(); int pies=0;
//newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory"); List<String> data = p.getInventory().getContents()[m].getItemMeta().getLore();
ItemStack magic_pie = null; //newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory");
for (int i=0;i<data.size();i++) { ItemStack magic_pie = null;
if (data.get(i).contains("Requires ") && data.get(i).contains(" Pumpkin Pie in inventory")) { for (int i=0;i<data.size();i++) {
pies = Integer.valueOf((data.get(i).replace("Requires ", "")).replace(" Pumpkin Pie in inventory", "")); if (data.get(i).contains("Requires ") && data.get(i).contains(" Pumpkin Pie in inventory")) {
Bukkit.getLogger().info("Found the magic pie. Amount required is "+pies); pies = Integer.valueOf((data.get(i).replace("Requires ", "")).replace(" Pumpkin Pie in inventory", ""));
magic_pie=p.getInventory().getContents()[m].clone(); Bukkit.getLogger().info("Found the magic pie. Amount required is "+pies);
break; magic_pie=p.getInventory().getContents()[m].clone();
} break;
} }
//Now count all pumpkin pies in inventory. If they are greater than the amount in the inventory (and are not special pies), remove them.
int piecount=0;
ItemStack ideal_pie = null;
for (int i=0;i<p.getInventory().getContents().length;i++) {
if (p.getInventory().getContents()[i]!=null && p.getInventory().getContents()[i].getType()==Material.PUMPKIN_PIE && p.getInventory().getContents()[i].getItemMeta().getLore()==null) {
piecount+=p.getInventory().getContents()[i].getAmount();
ideal_pie = p.getInventory().getContents()[i].clone();
} }
} //Now count all pumpkin pies in inventory. If they are greater than the amount in the inventory (and are not special pies), remove them.
Bukkit.getLogger().info("We have "+piecount+" pies."); int piecount=0;
if (ideal_pie!=null && magic_pie!=null && piecount>=pies) { ItemStack ideal_pie = null;
p.getInventory().remove(magic_pie);
//Check to see if there are any pies we need to keep for later.
List<ItemStack> items = new ArrayList<ItemStack>();
for (int i=0;i<p.getInventory().getContents().length;i++) { for (int i=0;i<p.getInventory().getContents().length;i++) {
if (p.getInventory().getContents()[i]!=null) { if (p.getInventory().getContents()[i]!=null && p.getInventory().getContents()[i].getType()==Material.PUMPKIN_PIE && p.getInventory().getContents()[i].getItemMeta().getLore()==null) {
if (p.getInventory().getContents()[i].getType()==Material.PUMPKIN_PIE && piecount+=p.getInventory().getContents()[i].getAmount();
p.getInventory().getContents()[i].hasItemMeta() && ideal_pie = p.getInventory().getContents()[i].clone();
p.getInventory().getContents()[i].getItemMeta().getLore()!=null) {
//This is a special pie. Must keep.
items.add(p.getInventory().getContents()[i]);
}
} }
} }
for (int i=0;i<pies;i++) { Bukkit.getLogger().info("We have "+piecount+" pies.");
p.getInventory().remove(Material.PUMPKIN_PIE); if (ideal_pie!=null && magic_pie!=null && piecount>=pies) {
//Remove the pies. Remove the magic pie. p.getInventory().remove(magic_pie);
} //Check to see if there are any pies we need to keep for later.
List<ItemStack> items = new ArrayList<ItemStack>();
int amountleft = piecount-pies; for (int i=0;i<p.getInventory().getContents().length;i++) {
while (amountleft>0) { if (p.getInventory().getContents()[i]!=null) {
if (amountleft>=64) { if (p.getInventory().getContents()[i].getType()==Material.PUMPKIN_PIE &&
p.getInventory().addItem(new ItemStack(Material.PUMPKIN_PIE,64)); p.getInventory().getContents()[i].hasItemMeta() &&
amountleft-=64; p.getInventory().getContents()[i].getItemMeta().getLore()!=null) {
} else { //This is a special pie. Must keep.
p.getInventory().addItem(new ItemStack(Material.PUMPKIN_PIE,1)); items.add(p.getInventory().getContents()[i]);
amountleft--; }
}
} }
for (int i=0;i<pies;i++) {
p.getInventory().remove(Material.PUMPKIN_PIE);
//Remove the pies. Remove the magic pie.
}
int amountleft = piecount-pies;
while (amountleft>0) {
if (amountleft>=64) {
p.getInventory().addItem(new ItemStack(Material.PUMPKIN_PIE,64));
amountleft-=64;
} else {
p.getInventory().addItem(new ItemStack(Material.PUMPKIN_PIE,1));
amountleft--;
}
}
for (int i=0;i<items.size();i++) {
p.getInventory().addItem(items.get(i));
}
//Give a legendary armor/weapon here.
//Bukkit.getLogger().info("LEGENDARY!");
giveLegendaryItem(p);
p.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION,1728000,0));
p.updateInventory();
} }
for (int i=0;i<items.size();i++) {
p.getInventory().addItem(items.get(i));
}
//Give a legendary armor/weapon here.
//Bukkit.getLogger().info("LEGENDARY!");
giveLegendaryItem(p);
p.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION,1728000,0));
p.updateInventory();
} }
} }
} }
@ -8085,7 +8129,7 @@ public ItemStack getGoodie() {
i.setDurability((short)0); i.setDurability((short)0);
p.getInventory().addItem(i); p.getInventory().addItem(i);
} }
if (i.hasItemMeta() && i.getItemMeta().getLore()!=null) { if (i.hasItemMeta() && i.getItemMeta().hasLore()) {
boolean is_halloween=false; boolean is_halloween=false;
List<String> finallore = new ArrayList<String>(); List<String> finallore = new ArrayList<String>();
for (int j=0;j<i.getItemMeta().getLore().size();j++) { for (int j=0;j<i.getItemMeta().getLore().size();j++) {
@ -8106,6 +8150,11 @@ public ItemStack getGoodie() {
meta.setLore(finallore); meta.setLore(finallore);
//p.sendMessage("Meta is set."); //p.sendMessage("Meta is set.");
i.setItemMeta(meta); i.setItemMeta(meta);
if (this.plugin.inventoryFull(p)) {
//Drop it on the ground since our inventory is full.
p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+i.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory.");
p.getWorld().dropItemNaturally(p.getLocation(), i);
}
p.updateInventory(); p.updateInventory();
} }
} }
@ -10856,6 +10905,11 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
boolean largechest=false; boolean largechest=false;
boolean smallchest=false; boolean smallchest=false;
int identifier=-1; int identifier=-1;
if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.getMaterial(127))) {
p.updateInventory();
e.setCancelled(true);
return;
}
if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.CHEST || p.getItemInHand().getType()==Material.TRAPPED_CHEST)) { if (p.getItemInHand()!=null && (p.getItemInHand().getType()==Material.CHEST || p.getItemInHand().getType()==Material.TRAPPED_CHEST)) {
if (p.getItemInHand().getItemMeta().getLore()!=null) { if (p.getItemInHand().getItemMeta().getLore()!=null) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.

@ -13,6 +13,7 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -322,6 +323,8 @@ public String convertToItemName(String val) {
p.getWorld().dropItemNaturally(p.getLocation(), finalitem); //Drop item on the ground if our inventory is full. That way we don't lose it. p.getWorld().dropItemNaturally(p.getLocation(), finalitem); //Drop item on the ground if our inventory is full. That way we don't lose it.
} }
} }
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{ {
@ -488,6 +491,537 @@ public String convertToItemName(String val) {
} }
} else } else
if (cmd.getName().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) { if (cmd.getName().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) {
if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("end")) {
p.sendMessage(ChatColor.GRAY+"Ending Harrowing night... Did you make sure it was night time? If not, type this command again after /time night instead.");
this.plugin.harrowing_night=true;
this.plugin.getConfig().set("halloween-enabled", Boolean.valueOf(false));
p.sendMessage("Halloween event disabled.");
Bukkit.broadcastMessage(ChatColor.GRAY+"Ending 'The Harrowing' Event...");
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage(" Thanks for playing and sticking with us through this event!");
}
},20);
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage(ChatColor.GOLD+" Please make 3 slots of room in your inventory now if you do not have room. We are giving prizes....");
}
},100);
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage(ChatColor.GREEN+" You each have received an extra Harrowing item, a bonus extra item, and a special Polymorph Wand for participating in this event! I have also given you appropriate buffs.");
for (int i=0;i<Bukkit.getOnlinePlayers().length;i++) {
Player p = Bukkit.getOnlinePlayers()[i];
String prefix = "";
String suffix = "";
int type=(int)(Math.random()*6);
//int type=5; //TESTING.
List<String> enchants1 = new ArrayList<String>();
List<String> enchants2 = new ArrayList<String>();
ItemStack finalitem = null;
if (type==0) {
finalitem=new ItemStack(Material.DIAMOND_HELMET);
enchants1.add("Protective");
enchants1.add("Fire-Proof");
enchants1.add("Blast Resistant");
enchants1.add("Untouchable");
enchants1.add("Breathing");
enchants1.add("Working");
enchants1.add("Unbreaking");
enchants1.add("Thorny");
enchants2.add("Life");
enchants2.add("Resistance");
enchants2.add("Durability");
enchants2.add("Protection");
}
if (type==1) {
finalitem=new ItemStack(Material.DIAMOND_CHESTPLATE);
enchants1.add("Protective");
enchants1.add("Fire-Proof");
enchants1.add("Blast Resistant");
enchants1.add("Untouchable");
enchants1.add("Unbreaking");
enchants1.add("Thorny");
enchants2.add("Life");
enchants2.add("Resistance");
enchants2.add("Durability");
enchants2.add("Protection");
}
if (type==2) {
finalitem=new ItemStack(Material.DIAMOND_LEGGINGS);
enchants1.add("Protective");
enchants1.add("Fire-Proof");
enchants1.add("Blast Resistant");
enchants1.add("Untouchable");
enchants1.add("Unbreaking");
enchants1.add("Thorny");
enchants2.add("Life");
enchants2.add("Resistance");
enchants2.add("Durability");
enchants2.add("Protection");
}
if (type==3) {
finalitem=new ItemStack(Material.DIAMOND_BOOTS);
enchants1.add("Protective");
enchants1.add("Fire-Proof");
enchants1.add("Blast Resistant");
enchants1.add("Untouchable");
enchants1.add("Lightweight");
enchants1.add("Unbreaking");
enchants1.add("Thorny");
enchants2.add("Life");
enchants2.add("Resistance");
enchants2.add("Durability");
enchants2.add("Protection");
}
if (type==4) {
finalitem=new ItemStack(Material.BOW);
enchants1.add("Power");
enchants1.add("Punch");
enchants1.add("Flaming");
enchants1.add("Infinite");
enchants1.add("Unbreaking");
enchants2.add("Smiting");
enchants2.add("Penetration");
enchants2.add("Draining");
enchants2.add("Fury");
enchants2.add("Power");
}
if (type==5) {
finalitem=new ItemStack(Material.DIAMOND_SWORD);
enchants1.add("Damaging");
enchants1.add("Knockback");
enchants1.add("Undead");
enchants1.add("Baning");
enchants1.add("Fiery");
enchants1.add("Greedy");
enchants1.add("Unbreaking");
enchants2.add("Smiting");
enchants2.add("Penetration");
enchants2.add("Draining");
enchants2.add("Fury");
enchants2.add("Power");
}
prefix = enchants1.get((int)(Math.random()*enchants1.size()));
suffix = enchants2.get((int)(Math.random()*enchants2.size()));
if (prefix.equalsIgnoreCase("Protective")) {
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
}
if (prefix.equalsIgnoreCase("Fire-Proof")) {
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10);
}
if (prefix.equalsIgnoreCase("Blast Resistant")) {
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10);
}
if (prefix.equalsIgnoreCase("Untouchable")) {
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
}
if (prefix.equalsIgnoreCase("Breathing")) {
finalitem.addUnsafeEnchantment(Enchantment.OXYGEN, 10);
}
if (prefix.equalsIgnoreCase("Working")) {
finalitem.addUnsafeEnchantment(Enchantment.WATER_WORKER, 10);
}
if (prefix.equalsIgnoreCase("Unbreaking")) {
finalitem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
}
if (prefix.equalsIgnoreCase("Thorny")) {
finalitem.addUnsafeEnchantment(Enchantment.THORNS, 10);
}
if (prefix.equalsIgnoreCase("Untouchable")) {
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
}
if (prefix.equalsIgnoreCase("Lightweight")) {
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10);
}
if (prefix.equalsIgnoreCase("Power")) {
finalitem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10);
}
if (prefix.equalsIgnoreCase("Damaging")) {
finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
}
if (prefix.equalsIgnoreCase("Knockback")) {
finalitem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10);
}
if (prefix.equalsIgnoreCase("Punch")) {
finalitem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 10);
}
if (prefix.equalsIgnoreCase("Flaming")) {
finalitem.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10);
}
if (prefix.equalsIgnoreCase("Infinite")) {
finalitem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 10);
}
if (prefix.equalsIgnoreCase("Undead")) {
finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 10);
}
if (prefix.equalsIgnoreCase("Baning")) {
finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 10);
}
if (prefix.equalsIgnoreCase("Fiery")) {
finalitem.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10);
}
if (prefix.equalsIgnoreCase("Greedy")) {
finalitem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
}
ItemMeta meta = finalitem.getItemMeta();
meta.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+prefix+" "+convertToItemName(finalitem.getType().name())+" of "+suffix);
List<String> setLore = new ArrayList<String>();
if (suffix.equalsIgnoreCase("Life")) {
setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10)+" "+ChatColor.BLUE+"Health");
}
if (suffix.equalsIgnoreCase("Resistance")) {
setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*70)+20)+"% "+ChatColor.BLUE+"Damage Reduction");
}
if (suffix.equalsIgnoreCase("Durability")) {
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*200)+50)*10)+"% "+ChatColor.BLUE+"Durability");
}
if (suffix.equalsIgnoreCase("Protection")) {
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Block Chance");
}
if (suffix.equalsIgnoreCase("Smiting")) {
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Critical Chance");
}
if (suffix.equalsIgnoreCase("Penetration")) {
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*20)+5))+" "+ChatColor.BLUE+"Armor Penetration");
}
if (suffix.equalsIgnoreCase("Draining")) {
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*30)+20))+"% "+ChatColor.BLUE+"Life Steal");
}
if (suffix.equalsIgnoreCase("Fury")) {
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Attack Speed");
}
if (suffix.equalsIgnoreCase("Power")) {
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*10)+5))+" "+ChatColor.BLUE+"Damage");
}
setLore.add("");
setLore.add(ChatColor.YELLOW+"[Halloween]");
setLore.add("This item was created during the Halloween");
setLore.add("event. When this item breaks, it simply turns");
setLore.add("into a \"broken\" state and has a recharge time");
setLore.add("of 1 week. The item will be fully restored after");
setLore.add("a week of cooldown.");
meta.setLore(setLore);
finalitem.setItemMeta(meta);
//finalitem.setDurability((short)1560); //TESTING.
boolean full=true;
for (int j=0;j<p.getInventory().getContents().length;j++) {
if (p.getInventory().getContents()[j]==null) {
full=false;
break;
}
}
if (!full) {
p.getInventory().addItem(finalitem);
} else {
p.getWorld().dropItemNaturally(p.getLocation(), finalitem); //Drop item on the ground if our inventory is full. That way we don't lose it.
}
ItemStack item = null;
//Add a weapon/armor piece.
int rand = (int)(Math.random()*5);
String type1 = "DIAMOND";
String type2 = "";
int rarity=2; //0 = Normal, 1 = Rare, 2 = Legendary
if (rand!=0 && rand!=3) {
rand = (int)(Math.random()*9);
type2 = "";
switch (rand) {
case 0: {
type2 = "HELMET";
}break;
case 1: {
type2 = "CHESTPLATE";
}break;
case 2: {
type2 = "LEGGINGS";
}break;
case 3: {
type2 = "BOOTS";
}break;
case 4: {
type2 = "SWORD";
}break;
case 5: {
type2 = "BOOTS";
}break;
case 6: {
type2 = "LEGGINGS";
}break;
case 7: {
type2 = "CHESTPLATE";
}break;
case 8: {
type2 = "HELMET";
}break;
}
} else {
rand = (int)(Math.random()*5);
type2 = "";
switch (rand) {
case 0: {
type2 = "HELMET";
}break;
case 1: {
type2 = "CHESTPLATE";
}break;
case 2: {
type2 = "LEGGINGS";
}break;
case 3: {
type2 = "BOOTS";
}break;
case 4: {
type2 = "SWORD";
}break;
}
}
double chance_increase=0;
if (rarity>0) {
chance_increase=1.5d;
}
if (type2.equalsIgnoreCase("BOW")) {
item = new ItemStack(Material.BOW);
int enchants[] = {48,49,50,51};
for (int j=0;j<enchants.length;j++) {
if (Math.random()*chance_increase<1.0d/enchants.length) {
if (rarity==2) {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
} else {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*6)+1);
}
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta1 = item.getItemMeta();
meta1.setLore(ourLore);
item.setItemMeta(meta1);
} else {
item = new ItemStack(Material.getMaterial(type1+"_"+type2));
if (type2.equalsIgnoreCase("SWORD")) {
int enchants[] = {16,17,18,19,20,21,34};
for (int j=0;j<enchants.length;j++) {
if (Math.random()*chance_increase<1.0d/enchants.length) {
if (rarity==2) {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
} else {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*6)+1);
}
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta1 = item.getItemMeta();
meta1.setLore(ourLore);
item.setItemMeta(meta1);
} else if (type2.equalsIgnoreCase("SPADE") || type2.equalsIgnoreCase("PICKAXE") || type2.equalsIgnoreCase("HOE") || type2.equalsIgnoreCase("AXE")) {
int enchants[] = {32,33,34,35};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
if (Math.random()<1.0d/enchants.length) {
if (Math.random()*chance_increase<1.0d/enchants.length) {
if (rarity==2) {
if (enchants[j]==33) {
if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)==0) {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
}
}
if (enchants[j]==35) {
if (item.getEnchantmentLevel(Enchantment.SILK_TOUCH)==0) {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
}
}
} else {
if (enchants[j]==33) {
if (item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)==0) {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*6)+1);
}
}
if (enchants[j]==35) {
if (item.getEnchantmentLevel(Enchantment.SILK_TOUCH)==0) {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*6)+1);
}
}
}
}
}
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta1 = item.getItemMeta();
meta1.setLore(ourLore);
item.setItemMeta(meta1);
} else {
int enchants[] = {0,1,2,3,4,5,6,7,34};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
if (rarity==2) {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
} else {
item.addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*6)+1);
}
}
}
List<String> ourLore = new ArrayList<String>();
if (rarity==2) {
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*16)+1)+" "+ChatColor.BLUE+"Health");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Damage Reduction");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*200)+1)*10)+"% "+ChatColor.BLUE+"Durability");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Block Chance");
} else
{
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance");
}
} else
if (rarity==1) {
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*8)+1)+" "+ChatColor.BLUE+"Health");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Damage Reduction");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*100)+1)*10)+"% "+ChatColor.BLUE+"Durability");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Block Chance");
} else
{
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*8)+1)+" "+ChatColor.BLUE+"Health");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Damage Reduction");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*100)+1)*10)+"% "+ChatColor.BLUE+"Durability");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Block Chance");
} else
{
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance");
}
} else {
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*4)+1)+" "+ChatColor.BLUE+"Health");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Damage Reduction");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+1)*10)+"% "+ChatColor.BLUE+"Durability");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Block Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance");
}
}
ItemMeta meta1 = item.getItemMeta();
meta1.setLore(ourLore);
if (rarity==1) {
meta1.setDisplayName(ChatColor.BLUE+"Rare "+item.getType().name().replace("_", " "));
}
if (rarity==2) {
meta1.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+item.getType().name().replace("_", " "));
}
item.setItemMeta(meta1);
}
}
p.getInventory().addItem(item);
ItemStack wand = new ItemStack(Material.getMaterial(127));
ItemMeta wand_meta = wand.getItemMeta();
wand_meta.setDisplayName(ChatColor.RED+"P"+
ChatColor.GOLD+"o"+ChatColor.YELLOW+"l"+
ChatColor.GREEN+"y"+ChatColor.BLUE+"m"+
ChatColor.LIGHT_PURPLE+"o"+ChatColor.DARK_RED+"r"
+ChatColor.DARK_GREEN+"p"+ChatColor.DARK_PURPLE+"h"+ChatColor.RESET+" Wand");
List<String> newLore = new ArrayList<String>();
newLore.add("A "+ChatColor.YELLOW+"[Halloween]"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" item received as a reward");
newLore.add("for participating in the event. This item can");
newLore.add("turn a creature into another creature.");
newLore.add("Can be used once a minute.");
wand_meta.setLore(newLore);
wand.setItemMeta(wand_meta);
p.getInventory().addItem(wand);
}
}
},400);
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage(ChatColor.GOLD+""+ChatColor.BOLD+"");
Bukkit.broadcastMessage(ChatColor.GOLD+""+ChatColor.BOLD+"Again, thank you for participating, and everyone have a great night!");
}
},600);
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+" And so the Harrowing ends....");
}
},700);
Bukkit.getWorld("world").setDifficulty(Difficulty.HARD);
this.plugin.harrowing_night=true;
this.plugin.saveConfig();
}
if (args[0].equalsIgnoreCase("spawn_dungeon") && args[1].equalsIgnoreCase("boss")) { if (args[0].equalsIgnoreCase("spawn_dungeon") && args[1].equalsIgnoreCase("boss")) {
//Empty the whole area. //Empty the whole area.
double xoffset = Math.random()*10+15; double xoffset = Math.random()*10+15;

Loading…
Cancel
Save