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. 27
      BankEconomyMod/src/me/kaZep/Base/Main.java
  15. 190
      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_lights_time=0;
public long check_spleef_game=0;
public boolean harrowing_night=false;
public int REVIVE_EFFECT=0;
public Location REVIVE_EFFECT_LOC;
@ -2853,7 +2854,16 @@ public void checkJukeboxes() {
//Bukkit.getPlayer("sigonasr2").sendMessage("Entered 2.");
if (p2!=p) {
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.");
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());
@ -2866,7 +2876,16 @@ public void checkJukeboxes() {
if (supportlv>=5) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Entered 3.");
//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.");
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));
@ -3219,7 +3238,11 @@ public void updateTime() {
last_world_time+=2;
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) {
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);
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")) {
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.chest9", 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")) {
this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimate", String.valueOf("None"));
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.
@ -1729,6 +1747,86 @@ public class PlayerListener
@EventHandler
public void onPlayerInteract(PlayerInteractEntityEvent ev) {
Entity theAnimal = ev.getRightClicked();
if (ev.getPlayer().getItemInHand().getType()==Material.getMaterial(127)) {
if (this.plugin.getAccountsConfig().getLong(ev.getPlayer().getName()+".halloween.wand")<Bukkit.getWorld("world").getFullTime())
if (theAnimal.getType()!=EntityType.PLAYER) {
if (theAnimal instanceof LivingEntity) {
LivingEntity l = (LivingEntity)theAnimal;
if (l.getCustomName()==null) {
//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.MINECART,
EntityType.MUSHROOM_COW,
EntityType.OCELOT,
EntityType.PIG,
EntityType.PIG_ZOMBIE,
EntityType.SHEEP,
EntityType.SILVERFISH,
EntityType.SKELETON,
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();
@ -1759,6 +1857,7 @@ public class PlayerListener
p.sendMessage(ChatColor.GREEN + "This dog is now happy!");
}
}
}
@EventHandler
public void onBlockGrow(BlockGrowEvent e) {
@ -1806,7 +1905,7 @@ public class PlayerListener
if (entity instanceof Monster) {
LivingEntity test = (LivingEntity)entity;
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 j=-2;j<3;j++) {
for (int k=-2;k<3;k++) {
@ -2045,6 +2144,7 @@ public class PlayerListener
}
}
}
if (!this.plugin.harrowing_night) {
if (Bukkit.getWorld("world").getHighestBlockYAt(entity.getLocation())>=96) {
//This is a tall world.
if (entity.getLocation().getBlockY()>104) {
@ -2064,6 +2164,11 @@ public class PlayerListener
}
}
}
} else {
for (int i=52;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 (contains && spawners==0) { //We only do this despawn/extra spawn chance stuff when we have an actual mob AND when there's not a spawner nearby.
if ((Math.random()<=despawnchancer || (torches+glowstone>=3))/* && entity.getNearbyEntities(5, 5, 5).size()>50*/) {
@ -5538,24 +5643,8 @@ public ItemStack getGoodie() {
if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) {
e.setDroppedExp(e.getDroppedExp()*2);
}
Player p = 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.
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) {
if (f.getKiller()!=null && f.getKiller().getType()==EntityType.PLAYER) {
Player p = f.getKiller();
for (int x=-10;x<10;x++) {
for (int y=-3;y<3;y++) {
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())) {
//Award the support player.
//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).p.giveExp(e.getDroppedExp()/2);
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);
/*
@ -6024,6 +6066,7 @@ public ItemStack getGoodie() {
}
}
}
if (this.plugin.getConfig().getBoolean("halloween-enabled")) {
for (int m=0;m<p.getInventory().getContents().length;m++) {
if (p.getInventory().getContents()[m]!=null && p.getInventory().getContents()[m].getType()==Material.PUMPKIN_PIE) {
//First see if it's a magical pumpkin pie.
@ -6094,6 +6137,7 @@ public ItemStack getGoodie() {
}
}
}
}
public void FatalSurvivor(Player p) {
p.setHealth(p.getMaxHealth());
@ -8085,7 +8129,7 @@ public ItemStack getGoodie() {
i.setDurability((short)0);
p.getInventory().addItem(i);
}
if (i.hasItemMeta() && i.getItemMeta().getLore()!=null) {
if (i.hasItemMeta() && i.getItemMeta().hasLore()) {
boolean is_halloween=false;
List<String> finallore = new ArrayList<String>();
for (int j=0;j<i.getItemMeta().getLore().size();j++) {
@ -8106,6 +8150,11 @@ public ItemStack getGoodie() {
meta.setLore(finallore);
//p.sendMessage("Meta is set.");
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();
}
}
@ -10856,6 +10905,11 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
boolean largechest=false;
boolean smallchest=false;
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().getItemMeta().getLore()!=null) {
//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.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
@ -323,6 +324,8 @@ public String convertToItemName(String val) {
}
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
if ((sender instanceof Player)) {
@ -488,6 +491,537 @@ public String convertToItemName(String val) {
}
} else
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")) {
//Empty the whole area.
double xoffset = Math.random()*10+15;

Loading…
Cancel
Save