From 75f59a94c69c6462e7c6e9c57b6d8f6c04b14edb Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 18 Nov 2013 21:48:56 -0700 Subject: [PATCH] Revert "Commit class changes." This reverts commit c45a58937b736582cba3d60001b9a9996e36edc3. --- BankEconomyMod/.classpath | 9 - ...PlayerListener.java1369598882888478183.tmp | 12407 ---------------- 2 files changed, 12416 deletions(-) delete mode 100644 BankEconomyMod/.classpath delete mode 100644 BankEconomyMod/src/me/kaZep/Base/._PlayerListener.java1369598882888478183.tmp diff --git a/BankEconomyMod/.classpath b/BankEconomyMod/.classpath deleted file mode 100644 index a40de46..0000000 --- a/BankEconomyMod/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/BankEconomyMod/src/me/kaZep/Base/._PlayerListener.java1369598882888478183.tmp b/BankEconomyMod/src/me/kaZep/Base/._PlayerListener.java1369598882888478183.tmp deleted file mode 100644 index 74625a1..0000000 --- a/BankEconomyMod/src/me/kaZep/Base/._PlayerListener.java1369598882888478183.tmp +++ /dev/null @@ -1,12407 +0,0 @@ -package me.kaZep.Base; - -import java.io.File; -import java.io.IOException; -import java.io.PrintStream; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.UUID; - -import net.milkbowl.vault.economy.Economy; -import net.milkbowl.vault.economy.EconomyResponse; -//import net.minecraft.server.v1_4_R1.EntityWolf; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Chunk; -import org.bukkit.Difficulty; -import org.bukkit.DyeColor; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.Sound; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.BrewingStand; -import org.bukkit.block.Chest; -import org.bukkit.block.CreatureSpawner; -import org.bukkit.block.DoubleChest; -import org.bukkit.block.Furnace; -import org.bukkit.block.Jukebox; -import org.bukkit.block.Sign; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.AnimalTamer; -import org.bukkit.entity.Animals; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Cow; -import org.bukkit.entity.Creature; -import org.bukkit.entity.CreatureType; -import org.bukkit.entity.EnderDragon; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.entity.Golem; -import org.bukkit.entity.Horse; -import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.Item; -import org.bukkit.entity.LightningStrike; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Minecart; -import org.bukkit.entity.Monster; -import org.bukkit.entity.MushroomCow; -import org.bukkit.entity.Ocelot; -import org.bukkit.entity.Pig; -import org.bukkit.entity.PigZombie; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Sheep; -import org.bukkit.entity.Wither; -import org.bukkit.entity.Wolf; -import org.bukkit.entity.Zombie; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockGrowEvent; -import org.bukkit.event.block.BlockPhysicsEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.block.BlockRedstoneEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.enchantment.EnchantItemEvent; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.event.entity.EntityCombustEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ExplosionPrimeEvent; -import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.ItemDespawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.PotionSplashEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.SheepDyeWoolEvent; -import org.bukkit.event.hanging.HangingBreakByEntityEvent; -import org.bukkit.event.hanging.HangingBreakEvent; -import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause; -import org.bukkit.event.inventory.BrewEvent; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.CraftItemEvent; -import org.bukkit.event.inventory.FurnaceBurnEvent; -import org.bukkit.event.inventory.FurnaceExtractEvent; -import org.bukkit.event.inventory.FurnaceSmeltEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.inventory.InventoryEvent; -import org.bukkit.event.inventory.InventoryInteractEvent; -import org.bukkit.event.inventory.InventoryMoveItemEvent; -import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.inventory.InventoryPickupItemEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.inventory.InventoryType.SlotType; -import org.bukkit.event.player.PlayerBedLeaveEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerExpChangeEvent; -import org.bukkit.event.player.PlayerFishEvent; -import org.bukkit.event.player.PlayerFishEvent.State; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerItemBreakEvent; -import org.bukkit.event.player.PlayerItemConsumeEvent; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerShearEntityEvent; -import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.player.PlayerToggleSneakEvent; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.event.vehicle.VehicleEnterEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; -import org.bukkit.event.weather.LightningStrikeEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.event.world.ChunkPopulateEvent; -import org.bukkit.event.world.WorldEvent; -import org.bukkit.event.world.WorldInitEvent; -import org.bukkit.event.world.WorldLoadEvent; -import org.bukkit.inventory.CraftingInventory; -import org.bukkit.inventory.EntityEquipment; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.bukkit.inventory.meta.BookMeta; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; -import org.bukkit.material.Pumpkin; -import org.bukkit.material.Wool; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.plugin.Plugin; -import org.bukkit.potion.Potion; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.potion.PotionType; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; -import org.bukkit.scoreboard.Team; -import org.bukkit.util.Vector; -import org.bukkit.potion.Potion; - -import com.google.common.base.Objects; -import com.sk89q.worldedit.CuboidClipboard; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.data.DataException; -import com.sk89q.worldedit.schematic.SchematicFormat; - -import me.kaZep.Base.BrewingStandData; -import me.kaZep.Base.FurnaceData; -import me.kaZep.Base.PlayerBuffData; -import me.kaZep.Base.JukeboxData; -import me.kaZep.Base.ArrowShooter; -import me.kaZep.Base.EntityHitData; -import me.kaZep.Base.EntityInteractData; -import me.kaZep.Base.ExplorerData; -import me.kaZep.Base.InvisibilityData; -import me.kaZep.Base.PersistentExplorerList; -import me.kaZep.Base.PlayerData; -import me.kaZep.Base.SupportEntity; -import me.kaZep.Base.SupportPlayer; - -public class PlayerListener - implements Listener -{ - public Main plugin; - - public PlayerListener(Main plugin) - { - this.plugin = plugin; - } - - enum Cube { SMALL, LARGE, ENDER } - - public void updateTopSPLEEFSigns() { - String name[] = {"","",""}; - int rating[] = {-9999,-9999,-9999}, wins[] = {0,0,0}, losses[] = {0,0,0}; - //Get list of all players on the server. - OfflinePlayer playerlist[] = Bukkit.getOfflinePlayers(); - for (int i=0;i=20) { - if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[0]) { - //This beats the top record, move everything down. - name[2]=name[1];rating[2]=rating[1];wins[2]=wins[1];losses[2]=losses[1]; - name[1]=name[0];rating[1]=rating[0];wins[1]=wins[0];losses[1]=losses[0]; - name[0]=playerlist[i].getName(); - rating[0]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[0]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[0]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); - } else - if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[1]) { - //This beats the 2nd record, move everything down. - name[2]=name[1];rating[2]=rating[1];wins[2]=wins[1];losses[2]=losses[1]; - name[1]=playerlist[i].getName(); - rating[1]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[1]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[1]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); - } else - if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[2]) { - //This beats the 3rd record, move everything down. - name[2]=playerlist[i].getName(); - rating[2]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[2]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[2]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); - } - } - } - } - Sign sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,85,42).getState(); - sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); - sign.setLine(1, ChatColor.BOLD+name[0]); - sign.update(); - sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,43).getState(); - sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); - sign.setLine(1, ChatColor.BOLD+"Wins: "+ChatColor.DARK_GREEN+wins[0]); - sign.update(); - sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,41).getState(); - sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); - sign.setLine(1, ChatColor.BOLD+"Losses: "+ChatColor.DARK_GREEN+losses[0]); - sign.update(); - sign = (Sign)Bukkit.getWorld("world").getBlockAt(1612,84,42).getState(); - sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); - sign.setLine(1, ChatColor.BOLD+"RATING: "+ChatColor.DARK_GREEN+rating[0]/10); - sign.update(); - - sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,85,39).getState(); - sign.setLine(0, ChatColor.BOLD+name[1]); - sign.setLine(1, "Rating: "+rating[1]/10); - sign.setLine(2, ChatColor.ITALIC+"Wins: "+wins[1]); - sign.setLine(3, ChatColor.ITALIC+"Losses: "+losses[1]); - sign.update(); - - sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,37).getState(); - sign.setLine(0, ChatColor.BOLD+name[2]); - sign.setLine(1, "Rating: "+rating[2]/10); - sign.setLine(2, ChatColor.ITALIC+"Wins: "+wins[2]); - sign.setLine(3, ChatColor.ITALIC+"Losses: "+losses[2]); - sign.update(); - } - - @EventHandler - public void onServerListPing(ServerListPingEvent e) { - e.setMaxPlayers(16); - if (this.plugin.getConfig().getBoolean("maintenance-mode")) { - e.setMotd(ChatColor.RED+"Currently in Maintenance Mode."); - } else { - e.setMotd("Sig's Minecraft - "+ChatColor.BLUE+"Currently Online."); - } - return; - } - - @EventHandler - public void onPlayerGainEXP(PlayerExpChangeEvent e) { - Player p = e.getPlayer(); - if (this.plugin.PlayerinJob(p, "Enchanter") && this.plugin.getJobLv("Enchanter", p)>=5) { - e.setAmount(e.getAmount()*2); - } - if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { - e.setAmount(e.getAmount()*2); - } - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify3")) { - p.sendMessage(ChatColor.DARK_GREEN+""+ChatColor.ITALIC+"Gained "+e.getAmount()+" exp."); - } - } - - @EventHandler - public void onBrewingStandBrew(BrewEvent e) { - //Look for an owner to this brewingstand. - String owner=""; - int mult=0; - boolean allowed=true; - for (int i=0;i=10) { - ItemStack[] items = e.getContents().getContents(); - for (int i=0;i map = e.getEnchantsToAdd(); - Player p = e.getEnchanter(); - /*e.getEnchanter().sendMessage("Enchantments are:"); - for (Map.Entry entry : map.entrySet()) { - e.getEnchanter().sendMessage(entry.getKey().getName()+" "+entry.getValue()); - }*/ - /* - if (Math.random()<=0.05) { - //5% chance of getting a book when enchanting. - ItemStack book = new ItemStack(Material.WRITTEN_BOOK); - BookMeta bookdata = (BookMeta)book.getItemMeta(); - int choosebook = (int)(Math.random()*9.0d); - switch (choosebook) { - case 0:{ - bookdata.setAuthor("Steve"); - bookdata.setTitle("Dangers of the Nether"); - bookdata.addPage("Dangers of the Nether\n"+ChatColor.ITALIC+" by Steve\n======\n"+ChatColor.RESET+"It didn't take me long to realize where we were. It was dangerous, very hot, and lots of torturous screams could be heard everywhere. I barely had time","to take it all in before a huge fireball was shot in my direction. I quickly looked to my side to find a convenient safe passage and hid there for a few minutes. I guess I was in there longer than I thought, I ended","up falling asleep and waking up to notice there was something scary on the wall.\n\n"+ChatColor.ITALIC+"\"TURN AND LEAVE NOW. DANGEROUS TO STAY. REAL WORLD HAS WHAT YOU ARE LOOKING FOR. I ONLY REMEMBER THE 1ST X POSITION...",ChatColor.ITALIC+"...IT WAS 7! I AM *POSITIVE*\""+ChatColor.RESET+"\n\nI did not know what to think. The 1st X position? I quickly remembered the 7 and sprinted out of the nether portal. And to think that was *THE END* of my adventures..."); - }break; - case 1:{ - bookdata.setAuthor("Lacey"); - bookdata.setTitle("A Hole in the Flower Garden"); - bookdata.addPage("A Hole in the Flower Garden\n"+ChatColor.ITALIC+" by Lacey\n======\n"+ChatColor.RESET+"It was a lovely day to pick flowers in the garden, they just finished blooming fully. I was so excited to pick them, but I didn't do so until","after I've taken in all the wonderful scents! Smelling all the flowers and wonderful smells of plants and trees and nature and grass. It was perfect. I was mindlessly walking along this prairie when I stumbled.","I fell, and fell, and fell. I hit the bottom of a ravine. It didn't even occur to me I would just walk into one. I took some minor damage, but when I got up, I noticed something strange.","There were two or three zombies gathered around a wall, etching something into it. I went over to read it once the zombies walked away. I saw on the wall:\n\n"+ChatColor.ITALIC+"X-2:6 <--END","It looked cryptic to me, but why would they write that on the wall? I quickly scribbled it down on a notepad I had in my pocket and started climbing out of the ravine to tend to my lovely flowers. What a day!"); - }break; - case 2:{ - bookdata.setAuthor("Jimmy"); - bookdata.setTitle("Messages in Music"); - bookdata.addPage("Messages in Music\n"+ChatColor.ITALIC+" by Jim"+"\n======"+ChatColor.RESET+"\nI popped out the disk from my Jukebox to put in another, I could jam to these all day! As I was looking through my collection for something to listen to","I found a really bent up disk. 'No way this could still play', I thought to myself. I put it in, and it crackled and snarled, but it was indeed playing! At first I heard some faint resemblence of music, but then suddenly,","a hiss, an explosion, and then 'CREEEEEEEEE----- 7X XSSSSSSSSSS 3RD EEEEEEE' mental images appeared in my head, but the 7X and 3RD stood out the most. It's like I was seeing them in my head while hearing something else!","I couldn't stand up anymore, or think. I forcibly reached up with my weak hand to find the eject button on the player and when I found the familiar nub in the button, pressed down on it and out popped the disk, hitting my face,","but putting me back into reality. Something was telling me that the 3RD and 7X was important. But I couldn't quite put my tongue on it."); - }break; - case 3:{ - bookdata.setAuthor("Creeper"); - bookdata.setTitle("HISS"); - bookdata.addPage("Y do i exisssst. nobody knowssss. i just want a hugssssss, HUGSSSSSSS. but i don't know Y i exist. there's no Y in the first position. it'sssss jusssst two digitssssss.... SSSSSSSSS. *THE END*"); - }break; - case 4:{ - bookdata.setAuthor("Marco"); - bookdata.setTitle("The Hunt for a Dragon"); - bookdata.addPage("The Hunt for a Dragon\n"+ChatColor.ITALIC+" by Marco"+"\n======"+ChatColor.RESET+"\nThere exists a rumor that a mythical dragon could be found in the depths of our world. It is even said he doesn't exist in OUR world, but ANOTHER world altogether!","That my friends already boggles me, but where the heck would I go to find it then? I have been told he exists, and I know he is. I believe deep in my heart. I searched day and night under and over ground.","One day I found something strange in the ground. It was pink wool, in the middle of a cave on the ground. It even said something, but I couldn't tell from so close up. So I literally dug all the way to the surface, keeping the boundaries","of that word uncovered the whole way up. When I got to the top and looked down, I was relieved to find it was made out of markings I could discern. It said: 'Y: X3?' It was definitely a weird group of symbols, but I have a strong feeling"," that it is directly linked with that dragon I am trying to hunt down. Maybe I can gather more clues and try to decipher the location of this thing."); - }break; - case 5:{ - bookdata.setAuthor("Steve"); - bookdata.setTitle("Cooking Food"); - bookdata.addPage("Cooking Food\n"+ChatColor.ITALIC+" by Steve"+"\n======"+ChatColor.RESET+"\nIt was a bright and rather typical sunny day in the Minecraft world. I don't actually think it was very hot either. I just managed to catch a few fish and was cooking them up.","It wasn't long before I got distracted and heard a funny noise. It was an ocelote. Lucky me, an ocelote has smelled the scent of my fish! I grab a few and hold it out for the ocelote. It slowly creeps over, and then takes it and runs from me.","I thought it was full and finished cooking the rest of the fish. However, the ocelote returned a few minutes later with a neatly-folded piece of paper in its mouth. It came up to me and set it down, like it was some message just for me.","I opened it up and it read:\n\n"+ChatColor.ITALIC+"Don't let the fish get to your tongue! If you know what's wise, you will investigate further. The 3rd position of Y being the number 5."+ChatColor.RESET+"\n\n","I didn't notice the ocelote run away, but I knew something FISHY was going on. That message seemed important for some reason, I've seen similar cryptic messages before... Perhaps I'll hold onto this in case I need it in the future."); - }break; - case 6:{ - bookdata.setAuthor("Fredric"); - bookdata.setTitle("Math Behind the Void"); - bookdata.addPage("Math Behind the Void\n"+ChatColor.ITALIC+" by Fredric"+"\n======"+ChatColor.RESET+"\nThis book describes a few principles that the void in this world follows. While no one has actually seen the void, we have found a few theories and rules regarding them.","1. The Void has a Light Level of -14. The Void actually absorbs light coming from light sources and thus, if The Void is ever opened to the real world, would suck up the light from it.","2. The Void always has a volume of 50,000m, being 50m x 20m x 50m. This means that The Void, regardless of location is always the same exact size. This would conclude to us that The Void is co-existing and multiple instaces of it may exist in the same realm.","3. Any Entity entering The Void will not be able to escape The Void as time passes much more quickly inside The Void. This means Entities that enter The Void feel accelerated processes and cannot combat it, since the time outside is behind them.","4. A point of connection between The Void and other dimensions has to exist, for The Void to exist. Speculation has it that one of these points has been leaked into the world, and is accessible by us directly. After further research,","we have learned that one of these points is located on the 1st respective numeral along our Z axis with the number 4. It has also been proven that this number has to be negative as the other two sources interacting with The Void are positive."); - }break; - case 7:{ - bookdata.setAuthor("Robert"); - bookdata.setTitle("TNT"); - bookdata.addPage("TNT\n"+ChatColor.ITALIC+" by Robert"+"\n======"+ChatColor.RESET+"\nYou know, the easiest way to clear a tunnel is using an item called TNT. It is a rather small block, but it is loaded with gunpowder. When lit by an external force, it ignites","with the force of 5 Creeper explosions to clear whole caves out. Well lo and behold one day I discovered a rather strange abandoned mineshaft. It wasn't normal for sure, because there were green vines everywhere and lots of strange doors.","It was like somebody lived here ages ago, and I am discovering the ruins of such a place. Inoperable levers, a few mobs I have to kill here and there that have made this area their designated home. It was a mess. But I did discover that","someone was trying to find what we would call 'The End'. It's a magical place, and I believe with the right amount of effort, we can find it someday too. He had scribbled the coordinates of the location he was trying to reach.","However, most of it is faded out and I can only tell faintly the remains of it: \n\n"+ChatColor.ITALIC+"X:---\nY:---\nZ:--7-"+ChatColor.RESET+"\n\nYep, that's about it.","Hopefully by me recording this data, someone else can fill in the remaining numbers and we can all find The End together. Someday..."); - }break; - case 8:{ - bookdata.setAuthor("Joshua"); - bookdata.setTitle("Fourside"); - bookdata.addPage("Fourside\n"+ChatColor.ITALIC+" by Joshua"+"\n======"+ChatColor.RESET+"\n"+ChatColor.DARK_BLUE+"ABANDONED PROJECT"+ChatColor.RESET+". A city that would be developed with the best technology and the highest standards. It would","succeed every single Minecraft city that has ever been built. Casinos, diamond-lined walkways, towering skyscrapers as far as the eye can see. Museums, Libraries, Educational Institutions. This mega-city would be able to hold","and sustain every single Minecrafter in existence. But no, something went terribly wrong. Our engineering team finally developed the perfect transportation system and we were wiring it up to our fusion power plant.","Something went horribly wrong. The Fusion power plant started self-combusting itself, leaving behind hyper-cold atoms. This caused nucleic waste to interact with the environment around itself and freezing the whole world as we knew it.","The city idea as we knew it was scrapped, and we would wait 2000 years before we could attempt this again. We wrote plans for a much more portable solution and have named it 'Twoside' and archived it appropriately.","Maybe someone will pick up that book and be able to make the future bright with a mini version of Fourside. That being said, we left the 3rd slot of the Z position of our city at 7. This should give you enough clue as to where NOT to build."); - }break; - } - book.setItemMeta(bookdata); - //p.setItemInHand(book); - p.getInventory().addItem(book); - p.updateInventory(); - p.sendMessage(ChatColor.LIGHT_PURPLE+"You feel a magical presence get inserted into your inventory."); - }*/ - - - if (this.plugin.PlayerinJob(p, "Enchanter")) { - if (this.plugin.getJobLv("Enchanter", p)>=10) { - e.setExpLevelCost((int)(e.getExpLevelCost()*0.75)); - if (e.getItem().getType()==Material.BOW) { - int enchants[] = {48,49,50,51}; - for (int j=0;j ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i entry : map.entrySet()) { - if (this.plugin.getJobLv("Enchanter", p)>=20) { - if (entry.getKey().getMaxLevel() ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i ourLore = new ArrayList(); - if (e.getItem().hasItemMeta() && e.getItem().getItemMeta().getLore()!=null) { //Check the lore for any weak item conflicts. - List thelore = e.getItem().getItemMeta().getLore(); - for (int i=0;i=5) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Old time: "+e.getBurnTime()); - e.setBurnTime(e.getBurnTime()*2); - //Bukkit.getPlayer("sigonasr2").sendMessage("Doubled the furnace's burn time. New time: "+e.getBurnTime()); - } - } - - @EventHandler - public void onFurnaceSmelt(FurnaceSmeltEvent e) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Current time: "+((Furnace)e.getBlock().getState()).getBurnTime()); - //Look for an owner to this furnace. - String owner=""; - for (int i=0;i=20 && crafteditem) { - ItemStack result = e.getResult(); - result.setAmount(result.getAmount()+1); - e.setResult(result); - } - } - } - - @EventHandler - public void onCreatureInteract(PlayerInteractEntityEvent e) { - Player p = e.getPlayer(); - //When right-clicked on, check if it already exists in the entity list. - boolean contains=false; - int slot=0; - for (int i=0;i=20) { - Cow a = (Cow)e.getRightClicked(); - if (a.canBreed()) { - if (Math.random()<=0.50) { - p.getItemInHand().setAmount(p.getItemInHand().getAmount()); - } - } - } - //See if it exists already. - boolean contains_uuid=false; - String finalstring = ""; - if (this.plugin.getConfig().getString("fed.mobs").length()>4) { - String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); - //p.sendMessage("Mobs list length: "+mobslist.length); - for (int i=0;i=20) { - Sheep a = (Sheep)e.getRightClicked(); - if (a.canBreed()) { - if (Math.random()<=0.50) { - p.getItemInHand().setAmount(p.getItemInHand().getAmount()); - } - } - } - //See if it exists already. - boolean contains_uuid=false; - String finalstring = ""; - if (this.plugin.getConfig().getString("fed.mobs").length()>4) { - String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); - //p.sendMessage("Mobs list length: "+mobslist.length); - for (int i=0;i=20) { - Pig a = (Pig)e.getRightClicked(); - if (a.canBreed()) { - if (Math.random()<=0.50) { - p.getItemInHand().setAmount(p.getItemInHand().getAmount()); - } - } - } - //See if it exists already. - boolean contains_uuid=false; - String finalstring = ""; - if (this.plugin.getConfig().getString("fed.mobs").length()>4) { - String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); - //p.sendMessage("Mobs list length: "+mobslist.length); - for (int i=0;i=20) { - Chicken a = (Chicken)e.getRightClicked(); - if (a.canBreed()) { - if (Math.random()<=0.50) { - p.getItemInHand().setAmount(p.getItemInHand().getAmount()); - } - } - } - //See if it exists already. - boolean contains_uuid=false; - String finalstring = ""; - if (this.plugin.getConfig().getString("fed.mobs").length()>4) { - String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); - //p.sendMessage("Mobs list length: "+mobslist.length); - for (int i=0;i=20) { - Wolf a = (Wolf)e.getRightClicked(); - if (a.canBreed()) { - if (Math.random()<=0.50) { - p.getItemInHand().setAmount(p.getItemInHand().getAmount()); - } - } - } - //See if it exists already. - boolean contains_uuid=false; - String finalstring = ""; - if (this.plugin.getConfig().getString("fed.mobs").length()>4) { - String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); - //p.sendMessage("Mobs list length: "+mobslist.length); - for (int i=0;i=20) { - Ocelot a = (Ocelot)e.getRightClicked(); - if (a.canBreed()) { - if (Math.random()<=0.50) { - p.getItemInHand().setAmount(p.getItemInHand().getAmount()); - } - } - } - //See if it exists already. - boolean contains_uuid=false; - String finalstring = ""; - if (this.plugin.getConfig().getString("fed.mobs").length()>4) { - String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); - ////p.sendMessage("Mobs list length: "+mobslist.length); - for (int i=0;i=20) { - Horse a = (Horse)e.getRightClicked(); - if (a.canBreed()) { - if (Math.random()<=0.50) { - p.getItemInHand().setAmount(p.getItemInHand().getAmount()); - } - } - } - //This is a special entity and won't be added to the list of animals to despawn for now. - } - } - } - - @EventHandler - public void onShearEntity(PlayerShearEntityEvent e) { - Player p = e.getPlayer(); - if (this.plugin.PlayerinJob(p, "Breeder")) { - if (e.getEntity().getType()==EntityType.SHEEP) { - this.plugin.gainMoneyExp(p,"Breeder",0.002,0.2); - } - if (e.getEntity().getType()==EntityType.MUSHROOM_COW) { - this.plugin.gainMoneyExp(p,"Breeder",0.005,1); - } - } - if (e.getEntity().getType()==EntityType.MUSHROOM_COW) { - Bukkit.getWorld("world").spawnEntity(e.getEntity().getLocation(), EntityType.COW); - } - Bukkit.getWorld("world").spawnEntity((Location) e.getEntity(), EntityType.COW); - } - - @EventHandler - public void onSheepDye(SheepDyeWoolEvent e) { - int slot=-1; - Player p=null; - for (int i=0;i=10) { - e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 0, true)); - } - } else { - if (this.plugin.PlayerinJob(e.getPlayer(),"Hunter") && this.plugin.getJobLv("Hunter", e.getPlayer())>=10) { - if (e.getPlayer().hasPotionEffect(PotionEffectType.INVISIBILITY)) { - try { - Collection effects = e.getPlayer().getActivePotionEffects(); - for (PotionEffect nextpotioneffect : effects) { - if (nextpotioneffect.getType().getName().compareTo("INVISIBILITY")==0 && nextpotioneffect.getDuration()>24000) { - //This is definitely not a potion given to you. - e.getPlayer().removePotionEffect(PotionEffectType.INVISIBILITY); - break; - } - } - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible for a hunter while toggling sneak mode."); - } - } - } - } - } - - public String healthbar(double curHP,double maxHP) { - //笆�笆� - int bits=(int)(Math.ceil(curHP/maxHP*10)); - String bar=" "; - if (bits>6) { - bar+=ChatColor.GREEN+""; - } else - if (bits>3) { - bar+=ChatColor.YELLOW+""; - } else - { - bar+=ChatColor.RED+""; - } - for (int i=0;i6) { - bar+=ChatColor.GREEN+""; - } else - if (bits>3) { - bar+=ChatColor.YELLOW+""; - } else - { - bar+=ChatColor.RED+""; - } - } else { - if (bits>6) { - bar+=ChatColor.DARK_GREEN+""; - } else - if (bits>3) { - bar+=ChatColor.GOLD+""; - } else - { - bar+=ChatColor.DARK_RED+""; - } - } - for (int i=0;i newlore = p.getInventory().getArmorContents()[i].getItemMeta().getLore(); - for (int j=0;j=5) { - //p.sendMessage("Explorer speed buff set."); - newplayer.setBaseSpd(1); - } - if (this.plugin.PlayerinJob(p, "Hunter") && this.plugin.getJobLv("Hunter", p)>=20) { - //p.sendMessage("Explorer speed buff set."); - newplayer.setBaseSpd(newplayer.base_spdlv+1); - } - //Bukkit.getPlayer("sigonasr2").sendMessage("Got to here."); - newplayer.updatePlayerSpd(); - this.plugin.SPEED_CONTROL.add(newplayer); - //Bukkit.getPlayer("sigonasr2").sendMessage("Got to here."); - Iterator players = Bukkit.getWhitelistedPlayers().iterator(); - boolean playerwhitelisted=false; - String playerslist = ""; - while (players.hasNext()) { - if (playerslist!="") { - playerslist += ","; - } - String name = players.next().getName(); - playerslist += name; - if (name.compareToIgnoreCase(p.getName())==0) { - playerwhitelisted=true; - } - } - /* - //Boss platform is created +,+ coordinates from the location specified. - File file = new File("plugins/WorldEdit/schematics/boss.schematic"); - if (file.exists()) { - try { - com.sk89q.worldedit.Vector v = new com.sk89q.worldedit.Vector(p.getLocation().getX()-8, p.getLocation().getY(), p.getLocation().getZ()-8); - World worldf = Bukkit.getWorld("world"); - BukkitWorld BWf = new BukkitWorld(worldf); - EditSession es = new EditSession(BWf, 2000000); - CuboidClipboard c1 = SchematicFormat.MCEDIT.load(file); - c1.place(es, v, true); - } catch (DataException ex) { - Bukkit.getLogger().warning("DataException while trying to create structure."); - } catch (IOException ex) { - Bukkit.getLogger().warning("IOException while trying to create structure."); - } catch (MaxChangedBlocksException ex) { - Bukkit.getLogger().warning("MaxChangedBlocksException while trying to create structure."); - } - } else { - Bukkit.getLogger().warning(("File does not exist.")); - } - */ - //System.out.println("Whitelisted Players: "+playerslist); - //System.out.println("Maximum Air: "+p.getMaximumAir()); - if (!this.plugin.getAccountsConfig().contains(p.getName())) { - //This is a brand new player. - Main.economy.withdrawPlayer(p.getName(), Main.economy.getBalance(p.getName())); - Main.economy.depositPlayer(p.getName(), 70); - this.plugin.getAccountsConfig().set(p.getName() + ".status", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(this.plugin.getConfig().getDouble("start-balance"))); - this.plugin.getAccountsConfig().set(p.getName() + ".revived", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".spleefrating", Double.valueOf(1000.0d)); - this.plugin.getAccountsConfig().set(p.getName() + ".spleefwins", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".spleeflosses", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job1", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job1lv", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job1exp", Double.valueOf(0.0d)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job2", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job2lv", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job2exp", Double.valueOf(0.0d)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job3", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job3lv", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job3exp", Double.valueOf(0.0d)); - 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() + ".stats.stat1", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat2", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat3", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat4", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat5", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat6", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat7", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat8", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat9", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat10", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify1", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify2", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify3", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify4", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify5", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify6", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest1", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest2", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest3", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest4", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest5", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest6", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest7", 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.chest10", Boolean.valueOf(false)); - this.plugin.saveAccountsConfig(); - System.out.println("[BankEconomy] Bank account created for " + p.getName() + "."); - if (playerwhitelisted) { - Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE+"New player "+ChatColor.ITALIC+ChatColor.GOLD+p.getName()+ChatColor.RESET+ChatColor.LIGHT_PURPLE+" has joined the game."); - //Give a tutorial book and starting items to this user. - p.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); - p.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE)); - p.getInventory().addItem(new ItemStack(Material.COOKED_CHICKEN,16)); - p.getInventory().addItem(new ItemStack(Material.TORCH,32)); - p.getInventory().addItem(new ItemStack(Material.LEATHER_HELMET)); - p.getInventory().addItem(new ItemStack(Material.LEATHER_CHESTPLATE)); - p.getInventory().addItem(new ItemStack(Material.LEATHER_LEGGINGS)); - p.getInventory().addItem(new ItemStack(Material.LEATHER_BOOTS)); - p.getInventory().addItem(new ItemStack(Material.MINECART)); - } - } else { - DecimalFormat df = new DecimalFormat("#0.00"); - p.sendMessage(ChatColor.DARK_AQUA+"For a list of all changes made to this server, visit: http://z-gamers.net/changelog.html"); - p.sendMessage("----------------------------"); - p.sendMessage(ChatColor.YELLOW+"Current Money Balance: $ "+df.format(Main.economy.bankBalance(p.getName()).balance)+", Bank Balance: $"+df.format(this.plugin.getAccountsConfig().getDouble(p.getName()+".money"))); - //Update account information for the stat point update. - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".stats.stat1")) { - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat1", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat2", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat3", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat4", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat5", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat6", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat7", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat8", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat9", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat10", Integer.valueOf(0)); - this.plugin.saveAccountsConfig(); - System.out.println("Updated " + p.getName() + "'s data with stat point update."); - } - //Update account information for notification settings. - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".settings.notify1")) { - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify1", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify2", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify3", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify4", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify5", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify6", Boolean.valueOf(false)); - this.plugin.saveAccountsConfig(); - System.out.println("Updated " + p.getName() + "'s data with nofitications update."); - } - if (this.plugin.getConfig().getBoolean("halloween-enabled")) { - //Update account information for Halloween book update. - PlayerInventory pi = p.getInventory(); - boolean full=true; - for (int i=0;i0) { - p.setMaximumAir(300+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName() + ".stats.stat10"))*20); - } - if (p.getLocation().getY()>78.0d && p.getLocation().getZ()>53.0d && p.getLocation().getZ()<64.0d && p.getLocation().getX()<1627.0d && p.getLocation().getX()>1616.0d) { - //In a spleef zone. Kick this player out. - Location newloc = p.getLocation(); - newloc.setX(1622.5d); - newloc.setY(87.0d); - newloc.setZ(51.65d); - p.teleport(newloc); - this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(false)); - } - } - boolean found=false; - for (int i=0;i effects = p.getActivePotionEffects().iterator(); - //Figure out potion effects when player joins. - while (effects.hasNext()) { - PotionEffect nexteffect = effects.next(); - //Bukkit.getLogger().info(p.getName()+" w/buff "+nexteffect.getType().getName()+" for "+nexteffect.getDuration()/20+" sec."); - /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { - p.removePotionEffect(PotionEffectType.JUMP); - p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); - }*/ - effects.remove(); - } - - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to slow down player."); - } - updateTopSPLEEFSigns(); - } - - /* - @EventHandler - public void onPortalEnter(PlayerTeleportEvent e) { - final Player p = e.getPlayer(); - if (e.getFrom().getWorld()==Bukkit.getWorld("world")) { - if (e.getFrom().distanceSquared(new Location(Bukkit.getWorld("world"),1606d,66d,-365d))<900) { - //This is a player trying to enter a portal. Verify if they have selected their ultimate. - if (this.plugin.getAccountsConfig().contains(e.getPlayer().getName()+".jobs.ultimate")) { - //Check if this job's ultimate level is high enough. - if (this.plugin.getJobLv(this.plugin.getAccountsConfig().getString(e.getPlayer().getName()+".jobs.ultimate"), e.getPlayer())>=40) { - //Allow this teleport. - //e.setTo(new Location(Bukkit.getWorld("world"),-8990,68,-4)); - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - p.getPlayer().teleport(new Location(Bukkit.getWorld("world"),-8990,68,-4)); - } - },5); - } else { - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - p.getPlayer().teleport(new Location(Bukkit.getWorld("world"),1606d,66d,-365d)); - } - },5); - } - } - } - } - }*/ - - @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")65) { - //Bukkit.broadcastMessage("PlayerListener: HP too high for ID "+id+". HP was "+hp); - } - return hp; - } - - @EventHandler - public void onBlockGrow(BlockGrowEvent e) { - int x1,y1,z1,x2=0,y2=0,z2=0; - x1=e.getBlock().getX(); - y1=e.getBlock().getY(); - z1=e.getBlock().getZ(); - Player[] plist= Bukkit.getOnlinePlayers(); - for (int i=0;i=20) { - if (Math.random()<=0.30) { - if (e.getBlock().getType()==Material.POTATO || e.getBlock().getType()==Material.CARROT || e.getBlock().getType()==Material.CROPS || e.getBlock().getType()==Material.MELON_STEM || e.getBlock().getType()==Material.PUMPKIN_STEM) { - if (e.getBlock().getData()<7) { - e.getBlock().setData((byte) (e.getBlock().getData()+1)); - } - } - if (e.getBlock().getType()==Material.COCOA) { - if (e.getBlock().getData()<8) { - e.getBlock().setData((byte) (e.getBlock().getData()+4)); - } - } - if (e.getBlock().getType()==Material.NETHER_WARTS) { - if (e.getBlock().getData()<3) { - e.getBlock().setData((byte) (e.getBlock().getData()+1)); - } - } - } - } - } - } - } - } - - private boolean isPermanentSpawn(CreatureSpawnEvent e, LivingEntity l) { - //Will return true if it's something that is not allowed to despawn. False if we are allowed to get rid of it. - //Basically this is the control that will determine if the mob stays or goes, before further processing is done. - //If the mob is identified as a special mob... - - EntityType type = l.getType(); - - //heightmodifier determines if it's a super tall chunk or a normal sized one. - int heightmodifier=0; - if (Bukkit.getWorld("world").getHighestBlockYAt(l.getLocation())>=96) { - heightmodifier=126; - } else { - heightmodifier=63; - } - - //Handle every special entity's spawning properties in here. - switch (type) { - case CREEPER:{ - if (l.getLocation().getY()<=40 && Math.random()<=0.08+((heightmodifier-l.getLocation().getY())*0.01d)) { - if (Math.random()<=0.35) { - l.setCustomName(ChatColor.YELLOW+"Explosive Creeper"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*1.25d); - l.setHealth(l.getMaxHealth()); - } else - if (Math.random()<=0.15) { - l.setCustomName(ChatColor.GOLD+"Explosive Creeper II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*1.75d); - l.setHealth(l.getMaxHealth()); - } else - if (Math.random()<=0.35) { - l.setCustomName(ChatColor.YELLOW+"Destructive Creeper"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*1.25d); - l.setHealth(l.getMaxHealth()); - } else { - l.setCustomName(ChatColor.GOLD+"Destructive Creeper II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*1.75d); - l.setHealth(l.getMaxHealth()); - } - } - }break; - case ARROW: { - }break; - case BAT: { - }break; - case BLAZE: { - }break; - case BOAT: { - }break; - case CAVE_SPIDER: { - }break; - case CHICKEN: { - }break; - case COMPLEX_PART: { - }break; - case COW: { - }break; - case DROPPED_ITEM: { - }break; - case EGG: { - }break; - case ENDERMAN: { - }break; - case ENDER_CRYSTAL: { - }break; - case ENDER_DRAGON: { - }break; - case ENDER_PEARL: { - }break; - case ENDER_SIGNAL: { - }break; - case EXPERIENCE_ORB: { - }break; - case FALLING_BLOCK: { - }break; - case FIREBALL: { - }break; - case FIREWORK: { - }break; - case FISHING_HOOK: { - }break; - case GHAST: { - }break; - case GIANT: { - }break; - case HORSE: { - }break; - case IRON_GOLEM: { - }break; - case ITEM_FRAME: { - }break; - case LEASH_HITCH: { - }break; - case LIGHTNING: { - }break; - case MAGMA_CUBE: { - }break; - case MINECART: { - }break; - case MINECART_CHEST: { - }break; - case MINECART_FURNACE: { - }break; - case MINECART_HOPPER: { - }break; - case MINECART_MOB_SPAWNER: { - }break; - case MINECART_TNT: { - }break; - case MUSHROOM_COW: { - }break; - case OCELOT: { - }break; - case PAINTING: { - }break; - case PIG: { - }break; - case PIG_ZOMBIE: { - }break; - case PLAYER: { - }break; - case PRIMED_TNT: { - }break; - case SHEEP: { - }break; - case SILVERFISH: { - }break; - case SKELETON: { - if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { - if (Math.random()<=0.85) { - l.setCustomName(ChatColor.YELLOW+"Sniper"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()/2); - l.setHealth(l.getMaxHealth()); - } else { - l.setCustomName(ChatColor.GOLD+"Sniper II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()/4); - l.setHealth(l.getMaxHealth()); - } - } - }break; - case SLIME: { - }break; - case SMALL_FIREBALL: { - }break; - case SNOWBALL: { - }break; - case SNOWMAN: { - }break; - case SPIDER: { - if (Math.random()<=0.08+((heightmodifier-l.getLocation().getY())*0.01d)) { - if (Math.random()<=0.35) { - l.setCustomName(ChatColor.YELLOW+"Venomous Spider"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()); - l.setHealth(l.getMaxHealth()); - } else - if (Math.random()<=0.15) { - l.setCustomName(ChatColor.GOLD+"Venomous Spider II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*1.5); - l.setHealth(l.getMaxHealth()); - } else - if (Math.random()<=0.35) { - l.setCustomName(ChatColor.YELLOW+"Snaring Spider"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*1.5); - l.setHealth(l.getMaxHealth()); - } else { - l.setCustomName(ChatColor.GOLD+"Snaring Spider II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()*2); - l.setHealth(l.getMaxHealth()); - } - } - }break; - case SPLASH_POTION: { - }break; - case SQUID: { - }break; - case THROWN_EXP_BOTTLE: { - }break; - case UNKNOWN: { - }break; - case VILLAGER: { - }break; - case WEATHER: { - }break; - case WITCH: { - }break; - case WITHER: { - }break; - case WITHER_SKULL: { - }break; - case WOLF: { - }break; - case ZOMBIE: { - if (l.getHealth()<65) { - if (l.getLocation().getY()<=35 && Math.random()<=0.15) { - if (Math.random()<=0.85) { - l.setCustomName(ChatColor.YELLOW+"Charge Zombie"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()+5); - l.setHealth(l.getMaxHealth()); - } else { - l.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - l.setCustomNameVisible(false); - //l.setCustomNameVisible(true); - l.setMaxHealth(l.getMaxHealth()+20); - l.setHealth(l.getMaxHealth()); - } - } else { - if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { - if (Math.random()<=0.25) { - l.setCustomName(ChatColor.GRAY+"Zombie Ninja"); - l.setCustomNameVisible(false); - l.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 0, true)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 2, true)); - //l.setCustomNameVisible(true); - //A Zombie Ninja will not wear armor to stay hidden. But may carry a sword. - l.getEquipment().setChestplate(new ItemStack(Material.AIR)); - l.getEquipment().setBoots(new ItemStack(Material.AIR)); - l.getEquipment().setLeggings(new ItemStack(Material.AIR)); - l.getEquipment().setHelmet(new ItemStack(Material.AIR)); - Zombie g = (Zombie)l; - g.setBaby(true); - l.setMaxHealth(l.getMaxHealth()*0.65d); - l.setHealth(l.getMaxHealth()); - } - } - } - } else { - return false; - } - //If it's a super zombie, we're going to despawn it now. - }break; - default: { - } - } - - //This allows bosses to spawn. - if (e.getEntity().getType()==EntityType.ENDER_DRAGON || e.getEntity().getType()==EntityType.WITHER || - e.getEntity() instanceof Golem || e.getEntity() instanceof Animals) { - return true; - } - - //Custom bosses - if (l.getCustomName()!=null && (l.getCustomName().contains(ChatColor.DARK_PURPLE+"") || l.getCustomName().contains(ChatColor.DARK_AQUA+"Polymorphed Creature"))) { - return true; - } - - //Special reasons that should always happen. - if (e.getSpawnReason()==SpawnReason.SPAWNER || e.getSpawnReason()==SpawnReason.BUILD_IRONGOLEM || e.getSpawnReason()==SpawnReason.BREEDING || - e.getSpawnReason()==SpawnReason.BUILD_SNOWMAN || e.getSpawnReason()==SpawnReason.BUILD_WITHER || e.getSpawnReason()==SpawnReason.LIGHTNING || - e.getSpawnReason()==SpawnReason.SPAWNER_EGG || e.getSpawnReason()==SpawnReason.VILLAGE_DEFENSE || e.getSpawnReason()==SpawnReason.VILLAGE_INVASION) { - return true; - } - - return false; //If we got down to here, allow this particular mob to spawn. - - } - - - @EventHandler - public void onCreatureSpawn(CreatureSpawnEvent e) { - if (isPermanentSpawn(e, e.getEntity())) { - e.getEntity().setRemoveWhenFarAway(false); - - //If this is a boss that spawns from a command block, make sure the command blocks are removed. - if (e.getEntity().getCustomName()!=null && (e.getEntity().getCustomName().contains(ChatColor.DARK_PURPLE+"") || e.getEntity().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++) { - if (Bukkit.getWorld("world").getBlockAt(e.getEntity().getLocation().add(i,j,k)).getType()==Material.COMMAND) { - Bukkit.getWorld("world").getBlockAt(e.getEntity().getLocation().add(i,j,k)).setType(Material.COBBLESTONE); - } - } - } - } - } - - //Give the wither bonuses. - if (e.getEntity() instanceof Wither) { - Wither w = (Wither)e.getEntity(); - w.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,999999,3)); - w.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,999999,3)); - w.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING,999999,3)); - w.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST,999999,40)); - w.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - w.setCustomName(ChatColor.GOLD+""+ChatColor.BOLD+"Mega Wither"); - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule mobGriefing true"); - } - - } else { - float groupmult=1.0f; //Change this to modify the global grouping multiplier. - int maxgroup=(int)(10*groupmult); - double chancer=0.10d; - double despawnchancer=0.25d; - - if (e.getEntity().getHealth()>65 && e.getEntity().getCustomName()==null /*Meaning it's not a special mob.*/) { - e.getEntity().remove(); //Too much HP. Nothing should have this much. - return; - } - - boolean allow=false; //If this is set to true, it will not be marked for removal. - - //We will now determine if it is allowed to spawn due to being next to a boss or mob spawner. - List entities = e.getEntity().getWorld().getEntities(); - for (int i=0;i=96) { - //This is a tall world. - if (e.getEntity().getLocation().getBlockY()<=104) { - for (int i=104-e.getEntity().getLocation().getBlockY();i>0;i--) { - despawnchancer/=1.0175d; - } - } - } else { - //This is a short world. - if (e.getEntity().getLocation().getBlockY()<=52) { - for (int i=52-e.getEntity().getLocation().getBlockY();i>0;i--) { - despawnchancer/=1.025d; - } - } - } - - if (spawners==0 && (Math.random()<=despawnchancer || (torches+glowstone>=3))) { - allow=false; - } else { - allow=true; - } - - - int totallvs=0; - List nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); - //Filter out all unrelated e.getEntity() types. - for (int k=0;kmaxgroup) { - allow=false; //Too many mobs, can't have more. - } - - if (!allow) { - //This is our chance to despawn it if we must. - e.getEntity().remove(); - } else { - //They will be allowed to spawn. Increase their base HP. - e.getEntity().setMaxHealth(e.getEntity().getMaxHealth()*1.15d); - e.getEntity().setHealth(e.getEntity().getMaxHealth()); - - - if (e.getEntity().getCustomName()!=null && e.getEntity().getCustomName().equals(ChatColor.GOLD+"Charge Zombie II")) { - //Destroy an area around itself. - for (int k=-4;k<5;k++) { - for (int j=-4;j<5;j++) { - for (int m=-1;m<5;m++) { - if (Math.random()<=1.00-((j+4)*0.05d)) { - Location checkloc = e.getEntity().getLocation().add(k,m,j); - Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); - if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER || bl.getType()!=Material.COMMAND || bl.getType()!=Material.MOSSY_COBBLESTONE) { - bl.breakNaturally(); - } - } - } - } - } - } - - - if (e.getEntity().getType()==EntityType.ZOMBIE || e.getEntity().getType()==EntityType.PIG_ZOMBIE || e.getEntity().getType()==EntityType.SKELETON) { - //Modify the difficulty of the mobs based on who is around. - EntityEquipment inven = e.getEntity().getEquipment(); - if (inven!=null) { - inven.setBootsDropChance(0.02f); - inven.setChestplateDropChance(0.02f); - inven.setLeggingsDropChance(0.02f); - inven.setHelmetDropChance(0.02f); - inven.setItemInHandDropChance(0.02f); - if (e.getEntity().getType()==EntityType.SKELETON) { - inven.setItemInHand(new ItemStack(Material.BOW)); - } - } - - double levelsmult=1.0; - if (totallvs>20*levelsmult) { - if (totallvs<40*levelsmult) { - //Sometimes wear leather armor. Only for Skeletons and Zombies. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - if (Math.random()>=0.15) { - l.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); - if (Math.random()>=0.25) { - l.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); - if (Math.random()>=0.5) { - l.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); - if (Math.random()>=0.8) { - l.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); - } - } - } - } - } - } else - if (totallvs<60*levelsmult) { - //Wear leather armor a bit more often. Sometimes a chain piece here or there. Include a Wooden sword usually. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - if (e.getEntity().getType()==EntityType.ZOMBIE) { - if (Math.random()<=0.65) { - l.getEquipment().setItemInHand(new ItemStack(Material.WOOD_SWORD)); - } - } - if (e.getEntity().getType()==EntityType.SKELETON) { - if (Math.random()<=0.65) { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); - l.getEquipment().setItemInHand(new_bow); - } - } - if (Math.random()>=0.25) { - if (Math.random()<=0.75) { - l.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); - } else { - l.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); - } - if (Math.random()>=0.45) { - if (Math.random()<=0.75) { - l.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); - } else { - l.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); - } - if (Math.random()>=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); - } else { - l.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); - } - if (Math.random()>=0.95) { - if (Math.random()<=0.75) { - l.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); - } else { - l.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); - } - } - } - } - } - } - } else - if (totallvs<80*levelsmult) { - //Wear chainmail armor a bit more often. Sometimes an iron piece here or there. Include an Iron sword sometimes, a wooden one usually. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - if (e.getEntity().getType()==EntityType.ZOMBIE) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setItemInHand(new ItemStack(Material.WOOD_SWORD)); - } else { - l.getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD)); - } - } - } else - if (e.getEntity().getType()==EntityType.SKELETON) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); - l.getEquipment().setItemInHand(new_bow); - } else { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); - l.getEquipment().setItemInHand(new_bow); - } - } - } else { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,0)); - } - if (Math.random()>=0.25) { - if (Math.random()<=0.75) { - l.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); - } else { - l.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); - } - if (Math.random()>=0.45) { - if (Math.random()<=0.75) { - l.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); - } else { - l.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); - } - if (Math.random()>=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); - } else { - l.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); - } - if (Math.random()>=0.95) { - if (Math.random()<=0.75) { - l.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); - } else { - l.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); - } - } - } - } - } - } - } else - if (totallvs<100*levelsmult) { - //Wear iron armor a bit more often. Sometimes a diamond piece here or there. Include a Diamond sword sometimes, an iron one usually. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - if (e.getEntity().getType()==EntityType.ZOMBIE) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD)); - } else { - l.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); - } - } - } else - if (e.getEntity().getType()==EntityType.SKELETON) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 2); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); - l.getEquipment().setItemInHand(new_bow); - } else { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 3); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); - l.getEquipment().setItemInHand(new_bow); - } - } - } else { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); - } else { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); - //l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,0)); - } - } - } - if (Math.random()>=0.25) { - if (Math.random()<=0.75) { - l.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); - } else { - l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - } - if (Math.random()>=0.45) { - if (Math.random()<=0.75) { - l.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); - } else { - l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - } - if (Math.random()>=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); - } else { - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } - if (Math.random()>=0.95) { - if (Math.random()<=0.75) { - l.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); - } else { - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } - } - } - } - } - } - } else - if (totallvs<120*levelsmult) { - //Wear diamond armor a bit more often. Sometimes an enchanted diamond piece here or there. Include a Golden sword sometimes, a diamond one usually. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - if (e.getEntity().getType()==EntityType.ZOMBIE) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); - } else { - l.getEquipment().setItemInHand(new ItemStack(Material.GOLD_SWORD)); - } - } - } else - if (e.getEntity().getType()==EntityType.SKELETON) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 3); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); - l.getEquipment().setItemInHand(new_bow); - } else { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 4); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); - l.getEquipment().setItemInHand(new_bow); - } - } - } else { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - } else { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - //l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,0)); - } - } - } - if (Math.random()>=0.25) { - if (Math.random()<=0.75) { - l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); - l.getEquipment().setChestplate(enchanted); - } - if (Math.random()>=0.45) { - if (Math.random()<=0.75) { - l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); - l.getEquipment().setLeggings(enchanted); - } - if (Math.random()>=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } - if (Math.random()>=0.95) { - if (Math.random()<=0.75) { - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*1.0d)+1); - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } - } - } - } - } - } - } else - if (totallvs<140*levelsmult) { - //Well dang, your party's huge and OP. - //Wear diamond armor almost always. Enchanted diamond pieces here and there. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - if (e.getEntity().getType()==EntityType.ZOMBIE) { - if (Math.random()<=0.80) { - if (Math.random()<=0.75) { - ItemStack enchanted = new ItemStack(Material.DIAMOND_SWORD); - //enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); - } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setItemInHand(enchanted); - } else { - ItemStack enchanted = new ItemStack(Material.GOLD_SWORD); - //enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); - } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*4.0d)+1); - } - l.getEquipment().setItemInHand(enchanted); - } - } - } else - if (e.getEntity().getType()==EntityType.SKELETON) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 5); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 1); - l.getEquipment().setItemInHand(new_bow); - } else { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 4); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 2); - l.getEquipment().setItemInHand(new_bow); - } - } - } else { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,0)); - } else { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,2)); - //l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,1)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,0)); - } - } - } - if (Math.random()>=0.25) { - if (Math.random()<=0.75) { - l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*1.0d)+1); - } - l.getEquipment().setChestplate(enchanted); - } - if (Math.random()>=0.45) { - if (Math.random()<=0.75) { - l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setLeggings(enchanted); - } - if (Math.random()>=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } - if (Math.random()>=0.95) { - if (Math.random()<=0.75) { - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } - } - } - } - } - } - } else - if (totallvs<200*levelsmult) { - //Well dang, your party's huge and OP. - //Wear diamond armor almost always. Enchanted diamond pieces here and there. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - if (e.getEntity().getType()==EntityType.ZOMBIE) { - if (Math.random()<=0.80) { - if (Math.random()<=0.75) { - ItemStack enchanted = new ItemStack(Material.DIAMOND_SWORD); - //enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*3.0d)+1); - } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setItemInHand(enchanted); - } else { - ItemStack enchanted = new ItemStack(Material.GOLD_SWORD); - //enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*3.0d)+1); - } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setItemInHand(enchanted); - } - } - } else - if (e.getEntity().getType()==EntityType.SKELETON) { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 5); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 1); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 2); - l.getEquipment().setItemInHand(new_bow); - } else { - ItemStack new_bow = new ItemStack(Material.BOW); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 6); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2); - new_bow.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 3); - l.getEquipment().setItemInHand(new_bow); - } - } - } else { - if (Math.random()<=0.65) { - if (Math.random()<=0.75) { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,3)); - //l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); - } else { - ////l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,4)); - //l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,2)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); - } - } - } - if (Math.random()>=0.25) { - if (Math.random()<=0.75) { - l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*3.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*3.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*3.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setChestplate(enchanted); - } - if (Math.random()>=0.45) { - if (Math.random()<=0.75) { - l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*2.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*2.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setLeggings(enchanted); - } - if (Math.random()>=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*2.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*2.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } - if (Math.random()>=0.95) { - if (Math.random()<=0.75) { - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*2.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); - } - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } - } - } - } - } - } - } - else { - //Time to give it our all. - //Well dang, your party's huge and OP. - //Wear diamond armor almost always. Enchanted diamond pieces here and there. - if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity l = (LivingEntity) e.getEntity(); - //l.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST,999999,1)); - l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,999999,1)); - l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,999999,0)); - l.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,999999,0)); - //l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,999999,0)); - //l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,999999,1)); - if (e.getEntity().getType()==EntityType.ZOMBIE) { - if (Math.random()<=0.80) { - if (Math.random()<=0.75) { - ItemStack enchanted = new ItemStack(Material.DIAMOND_SWORD); - //enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); - } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*3.0d)+1); - } - l.getEquipment().setItemInHand(enchanted); - } else { - ItemStack enchanted = new ItemStack(Material.GOLD_SWORD); - //enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1); - } else { - enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*3.0d)+1); - } - l.getEquipment().setItemInHand(enchanted); - } - } - } - if (Math.random()>=0.25) { - if (Math.random()<=0.75) { - l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*3.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); - } - l.getEquipment().setChestplate(enchanted); - } - if (Math.random()>=0.45) { - if (Math.random()<=0.75) { - l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*3.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); - } - l.getEquipment().setLeggings(enchanted); - } - if (Math.random()>=0.65) { - if (Math.random()<=0.75) { - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*2.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*2.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1); - } - l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - } - if (Math.random()>=0.95) { - if (Math.random()<=0.75) { - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } else { - ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, (int)(Math.random()*4.0d)+1); - enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, (int)(Math.random()*4.0d)+1); - if (Math.random()<=0.5) { - enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*2.0d)+1); - } - l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } - } - } - } - } - } - } - } - } - } - } - if (e.getEntity().getType()==EntityType.EXPERIENCE_ORB) { - Bukkit.getWorld("world").spawnEntity(e.getEntity().getLocation(),e.getEntity().getType()); - } - if (e.getSpawnReason()==SpawnReason.BREEDING) { - //Spawn reason for later spawning. - //Check for this entity in list of animals that have been interacted with. - int slot=-1; - Player p=null; - String owner1="",owner2=""; - List checklist = e.getEntity().getNearbyEntities(3, 3, 3); - for (int i=0;inearby=e.getEntity().getNearbyEntities(25, 25, 25); - int countamount=0; - for (int i=0;i=10) { - if (Math.random()<=0.25 && countamount<50) { - Chicken newent = (Chicken)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.CHICKEN); - newent.setBaby(); - } else - if (Math.random()<=0.25 && countamount<50) { - Chicken newent = (Chicken)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.CHICKEN); - newent.setBaby(); - newent = (Chicken)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.CHICKEN); - newent.setBaby(); - } - } - } - if (e.getEntity().getType()==EntityType.PIG) { - this.plugin.gainMoneyExp(p,"Breeder",0.02*mult,4*mult); - if (this.plugin.getJobLv("Breeder", p)>=10) { - if (Math.random()<=0.25 && countamount<50) { - Pig newent = (Pig)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.PIG); - newent.setBaby(); - } else - if (Math.random()<=0.25 && countamount<50) { - Pig newent = (Pig)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.PIG); - newent.setBaby(); - newent = (Pig)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.PIG); - newent.setBaby(); - } - } - } - if (e.getEntity().getType()==EntityType.SHEEP) { - this.plugin.gainMoneyExp(p,"Breeder",0.02*mult,4*mult); - if (this.plugin.getJobLv("Breeder", p)>=10) { - if (Math.random()<=0.25 && countamount<50) { - Sheep newent = (Sheep)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.SHEEP); - newent.setBaby(); - newent.setColor(((Sheep)e.getEntity()).getColor()); - } else - if (Math.random()<=0.25 && countamount<50) { - Sheep newent = (Sheep)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.SHEEP); - newent.setBaby(); - newent.setColor(((Sheep)e.getEntity()).getColor()); - newent = (Sheep)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.SHEEP); - newent.setBaby(); - newent.setColor(((Sheep)e.getEntity()).getColor()); - } - } - } - if (e.getEntity().getType()==EntityType.COW) { - this.plugin.gainMoneyExp(p,"Breeder",0.03*mult,4*mult); - if (this.plugin.getJobLv("Breeder", p)>=10) { - if (Math.random()<=0.25 && countamount<50) { - Cow newent = (Cow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.COW); - newent.setBaby(); - } else - if (Math.random()<=0.25 && countamount<50) { - Cow newent = (Cow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.COW); - newent.setBaby(); - newent = (Cow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.COW); - newent.setBaby(); - } - } - } - if (e.getEntity().getType()==EntityType.OCELOT) { - this.plugin.gainMoneyExp(p,"Breeder",0.04*mult,8*mult); - if (this.plugin.getJobLv("Breeder", p)>=10) { - if (Math.random()<=0.25 && countamount<50) { - Ocelot newent = (Ocelot)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.OCELOT); - newent.setBaby(); - newent.setOwner(((Ocelot)e.getEntity()).getOwner()); - newent.setCatType(((Ocelot)e.getEntity()).getCatType()); - } else - if (Math.random()<=0.25 && countamount<50) { - Ocelot newent = (Ocelot)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.OCELOT); - newent.setBaby(); - newent.setOwner(((Ocelot)e.getEntity()).getOwner()); - newent.setCatType(((Ocelot)e.getEntity()).getCatType()); - newent = (Ocelot)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.OCELOT); - newent.setBaby(); - newent.setOwner(((Ocelot)e.getEntity()).getOwner()); - newent.setCatType(((Ocelot)e.getEntity()).getCatType()); - } - } - } - if (e.getEntity().getType()==EntityType.WOLF) { - this.plugin.gainMoneyExp(p,"Breeder",0.06*mult,10*mult); - if (this.plugin.getJobLv("Breeder", p)>=10) { - if (Math.random()<=0.25 && countamount<50) { - Wolf newent = (Wolf)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.WOLF); - newent.setBaby(); - newent.setOwner(((Wolf)e).getOwner()); - newent.setCollarColor(((Wolf)e.getEntity()).getCollarColor()); - } else - if (Math.random()<=0.25 && countamount<50) { - Wolf newent = (Wolf)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.WOLF); - newent.setBaby(); - newent.setOwner(((Wolf)e).getOwner()); - newent.setCollarColor(((Wolf)e.getEntity()).getCollarColor()); - newent = (Wolf)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.WOLF); - newent.setBaby(); - newent.setOwner(((Wolf)e).getOwner()); - newent.setCollarColor(((Wolf)e.getEntity()).getCollarColor()); - } - } - } - if (e.getEntity().getType()==EntityType.MUSHROOM_COW) { - this.plugin.gainMoneyExp(p,"Breeder",0.20*mult,16*mult); - if (this.plugin.getJobLv("Breeder", p)>=10) { - if (Math.random()<=0.25 && countamount<50) { - MushroomCow newent = (MushroomCow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.MUSHROOM_COW); - newent.setBaby(); - } else - if (Math.random()<=0.25 && countamount<50) { - MushroomCow newent = (MushroomCow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.MUSHROOM_COW); - newent.setBaby(); - newent = (MushroomCow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.MUSHROOM_COW); - newent.setBaby(); - } - } - } - if (e.getEntity().getType()==EntityType.HORSE) { - this.plugin.gainMoneyExp(p,"Breeder",0.30*mult,30*mult); - if (this.plugin.getJobLv("Breeder", p)>=10) { - if (Math.random()<=0.25 && countamount<50) { - Horse newent = (Horse)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.HORSE); - newent.setBaby(); - } else - if (Math.random()<=0.25 && countamount<50) { - Horse newent = (Horse)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.HORSE); - newent.setBaby(); - newent = (Horse)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.HORSE); - newent.setBaby(); - } - } - } - } - } - } - } - - @EventHandler - public void onBlockBreak(BlockBreakEvent e) { - Player p = e.getPlayer(); - //p.sendMessage("Block broke."); - //p.sendMessage("Has name: "+p.getItemInHand().getItemMeta().hasDisplayName()); - //p.sendMessage("Name is: "+p.getItemInHand().getItemMeta().getDisplayName()); - int myData=this.plugin.getPlayerDataSlot(p); - boolean has_silktouch=false; - if (!p.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) { - has_silktouch=false; - } else { - has_silktouch=true; - } - if (p!=null) { - if (e.getBlock().getType()==Material.COMMAND) { - e.setCancelled(true); - return; - } - if (e.getBlock().getType()==Material.STONE && p.getLocation().getY()<=50) { - //We are mining underground. - //Check if we need to spawn Charge Zombie II's. - //Find our player data. - int pdata_slot=0; - for (int i=0;i-6;j--) { - for (int k=2;k>-1;k--) { - for (int l=5;l>-6;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(20+j,k,spread+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { - torch1=true; - } - } - } - } - if (!torch1) { - int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; - for (int j=lb1;j>ub1;j--) { - for (int k=2;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(10+j,k,spread+l)); - if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - e1 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(10,0,spread), EntityType.ZOMBIE); - } - torch2=false; - spread = (int)(Math.random()*10); - for (int j=5;j>-6;j--) { - for (int k=2;k>-1;k--) { - for (int l=5;l>-6;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(-10+j,k,spread+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { - torch2=true; - } - } - } - } - if (!torch2) { - int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; - for (int j=lb1;j>ub1;j--) { - for (int k=2;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(-10+j,k,spread+l)); - if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - e2 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(-10,0,spread), EntityType.ZOMBIE); - } - spread = (int)(Math.random()*10); - for (int j=5;j>-6;j--) { - for (int k=2;k>-1;k--) { - for (int l=5;l>-6;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,10+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { - torch3=true; - } - } - } - } - if (!torch3) { - int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; - for (int j=lb1;j>ub1;j--) { - for (int k=2;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,10+l)); - if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - e3 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(spread,0,10), EntityType.ZOMBIE); - } - spread = (int)(Math.random()*10); - for (int j=5;j>-6;j--) { - for (int k=2;k>-1;k--) { - for (int l=5;l>-6;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,-10+l)); - if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { - torch4=true; - } - } - } - } - if (!torch4) { - int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; - for (int j=lb1;j>ub1;j--) { - for (int k=2;k>-1;k--) { - for (int l=lb2;l>-ub2;l--) { - Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,-10+l)); - if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { - b.setType(Material.AIR); - } - } - } - } - e4 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(spread,0,-20), EntityType.ZOMBIE); - } - if (!torch1) { - Zombie z1 = (Zombie)e1; - z1.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z1.setCustomNameVisible(false); - z1.setTarget(p); - } - if (!torch2) { - Zombie z2 = (Zombie)e2; - z2.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z2.setCustomNameVisible(false); - z2.setTarget(p); - } - if (!torch3) { - Zombie z3 = (Zombie)e3; - z3.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z3.setCustomNameVisible(false); - z3.setTarget(p); - } - if (!torch4) { - Zombie z4 = (Zombie)e4; - z4.setCustomName(ChatColor.GOLD+"Charge Zombie II"); - z4.setCustomNameVisible(false); - z4.setTarget(p); - } - } - } - if (e.getBlock().getType()==Material.EMERALD_ORE || - e.getBlock().getType()==Material.DIAMOND_ORE || - e.getBlock().getType()==Material.GOLD_ORE || - e.getBlock().getType()==Material.IRON_ORE) { - /* - if (Math.random()<=0.01) { - //1% chance of getting a book. - ItemStack book = new ItemStack(Material.WRITTEN_BOOK); - BookMeta bookdata = (BookMeta)book.getItemMeta(); - int choosebook = (int)(Math.random()*9.0d); - switch (choosebook) { - case 0:{ - bookdata.setAuthor("Steve"); - bookdata.setTitle("Dangers of the Nether"); - bookdata.addPage("Dangers of the Nether\n"+ChatColor.ITALIC+" by Steve\n======\n"+ChatColor.RESET+"It didn't take me long to realize where we were. It was dangerous, very hot, and lots of torturous screams could be heard everywhere. I barely had time","to take it all in before a huge fireball was shot in my direction. I quickly looked to my side to find a convenient safe passage and hid there for a few minutes. I guess I was in there longer than I thought, I ended","up falling asleep and waking up to notice there was something scary on the wall.\n\n"+ChatColor.ITALIC+"\"TURN AND LEAVE NOW. DANGEROUS TO STAY. REAL WORLD HAS WHAT YOU ARE LOOKING FOR. I ONLY REMEMBER THE 1ST X POSITION...",ChatColor.ITALIC+"...IT WAS 7! I AM *POSITIVE*\""+ChatColor.RESET+"\n\nI did not know what to think. The 1st X position? I quickly remembered the 7 and sprinted out of the nether portal. And to think that was *THE END* of my adventures..."); - }break; - case 1:{ - bookdata.setAuthor("Lacey"); - bookdata.setTitle("A Hole in the Flower Garden"); - bookdata.addPage("A Hole in the Flower Garden\n"+ChatColor.ITALIC+" by Lacey\n======\n"+ChatColor.RESET+"It was a lovely day to pick flowers in the garden, they just finished blooming fully. I was so excited to pick them, but I didn't do so until","after I've taken in all the wonderful scents! Smelling all the flowers and wonderful smells of plants and trees and nature and grass. It was perfect. I was mindlessly walking along this prairie when I stumbled.","I fell, and fell, and fell. I hit the bottom of a ravine. It didn't even occur to me I would just walk into one. I took some minor damage, but when I got up, I noticed something strange.","There were two or three zombies gathered around a wall, etching something into it. I went over to read it once the zombies walked away. I saw on the wall:\n\n"+ChatColor.ITALIC+"X-2:6 <--END","It looked cryptic to me, but why would they write that on the wall? I quickly scribbled it down on a notepad I had in my pocket and started climbing out of the ravine to tend to my lovely flowers. What a day!"); - }break; - case 2:{ - bookdata.setAuthor("Jimmy"); - bookdata.setTitle("Messages in Music"); - bookdata.addPage("Messages in Music\n"+ChatColor.ITALIC+" by Jim"+"\n======"+ChatColor.RESET+"\nI popped out the disk from my Jukebox to put in another, I could jam to these all day! As I was looking through my collection for something to listen to","I found a really bent up disk. 'No way this could still play', I thought to myself. I put it in, and it crackled and snarled, but it was indeed playing! At first I heard some faint resemblence of music, but then suddenly,","a hiss, an explosion, and then 'CREEEEEEEEE----- 7X XSSSSSSSSSS 3RD EEEEEEE' mental images appeared in my head, but the 7X and 3RD stood out the most. It's like I was seeing them in my head while hearing something else!","I couldn't stand up anymore, or think. I forcibly reached up with my weak hand to find the eject button on the player and when I found the familiar nub in the button, pressed down on it and out popped the disk, hitting my face,","but putting me back into reality. Something was telling me that the 3RD and 7X was important. But I couldn't quite put my tongue on it."); - }break; - case 3:{ - bookdata.setAuthor("Creeper"); - bookdata.setTitle("HISS"); - bookdata.addPage("Y do i exisssst. nobody knowssss. i just want a hugssssss, HUGSSSSSSS. but i don't know Y i exist. there's no Y in the first position. it'sssss jusssst two digitssssss.... SSSSSSSSS. *THE END*"); - }break; - case 4:{ - bookdata.setAuthor("Marco"); - bookdata.setTitle("The Hunt for a Dragon"); - bookdata.addPage("The Hunt for a Dragon\n"+ChatColor.ITALIC+" by Marco"+"\n======"+ChatColor.RESET+"\nThere exists a rumor that a mythical dragon could be found in the depths of our world. It is even said he doesn't exist in OUR world, but ANOTHER world altogether!","That my friends already boggles me, but where the heck would I go to find it then? I have been told he exists, and I know he is. I believe deep in my heart. I searched day and night under and over ground.","One day I found something strange in the ground. It was pink wool, in the middle of a cave on the ground. It even said something, but I couldn't tell from so close up. So I literally dug all the way to the surface, keeping the boundaries","of that word uncovered the whole way up. When I got to the top and looked down, I was relieved to find it was made out of markings I could discern. It said: 'Y: X3?' It was definitely a weird group of symbols, but I have a strong feeling"," that it is directly linked with that dragon I am trying to hunt down. Maybe I can gather more clues and try to decipher the location of this thing."); - }break; - case 5:{ - bookdata.setAuthor("Steve"); - bookdata.setTitle("Cooking Food"); - bookdata.addPage("Cooking Food\n"+ChatColor.ITALIC+" by Steve"+"\n======"+ChatColor.RESET+"\nIt was a bright and rather typical sunny day in the Minecraft world. I don't actually think it was very hot either. I just managed to catch a few fish and was cooking them up.","It wasn't long before I got distracted and heard a funny noise. It was an ocelote. Lucky me, an ocelote has smelled the scent of my fish! I grab a few and hold it out for the ocelote. It slowly creeps over, and then takes it and runs from me.","I thought it was full and finished cooking the rest of the fish. However, the ocelote returned a few minutes later with a neatly-folded piece of paper in its mouth. It came up to me and set it down, like it was some message just for me.","I opened it up and it read:\n\n"+ChatColor.ITALIC+"Don't let the fish get to your tongue! If you know what's wise, you will investigate further. The 3rd position of Y being the number 5."+ChatColor.RESET+"\n\n","I didn't notice the ocelote run away, but I knew something FISHY was going on. That message seemed important for some reason, I've seen similar cryptic messages before... Perhaps I'll hold onto this in case I need it in the future."); - }break; - case 6:{ - bookdata.setAuthor("Fredric"); - bookdata.setTitle("Math Behind the Void"); - bookdata.addPage("Math Behind the Void\n"+ChatColor.ITALIC+" by Fredric"+"\n======"+ChatColor.RESET+"\nThis book describes a few principles that the void in this world follows. While no one has actually seen the void, we have found a few theories and rules regarding them.","1. The Void has a Light Level of -14. The Void actually absorbs light coming from light sources and thus, if The Void is ever opened to the real world, would suck up the light from it.","2. The Void always has a volume of 50,000m, being 50m x 20m x 50m. This means that The Void, regardless of location is always the same exact size. This would conclude to us that The Void is co-existing and multiple instaces of it may exist in the same realm.","3. Any Entity entering The Void will not be able to escape The Void as time passes much more quickly inside The Void. This means Entities that enter The Void feel accelerated processes and cannot combat it, since the time outside is behind them.","4. A point of connection between The Void and other dimensions has to exist, for The Void to exist. Speculation has it that one of these points has been leaked into the world, and is accessible by us directly. After further research,","we have learned that one of these points is located on the 1st respective numeral along our Z axis with the number 4. It has also been proven that this number has to be negative as the other two sources interacting with The Void are positive."); - }break; - case 7:{ - bookdata.setAuthor("Robert"); - bookdata.setTitle("TNT"); - bookdata.addPage("TNT\n"+ChatColor.ITALIC+" by Robert"+"\n======"+ChatColor.RESET+"\nYou know, the easiest way to clear a tunnel is using an item called TNT. It is a rather small block, but it is loaded with gunpowder. When lit by an external force, it ignites","with the force of 5 Creeper explosions to clear whole caves out. Well lo and behold one day I discovered a rather strange abandoned mineshaft. It wasn't normal for sure, because there were green vines everywhere and lots of strange doors.","It was like somebody lived here ages ago, and I am discovering the ruins of such a place. Inoperable levers, a few mobs I have to kill here and there that have made this area their designated home. It was a mess. But I did discover that","someone was trying to find what we would call 'The End'. It's a magical place, and I believe with the right amount of effort, we can find it someday too. He had scribbled the coordinates of the location he was trying to reach.","However, most of it is faded out and I can only tell faintly the remains of it: \n\n"+ChatColor.ITALIC+"X:---\nY:---\nZ:--7-"+ChatColor.RESET+"\n\nYep, that's about it.","Hopefully by me recording this data, someone else can fill in the remaining numbers and we can all find The End together. Someday..."); - }break; - case 8:{ - bookdata.setAuthor("Joshua"); - bookdata.setTitle("Fourside"); - bookdata.addPage("Fourside\n"+ChatColor.ITALIC+" by Joshua"+"\n======"+ChatColor.RESET+"\n"+ChatColor.DARK_BLUE+"ABANDONED PROJECT"+ChatColor.RESET+". A city that would be developed with the best technology and the highest standards. It would","succeed every single Minecraft city that has ever been built. Casinos, diamond-lined walkways, towering skyscrapers as far as the eye can see. Museums, Libraries, Educational Institutions. This mega-city would be able to hold","and sustain every single Minecrafter in existence. But no, something went terribly wrong. Our engineering team finally developed the perfect transportation system and we were wiring it up to our fusion power plant.","Something went horribly wrong. The Fusion power plant started self-combusting itself, leaving behind hyper-cold atoms. This caused nucleic waste to interact with the environment around itself and freezing the whole world as we knew it.","The city idea as we knew it was scrapped, and we would wait 2000 years before we could attempt this again. We wrote plans for a much more portable solution and have named it 'Twoside' and archived it appropriately.","Maybe someone will pick up that book and be able to make the future bright with a mini version of Fourside. That being said, we left the 3rd slot of the Z position of our city at 7. This should give you enough clue as to where NOT to build."); - }break; - } - book.setItemMeta(bookdata); - //p.setItemInHand(book); - p.getInventory().addItem(book); - p.updateInventory(); - p.sendMessage(ChatColor.LIGHT_PURPLE+"You feel a magical presence get inserted into your inventory."); - }*/ - } - if (this.plugin.PlayerinJob(p, "Builder")) { - this.plugin.playerdata_list.get(myData).BadInteract(e.getBlock().getType()); - } - if (this.plugin.PlayerinJob(p, "Woodcutter")) { - if (e.getBlock().getType()==Material.LOG) { - if (p.getItemInHand().getType()==Material.WOOD_AXE || p.getItemInHand().getType()==Material.STONE_AXE || p.getItemInHand().getType()==Material.IRON_AXE || p.getItemInHand().getType()==Material.GOLD_AXE || p.getItemInHand().getType()==Material.DIAMOND_AXE) { - //p.sendMessage("Cut down wood w/axe."); - this.plugin.gainMoneyExp(p,"Woodcutter",0.025,2); - } else { - //p.sendMessage("Cut down wood."); - this.plugin.gainMoneyExp(p,"Woodcutter",0.01,1); - } - } - } - if (this.plugin.PlayerinJob(p, "Miner")) { - if (this.plugin.getJobLv("Miner", p)>=10) { - //Half chance to set the durability back by one. - if (p.getItemInHand().getType()==Material.WOOD_PICKAXE || - p.getItemInHand().getType()==Material.STONE_PICKAXE || - p.getItemInHand().getType()==Material.GOLD_PICKAXE || - p.getItemInHand().getType()==Material.IRON_PICKAXE || - p.getItemInHand().getType()==Material.DIAMOND_PICKAXE) { - if (p.getItemInHand().getDurability()>0) { - if (Math.random()>=0.5) { - p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); - p.updateInventory(); - } - } - } - } - if (this.plugin.playerdata_list.get(myData).GoodInteract()) { - if (e.getBlock().getType()==Material.STONE) { - this.plugin.gainMoneyExp(p,"Miner",0.0025,1); - } else - if (e.getBlock().getType()==Material.NETHERRACK) { - this.plugin.gainMoneyExp(p,"Miner",0.005,1); - } else - if (e.getBlock().getType()==Material.COAL_ORE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.0125,3); - } else - if (e.getBlock().getType()==Material.GLOWSTONE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.015,3); - } else - if (e.getBlock().getType()==Material.SANDSTONE) { - this.plugin.gainMoneyExp(p,"Miner",0.015,4); - } else - if (e.getBlock().getType()==Material.NETHER_BRICK) { - this.plugin.gainMoneyExp(p,"Miner",0.02,3); - } else - if (e.getBlock().getType()==Material.QUARTZ_ORE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.025,4); - } else - if (e.getBlock().getType()==Material.LAPIS_ORE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.03,5); - } else - if (e.getBlock().getType()==Material.MOSSY_COBBLESTONE) { - this.plugin.gainMoneyExp(p,"Miner",0.0375,8); - } else - if (e.getBlock().getType()==Material.IRON_ORE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.0375,6); - } else - if ((e.getBlock().getType()==Material.REDSTONE_ORE || e.getBlock().getType()==Material.GLOWING_REDSTONE_ORE) && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.05,9); - } else - if (e.getBlock().getType()==Material.OBSIDIAN) { - this.plugin.gainMoneyExp(p,"Miner",0.0625,10); - } else - if (e.getBlock().getType()==Material.GOLD_ORE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.0975,12); - } else - if (e.getBlock().getType()==Material.DIAMOND_ORE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.3125,60); - } else - if (e.getBlock().getType()==Material.EMERALD_ORE && !has_silktouch) { - this.plugin.gainMoneyExp(p,"Miner",0.7625,160); - } - } - } - if (this.plugin.PlayerinJob(p, "Digger")) { - if (this.plugin.getJobLv("Digger", p)>=20) { - //Half chance to set the durability back by one. - if (p.getItemInHand().getType()==Material.WOOD_SPADE || - p.getItemInHand().getType()==Material.STONE_SPADE || - p.getItemInHand().getType()==Material.GOLD_SPADE || - p.getItemInHand().getType()==Material.IRON_SPADE || - p.getItemInHand().getType()==Material.DIAMOND_SPADE) { - if (p.getItemInHand().getDurability()>0) { - if (Math.random()>=0.66) { - p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); - p.updateInventory(); - } - } - } - } else - if (this.plugin.getJobLv("Digger", p)>=10) { - //Half chance to set the durability back by one. - if (p.getItemInHand().getType()==Material.WOOD_SPADE || - p.getItemInHand().getType()==Material.STONE_SPADE || - p.getItemInHand().getType()==Material.GOLD_SPADE || - p.getItemInHand().getType()==Material.IRON_SPADE || - p.getItemInHand().getType()==Material.DIAMOND_SPADE) { - if (p.getItemInHand().getDurability()>0) { - if (Math.random()>=0.5) { - p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); - p.updateInventory(); - } - } - } - } - if (this.plugin.playerdata_list.get(myData).GoodInteract()) { - if (e.getBlock().getType()==Material.DIRT) { - this.plugin.gainMoneyExp(p,"Digger",0.005,1); - } - if (e.getBlock().getType()==Material.GRASS) { - this.plugin.gainMoneyExp(p,"Digger",0.005,2); - } - if (e.getBlock().getType()==Material.SAND) { - this.plugin.gainMoneyExp(p,"Digger",0.01,2); - } - if (e.getBlock().getType()==Material.GRAVEL) { - this.plugin.gainMoneyExp(p,"Digger",0.02,5); - } - if (e.getBlock().getType()==Material.SOUL_SAND) { - this.plugin.gainMoneyExp(p,"Digger",0.04,8); - } - if (e.getBlock().getType()==Material.CLAY) { - this.plugin.gainMoneyExp(p,"Digger",0.05,10); - } - } - } - //p.sendMessage("You broke the "+e.getBlock().getType()+", Data: "+e.getBlock().getData()); - if (this.plugin.PlayerinJob(p, "Farmer")) { - if (e.getBlock().getType()==Material.SUGAR_CANE_BLOCK) { - this.plugin.gainMoneyExp(p,"Farmer",0.00,1); - } - if (e.getBlock().getType()==Material.CROPS && e.getBlock().getData()==7) { - this.plugin.gainMoneyExp(p,"Farmer",0.01,2); - } - if (e.getBlock().getType()==Material.CARROT && e.getBlock().getData()==7) { - this.plugin.gainMoneyExp(p,"Farmer",0.01,2); - } - if (e.getBlock().getType()==Material.CACTUS) { - this.plugin.gainMoneyExp(p,"Farmer",0.00,3); - } - if (e.getBlock().getType()==Material.POTATO && e.getBlock().getData()==7) { - this.plugin.gainMoneyExp(p,"Farmer",0.03,3); - } - if (e.getBlock().getType()==Material.BROWN_MUSHROOM) { - this.plugin.gainMoneyExp(p,"Farmer",0.00,3); - } - if (e.getBlock().getType()==Material.RED_MUSHROOM) { - this.plugin.gainMoneyExp(p,"Farmer",0.00,3); - } - if (e.getBlock().getType()==Material.NETHER_WARTS && e.getBlock().getData()==3) { - this.plugin.gainMoneyExp(p,"Farmer",0.03,3); - } - /*if (e.getBlock().getType()==Material.PUMPKIN) { - this.plugin.gainMoneyExp(p,"Farmer",0.00,1); - } - if (e.getBlock().getType()==Material.MELON_BLOCK) { - this.plugin.gainMoneyExp(p,"Farmer",0.10,10); - }*/ - } - boolean hasfortune; - hasfortune = (p.getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)>0)?true:false; - //Check blocks around it. If it's a spawner, it's protected until the spawner is destroyed. - for (int x=-4;x<4;x++) { - for (int y=0;y<2;y++) { - for (int z=-4;z<4;z++) { - if ((x!=0 || y!=0 || z!=0) && p.getWorld().getBlockAt(e.getBlock().getLocation().add(x,y,z)).getType()==Material.MOB_SPAWNER && e.getBlock().getType()!=Material.MOB_SPAWNER) { - e.setCancelled(true); - p.sendMessage("A Mob Spawner force field protects this block from being destroyed."); - } - } - } - } - if (e.getBlock().getType()==Material.MOB_SPAWNER) { - p.setLevel(p.getLevel()+30); - try { - Iterator effects = p.getActivePotionEffects().iterator(); - //Figure out potion effects when player joins. - while (effects.hasNext()) { - PotionEffect nexteffect = effects.next(); - if (nexteffect.getType().getName().compareTo(PotionEffectType.SPEED.getName())==0 && nexteffect.getAmplifier()<4) { - p.removePotionEffect(PotionEffectType.SPEED); - p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 360000, nexteffect.getAmplifier()+2, true)); - } - if (nexteffect.getType().getName().compareTo(PotionEffectType.HEALTH_BOOST.getName())==0) { - p.removePotionEffect(PotionEffectType.HEALTH_BOOST); - p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 360000, nexteffect.getAmplifier()+1, true)); - } - /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { - p.removePotionEffect(PotionEffectType.JUMP); - p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); - }*/ - effects.remove(); - } - - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible while initializing player speed."); - } - p.removePotionEffect(PotionEffectType.WATER_BREATHING); - p.removePotionEffect(PotionEffectType.FAST_DIGGING); - p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE); - //p.removePotionEffect(PotionEffectType.NIGHT_VISION); - p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 360000, 1, true)); - p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 360000, 0, true)); - p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 360000, 0, true)); - p.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 360000, 0, true)); - //p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 360000, 0, true)); - //p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, 1, true)); - p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 360000, 1, true)); - } - if ((e.getBlock().getX()==1616 && e.getBlock().getZ()>=53 && e.getBlock().getZ()<=64) || (e.getBlock().getX()==1627 && e.getBlock().getZ()>=53 && e.getBlock().getZ()<=64) || (e.getBlock().getZ()==53 && e.getBlock().getX()>=1616 && e.getBlock().getX()<=1627) || (e.getBlock().getZ()==64 && e.getBlock().getX()>=1616 && e.getBlock().getX()<=1627)) { - e.setCancelled(true); - } - if ((e.getBlock().getX()==1585 && e.getBlock().getZ()>=24 && e.getBlock().getZ()<=39) || (e.getBlock().getX()==1600 && e.getBlock().getZ()>=24 && e.getBlock().getZ()<=39) || (e.getBlock().getZ()==24 && e.getBlock().getX()>=1585 && e.getBlock().getX()<=1600) || (e.getBlock().getZ()==39 && e.getBlock().getX()>=1585 && e.getBlock().getX()<=1600)) { - e.setCancelled(true); - } - if (this.plugin.getConfig().getBoolean("spleefinsession")==true && (this.plugin.getConfig().getString("spleefrequestaplayer").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestbplayer").compareTo(p.getName())==0)) { - this.plugin.spleef_last_broken_block=p.getPlayerTime(); - } - if (this.plugin.getConfig().getBoolean("spleef4insession")==true && (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0)) { - this.plugin.spleef4_last_broken_block=p.getPlayerTime(); - } - if (p.getItemInHand()!=null && p.getItemInHand().getItemMeta()!=null && p.getItemInHand().getItemMeta().hasDisplayName()==true && p.getItemInHand().getItemMeta().getDisplayName().compareTo("Spleef Wooden Shovel")==0) { - p.getItemInHand().setDurability((short)0); - //p.sendMessage("Got in."); - p.updateInventory(); - } - if (p.getItemInHand()!=null && p.getItemInHand().getItemMeta()!=null && p.getItemInHand().getItemMeta().hasDisplayName()==true && p.getItemInHand().getItemMeta().getDisplayName().compareTo("Spleef Stone Shovel")==0) { - p.getItemInHand().setDurability((short)0); - //p.sendMessage("Got in."); - p.updateInventory(); - } - } - Material[] fortune_materials = {Material.EMERALD_ORE,Material.COAL_ORE,Material.DIAMOND_ORE,Material.REDSTONE_ORE,Material.LAPIS_ORE,Material.QUARTZ_ORE}; //An array of all blocks that multiply via fortune. - Material[] result_materials = {Material.EMERALD,Material.COAL,Material.DIAMOND,Material.REDSTONE,Material.INK_SACK,Material.QUARTZ}; //The resulting materials corresponding to the fortune blocks being broken. - boolean fortune_material=false; - int fortune_material_slot=0; - for (int i=0;i0) { //Check if the player has fortune. - if (fortune_material) { //If this is a fortune material, we have to account for the new fortune enchantment algorithm. - e.setCancelled(true); - e.getPlayer().getWorld().getBlockAt(e.getBlock().getLocation()).setType(Material.AIR); - int fortune_level = p.getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS); - int drop_chance=50; - for (int i=1;ip.getMaxHealth()) { - p.setHealth(p.getMaxHealth()); - } else { - p.setHealth(p.getHealth()+24); - } - } - } - } - } - - @EventHandler - public void onPotionSplash(PotionSplashEvent e) { - try { - Iterator entities = e.getAffectedEntities().iterator(); - Player shooter; - if (e.getPotion().getShooter().getType() == EntityType.PLAYER) { - shooter=(Player)e.getPotion().getShooter(); - if (this.plugin.PlayerinJob(shooter,"Support")) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Shooter is "+shooter.getName()); - while (entities.hasNext()) { - LivingEntity next = entities.next(); - if (next.getType() == EntityType.PLAYER) { - final Player p = (Player)next; - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); - } - },5); - if (p!=shooter) { - //Award the support. - //Bukkit.getPlayer("sigonasr2").sendMessage(p.getName()+" got hit by your potion!"); - //Iterator effects = e.getPotion().getEffects().iterator(); - try { - Collection effects = e.getPotion().getEffects(); - for (PotionEffect nextpotioneffect : effects) { - //shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); - if (nextpotioneffect.getType().getName().compareTo("NIGHT_VISION")==0) { - //this.plugin.gainMoneyExp(shooter,"Support",0.10,5); - } - if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { - this.plugin.gainMoneyExp(shooter,"Support",0.15,6); - for (int i=0;i0) { - this.plugin.gainMoneyExp(shooter,"Support",4.80,240); - } - //this.plugin.gainMoneyExp(shooter,"Support",0.25,12); - } - if (nextpotioneffect.getType().getName().compareTo("HEAL")==0) { - if (!p.isDead()) { - if (p.getHealth()/p.getMaxHealth()<=0.30) { - this.plugin.gainMoneyExp(shooter,"Support",2.40,120); - //shooter.sendMessage("This is a big heal."); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); - } - //this.plugin.gainMoneyExp(shooter,"Support",0.30,14); - if (p.getHealth()+12>p.getMaxHealth()) { - p.setHealth(p.getMaxHealth()); - } else { - p.setHealth(p.getHealth()+12); - } - //shooter.sendMessage("This is a heal."); - } - } - if (nextpotioneffect.getType().getName().compareTo("REGENERATION")==0) { - if (p.getHealth()/p.getMaxHealth()<=0.30) { - //this.plugin.gainMoneyExp(shooter,"Support",0.60,30); - } - //this.plugin.gainMoneyExp(shooter,"Support",0.30,14); - //shooter.sendMessage("This is a heal."); - } - } - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible for a support while attempting a splash potion."); - } - /*while (effects.hasNext()) { - PotionEffect nextpotioneffect = effects.next(); - shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); - if (nextpotioneffect.getType().getName().compareTo("NIGHT_VISION")==0) { - this.plugin.gainMoneyExp(shooter,"Support",0.10,5); - } - if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { - this.plugin.gainMoneyExp(shooter,"Support",0.15,6); - for (int i=0;i0) { - this.plugin.gainMoneyExp(shooter,"Support",0.60,30); - } - this.plugin.gainMoneyExp(shooter,"Support",0.25,12); - } - if (nextpotioneffect.getType().getName().compareTo("HEAL")==0) { - if (p.getHealth()<=8) { - this.plugin.gainMoneyExp(shooter,"Support",0.60,30); - shooter.sendMessage("This is a big heal."); - } - this.plugin.gainMoneyExp(shooter,"Support",0.30,14); - shooter.sendMessage("This is a heal."); - } - if (nextpotioneffect.getType().getName().compareTo("REGENERATION")==0) { - if (p.getHealth()<=8) { - this.plugin.gainMoneyExp(shooter,"Support",0.60,30); - } - this.plugin.gainMoneyExp(shooter,"Support",0.30,14); - //shooter.sendMessage("This is a heal."); - } - effects.remove(); - } - */ - } else { - try { - Collection effects = e.getPotion().getEffects(); - for (PotionEffect nextpotioneffect : effects) { - //shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); - if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { - //this.plugin.gainMoneyExp(shooter,"Support",0.15,6); - //Apply this potion effect to our player buff data. - for (int i=0;ip.getMaxHealth()) { - p.setHealth(p.getMaxHealth()); - } else { - p.setHealth(p.getHealth()+12); - } - //shooter.sendMessage("This is a heal."); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); - } - } - } - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible for a player while modifying speed amount."); - } - } - } - entities.remove(); - } - } else { - while (entities.hasNext()) { - LivingEntity next = entities.next(); - if (next.getType() == EntityType.PLAYER) { - final Player p = (Player)next; - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); - } - },5); - try { - Iterator effects = e.getPotion().getEffects().iterator(); - while (effects.hasNext()) { - PotionEffect nextpotioneffect = effects.next(); - //shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); - if (this.plugin.PlayerinJob(shooter, "Brewer") && this.plugin.getJobLv("Brewer", shooter)>=20) { - next.removePotionEffect(nextpotioneffect.getType()); - next.addPotionEffect(new PotionEffect(nextpotioneffect.getType(),nextpotioneffect.getDuration()*2,nextpotioneffect.getAmplifier(),false)); - nextpotioneffect.getDuration(); - } - if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { - //this.plugin.gainMoneyExp(shooter,"Support",0.15,6); - //Apply this potion effect to our player buff data. - for (int i=0;ip.getMaxHealth()) { - p.setHealth(p.getMaxHealth()); - } else { - p.setHealth(p.getHealth()+12); - } - //shooter.sendMessage("This is a heal."); - } - } - effects.remove(); - } - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible for a player during a splash potion speed update."); - } - } - entities.remove(); - } - } - } - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Entity Collection not accessible during splash potion effect."); - } - } - - @EventHandler - public void onItemPrepareCraft(PrepareItemCraftEvent e) { - CraftingInventory result = e.getInventory(); - - // Disable melon crafting recipe - if (result.getResult().getType()==Material.MELON_BLOCK) { - result.setResult(new ItemStack(Material.AIR)); - } - - // Increase stairs recipe efficiency - if (result.getResult().getType()==Material.WOOD_STAIRS) { - result.setResult(new ItemStack(Material.WOOD_STAIRS, 8)); - } - if (result.getResult().getType()==Material.BIRCH_WOOD_STAIRS) { - result.setResult(new ItemStack(Material.BIRCH_WOOD_STAIRS, 8)); - } - if (result.getResult().getType()==Material.SPRUCE_WOOD_STAIRS) { - result.setResult(new ItemStack(Material.SPRUCE_WOOD_STAIRS, 8)); - } - if (result.getResult().getType()==Material.JUNGLE_WOOD_STAIRS) { - result.setResult(new ItemStack(Material.JUNGLE_WOOD_STAIRS, 8)); - } - if (result.getResult().getType()==Material.BRICK_STAIRS) { - result.setResult(new ItemStack(Material.BRICK_STAIRS, 8)); - } - if (result.getResult().getType()==Material.NETHER_BRICK_STAIRS) { - result.setResult(new ItemStack(Material.NETHER_BRICK_STAIRS, 8)); - } - if (result.getResult().getType()==Material.QUARTZ_STAIRS) { - result.setResult(new ItemStack(Material.QUARTZ_STAIRS, 8)); - } - if (result.getResult().getType()==Material.SANDSTONE_STAIRS) { - result.setResult(new ItemStack(Material.SANDSTONE_STAIRS, 8)); - } - if (result.getResult().getType()==Material.SMOOTH_STAIRS) { - result.setResult(new ItemStack(Material.SMOOTH_STAIRS, 8)); - } - - if (result.getResult().getType()==Material.IRON_HELMET || - result.getResult().getType()==Material.IRON_CHESTPLATE || - result.getResult().getType()==Material.IRON_LEGGINGS || - result.getResult().getType()==Material.IRON_BOOTS) { - ItemStack[] craftwith = result.getMatrix(); - boolean ingots=true; - for (int i=0;i='a'&&mod[i]<='z') { - mod[i]-=32; - first=true; - } else - if (i==0) { - if (mod[i]>='A'&&mod[i]<='Z') { - first=true; - } - } else { - if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { - first=true; - } - } - } else { - if (mod[i-1]!=' ') { - if (mod[i]>='A'&&mod[i]<='Z') { - mod[i]+=32; - } - } - } - } - newarmor_meta.setDisplayName(String.copyValueOf(mod)); - List NewLore = new ArrayList(); - NewLore.add(ChatColor.RED+"-400% Durability"); - newarmor_meta.setLore(NewLore); - newarmor.setItemMeta(newarmor_meta); - result.setResult(newarmor); - } - } else - if (result.getResult().getType()==Material.GOLD_HELMET || - result.getResult().getType()==Material.GOLD_CHESTPLATE || - result.getResult().getType()==Material.GOLD_LEGGINGS || - result.getResult().getType()==Material.GOLD_BOOTS) { - ItemStack[] craftwith = result.getMatrix(); - boolean ingots=true; - for (int i=0;i='a'&&mod[i]<='z') { - mod[i]-=32; - first=true; - } else - if (i==0) { - if (mod[i]>='A'&&mod[i]<='Z') { - first=true; - } - } else { - if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { - first=true; - } - } - } else { - if (mod[i-1]!=' ') { - if (mod[i]>='A'&&mod[i]<='Z') { - mod[i]+=32; - } - } - } - } - newarmor_meta.setDisplayName(String.copyValueOf(mod)); - List NewLore = new ArrayList(); - NewLore.add(ChatColor.RED+"-400% Durability"); - newarmor_meta.setLore(NewLore); - newarmor.setItemMeta(newarmor_meta); - result.setResult(newarmor); - } - } else - if (result.getResult().getType()==Material.DIAMOND_HELMET || - result.getResult().getType()==Material.DIAMOND_CHESTPLATE || - result.getResult().getType()==Material.DIAMOND_LEGGINGS || - result.getResult().getType()==Material.DIAMOND_BOOTS) { - ItemStack[] craftwith = result.getMatrix(); - boolean ingots=true; - for (int i=0;i='a'&&mod[i]<='z') { - mod[i]-=32; - first=true; - } else - if (i==0) { - if (mod[i]>='A'&&mod[i]<='Z') { - first=true; - } - } else { - if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { - first=true; - } - } - } else { - if (mod[i-1]!=' ') { - if (mod[i]>='A'&&mod[i]<='Z') { - mod[i]+=32; - } - } - } - } - newarmor_meta.setDisplayName(String.copyValueOf(mod)); - List NewLore = new ArrayList(); - NewLore.add(ChatColor.RED+"-400% Durability"); - newarmor_meta.setLore(NewLore); - newarmor.setItemMeta(newarmor_meta); - result.setResult(newarmor); - } - } - //It could be with iron, gold, or diamond blocks. Try them out. - /* - boolean iron=false,gold=false,diamond=false; - boolean helmet=false,chestplate=false,leggings=false,boots=false; - ItemStack[] craftwith = result.getMatrix(); - if (craftwith[0].getType()==Material.IRON_BLOCK && - craftwith[1].getType()==Material.IRON_BLOCK && - craftwith[2].getType()==Material.IRON_BLOCK && - craftwith[3].getType()==Material.IRON_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.IRON_BLOCK && - craftwith[6].getType()==Material.IRON_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.IRON_BLOCK) { - ItemStack newarmor = new ItemStack(Material.IRON_LEGGINGS); - result.setResult(newarmor); - } else - if (craftwith[0].getType()==Material.IRON_BLOCK && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.IRON_BLOCK && - craftwith[3].getType()==Material.IRON_BLOCK && - craftwith[4].getType()==Material.IRON_BLOCK && - craftwith[5].getType()==Material.IRON_BLOCK && - craftwith[6].getType()==Material.IRON_BLOCK && - craftwith[7].getType()==Material.IRON_BLOCK && - craftwith[8].getType()==Material.IRON_BLOCK) { - ItemStack newarmor = new ItemStack(Material.IRON_CHESTPLATE); - result.setResult(newarmor); - } else - if ((craftwith[0].getType()==Material.IRON_BLOCK && - craftwith[1].getType()==Material.IRON_BLOCK && - craftwith[2].getType()==Material.IRON_BLOCK && - craftwith[3].getType()==Material.IRON_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.IRON_BLOCK && - craftwith[6].getType()==Material.AIR && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.IRON_BLOCK && - craftwith[4].getType()==Material.IRON_BLOCK && - craftwith[5].getType()==Material.IRON_BLOCK && - craftwith[6].getType()==Material.IRON_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.IRON_BLOCK && - craftwith[0].getType()==Material.AIR && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.AIR)) { - ItemStack newarmor = new ItemStack(Material.IRON_HELMET); - result.setResult(newarmor); - } else - if ((craftwith[0].getType()==Material.IRON_BLOCK && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.IRON_BLOCK && - craftwith[3].getType()==Material.IRON_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.IRON_BLOCK && - craftwith[6].getType()==Material.AIR && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.IRON_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.IRON_BLOCK && - craftwith[6].getType()==Material.IRON_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.IRON_BLOCK && - craftwith[0].getType()==Material.AIR && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.AIR)) { - ItemStack newarmor = new ItemStack(Material.IRON_BOOTS); - result.setResult(newarmor); - } - if (craftwith[0].getType()==Material.GOLD_BLOCK && - craftwith[1].getType()==Material.GOLD_BLOCK && - craftwith[2].getType()==Material.GOLD_BLOCK && - craftwith[3].getType()==Material.GOLD_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.GOLD_BLOCK && - craftwith[6].getType()==Material.GOLD_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.GOLD_BLOCK) { - ItemStack newarmor = new ItemStack(Material.GOLD_LEGGINGS); - result.setResult(newarmor); - } else - if (craftwith[0].getType()==Material.GOLD_BLOCK && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.GOLD_BLOCK && - craftwith[3].getType()==Material.GOLD_BLOCK && - craftwith[4].getType()==Material.GOLD_BLOCK && - craftwith[5].getType()==Material.GOLD_BLOCK && - craftwith[6].getType()==Material.GOLD_BLOCK && - craftwith[7].getType()==Material.GOLD_BLOCK && - craftwith[8].getType()==Material.GOLD_BLOCK) { - ItemStack newarmor = new ItemStack(Material.GOLD_CHESTPLATE); - result.setResult(newarmor); - } else - if ((craftwith[0].getType()==Material.GOLD_BLOCK && - craftwith[1].getType()==Material.GOLD_BLOCK && - craftwith[2].getType()==Material.GOLD_BLOCK && - craftwith[3].getType()==Material.GOLD_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.GOLD_BLOCK && - craftwith[6].getType()==Material.AIR && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.GOLD_BLOCK && - craftwith[4].getType()==Material.GOLD_BLOCK && - craftwith[5].getType()==Material.GOLD_BLOCK && - craftwith[6].getType()==Material.GOLD_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.GOLD_BLOCK && - craftwith[0].getType()==Material.AIR && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.AIR)) { - ItemStack newarmor = new ItemStack(Material.GOLD_HELMET); - result.setResult(newarmor); - } else - if ((craftwith[0].getType()==Material.GOLD_BLOCK && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.GOLD_BLOCK && - craftwith[3].getType()==Material.GOLD_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.GOLD_BLOCK && - craftwith[6].getType()==Material.AIR && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.GOLD_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.GOLD_BLOCK && - craftwith[6].getType()==Material.GOLD_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.GOLD_BLOCK && - craftwith[0].getType()==Material.AIR && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.AIR)) { - ItemStack newarmor = new ItemStack(Material.GOLD_BOOTS); - result.setResult(newarmor); - } - if (craftwith[0].getType()==Material.DIAMOND_BLOCK && - craftwith[1].getType()==Material.DIAMOND_BLOCK && - craftwith[2].getType()==Material.DIAMOND_BLOCK && - craftwith[3].getType()==Material.DIAMOND_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.DIAMOND_BLOCK && - craftwith[6].getType()==Material.DIAMOND_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.DIAMOND_BLOCK) { - ItemStack newarmor = new ItemStack(Material.DIAMOND_LEGGINGS); - result.setResult(newarmor); - } else - if (craftwith[0].getType()==Material.DIAMOND_BLOCK && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.DIAMOND_BLOCK && - craftwith[3].getType()==Material.DIAMOND_BLOCK && - craftwith[4].getType()==Material.DIAMOND_BLOCK && - craftwith[5].getType()==Material.DIAMOND_BLOCK && - craftwith[6].getType()==Material.DIAMOND_BLOCK && - craftwith[7].getType()==Material.DIAMOND_BLOCK && - craftwith[8].getType()==Material.DIAMOND_BLOCK) { - ItemStack newarmor = new ItemStack(Material.DIAMOND_CHESTPLATE); - result.setResult(newarmor); - } else - if ((craftwith[0].getType()==Material.DIAMOND_BLOCK && - craftwith[1].getType()==Material.DIAMOND_BLOCK && - craftwith[2].getType()==Material.DIAMOND_BLOCK && - craftwith[3].getType()==Material.DIAMOND_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.DIAMOND_BLOCK && - craftwith[6].getType()==Material.AIR && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.DIAMOND_BLOCK && - craftwith[4].getType()==Material.DIAMOND_BLOCK && - craftwith[5].getType()==Material.DIAMOND_BLOCK && - craftwith[6].getType()==Material.DIAMOND_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.DIAMOND_BLOCK && - craftwith[0].getType()==Material.AIR && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.AIR)) { - ItemStack newarmor = new ItemStack(Material.DIAMOND_HELMET); - result.setResult(newarmor); - } else - if ((craftwith[0].getType()==Material.DIAMOND_BLOCK && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.DIAMOND_BLOCK && - craftwith[3].getType()==Material.DIAMOND_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.DIAMOND_BLOCK && - craftwith[6].getType()==Material.AIR && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.DIAMOND_BLOCK && - craftwith[4].getType()==Material.AIR && - craftwith[5].getType()==Material.DIAMOND_BLOCK && - craftwith[6].getType()==Material.DIAMOND_BLOCK && - craftwith[7].getType()==Material.AIR && - craftwith[8].getType()==Material.DIAMOND_BLOCK && - craftwith[0].getType()==Material.AIR && - craftwith[1].getType()==Material.AIR && - craftwith[2].getType()==Material.AIR)) { - ItemStack newarmor = new ItemStack(Material.DIAMOND_BOOTS); - result.setResult(newarmor); - } - */ - } - - @EventHandler - public void onItemCraft(CraftItemEvent e) { - //This is something we just crafted. - //Bukkit.getPlayer("sigonasr2").sendMessage("Resulting item is "+result.getResult().getAmount()+" "+result.getResult().getType()); - CraftingInventory result = e.getInventory(); - //Bukkit.getPlayer("sigonasr2").sendMessage("Resulting item is "+result.getResult().getAmount()+" "+result.getResult().getType()); - Player p = Bukkit.getPlayer(e.getWhoClicked().getName()); - if (this.plugin.PlayerinJob(p,"Weaponsmith")) { - boolean crafteditem=false; - if (result.getResult().getType()==Material.ARROW) { - crafteditem=true; - } - if (result.getResult().getType()==Material.WOOD_SWORD) { - crafteditem=true; - } - if (result.getResult().getType()==Material.FLINT_AND_STEEL) { - crafteditem=true; - } - if (result.getResult().getType()==Material.BOW) { - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_SWORD) { - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_SWORD) { - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_SWORD) { - crafteditem=true; - } - if (this.plugin.getJobLv("Weaponsmith", p)>=20 && crafteditem) { - ItemStack[] crafteditems = result.getMatrix(); - if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) { - int lowestamt=9999; - for (int i=0;i=5 && crafteditem) { - ItemStack[] crafteditems = result.getMatrix(); - if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) { - int lowestamt=9999; - for (int i=0;i=10 && crafteditem) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - if (e.getClick()!=ClickType.SHIFT_RIGHT && e.getClick()!=ClickType.SHIFT_LEFT) { - ItemStack resulting = EnchantItem(result.getResult(),5,p); - result.setResult(resulting); - } - } - } - if (this.plugin.PlayerinJob(p,"Blacksmith")) { - boolean crafteditem=false; - /* - if (result.getResult().getType()==Material.STONE_HOE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.04,7); - crafteditem=true; - } - if (result.getResult().getType()==Material.STONE_SPADE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.05,8); - crafteditem=true; - } - if (result.getResult().getType()==Material.STONE_PICKAXE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.075,15); - crafteditem=true; - }*/ - if (result.getResult().getType()==Material.LEATHER_BOOTS) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.125,8); - crafteditem=true; - } - if (result.getResult().getType()==Material.LEATHER_HELMET) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.15,14); - crafteditem=true; - } - if (result.getResult().getType()==Material.LEATHER_LEGGINGS) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.175,15); - crafteditem=true; - } - if (result.getResult().getType()==Material.LEATHER_CHESTPLATE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.20,18); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_SPADE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.25,18); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_AXE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.25,18); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_HOE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.325,24); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_BOOTS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",0.375*mult,27*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_PICKAXE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.40,30); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_HELMET) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",0.50*mult,45*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_SPADE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.625,55); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_AXE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.625,55); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_HOE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.65,60); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_LEGGINGS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",0.725*mult,60*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_SPADE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.75,65); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_AXE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.75,65); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_HOE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.80,70); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_BOOTS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",0.825*mult,50*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_CHESTPLATE) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",0.875*mult,70*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_HELMET) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",0.925*mult,80*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_PICKAXE) { - //this.plugin.gainMoneyExp(p,"Blacksmith",0.925,80); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_BOOTS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",1.00*mult,85*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_LEGGINGS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",1.025*mult,100*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_CHESTPLATE) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,130*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_HELMET) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,125*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_LEGGINGS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",1.325*mult,145*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_CHESTPLATE) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - //this.plugin.gainMoneyExp(p,"Blacksmith",1.50*mult,175*mult); - crafteditem=true; - } - if (this.plugin.getJobLv("Blacksmith", p)>=5 && crafteditem) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - if (e.getClick()!=ClickType.SHIFT_RIGHT && e.getClick()!=ClickType.SHIFT_LEFT) { - ItemStack resulting = EnchantItem(result.getResult(),5,p); - result.setResult(resulting); - } - } - if (this.plugin.getJobLv("Blacksmith", p)>=10 && crafteditem) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - if (e.getClick()!=ClickType.SHIFT_RIGHT && e.getClick()!=ClickType.SHIFT_LEFT) { - ItemStack resulting = EnchantItem(result.getResult(),10,p); - result.setResult(resulting); - } - } - if (this.plugin.getJobLv("Blacksmith", p)>=20 && crafteditem) { - ItemStack[] crafteditems = result.getMatrix(); - if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) { - int lowestamt=9999; - for (int i=0;i=20) { - ItemStack[] crafteditems = result.getMatrix(); - for (int i=0;i=5) { - ItemStack[] crafteditems = result.getMatrix(); - for (int i=0;i=10 && crafteditem) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - ItemStack resulting = this.plugin.EnchantItem(result.getResult(),10); - result.setResult(resulting); - } - } - if (this.plugin.PlayerinJob(p,"Blacksmith")) { - boolean crafteditem=false; - if (result.getResult().getType()==Material.STONE_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.04,7); - crafteditem=true; - } - if (result.getResult().getType()==Material.STONE_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.05,8); - crafteditem=true; - } - if (result.getResult().getType()==Material.STONE_PICKAXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.075,15); - crafteditem=true; - } - if (result.getResult().getType()==Material.LEATHER_BOOTS) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.125,8); - crafteditem=true; - } - if (result.getResult().getType()==Material.LEATHER_HELMET) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.15,14); - crafteditem=true; - } - if (result.getResult().getType()==Material.LEATHER_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.175,15); - crafteditem=true; - } - if (result.getResult().getType()==Material.LEATHER_CHESTPLATE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.20,18); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.25,18); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.325,24); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_BOOTS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.375*mult,27*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_PICKAXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.40,30); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_HELMET) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.50*mult,45*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.625,55); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.65,60); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_LEGGINGS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.725*mult,60*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.75,65); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.80,70); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_BOOTS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.825*mult,50*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.IRON_CHESTPLATE) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.875*mult,70*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_HELMET) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.925*mult,80*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_PICKAXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.925,80); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_BOOTS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.00*mult,85*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_LEGGINGS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.025*mult,100*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.GOLD_CHESTPLATE) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,130*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_HELMET) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,125*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_LEGGINGS) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.325*mult,145*mult); - crafteditem=true; - } - if (result.getResult().getType()==Material.DIAMOND_CHESTPLATE) { - int mult=1; - if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { - mult=8; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.50*mult,175*mult); - crafteditem=true; - } - if (this.plugin.getJobLv("Blacksmith", p)>=5 && crafteditem) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - ItemStack resulting = this.plugin.EnchantItem(result.getResult(),5); - result.setResult(resulting); - } - if (this.plugin.getJobLv("Blacksmith", p)>=10 && crafteditem) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - ItemStack resulting = this.plugin.EnchantItem(result.getResult(),10); - result.setResult(resulting); - } - if (this.plugin.getJobLv("Blacksmith", p)>=20) { - ItemStack[] crafteditems = result.getMatrix(); - for (int i=0;i=10 && crafteditem==true) { - ItemStack resultingitem = result.getResult(); - resultingitem.setAmount(resultingitem.getAmount()*2); - } - } - if (this.plugin.PlayerinJob(p,"Support")) { - if (result.getResult().getType()==Material.BREAD) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getResult().getType()==Material.MUSHROOM_SOUP) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getResult().getType()==Material.COOKIE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getResult().getType()==Material.GOLDEN_CARROT) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getResult().getType()==Material.GOLDEN_APPLE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getResult().getType()==Material.PUMPKIN_PIE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getResult().getType()==Material.CAKE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getResult().getType()==Material.IRON_SWORD) { - this.plugin.gainMoneyExp(p,"Support",0.015,3); - } - if (result.getResult().getType()==Material.IRON_CHESTPLATE || result.getResult().getType()==Material.IRON_HELMET || result.getResult().getType()==Material.IRON_BOOTS || result.getResult().getType()==Material.IRON_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Support",0.025,5); - } - if (result.getResult().getType()==Material.DIAMOND_SWORD) { - this.plugin.gainMoneyExp(p,"Support",0.075,8); - } - if (result.getResult().getType()==Material.DIAMOND_CHESTPLATE || result.getResult().getType()==Material.DIAMOND_HELMET || result.getResult().getType()==Material.DIAMOND_BOOTS || result.getResult().getType()==Material.DIAMOND_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Support",0.20,20); - } - if (result.getResult().getType()==Material.CAKE) { - this.plugin.gainMoneyExp(p,"Support",0.03,2); - } - } - */ - } - - /*@EventHandler - public void onFurnaceGet(FurnaceExtractEvent e) { - Player p = e.getPlayer(); - Bukkit.getPlayer("sigonasr2").sendMessage("Extacting "+e.getItemAmount()+" "+e.getItemType()); - }*/ - @EventHandler - public void onLeafDecay(LeavesDecayEvent e) { - Player[] list = Bukkit.getOnlinePlayers(); - for (int i=0;i=20) { - //Increase sapling drops by 64%. - if (e.getBlock().getData()!=3) { - //This is not a jungle leaf block. - if (Math.random()*100<=25) { - //Produce a sapling. - Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); - //list[i].sendMessage("You got an extra spawned sapling."); - } - } else { - if (Math.random()*100<=12.5) { - //Produce a sapling. - Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); - } - } - } else - if (this.plugin.PlayerinJob(list[i], "Woodcutter") && this.plugin.getJobLv("Woodcutter", list[i])>=5) { - //Increase sapling drops by 40%. - if (e.getBlock().getData()!=3) { - //This is not a jungle leaf block. - if (Math.random()*100<=12) { - //Produce a sapling. - Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); - //list[i].sendMessage("You got an extra spawned sapling."); - } - } else { - if (Math.random()*100<=6) { - //Produce a sapling. - Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); - } - } - } - } - } - } - - @EventHandler - public void onItemChange(PlayerItemHeldEvent e) { - Player p = e.getPlayer(); - if (this.plugin.PlayerinJob(p, "Miner") && this.plugin.getJobLv("Miner", p)>=20) { - if (p.getInventory().getContents()[e.getNewSlot()]!=null && - (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_PICKAXE)) { - ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; - if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { - currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 2); - } else { - //if (currentitem.getEnchantmentLevel()) - } - } - } else - if (this.plugin.PlayerinJob(p, "Miner") && this.plugin.getJobLv("Miner", p)>=5) { - if (p.getInventory().getContents()[e.getNewSlot()]!=null && - (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_PICKAXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_PICKAXE)) { - ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; - if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { - currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 1); - } - } - } - if (this.plugin.PlayerinJob(p, "Digger") && this.plugin.getJobLv("Digger", p)>=5) { - if (p.getInventory().getContents()[e.getNewSlot()]!=null && - (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_SPADE)) { - ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; - if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { - currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 1); - } - } - } else - if (this.plugin.PlayerinJob(p, "Digger") && this.plugin.getJobLv("Digger", p)>=20) { - if (p.getInventory().getContents()[e.getNewSlot()]!=null && - (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_SPADE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_SPADE)) { - ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; - if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { - currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 2); - } - } - } - if (this.plugin.PlayerinJob(p, "Hunter") && this.plugin.getJobLv("Hunter", p)>=20) { - if (p.getInventory().getContents()[e.getNewSlot()]!=null && - (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_SWORD || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_SWORD || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_SWORD || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_SWORD || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_SWORD)) { - ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; - if (!currentitem.containsEnchantment(Enchantment.getByName("FIRE_ASPECT"))) { - currentitem.addEnchantment(Enchantment.getByName("FIRE_ASPECT"), 2); - } - } - } - if (this.plugin.PlayerinJob(p, "Woodcutter") && this.plugin.getJobLv("Woodcutter", p)>=10) { - if (p.getInventory().getContents()[e.getNewSlot()]!=null && - (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_AXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_AXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_AXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_AXE || - p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_AXE)) { - ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; - if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { - currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 1); - } - } - } - } - -public ItemStack getGoodie() { - ItemStack item = null; - if (Math.random()<0.33) { - //Add a weapon/armor piece. - int rand = (int)(Math.random()*5); - String type = ""; - String type2 = ""; - int rarity=0; //0 = Normal, 1 = Rare, 2 = Legendary, 3 = Mythical - switch ((int)(Math.random()*20)) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 10: - case 11: - case 7: - case 8: - case 9: - case 12: - case 13: - case 18:{ - rarity=0; - }break; - case 5: - case 14: - case 15:{ - rarity=1; - }break; - case 6: - case 16: - case 17:{ - rarity=2; - }break; - case 19:{ - rarity=3; - }break; - } - switch (rand) { - case 0: { - type = "LEATHER"; - }break; - case 1: { - type = "IRON"; - }break; - case 2: { - type = "GOLD"; - }break; - case 3: { - type = "CHAINMAIL"; - }break; - case 4: { - type = "DIAMOND"; - }break; - } - 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 = "PICKAXE"; - }break; - case 6: { - type2 = "SPADE"; - }break; - case 7: { - type2 = "HOE"; - }break; - case 8: { - type2 = "AXE"; - }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 = "BOW"; - }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 ourLore = new ArrayList(); - if (rarity==3) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+20+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+4+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+20+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*180)+60+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10+1)+" "+ChatColor.BLUE+"Damage"); - } - } else - if (rarity==2) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*12)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*120)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+" "+ChatColor.BLUE+"Damage"); - } - } else - if (rarity==1) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage"); - } - if (Math.random()<=0.2 && choice1!=0) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2 && choice1!=1) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2 && choice1!=2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2 && choice1!=3) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - if (choice1!=4) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage"); - } - } - } - else { - 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 meta = item.getItemMeta(); - meta.setLore(ourLore); - if (rarity==1) { - meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==2) { - meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==3) { - meta.setDisplayName(ChatColor.LIGHT_PURPLE+""+"Mythical "+convertToItemName(item.getType().name().replace("_", " "))); - } - item.setItemMeta(meta); - } else { - item = new ItemStack(Material.getMaterial(type+"_"+type2)); - if (type2.equalsIgnoreCase("SWORD")) { - int enchants[] = {16,17,18,19,20,21,34}; - for (int j=0;j ourLore = new ArrayList(); - if (rarity==3) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+20+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+4+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+20+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*180)+60+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10+1)+" "+ChatColor.BLUE+"Damage"); - } - } else - if (rarity==2) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*12)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*120)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+" "+ChatColor.BLUE+"Damage"); - } - } else - if (rarity==1) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage"); - } - if (Math.random()<=0.2 && choice1!=0) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2 && choice1!=1) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2 && choice1!=2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2 && choice1!=3) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - if (choice1!=4) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage"); - } - } - } - else { - 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 meta = item.getItemMeta(); - meta.setLore(ourLore); - if (rarity==1) { - meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==2) { - meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==3) { - meta.setDisplayName(ChatColor.LIGHT_PURPLE+""+"Mythical "+convertToItemName(item.getType().name().replace("_", " "))); - } - item.setItemMeta(meta); - } 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 ourLore = new ArrayList(); - if (rarity==3) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+20+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+4+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+20+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*180)+60+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10+1)+" "+ChatColor.BLUE+"Damage"); - } - } else - if (rarity==2) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*12)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*40)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*120)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+" "+ChatColor.BLUE+"Damage"); - } - } else - if (rarity==1) { - int choice1=0; - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage"); - } - if (Math.random()<=0.2 && choice1!=0) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance"); - } else - if (Math.random()<=0.2 && choice1!=1) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration"); - } else - if (Math.random()<=0.2 && choice1!=2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal"); - } else - if (Math.random()<=0.2 && choice1!=3) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed"); - } else { - if (choice1!=4) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage"); - } - } - } - else { - 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 meta = item.getItemMeta(); - meta.setLore(ourLore); - if (rarity==1) { - meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==2) { - meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==3) { - meta.setDisplayName(ChatColor.LIGHT_PURPLE+""+"Mythical "+convertToItemName(item.getType().name().replace("_", " "))); - } - item.setItemMeta(meta); - } else { - int enchants[] = {0,1,2,3,4,5,6,7,34}; - for (int j=0;j ourLore = new ArrayList(); - if (rarity==3) { - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*48)+16+1)+" "+ChatColor.BLUE+"Health"); - } else - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+20+1)+"% "+ChatColor.BLUE+"Damage Reduction"); - } else - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*400)+100+1)*10)+"% "+ChatColor.BLUE+"Durability"); - } else - if (Math.random()<=0.2) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+10+1)+"% "+ChatColor.BLUE+"Block Chance"); - } else - { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*70)+20+1)+"% "+ChatColor.BLUE+"Speed Boost Chance"); - } - } else - 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) { - int choice1=0; - if (Math.random()<=0.2) { - choice1=0; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*8)+1)+" "+ChatColor.BLUE+"Health"); - } else - if (Math.random()<=0.2) { - choice1=1; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Damage Reduction"); - } else - if (Math.random()<=0.2) { - choice1=2; - ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*100)+1)*10)+"% "+ChatColor.BLUE+"Durability"); - } else - if (Math.random()<=0.2) { - choice1=3; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Block Chance"); - } else - { - choice1=4; - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance"); - } - if (Math.random()<=0.2 && choice1!=0) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*8)+1)+" "+ChatColor.BLUE+"Health"); - } else - if (Math.random()<=0.2 && choice1!=1) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Damage Reduction"); - } else - if (Math.random()<=0.2 && choice1!=2) { - ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*100)+1)*10)+"% "+ChatColor.BLUE+"Durability"); - } else - if (Math.random()<=0.2 && choice1!=3) { - ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Block Chance"); - } else - { - if (choice1!=4) { - 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 meta = item.getItemMeta(); - meta.setLore(ourLore); - if (rarity==1) { - meta.setDisplayName(ChatColor.BLUE+"Rare "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==2) { - meta.setDisplayName(ChatColor.YELLOW+""+ChatColor.BOLD+"Legendary "+convertToItemName(item.getType().name().replace("_", " "))); - } - if (rarity==3) { - meta.setDisplayName(ChatColor.LIGHT_PURPLE+""+"Mythical "+convertToItemName(item.getType().name().replace("_", " "))); - } - item.setItemMeta(meta); - } - } - } else { - //Add minerals. - int rand = (int)(Math.random()*18); - switch (rand) { - case 0 : - case 9: - case 10: - case 11:{ - item = new ItemStack(Material.IRON_INGOT,(int)(Math.random()*20)+10); - }break; - case 1 :{ - item = new ItemStack(Material.IRON_BLOCK,(int)(Math.random()*2)+1); - }break; - case 2 : - case 12: - case 13: - case 14:{ - item = new ItemStack(Material.GOLD_INGOT,(int)(Math.random()*10)+5); - }break; - case 3 :{ - item = new ItemStack(Material.GOLD_BLOCK,(int)(Math.random()*1)+1); - }break; - case 4 : - case 15: - case 16: - case 17: { - item = new ItemStack(Material.LAPIS_BLOCK,(int)(Math.random()*20)+10); - }break; - case 5 :{ - item = new ItemStack(Material.REDSTONE_BLOCK,(int)(Math.random()*12)+2); - }break; - case 6 :{ - item = new ItemStack(Material.DIAMOND,(int)(Math.random()*2)+1); - }break; - case 7 :{ - item = new ItemStack(Material.DIAMOND_BLOCK,(int)(Math.random()*1)+1); - }break; - case 8 :{ - item = new ItemStack(Material.EMERALD,(int)(Math.random()*2)+1); - }break; - } - } - return item; -} - - @EventHandler - public void onEnemyKill(EntityDeathEvent e) { - if (e.getEntity().getType()==EntityType.SQUID || e.getEntity().getType()==EntityType.SLIME || e.getEntity().getType()==EntityType.ZOMBIE || e.getEntity().getType()==EntityType.SPIDER || e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.CREEPER - || e.getEntity().getType()==EntityType.PIG_ZOMBIE || e.getEntity().getType()==EntityType.GHAST || e.getEntity().getType()==EntityType.ENDERMAN || e.getEntity().getType()==EntityType.BLAZE - || e.getEntity().getType()==EntityType.ENDER_DRAGON || e.getEntity().getType()==EntityType.WITHER || e.getEntity().getType()==EntityType.CHICKEN || e.getEntity().getType()==EntityType.SHEEP - || e.getEntity().getType()==EntityType.PIG || e.getEntity().getType()==EntityType.COW || e.getEntity().getType()==EntityType.OCELOT || e.getEntity().getType()==EntityType.WOLF - || e.getEntity().getType()==EntityType.MUSHROOM_COW) { - LivingEntity f = e.getEntity(); - if (f.getType()==EntityType.ZOMBIE || - f.getType()==EntityType.SKELETON || - f.getType()==EntityType.PIG_ZOMBIE || - f.getType()==EntityType.SPIDER || - f.getType()==EntityType.CREEPER || - f.getType()==EntityType.ENDERMAN) { - //if (Math.random()<=0.005) { - /* - if (Math.random()<=0.005) { - //0.5% chance of a mystical book dropping. - if (f.getKiller()!=null) { - ItemStack book = new ItemStack(Material.WRITTEN_BOOK); - BookMeta bookdata = (BookMeta)book.getItemMeta(); - int choosebook = (int)(Math.random()*9.0d); - switch (choosebook) { - case 0:{ - bookdata.setAuthor("Steve"); - bookdata.setTitle("Dangers of the Nether"); - bookdata.addPage("Dangers of the Nether\n"+ChatColor.ITALIC+" by Steve\n======\n"+ChatColor.RESET+"It didn't take me long to realize where we were. It was dangerous, very hot, and lots of torturous screams could be heard everywhere. I barely had time","to take it all in before a huge fireball was shot in my direction. I quickly looked to my side to find a convenient safe passage and hid there for a few minutes. I guess I was in there longer than I thought, I ended","up falling asleep and waking up to notice there was something scary on the wall.\n\n"+ChatColor.ITALIC+"\"TURN AND LEAVE NOW. DANGEROUS TO STAY. REAL WORLD HAS WHAT YOU ARE LOOKING FOR. I ONLY REMEMBER THE 1ST X POSITION...",ChatColor.ITALIC+"...IT WAS 7! I AM *POSITIVE*\""+ChatColor.RESET+"\n\nI did not know what to think. The 1st X position? I quickly remembered the 7 and sprinted out of the nether portal. And to think that was *THE END* of my adventures..."); - }break; - case 1:{ - bookdata.setAuthor("Lacey"); - bookdata.setTitle("A Hole in the Flower Garden"); - bookdata.addPage("A Hole in the Flower Garden\n"+ChatColor.ITALIC+" by Lacey\n======\n"+ChatColor.RESET+"It was a lovely day to pick flowers in the garden, they just finished blooming fully. I was so excited to pick them, but I didn't do so until","after I've taken in all the wonderful scents! Smelling all the flowers and wonderful smells of plants and trees and nature and grass. It was perfect. I was mindlessly walking along this prairie when I stumbled.","I fell, and fell, and fell. I hit the bottom of a ravine. It didn't even occur to me I would just walk into one. I took some minor damage, but when I got up, I noticed something strange.","There were two or three zombies gathered around a wall, etching something into it. I went over to read it once the zombies walked away. I saw on the wall:\n\n"+ChatColor.ITALIC+"X-2:6 <--END","It looked cryptic to me, but why would they write that on the wall? I quickly scribbled it down on a notepad I had in my pocket and started climbing out of the ravine to tend to my lovely flowers. What a day!"); - }break; - case 2:{ - bookdata.setAuthor("Jimmy"); - bookdata.setTitle("Messages in Music"); - bookdata.addPage("Messages in Music\n"+ChatColor.ITALIC+" by Jim"+"\n======"+ChatColor.RESET+"\nI popped out the disk from my Jukebox to put in another, I could jam to these all day! As I was looking through my collection for something to listen to","I found a really bent up disk. 'No way this could still play', I thought to myself. I put it in, and it crackled and snarled, but it was indeed playing! At first I heard some faint resemblence of music, but then suddenly,","a hiss, an explosion, and then 'CREEEEEEEEE----- 7X XSSSSSSSSSS 3RD EEEEEEE' mental images appeared in my head, but the 7X and 3RD stood out the most. It's like I was seeing them in my head while hearing something else!","I couldn't stand up anymore, or think. I forcibly reached up with my weak hand to find the eject button on the player and when I found the familiar nub in the button, pressed down on it and out popped the disk, hitting my face,","but putting me back into reality. Something was telling me that the 3RD and 7X was important. But I couldn't quite put my tongue on it."); - }break; - case 3:{ - bookdata.setAuthor("Creeper"); - bookdata.setTitle("HISS"); - bookdata.addPage("Y do i exisssst. nobody knowssss. i just want a hugssssss, HUGSSSSSSS. but i don't know Y i exist. there's no Y in the first position. it'sssss jusssst two digitssssss.... SSSSSSSSS. *THE END*"); - }break; - case 4:{ - bookdata.setAuthor("Marco"); - bookdata.setTitle("The Hunt for a Dragon"); - bookdata.addPage("The Hunt for a Dragon\n"+ChatColor.ITALIC+" by Marco"+"\n======"+ChatColor.RESET+"\nThere exists a rumor that a mythical dragon could be found in the depths of our world. It is even said he doesn't exist in OUR world, but ANOTHER world altogether!","That my friends already boggles me, but where the heck would I go to find it then? I have been told he exists, and I know he is. I believe deep in my heart. I searched day and night under and over ground.","One day I found something strange in the ground. It was pink wool, in the middle of a cave on the ground. It even said something, but I couldn't tell from so close up. So I literally dug all the way to the surface, keeping the boundaries","of that word uncovered the whole way up. When I got to the top and looked down, I was relieved to find it was made out of markings I could discern. It said: 'Y: X3?' It was definitely a weird group of symbols, but I have a strong feeling"," that it is directly linked with that dragon I am trying to hunt down. Maybe I can gather more clues and try to decipher the location of this thing."); - }break; - case 5:{ - bookdata.setAuthor("Steve"); - bookdata.setTitle("Cooking Food"); - bookdata.addPage("Cooking Food\n"+ChatColor.ITALIC+" by Steve"+"\n======"+ChatColor.RESET+"\nIt was a bright and rather typical sunny day in the Minecraft world. I don't actually think it was very hot either. I just managed to catch a few fish and was cooking them up.","It wasn't long before I got distracted and heard a funny noise. It was an ocelote. Lucky me, an ocelote has smelled the scent of my fish! I grab a few and hold it out for the ocelote. It slowly creeps over, and then takes it and runs from me.","I thought it was full and finished cooking the rest of the fish. However, the ocelote returned a few minutes later with a neatly-folded piece of paper in its mouth. It came up to me and set it down, like it was some message just for me.","I opened it up and it read:\n\n"+ChatColor.ITALIC+"Don't let the fish get to your tongue! If you know what's wise, you will investigate further. The 3rd position of Y being the number 5."+ChatColor.RESET+"\n\n","I didn't notice the ocelote run away, but I knew something FISHY was going on. That message seemed important for some reason, I've seen similar cryptic messages before... Perhaps I'll hold onto this in case I need it in the future."); - }break; - case 6:{ - bookdata.setAuthor("Fredric"); - bookdata.setTitle("Math Behind the Void"); - bookdata.addPage("Math Behind the Void\n"+ChatColor.ITALIC+" by Fredric"+"\n======"+ChatColor.RESET+"\nThis book describes a few principles that the void in this world follows. While no one has actually seen the void, we have found a few theories and rules regarding them.","1. The Void has a Light Level of -14. The Void actually absorbs light coming from light sources and thus, if The Void is ever opened to the real world, would suck up the light from it.","2. The Void always has a volume of 50,000m, being 50m x 20m x 50m. This means that The Void, regardless of location is always the same exact size. This would conclude to us that The Void is co-existing and multiple instaces of it may exist in the same realm.","3. Any Entity entering The Void will not be able to escape The Void as time passes much more quickly inside The Void. This means Entities that enter The Void feel accelerated processes and cannot combat it, since the time outside is behind them.","4. A point of connection between The Void and other dimensions has to exist, for The Void to exist. Speculation has it that one of these points has been leaked into the world, and is accessible by us directly. After further research,","we have learned that one of these points is located on the 1st respective numeral along our Z axis with the number 4. It has also been proven that this number has to be negative as the other two sources interacting with The Void are positive."); - }break; - case 7:{ - bookdata.setAuthor("Robert"); - bookdata.setTitle("TNT"); - bookdata.addPage("TNT\n"+ChatColor.ITALIC+" by Robert"+"\n======"+ChatColor.RESET+"\nYou know, the easiest way to clear a tunnel is using an item called TNT. It is a rather small block, but it is loaded with gunpowder. When lit by an external force, it ignites","with the force of 5 Creeper explosions to clear whole caves out. Well lo and behold one day I discovered a rather strange abandoned mineshaft. It wasn't normal for sure, because there were green vines everywhere and lots of strange doors.","It was like somebody lived here ages ago, and I am discovering the ruins of such a place. Inoperable levers, a few mobs I have to kill here and there that have made this area their designated home. It was a mess. But I did discover that","someone was trying to find what we would call 'The End'. It's a magical place, and I believe with the right amount of effort, we can find it someday too. He had scribbled the coordinates of the location he was trying to reach.","However, most of it is faded out and I can only tell faintly the remains of it: \n\n"+ChatColor.ITALIC+"X:---\nY:---\nZ:--7-"+ChatColor.RESET+"\n\nYep, that's about it.","Hopefully by me recording this data, someone else can fill in the remaining numbers and we can all find The End together. Someday..."); - }break; - case 8:{ - bookdata.setAuthor("Joshua"); - bookdata.setTitle("Fourside"); - bookdata.addPage("Fourside\n"+ChatColor.ITALIC+" by Joshua"+"\n======"+ChatColor.RESET+"\n"+ChatColor.DARK_BLUE+"ABANDONED PROJECT"+ChatColor.RESET+". A city that would be developed with the best technology and the highest standards. It would","succeed every single Minecraft city that has ever been built. Casinos, diamond-lined walkways, towering skyscrapers as far as the eye can see. Museums, Libraries, Educational Institutions. This mega-city would be able to hold","and sustain every single Minecrafter in existence. But no, something went terribly wrong. Our engineering team finally developed the perfect transportation system and we were wiring it up to our fusion power plant.","Something went horribly wrong. The Fusion power plant started self-combusting itself, leaving behind hyper-cold atoms. This caused nucleic waste to interact with the environment around itself and freezing the whole world as we knew it.","The city idea as we knew it was scrapped, and we would wait 2000 years before we could attempt this again. We wrote plans for a much more portable solution and have named it 'Twoside' and archived it appropriately.","Maybe someone will pick up that book and be able to make the future bright with a mini version of Fourside. That being said, we left the 3rd slot of the Z position of our city at 7. This should give you enough clue as to where NOT to build."); - }break; - } - book.setItemMeta(bookdata); - //p.setItemInHand(book); - f.getKiller().getInventory().addItem(book); - f.getKiller().updateInventory(); - f.getKiller().sendMessage(ChatColor.LIGHT_PURPLE+"You feel a magical presence get inserted into your inventory."); - } - }*/ - } - if (f.getCustomName()!=null) { - if (f.getCustomName().contains("Strong")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("II")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("Venomous")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("Snaring")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("Charge")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("Explosive")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("Destructive")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("Sniper")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - if (f.getCustomName().contains("Mega Wither")) { - e.setDroppedExp(e.getDroppedExp()*500); - for (int j=0;j<4;j++) { - Location dd = f.getLocation().add(Math.random()*4,Math.random()*4,Math.random()*4); - Bukkit.getWorld("world").getBlockAt(dd).setType(Material.CHEST); - Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(dd).getState(); - for (int i=0;i<27;i++) { - ItemStack item = null; - if (Math.random()<=0.3) { - item = getGoodie(); - c.getBlockInventory().setItem(i, item); - } - } - } - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule mobGriefing false"); - } - if (f.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { - e.setDroppedExp(e.getDroppedExp()*20); - f.setHealth(0); - this.plugin.BOSS_DEFEAT=100; - this.plugin.BOSS_DEFEAT_LOC=f.getLocation(); - //Create a chest at the death spot. - Bukkit.getWorld("world").getBlockAt(f.getLocation()).setType(Material.CHEST); - Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(f.getLocation()).getState(); - for (int i=0;i<27;i++) { - ItemStack item = null; - if (Math.random()<=0.3) { - item = getGoodie(); - c.getBlockInventory().setItem(i, item); - } - } - } - } - if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { - e.setDroppedExp(e.getDroppedExp()*2); - } - 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++) { - if (f.getWorld().getBlockAt(f.getLocation().add(x,y,z)).getType()==Material.MOB_SPAWNER) { - //This is near a spawner. Do not drop exp orbs or items. - List drops = e.getDrops(); - for (int i=0;i=5) { - e.setDroppedExp(e.getDroppedExp()*2); - } - p.giveExp(e.getDroppedExp()); - if (e.getDroppedExp()!=0) { - p.playSound(p.getLocation(), Sound.ORB_PICKUP, 0.9f, 1); - } - //p.sendMessage(f.getType()+" is mad at you."); - if (!this.plugin.PlayerinJob(p, "Support")) { - //Make sure a support did not kill it. - for (int i=0;i=10) { - List drops = e.getDrops(); - for (int i=0;i0) { - ItemStack reward = getGoodie(); - Bukkit.getWorld("world").dropItemNaturally(s.getLocation(), reward); - times--; - } - } - } - } - e.setDroppedExp(0); - /* - if (f.getType()==EntityType.PLAYER) { - Player p = (Player)f; - Bukkit.getPlayer("sigonasr2").sendMessage("EXP Lost: "+p.get); - if (this.plugin.PlayerinJob(p, "Explorer")) { - if (this.plugin.getJobLv("Explorer", p)>=10) { - //Don't lose levels. - - } - } - }*/ - } - } - - @EventHandler - public void onFoodLevelChange(FoodLevelChangeEvent e) { - //Check for nearby support. - if (e.getEntity().getType()==EntityType.PLAYER) { - final Player p = (Player)e.getEntity(); - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); - } - },5); - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")>0) { - if (Math.random()<=this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9"))/100.0d) { - e.setFoodLevel(e.getFoodLevel()+1); - } - } - List nearby = p.getNearbyEntities(10, 10, 10); - for (int i=0;i=20) { - if (Math.random()<=0.50) { - e.setFoodLevel(e.getFoodLevel()+1); - } - } - } - } - } - - @EventHandler - public void onBucketEmpty(PlayerBucketEmptyEvent e) { - Player p = e.getPlayer(); - if (e.getBucket()==Material.WATER_BUCKET) { - if (this.plugin.PlayerinJob(p, "Support")) { - //Check if someone's with us. If not, we don't get awarded for supporting. - List nearby = p.getNearbyEntities(10, 20, 10); - boolean playernearby=false; - boolean onfire=false; - for (int i=0;i0 && ((Player)nearby.get(i)).getHealth()<=8) { - //They are on fire, you intend to douse them. - this.plugin.gainMoneyExp(p,"Support",4.80,240); - } - } - } - if (playernearby) { - //Check for lava below. If we find some, award some money and experience. - boolean foundlava=false; - for (int x=-10;x<10;x++) { - for (int y=-20;y<0;y++) { - for (int z=-10;z<10;z++) { - if (Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+x,p.getLocation().getBlockY()+y,p.getLocation().getBlockZ()+z).getType()==Material.LAVA) { - foundlava=true; - break; - } - } - if (foundlava) { - break; - } - } - if (foundlava) { - break; - } - } - if (foundlava) { - this.plugin.gainMoneyExp(p,"Support",0.15,60); - } - } - } - } - } - - - @EventHandler - public void onLightningStrike(LightningStrikeEvent e) { - if (this.plugin.last_lightning_random_time=5) { - //Half chance to set the durability back by one. - if (p.getItemInHand().getType()==Material.FISHING_ROD) { - if (p.getItemInHand().getDurability()>0) { - if (Math.random()>=0.5) { - p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); - } - } - } - } - if (this.plugin.getJobLv("Fisherman", p)>=20) { - e.setExpToDrop(e.getExpToDrop()*2); - int i=4; - while (i>0) { - if (Math.random()<=0.25) { - this.plugin.gainMoneyExp(p,"Fisherman",0.175,3); - if (Math.random()<=0.50) { - p.getWorld().dropItemNaturally(p.getLocation(), new ItemStack(Material.COOKED_FISH)); - //p.getInventory().addItem(new ItemStack(Material.COOKED_FISH)); - this.plugin.gainMoneyExp(p,"Fisherman",0.125,2); - } else { - p.getWorld().dropItemNaturally(p.getLocation(), new ItemStack(Material.RAW_FISH)); - //p.getInventory().addItem(new ItemStack(Material.RAW_FISH)); - } - } - i--; - } - } else - if (this.plugin.getJobLv("Fisherman", p)>=10) { - e.setExpToDrop(e.getExpToDrop()*2); - if (Math.random()<=0.25) { - p.getWorld().dropItemNaturally(p.getLocation(), new ItemStack(Material.RAW_FISH)); - //p.getInventory().addItem(new ItemStack(Material.RAW_FISH)); - this.plugin.gainMoneyExp(p,"Fisherman",0.175,3); - } - } - - } - } - } - - @EventHandler - public void onWorldLoad(WorldLoadEvent e) { - /*for (int i=0;i <"+f.getLocation().getY()+"> <"+f.getLocation().getZ()+">"); - f.remove(); - arrows++; - } - } - this.plugin.cleaned=true; - } - if (this.plugin.chunk_queue_list!=null && e.getChunk()!=null && e.getChunk().isLoaded()) { - this.plugin.chunk_queue_list.add(e.getChunk()); - if (this.plugin.chunk_queue_list.size()>640) { - this.plugin.chunk_queue_list.remove(0); - } - } - } - - @EventHandler - public void onChunkLoad(ChunkPopulateEvent e) { - Chunk c = e.getChunk(); - if (e.getWorld().getName().equalsIgnoreCase("world")) { - int removeddiamonds=0,keptdiamonds=0,removediron=0,keptiron=0; - for (int x=0;x<16;x++) { - for (int y=5;y<100;y++) { - for (int z=0;z<16;z++) { - Block b = c.getBlock(x, y, z); - if (b.getType()==Material.DIAMOND_ORE) { - if (Math.random()<=0.4) { - removeddiamonds++; - ////Bukkit.getLogger().info("A diamond has been removed from this chunk."); - b.setType(Material.STONE); - } else { - keptdiamonds++; - } - } else - if (b.getType()==Material.IRON_ORE) { - if (Math.random()<=0.6) { - removediron++; - ////Bukkit.getLogger().info("A diamond has been removed from this chunk."); - b.setType(Material.STONE); - } else { - keptiron++; - } - } - } - } - } - //Bukkit.getLogger().info(keptdiamonds+"/"+(removeddiamonds+keptdiamonds)+" diamonds, "+keptiron+"/"+(removediron+keptiron)+" iron kept for this new chunk."); - } - - Player[] playerlist = Bukkit.getOnlinePlayers(); - //Whichever player is closest gets the credit. - Player closestplayer=null; - double closestdistance=99999999; - for (int i=0;i newlore = new ArrayList(); - newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory"); - newlore.add("to convert to a legendary equipment item."); - meta.setLore(newlore); - meta.setDisplayName(ChatColor.GREEN+"Magical Pumpkin Pie"); - pump.setItemMeta(meta); - a.addItem(pump); - p.openInventory(a); - } - } - } - } - if (this.plugin.getConfig().getBoolean("halloween-enabled")) { - for (int m=0;m data = p.getInventory().getContents()[m].getItemMeta().getLore(); - //newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory"); - ItemStack magic_pie = null; - for (int i=0;i=pies) { - p.getInventory().remove(magic_pie); - //Check to see if there are any pies we need to keep for later. - List items = new ArrayList(); - for (int i=0;i0) { - 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 nearby = p.getNearbyEntities(10, 10, 10); - for (int i=0;i=20) { - //A support with the Lv20 buff is detected. If health is less than 8, take half damage. - if (p.getHealth()<=8) { - e.setDamage(e.getDamage()/2.0d); - } - } - } - if (this.plugin.PlayerinJob(p, "Explorer")) { - if (this.plugin.getJobLv("Explorer", p)>=10) { - //Check to see if our "fatal s urvivor" effect is available. - boolean survivor=false; - for (int i=0;i=0.5) { - p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(player_starthp-p.getHealth())+" damage from "+ChatColor.WHITE+f.getCause().toString()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((player_starthp-p.getHealth())/p.getMaxHealth())*100)+"%)"); - } - if (plugin.PlayerinJob(p, "Explorer")) { - if (plugin.getJobLv("Explorer", p)>=10) { - //Check to see if our "fatal s urvivor" effect is available. - boolean survivor=false; - for (int i=0;i='a'&&mod[i]<='z') { - mod[i]-=32; - first=true; - } else - if (i==0) { - if (mod[i]>='A'&&mod[i]<='Z') { - first=true; - } - } else { - if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { - first=true; - } - } - } else { - if (mod[i-1]!=' ') { - if (mod[i]>='A'&&mod[i]<='Z') { - mod[i]+=32; - } - } - } - } - boolean same=false; - for (int i=0;i0) { - p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, (this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6"))/3)*20, 0)); - } - } - } - - @EventHandler - public void onRegainHealth(EntityRegainHealthEvent e) { - if (e.getEntity().getType()==EntityType.PLAYER) { - final Player p = (Player)e.getEntity(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); - boolean regen_high=false; - int duration=0; - if (e.getRegainReason()==RegainReason.MAGIC_REGEN) { - try { - Iterator effects = p.getActivePotionEffects().iterator(); - //Figure out potion effects when player joins. - while (effects.hasNext()) { - PotionEffect nexteffect = effects.next(); - if (nexteffect.getType().getName().compareTo(PotionEffectType.REGENERATION.getName())==0) { - e.setAmount(e.getAmount()/1.25d); - if (nexteffect.getAmplifier()>2) { - regen_high=true; - duration=nexteffect.getDuration(); - } - } - /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { - p.removePotionEffect(PotionEffectType.JUMP); - p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); - }*/ - } - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to regenerate player."); - } - final int mod_duration=duration; - if (regen_high) { - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - p.removePotionEffect(PotionEffectType.REGENERATION); - p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,mod_duration,2)); - } - }, 1L); - } - } - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")>0) { - e.setAmount(e.getAmount()+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6)); - } - } - } - - @EventHandler - public void onEnemyHit(EntityDamageByEntityEvent e) { - if (e.getEntity() instanceof LivingEntity) { - final LivingEntity l = (LivingEntity)e.getEntity(); - if (l instanceof Player) { - e.setDamage(e.getDamage()*1.45d); - if (e.getDamager() instanceof Wither) { - e.setDamage(e.getDamage()*2d); - if (Math.random()<=0.25) { - l.getWorld().spawnEntity(l.getLocation(), EntityType.CREEPER); - } - } - } - if (e.getEntity() instanceof Wither) { - e.setDamage(e.getDamage()*0.2d); - } - if (e.getDamager() instanceof Projectile) { - Projectile pp = (Projectile)(e.getDamager()); - if (pp.getShooter() instanceof Player && l instanceof Wither) { - Player p = (Player)(pp.getShooter()); - if (Math.random()<=0.25) { - l.getWorld().spawnEntity(pp.getLocation(), EntityType.CREEPER); - } - } - } - if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Entered Boss Entity hit loop."); - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - //Multiplying by a number lower than 1 will reduce knockback - //Multiplying by a number greater than 1 will increase knockback - Vector knockback = l.getVelocity().multiply(0.1f); - l.setVelocity(knockback); - } - }, 1L); - if (l.getHealth()>=1) { - LivingEntity enderdragon = (LivingEntity)Bukkit.getWorld("world").spawnEntity(new Location(l.getWorld(),l.getLocation().getBlockX(),-250,l.getLocation().getBlockZ()),EntityType.ENDER_DRAGON); - enderdragon.setCustomName(ChatColor.DARK_PURPLE+"Charge Zombie III"); - enderdragon.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,127,999999)); - enderdragon.setMaxHealth(200); - enderdragon.setHealth(Warning(l.getHealth()/l.getMaxHealth()*200,7)); - enderdragon.setNoDamageTicks(999999); - enderdragon.setRemoveWhenFarAway(false); - } - Iterator e_list = Bukkit.getWorld("world").getEntitiesByClass(EnderDragon.class).iterator(); - boolean first=false; - while (e_list.hasNext()) { - //p.sendMessage("Moving Enderdragon to "+new Location(p.getWorld(),p.getLocation().getBlockX()+i,-50,p.getLocation().getBlockZ()+j)); - EnderDragon next = e_list.next(); - if (!first) { - first=true; - } else { - next.remove(); - } - } - boolean clear_torches=false; - try { - Iterator effects = l.getActivePotionEffects().iterator(); - //Figure out potion effects when player joins. - while (effects.hasNext()) { - PotionEffect nexteffect = effects.next(); - if (nexteffect.getType().getName().compareTo(PotionEffectType.SLOW.getName())==0 && nexteffect.getDuration()>99999) { - l.removePotionEffect(PotionEffectType.SLOW); - //Make lightning strikes in random places. - for (int i=0;i<8;i++) { - Bukkit.getWorld("world").strikeLightningEffect(l.getLocation().add(Math.random()*10-Math.random()*10,0,Math.random()*10-Math.random()*10)); - this.plugin.last_lightning_random_time=Main.SERVER_TICK_TIME+60; - } - int extramobs=0; - List nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); - //Filter out all unrelated entity types. - for (int k=0;k nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); - //Filter out all unrelated entity types. - for (int k=0;k nearby = p.getNearbyEntities(10, 10, 10); - for (int i=0;i=20) { - //A support with the Lv20 buff is detected. If health is less than 8, take half damage. - if (p.getHealth()<=8) { - e.setDamage(e.getDamage()/2.0d); - } - } - } - if (e.getDamager() instanceof LivingEntity) { - final double player_starthp = p.getHealth(); - final LivingEntity l = (LivingEntity)e.getDamager(); - if (p.getNoDamageTicks()=10) { - //Check to see if our "fatal s urvivor" effect is available. - boolean survivor=false; - for (int i=0;iblocks = new ArrayList(); //Corresponds to helmet, chestplate, leggings, and boots. - //Found the slot. Check armor values. - double block_chance=0,speed_boost_chance=0; - if (p.getEquipment().getBoots()!=null) { - ItemStack item = p.getEquipment().getBoots(); - if (this.plugin.isBroken(item)) { - //Add it either to our inventory, or drop on the ground. - if (this.plugin.inventoryFull(p)) { - //Drop it on the ground. - p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); - p.getWorld().dropItemNaturally(p.getLocation(), item); - } else { - p.getInventory().addItem(item); - } - - //Remove it from the slot. - p.getEquipment().setBoots(new ItemStack(Material.AIR)); - } else - if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { - for (int i=0;i100) { - extradurability=this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i)); - } - } - } - - //Bukkit.getLogger().info("Made it through 2.1.6."); - } - int heal = item.getDurability()-this.plugin.SPEED_CONTROL.get(slot).boots_durability; - //p.sendMessage("Heal is "+heal+" ("+item.getDurability()+"-"+this.plugin.SPEED_CONTROL.get(slot).boots_durability+")"); - if (Math.random()<=0.75 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - //p.sendMessage("Healed! "+item.getDurability()); - } - if (heal!=0) { - while (extradurability>0) { - extradurability-=200; - if (Math.random()<=0.5 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - //p.sendMessage("Healed! "+item.getDurability()); - } - } - } - //Bukkit.getLogger().info("Armor durability now "+item.getDurability()); - //Bukkit.getLogger().info("Made it through 2.1.7."); - this.plugin.SPEED_CONTROL.get(slot).boots_durability=item.getDurability(); - //p.sendMessage("New Durability: "+item.getDurability()); - //Bukkit.getLogger().info("Made it through 2.1.8."); - } - } - } else { - this.plugin.SPEED_CONTROL.get(slot).boots_durability=-1; - //Bukkit.getLogger().info("Made it through 2.1.9."); - } - //Bukkit.getLogger().info("Made it through 2.1."); - if (p.getEquipment().getChestplate()!=null) { - ItemStack item = p.getEquipment().getChestplate(); - if (this.plugin.isBroken(item)) { - //Add it either to our inventory, or drop on the ground. - if (this.plugin.inventoryFull(p)) { - //Drop it on the ground. - p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); - p.getWorld().dropItemNaturally(p.getLocation(), item); - } else { - p.getInventory().addItem(item); - } - - //Remove it from the slot. - p.getEquipment().setChestplate(new ItemStack(Material.AIR)); - } else - if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { - for (int i=0;i100) { - extradurability=this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i)); - } - } - } - } - boolean allow=false; - int heal = item.getDurability()-this.plugin.SPEED_CONTROL.get(slot).chestplate_durability; - if (Math.random()<=0.75 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - } - if (heal!=0) { - while (extradurability>0) { - extradurability-=200; - if (Math.random()<=0.5 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - } - } - } - this.plugin.SPEED_CONTROL.get(slot).chestplate_durability=item.getDurability(); - } - } - } else { - this.plugin.SPEED_CONTROL.get(slot).chestplate_durability=-1; - } - //Bukkit.getLogger().info("Made it through 2.2."); - if (p.getEquipment().getLeggings()!=null) { - ItemStack item = p.getEquipment().getLeggings(); - if (this.plugin.isBroken(item)) { - //Add it either to our inventory, or drop on the ground. - if (this.plugin.inventoryFull(p)) { - //Drop it on the ground. - p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); - p.getWorld().dropItemNaturally(p.getLocation(), item); - } else { - p.getInventory().addItem(item); - } - - //Remove it from the slot. - p.getEquipment().setLeggings(new ItemStack(Material.AIR)); - } else - if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { - for (int i=0;i100) { - extradurability=this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i)); - } - } - } - } - int heal = item.getDurability()-this.plugin.SPEED_CONTROL.get(slot).leggings_durability; - if (Math.random()<=0.75 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - } - if (heal!=0) { - while (extradurability>0) { - extradurability-=200; - if (Math.random()<=0.5 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - } - } - } - this.plugin.SPEED_CONTROL.get(slot).leggings_durability=item.getDurability(); - } - } - } else { - this.plugin.SPEED_CONTROL.get(slot).leggings_durability=-1; - } - //Bukkit.getLogger().info("Made it through 2.3"); - if (p.getEquipment().getHelmet()!=null) { - ItemStack item = p.getEquipment().getHelmet(); - if (this.plugin.isBroken(item)) { - //Add it either to our inventory, or drop on the ground. - if (this.plugin.inventoryFull(p)) { - //Drop it on the ground. - p.sendMessage(ChatColor.LIGHT_PURPLE+"Dropped "+item.getItemMeta().getDisplayName()+ChatColor.LIGHT_PURPLE+" on the ground since there is no room in your inventory."); - p.getWorld().dropItemNaturally(p.getLocation(), item); - } else { - p.getInventory().addItem(item); - } - - //Remove it from the slot. - p.getEquipment().setHelmet(new ItemStack(Material.AIR)); - } else - if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { - for (int i=0;i100) { - extradurability=this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i)); - } - } - } - } - int heal = item.getDurability()-this.plugin.SPEED_CONTROL.get(slot).helmet_durability; - if (Math.random()<=0.75 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - } - if (heal!=0) { - while (extradurability>0) { - extradurability-=200; - if (Math.random()<=0.5 && heal>0) { - heal--; - item.setDurability((short)(item.getDurability()-1)); - } - } - } - this.plugin.SPEED_CONTROL.get(slot).helmet_durability=item.getDurability(); - } - } - } else { - this.plugin.SPEED_CONTROL.get(slot).helmet_durability=-1; - } - //Bukkit.getLogger().info("Made it through 3."); - //This is the player getting hit. - for (int i=0;i effects = p.getActivePotionEffects().iterator(); - //Figure out potion effects when player joins. - while (effects.hasNext()) { - PotionEffect nexteffect = effects.next(); - if (nexteffect.getType().getName().compareTo(PotionEffectType.SPEED.getName())==0) { - if (nexteffect.getAmplifier()<2) { - p.removePotionEffect(PotionEffectType.SPEED); - if (data!=-1) { - this.plugin.SPEED_CONTROL.get(data).potion_spdlv=0; - } - } - } - effects.remove(); - } - - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible while finalizing player speed."); - } - p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,200,2)); - } - if (Math.random()<=block_chance/100.0d) { - e.setDamage(0); - //Choose a random set to mark off. - int armor = blocks.get((int)(Math.random()*blocks.size())); - switch (armor) { - case 0:{ - p.getInventory().getHelmet().setDurability((short)(p.getInventory().getHelmet().getDurability()+1)); - }break; - case 1:{ - p.getInventory().getChestplate().setDurability((short)(p.getInventory().getChestplate().getDurability()+1)); - }break; - case 2:{ - p.getInventory().getLeggings().setDurability((short)(p.getInventory().getLeggings().getDurability()+1)); - }break; - case 3:{ - p.getInventory().getBoots().setDurability((short)(p.getInventory().getBoots().getDurability()+1)); - }break; - } - e.setCancelled(true); - } - //Bukkit.getLogger().info("Made it through 4."); - p.updateInventory(); - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")>0) { - double olddmg=e.getDamage(); - e.setDamage(e.getDamage()*(((100-this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4))/100.0d))); - //p.sendMessage("Damage set from "+olddmg+" to "+e.getDamage()); - } - } - //Bukkit.getLogger().info("Made it through 5."); - if (e.getEntity().getType()==EntityType.PLAYER && e.getDamager().getType()==EntityType.SPIDER) { - LivingEntity enemy = (LivingEntity)e.getDamager(); - if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.YELLOW+"Venomous Spider")==0)) { - LivingEntity p = (LivingEntity)e.getEntity(); - p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 1, false)); - } else - if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GOLD+"Venomous Spider II")==0)) { - LivingEntity p = (LivingEntity)e.getEntity(); - p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 2, false)); - } else - if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.YELLOW+"Snaring Spider")==0)) { - LivingEntity p = (LivingEntity)e.getEntity(); - p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 2, false)); - //Create web at the position of the player. - /* - for (int x=-1;x<2;x++) { - for (int y=-1;y<2;y++) { - for (int z=-1;z<2;z++) { - Block b = Bukkit.getWorld("world").getBlockAt(p.getLocation().add(x,y,z)); - if (b.getType()==Material.AIR) { - b.setType(Material.WEB); - this.plugin.TEMP_WEBS.add(new TempWeb(p.getLocation().add(x,y,z), 90)); - } - } - } - }*/ - } else - if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GOLD+"Snaring Spider II")==0)) { - LivingEntity p = (LivingEntity)e.getEntity(); - try { - Iterator effects = p.getActivePotionEffects().iterator(); - //Figure out potion effects when player joins. - while (effects.hasNext()) { - PotionEffect nexteffect = effects.next(); - if (nexteffect.getType().getName().compareTo(PotionEffectType.SLOW.getName())==0) { - p.removePotionEffect(PotionEffectType.SLOW); - p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 150, nexteffect.getAmplifier()+1, true)); - } - /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { - p.removePotionEffect(PotionEffectType.JUMP); - p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); - }*/ - effects.remove(); - } - - } catch (ConcurrentModificationException ex_e) { - Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to slow down player."); - } - p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 150, 1, true)); - //Create web at the position of the player. - /*for (int x=-2;x<3;x++) { - for (int y=-2;y<3;y++) { - for (int z=-2;z<3;z++) { - Block b = Bukkit.getWorld("world").getBlockAt(p.getLocation().add(x,y,z)); - if (b.getType()==Material.AIR) { - b.setType(Material.WEB); - this.plugin.TEMP_WEBS.add(new TempWeb(p.getLocation().add(x,y,z), 150)); - } - } - } - }*/ - } - } - //Bukkit.getLogger().info("Made it through 6."); - if (e.getEntity().getType()==EntityType.PLAYER && e.getDamager().getType()==EntityType.ZOMBIE) { - LivingEntity enemy = (LivingEntity)e.getDamager(); - Player p = (Player)e.getEntity(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); - double throughdmg=0; - double maxdmg=0; - if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 || enemy.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0)) { - throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false))/2; - if (throughdmg>e.getDamage()/2) { - if (p.getHealth()-throughdmg>0) { - p.setHealth(p.getHealth()-throughdmg); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); - } - } else { - e.setDamage(0); - final Player p2 = p; - if (plugin.PlayerinJob(p, "Explorer")) { - if (plugin.getJobLv("Explorer", p)>=10) { - //Check to see if our "fatal s urvivor" effect is available. - boolean survivor=false; - for (int i=0;i0) { - p.setHealth(p.getHealth()-e.getDamage()/2); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()/2*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); - } - } else { - e.setDamage(0); - final Player p2 = p; - if (plugin.PlayerinJob(p, "Explorer")) { - if (plugin.getJobLv("Explorer", p)>=10) { - //Check to see if our "fatal s urvivor" effect is available. - boolean survivor=false; - for (int i=0;ie.getDamage()) { - if (p.getHealth()-throughdmg>0) { - p.setHealth(p.getHealth()-throughdmg); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); - } - } else { - e.setDamage(0); - final Player p2 = p; - if (plugin.PlayerinJob(p, "Explorer")) { - if (plugin.getJobLv("Explorer", p)>=10) { - //Check to see if our "fatal s urvivor" effect is available. - boolean survivor=false; - for (int i=0;i0) { - p.setHealth(p.getHealth()-e.getDamage()); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { - //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); - } - } else { - e.setDamage(0); - final Player p2 = p; - if (plugin.PlayerinJob(p, "Explorer")) { - if (plugin.getJobLv("Explorer", p)>=10) { - //Check to see if our "fatal s urvivor" effect is available. - boolean survivor=false; - for (int i=0;i0) { - if (Math.random()<=critical_chance/100.0d) { - e.setDamage(e.getDamage()*2); - } - } - if (f.getNoDamageTicks()0) { - if (p.getHealth()+e.getDamage()*(life_steal/100.0d)0) { - f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d/4))); - } - if (dmg>0) { - e.setDamage(e.getDamage()+dmg); - } - if (this.plugin.PlayerinJob((Player)e.getDamager(), "Support")) { - for (int i=0;i=5) { - //Deal 2 extra damage. - e.setDamage(e.getDamage()+2); - } - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")>0) { - e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7"))/2)); - } - if (f.getNoDamageTicks()0) { - double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - if (throughdmg>normaldmg+armor_pen) { - //This means some piercing can be done. - //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); - if (f.getHealth()-(normaldmg+armor_pen)>0) { - f.setHealth(f.getHealth()-(normaldmg+armor_pen)); - armor_pen_dmg=(normaldmg+armor_pen); - if (f!=null) { - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } - } else { - f.setHealth(0); - } - } else { - //This means piercing would do extra damage. Just subtract throughdmg. - if (f.getHealth()-throughdmg>0) { - f.setHealth(Warning(f,14)); - if (f!=null) { - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } - } else { - f.setHealth(0); - } - } - e.setDamage(0); - } - - if (f.getNoDamageTicks()0) { - //e.setDamage(e.getDamage()+(this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5"))/4)); - double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - if (throughdmg>normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)) { - //This means some piercing can be done. - //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); - if (f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))>0) { - f.setHealth(Warning(f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)),15)); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } else { - f.setHealth(0); - } - } else { - //This means piercing would do extra damage. Just subtract throughdmg. - if (f.getHealth()-throughdmg>0) { - f.setHealth(Warning(f.getHealth()-throughdmg,16)); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } else { - f.setHealth(0); - } - } - e.setDamage(0); - } - if (f.getNoDamageTicks()0) { - if (Math.random()<=critical_chance/100.0d) { - e.setDamage(e.getDamage()*2); - } - } - if (f.getNoDamageTicks()0) { - if (p.getHealth()+e.getDamage()*(life_steal/100.0d)0) { - f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d/4))); - } - if (dmg>0) { - e.setDamage(e.getDamage()+dmg); - } - if (e.getEntity() instanceof LivingEntity) { - LivingEntity enemy = (LivingEntity)e.getEntity(); - if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GRAY+"Zombie Ninja")==0)) { - boolean found=false; - for (int i=0;i=5) { - //Deal 2 extra damage. - e.setDamage(e.getDamage()+2); - } - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")>0) { - e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7"))/2)); - } - if (f.getNoDamageTicks()0) { - double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - - - if (throughdmg>normaldmg+armor_pen) { - //This means some piercing can be done. - //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); - if (f.getHealth()-(normaldmg+armor_pen)>0) { - f.setHealth(f.getHealth()-(normaldmg+armor_pen)); - armor_pen_dmg=(normaldmg+armor_pen); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } else { - f.setHealth(0); - } - } else { - //This means piercing would do extra damage. Just subtract throughdmg. - if (f.getHealth()-throughdmg>0) { - f.setHealth(Warning(f.getHealth()-throughdmg,18)); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } else { - f.setHealth(0); - } - } - e.setDamage(0); - } - if (f.getNoDamageTicks()0) { - //e.setDamage(e.getDamage()+(this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5"))/4)); - double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); - if (throughdmg>normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)) { - //This means some piercing can be done. - //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); - if (f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))>0) { - f.setHealth(Warning(f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)),19)); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } else { - f.setHealth(0); - } - } else { - //This means piercing would do extra damage. Just subtract throughdmg. - if (f.getHealth()-throughdmg>0) { - f.setHealth(Warning(f.getHealth()-throughdmg,20)); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { - if (f.getCustomName()!=null) { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); - } else { - //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); - } - } - } else { - f.setHealth(0); - } - } - e.setDamage(0); - } - if (f.getNoDamageTicks()=20) { - if (Math.random()<=0.05) { - ItemStack replenishitem = e.getItemInHand().clone(); - replenishitem.setAmount(1); - p.getInventory().addItem(replenishitem); - p.updateInventory(); - } - } else - if (this.plugin.getJobLv("Builder", p)>=10) { - if (Math.random()<=0.01) { - ItemStack replenishitem = e.getItemInHand().clone(); - replenishitem.setAmount(1); - p.getInventory().addItem(replenishitem); - p.updateInventory(); - } - } - if (e.getBlockPlaced().getType()==Material.COBBLESTONE) { - this.plugin.gainMoneyExp(p,"Builder",0.005,1); - if (this.plugin.getJobLv("Builder", p)>=5 && (int)this.plugin.getcurrentJobExp("Builder", p)%5==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - if (e.getBlockPlaced().getType()==Material.WOOD) { - this.plugin.gainMoneyExp(p,"Builder",0.005,2); - for (int i=0;i<2;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.LOG) { - this.plugin.gainMoneyExp(p,"Builder",0.01,3); - for (int i=0;i<3;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.WOOD_STEP) { - this.plugin.gainMoneyExp(p,"Builder",0.015,3); - for (int i=0;i<2;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.COBBLESTONE_STAIRS) { - this.plugin.gainMoneyExp(p,"Builder",0.015,3); - for (int i=0;i<2;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.STONE) { - this.plugin.gainMoneyExp(p,"Builder",0.015,4); - for (int i=0;i<4;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.FENCE) { - this.plugin.gainMoneyExp(p,"Builder",0.015,3); - for (int i=0;i<3;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.STEP) { - switch (e.getBlockPlaced().getData()) { - case 0:{ - this.plugin.gainMoneyExp(p,"Builder",0.02,4); - for (int i=0;i<4;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 1:{ - this.plugin.gainMoneyExp(p,"Builder",0.025,4); - for (int i=0;i<4;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 3:{ - this.plugin.gainMoneyExp(p,"Builder",0.015,3); - for (int i=0;i<3;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 4:{ - this.plugin.gainMoneyExp(p,"Builder",0.05,9); - for (int i=0;i<9;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 5:{ - this.plugin.gainMoneyExp(p,"Builder",0.03,5); - for (int i=0;i<5;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 6:{ - this.plugin.gainMoneyExp(p,"Builder",0.03,5); - for (int i=0;i<5;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 7:{ - this.plugin.gainMoneyExp(p,"Builder",0.06,12); - for (int i=0;i<12;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 8:{ - this.plugin.gainMoneyExp(p,"Builder",0.02,4); - for (int i=0;i<4;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 9:{ - this.plugin.gainMoneyExp(p,"Builder",0.025,4); - for (int i=0;i<4;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 10:{ - this.plugin.gainMoneyExp(p,"Builder",0.015,3); - for (int i=0;i<3;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 11:{ - this.plugin.gainMoneyExp(p,"Builder",0.015,3); - for (int i=0;i<3;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 12:{ - this.plugin.gainMoneyExp(p,"Builder",0.05,9); - for (int i=0;i<9;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 13:{ - this.plugin.gainMoneyExp(p,"Builder",0.03,5); - for (int i=0;i<5;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 14:{ - this.plugin.gainMoneyExp(p,"Builder",0.03,5); - for (int i=0;i<5;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - case 15:{ - this.plugin.gainMoneyExp(p,"Builder",0.06,12); - for (int i=0;i<12;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - }break; - } - } - if (e.getBlockPlaced().getType()==Material.WOOD_STAIRS) { - this.plugin.gainMoneyExp(p,"Builder",0.02,4); - for (int i=0;i<4;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.LAPIS_BLOCK) { - this.plugin.gainMoneyExp(p,"Builder",0.02,3); - for (int i=0;i<3;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.COBBLE_WALL) { - this.plugin.gainMoneyExp(p,"Builder",0.025,5); - for (int i=0;i<5;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.NETHER_BRICK_STAIRS) { - this.plugin.gainMoneyExp(p,"Builder",0.025,5); - for (int i=0;i<5;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.NETHER_BRICK) { - this.plugin.gainMoneyExp(p,"Builder",0.03,5); - for (int i=0;i<5;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.NETHER_FENCE) { - this.plugin.gainMoneyExp(p,"Builder",0.03,6); - for (int i=0;i<6;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.WOOL) { - this.plugin.gainMoneyExp(p,"Builder",0.035,7); - for (int i=0;i<7;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.getMaterial(109)) { - this.plugin.gainMoneyExp(p,"Builder",0.04,8); - for (int i=0;i<8;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.getMaterial(98)) { - this.plugin.gainMoneyExp(p,"Builder",0.04,8); - for (int i=0;i<8;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.GLASS) { - this.plugin.gainMoneyExp(p,"Builder",0.04,8); - for (int i=0;i<8;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.GLOWSTONE) { - this.plugin.gainMoneyExp(p,"Builder",0.05,10); - for (int i=0;i<10;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.HARD_CLAY) { - this.plugin.gainMoneyExp(p,"Builder",0.05,10); - for (int i=0;i<10;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.STAINED_CLAY) { - this.plugin.gainMoneyExp(p,"Builder",0.05,10); - for (int i=0;i<10;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.SANDSTONE_STAIRS) { - this.plugin.gainMoneyExp(p,"Builder",0.05,10); - for (int i=0;i<10;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.SANDSTONE) { - this.plugin.gainMoneyExp(p,"Builder",0.06,10); - for (int i=0;i<10;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.QUARTZ_STAIRS) { - this.plugin.gainMoneyExp(p,"Builder",0.06,12); - for (int i=0;i<12;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.IRON_FENCE) { - this.plugin.gainMoneyExp(p,"Builder",0.06,12); - for (int i=0;i<12;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.BRICK_STAIRS) { - this.plugin.gainMoneyExp(p,"Builder",0.065,9); - for (int i=0;i<9;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.QUARTZ_BLOCK) { - this.plugin.gainMoneyExp(p,"Builder",0.07,14); - for (int i=0;i<14;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - if (e.getBlockPlaced().getType()==Material.BRICK) { - this.plugin.gainMoneyExp(p,"Builder",0.075,11); - for (int i=0;i<11;i++) { - if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { - //Give a torch to the player. - p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); - } - } - } - } - } - if (this.plugin.PlayerinJob(p, "Miner")) { - this.plugin.playerdata_list.get(myData).BadInteract(e.getBlockPlaced().getType()); - } - if (this.plugin.PlayerinJob(p, "Digger")) { - this.plugin.playerdata_list.get(myData).BadInteract(e.getBlockPlaced().getType()); - } - if (this.plugin.PlayerinJob(p, "Farmer")) { - if (e.getBlockPlaced().getType()==Material.CROPS) { - this.plugin.gainMoneyExp(p,"Farmer",0.005,1); - } - //p.sendMessage("Placing down "+e.getBlockPlaced().getType()+" ("+e.getBlockPlaced().getTypeId()+"), "+e.getBlockPlaced().getData()); - if (e.getBlockPlaced().getType()==Material.PUMPKIN_STEM) { - this.plugin.gainMoneyExp(p,"Farmer",0.01,2); - } - if (e.getBlockPlaced().getType()==Material.MELON_STEM) { - this.plugin.gainMoneyExp(p,"Farmer",0.01,2); - } - } - if (this.plugin.PlayerinJob(p, "Support")) { - if (e.getBlockPlaced().getType()==Material.TORCH) { - //Make sure there are no other torches or Glowstone nearby. - boolean found=false; - for (int x=-5;x<5;x++) { - for (int y=-3;y<3;y++) { - for (int z=-5;z<5;z++) { - if (Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.TORCH || Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.GLOWSTONE) { - found=true; - break; - } - if (found) { - break; - } - } - if (found) { - break; - } - } - } - if (!found) { - this.plugin.gainMoneyExp(p,"Support",0.01,2); - } - } else - if (e.getBlockPlaced().getType()==Material.GLOWSTONE) { - //Make sure there are no other torches or Glowstone nearby. - boolean found=false; - for (int x=-5;x<5;x++) { - for (int y=-3;y<3;y++) { - for (int z=-5;z<5;z++) { - if (Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.TORCH || Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.GLOWSTONE) { - found=true; - break; - } - if (found) { - break; - } - } - if (found) { - break; - } - } - } - if (!found) { - this.plugin.gainMoneyExp(p,"Support",0.00,1); - } - } - } - if (this.plugin.getConfig().getBoolean("spleefinsession")==true && (this.plugin.getConfig().getString("spleefrequestaplayer").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestbplayer").compareTo(p.getName())==0)) { - e.setCancelled(true); - } - if (this.plugin.getConfig().getBoolean("spleef4insession")==true && (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0)) { - e.setCancelled(true); - } - if (e.getItemInHand().getType()==Material.getMaterial(127)) { - e.setCancelled(true); - } - if (this.plugin.is_ItemCube(e.getItemInHand())) { - e.setCancelled(true); - } - return; - } - - @EventHandler - public void onItemBreak(PlayerItemBreakEvent e) { - final Player p = e.getPlayer(); - final ItemStack i = e.getBrokenItem(); - if (i.getItemMeta()!=null && i.getItemMeta().hasDisplayName() && i.getItemMeta().getDisplayName().compareTo("Spleef Wooden Shovel")==0) { - i.setDurability((short)0); - p.getInventory().addItem(i); - } - if (i.hasItemMeta() && i.getItemMeta().hasLore()) { - boolean is_halloween=false; - List finallore = new ArrayList(); - for (int j=0;j=10 && crafteditem==true) { - ItemStack resultingitem = result; - resultingitem.setAmount(resultingitem.getAmount()*2); - } - } - if (this.plugin.PlayerinJob(p,"Support")) { - if (result.getType()==Material.BREAD) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getType()==Material.MUSHROOM_SOUP) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getType()==Material.COOKIE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getType()==Material.GOLDEN_CARROT) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getType()==Material.GOLDEN_APPLE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getType()==Material.PUMPKIN_PIE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getType()==Material.CAKE) { - this.plugin.gainMoneyExp(p,"Support",0.015,2); - } - if (result.getType()==Material.IRON_SWORD) { - this.plugin.gainMoneyExp(p,"Support",0.015,3); - } - if (result.getType()==Material.IRON_CHESTPLATE || result.getType()==Material.IRON_HELMET || result.getType()==Material.IRON_BOOTS || result.getType()==Material.IRON_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Support",0.025,5); - } - if (result.getType()==Material.DIAMOND_SWORD) { - this.plugin.gainMoneyExp(p,"Support",0.075,8); - } - if (result.getType()==Material.DIAMOND_CHESTPLATE || result.getType()==Material.DIAMOND_HELMET || result.getType()==Material.DIAMOND_BOOTS || result.getType()==Material.DIAMOND_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Support",0.20,20); - } - if (result.getType()==Material.CAKE) { - this.plugin.gainMoneyExp(p,"Support",0.03,2); - } - } - } - } - }*/ - - @EventHandler - public void onInventoryCloseEvent(InventoryCloseEvent e) { - Player p = (Player)e.getPlayer(); - p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.WHITE+""); - if (p.hasPermission("group.moderator")) { - p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.GREEN+""); - } - if (p.hasPermission("group.administrators")) { - p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.LIGHT_PURPLE+""); - } - if (e.getInventory().getName().contains("Item Cube")) { - int identifier=-1; - //Get idenfitier. - String ident_string=e.getInventory().getTitle().substring(e.getInventory().getTitle().indexOf("#")).replace("#", ""); - identifier=Integer.valueOf(ident_string); - if (identifier==-1) { - Bukkit.getLogger().severe("SEVERE error when saving Item Cube contents! Could not get ID!"); - return; - } - //We are going to save the contents of this inventory appropriately. - FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); - for (int i=0;i ench1 = ((EnchantmentStorageMeta) stack1.getItemMeta()).getStoredEnchants(); - Map ench2 = ((EnchantmentStorageMeta) stack2.getItemMeta()).getStoredEnchants(); - if(!ench1.equals(ench2)) return false; //Enchants aren't the same. - } - } - catch(ClassNotFoundException e){ - //Nothing. They dont have a build high enough to support this. - } - - return true; - } - - /** - * Returns the number of items that can be given to the inventory safely. - * @param inv The inventory to count - * @param item The item prototype. Material, durabiltiy and enchants must match for 'stackability' to occur. - * @return The number of items that can be given to the inventory safely. - */ - public static int countSpace(Inventory inv, ItemStack item){ - int space = 0; - for(ItemStack iStack : inv.getContents()){ - if(iStack == null || iStack.getType() == Material.AIR){ - space += item.getMaxStackSize(); - } - else if(matches(item, iStack)){ - space += item.getMaxStackSize() - iStack.getAmount(); - } - } - return space; - } - - public void giveLegendaryItem(Player p) { - String prefix = ""; - String suffix = ""; - int type=(int)(Math.random()*6); - //int type=5; //TESTING. - List enchants1 = new ArrayList(); - List enchants2 = new ArrayList(); - 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 setLore = new ArrayList(); - 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 i=0;i storelore = store.getItemMeta().getLore(); - for (int i=0;i0) { - if (storename.contains("Diamond Chestplate")) { - store.setType(Material.DIAMOND_CHESTPLATE); - ItemMeta meta = store.getItemMeta(); - meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ","")); - List lore = store.getItemMeta().getLore(); - lore.remove(repairline); - lore.remove(repairline-1); - meta.setLore(lore); - store.setItemMeta(meta); - p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); - } - if (storename.contains("Diamond Leggings")) { - store.setType(Material.DIAMOND_LEGGINGS); - ItemMeta meta = store.getItemMeta(); - meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ","")); - List lore = store.getItemMeta().getLore(); - lore.remove(repairline); - lore.remove(repairline-1); - meta.setLore(lore); - store.setItemMeta(meta); - p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); - } - if (storename.contains("Diamond Helmet")) { - store.setType(Material.DIAMOND_HELMET); - ItemMeta meta = store.getItemMeta(); - meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ","")); - List lore = store.getItemMeta().getLore(); - lore.remove(repairline); - lore.remove(repairline-1); - meta.setLore(lore); - store.setItemMeta(meta); - p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); - } - if (storename.contains("Diamond Boots")) { - store.setType(Material.DIAMOND_CHESTPLATE); - ItemMeta meta = store.getItemMeta(); - meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ","")); - List lore = store.getItemMeta().getLore(); - lore.remove(repairline); - lore.remove(repairline-1); - meta.setLore(lore); - store.setItemMeta(meta); - p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); - } - if (storename.contains("Diamond Sword")) { - store.setType(Material.DIAMOND_SWORD); - ItemMeta meta = store.getItemMeta(); - meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ","")); - List lore = store.getItemMeta().getLore(); - lore.remove(repairline); - lore.remove(repairline-1); - meta.setLore(lore); - store.setItemMeta(meta); - p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); - } - if (storename.contains("Bow")) { - store.setType(Material.BOW); - ItemMeta meta = store.getItemMeta(); - meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ","")); - List lore = store.getItemMeta().getLore(); - lore.remove(repairline); - lore.remove(repairline-1); - meta.setLore(lore); - store.setItemMeta(meta); - p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); - } - } - } - } - if ((event.getClick()==ClickType.LEFT || event.getClick()==ClickType.RIGHT)) { - if (event.getCursor()!=null && event.getCurrentItem()!=null && event.getCursor().getType().equals(event.getCurrentItem().getType()) && event.getCursor().getType()==Material.POTION) { - //Literally swap them and cancel. - ItemStack temp = event.getCursor(); - event.setCursor(event.getCurrentItem()); - event.setCurrentItem(temp); - event.setCancelled(true); - } - } - if ((event.getClick()==ClickType.SHIFT_RIGHT || event.getClick()==ClickType.SHIFT_LEFT) && (event.getInventory().getType()==InventoryType.WORKBENCH || event.getInventory().getType()==InventoryType.CRAFTING || event.getInventory().getType()==InventoryType.PLAYER) && event.getSlotType()==SlotType.RESULT) { - //Always refresh your inventory after a delay, just in case. This is a temporary fix for bugs with crafting multiple amounts of a crafting recipe. - final Player p2 = p; - p.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - p2.updateInventory(); - } - }, 1); - } - if (event.getSlot() != -999) { - ItemStack item = event.getCurrentItem(); - if (event.getInventory().getType() == InventoryType.ANVIL) - { - if (item != null && item.hasItemMeta() && item.getItemMeta().hasLore()) { - List lore = item.getItemMeta().getLore(); - for (int i=0;i=10) { - if (event.getCurrentItem()!=null && event.getCurrentItem().getType()==Material.POTION) { - if (event.getCurrentItem().getItemMeta()!=null && event.getCurrentItem().getItemMeta().getLore()!=null) { - List loredata = event.getCurrentItem().getItemMeta().getLore(); - boolean found=false; - for (int i=0;i loredata = new ArrayList(); - loredata.add(ChatColor.RED+"Duplicated"); - ItemMeta meta = event.getCurrentItem().getItemMeta(); - meta.setLore(loredata); - event.getCurrentItem().setItemMeta(meta); - } - } - } - } - } else - if (event.getInventory().getName().equalsIgnoreCase("Notification Options")) { - if (event.getSlotType()==SlotType.CONTAINER && (event.getSlot()==2 || event.getSlot()==6 || - event.getSlot()==11 || event.getSlot()==15 || - event.getSlot()==20 || event.getSlot()==24)) { - if (event.getInventory().getContents()[event.getSlot()].getType()==Material.REDSTONE_TORCH_OFF) { - event.getInventory().getContents()[event.getSlot()].setType(Material.REDSTONE_TORCH_ON); - } else { - event.getInventory().getContents()[event.getSlot()].setType(Material.REDSTONE_TORCH_OFF); - } - } - if (event.getSlotType()==SlotType.CONTAINER && (event.getSlot()==1 || event.getSlot()==5 || - event.getSlot()==10 || event.getSlot()==14 || - event.getSlot()==19 || event.getSlot()==23)) { - if (event.getInventory().getContents()[event.getSlot()+1].getType()==Material.REDSTONE_TORCH_OFF) { - event.getInventory().getContents()[event.getSlot()+1].setType(Material.REDSTONE_TORCH_ON); - } else { - event.getInventory().getContents()[event.getSlot()+1].setType(Material.REDSTONE_TORCH_OFF); - } - } - event.setCancelled(true); - } - if (event.getInventory() != null && - event.getSlotType() == SlotType.RESULT) { - - switch (event.getInventory().getType()) { - case CRAFTING: - handleCrafting(event); - break; - case WORKBENCH: - handleCrafting(event); - break; - } - - } - } - - private void rewardCraft(ItemStack item, int amount, HumanEntity pl) { - Player p = (Player)pl; - if (this.plugin.PlayerinJob(p,"Digger")) { - if (item.getType()==Material.SANDSTONE) { - this.plugin.gainMoneyExp(p,"Digger",0.02*amount,6*amount); - } - if (item.getType()==Material.BRICK) { - this.plugin.gainMoneyExp(p,"Digger",0.04*amount,8*amount); - } - } - if (this.plugin.PlayerinJob(p,"Weaponsmith")) { - boolean crafteditem=false; - if (item.getType()==Material.ARROW) { - this.plugin.gainMoneyExp(p,"Weaponsmith",0.025*amount,4*amount); - crafteditem=true; - } - /* - if (item.getType()==Material.WOOD_SWORD) { - this.plugin.gainMoneyExp(p,"Weaponsmith",0.05*amount,10*amount); - crafteditem=true; - }*/ - if (item.getType()==Material.FLINT_AND_STEEL) { - this.plugin.gainMoneyExp(p,"Weaponsmith",0.06*amount,12*amount); - crafteditem=true; - } - if (item.getType()==Material.BOW) { - this.plugin.gainMoneyExp(p,"Weaponsmith",0.075*amount,12*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_SWORD) { - this.plugin.gainMoneyExp(p,"Weaponsmith",0.375*amount,75*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_SWORD) { - this.plugin.gainMoneyExp(p,"Weaponsmith",0.50*amount,100*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_SWORD) { - this.plugin.gainMoneyExp(p,"Weaponsmith",3.60*amount,280*amount); - crafteditem=true; - } - } - if (this.plugin.PlayerinJob(p,"Blacksmith")) { - boolean crafteditem=false; - /* - if (item.getType()==Material.STONE_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.04*amount,7*amount); - crafteditem=true; - } - if (item.getType()==Material.STONE_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.05*amount,8*amount); - crafteditem=true; - } - if (item.getType()==Material.STONE_PICKAXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.075*amount,15*amount); - crafteditem=true; - }*/ - if (item.getType()==Material.LEATHER_BOOTS) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.125*amount,8*amount); - crafteditem=true; - } - if (item.getType()==Material.LEATHER_HELMET) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.15*amount,14*amount); - crafteditem=true; - } - if (item.getType()==Material.LEATHER_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.175*amount,15*amount); - crafteditem=true; - } - if (item.getType()==Material.LEATHER_CHESTPLATE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.20*amount,18*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.25*amount,18*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.325*amount,38*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_AXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.35*amount,40*amount); - crafteditem=true; - } - if (item.getType()==Material.CHAINMAIL_BOOTS) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.375*0.5*amount,80*0.5*amount); - crafteditem=true; - } - if (item.getType()==Material.CHAINMAIL_HELMET) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.50*0.5*amount,100*0.5*amount); - crafteditem=true; - } - if (item.getType()==Material.CHAINMAIL_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.725*0.5*amount,140*0.5*amount); - crafteditem=true; - } - if (item.getType()==Material.CHAINMAIL_CHESTPLATE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.875*0.5*amount,175*0.5*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_BOOTS) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.375*mult*amount,80*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_PICKAXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.40*amount,58*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_HELMET) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.50*mult*amount,100*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.625*amount,23*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.65*amount,65*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_AXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.70*amount,70*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_LEGGINGS) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.725*mult*amount,140*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_SPADE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.75*amount,90*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_HOE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.80*amount,188*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_AXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.81*amount,196*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_BOOTS) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.825*mult*amount,120*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.IRON_CHESTPLATE) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.875*mult*amount,175*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_HELMET) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",0.925*mult*amount,150*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_PICKAXE) { - this.plugin.gainMoneyExp(p,"Blacksmith",0.925*amount,290*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_BOOTS) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.00*mult*amount,390*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_LEGGINGS) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.025*mult*amount,170*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLD_CHESTPLATE) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult*amount,192*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_HELMET) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult*amount,480*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_LEGGINGS) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.325*mult*amount,660*mult*amount); - crafteditem=true; - } - if (item.getType()==Material.DIAMOND_CHESTPLATE) { - int mult=1; - if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { - mult=10; - } - this.plugin.gainMoneyExp(p,"Blacksmith",1.50*mult*amount,750*mult*amount); - crafteditem=true; - } - } - /*if (e.getBlock().getType()==Material.PUMPKIN) { - this.plugin.gainMoneyExp(p,"Farmer",0.00,1); - } - if (e.getBlock().getType()==Material.MELON_BLOCK) { - this.plugin.gainMoneyExp(p,"Farmer",0.10,10); - }*/ - if (this.plugin.PlayerinJob(p,"Farmer")) { - boolean crafteditem=false; - if (item.getType()==Material.MELON) { - this.plugin.gainMoneyExp(p,"Farmer",0.10,10); - crafteditem=true; - } - if (item.getType()==Material.PUMPKIN_SEEDS) { - this.plugin.gainMoneyExp(p,"Farmer",0.04,8); - crafteditem=true; - } - } - if (this.plugin.PlayerinJob(p,"Cook")) { - boolean crafteditem=false; - if (item.getType()==Material.BREAD) { - this.plugin.gainMoneyExp(p,"Cook",0.003125*amount,1.25*amount); - crafteditem=true; - } - if (item.getType()==Material.COOKIE) { - this.plugin.gainMoneyExp(p,"Cook",0.016875*amount,1.50*amount); - crafteditem=true; - } - if (item.getType()==Material.MUSHROOM_SOUP) { - this.plugin.gainMoneyExp(p,"Cook",0.009375*amount,3.75*amount); - crafteditem=true; - } - if (item.getType()==Material.PUMPKIN_PIE) { - this.plugin.gainMoneyExp(p,"Cook",0.0375*amount,15*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLDEN_CARROT) { - this.plugin.gainMoneyExp(p,"Cook",0.0875*amount,35*amount); - crafteditem=true; - } - if (item.getType()==Material.CAKE) { - this.plugin.gainMoneyExp(p,"Cook",0.10625*amount,21.25*amount); - crafteditem=true; - } - if (item.getType()==Material.GOLDEN_APPLE) { - this.plugin.gainMoneyExp(p,"Cook",0.1125*amount,45*amount); - crafteditem=true; - } - if (this.plugin.getJobLv("Cook", p)>=10 && crafteditem==true) { - //This is an ugly fix for the problem...But it works somehow. - //Player newp = Bukkit.getPlayer(p.getName()); - p.getInventory().addItem(new ItemStack(item.getType(),amount,item.getDurability(),item.getData().getData())); - } - } - /* - if (this.plugin.PlayerinJob(p,"Support")) { - if (item.getType()==Material.BREAD) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); - } - if (item.getType()==Material.MUSHROOM_SOUP) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); - } - if (item.getType()==Material.COOKIE) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); - } - if (item.getType()==Material.GOLDEN_CARROT) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); - } - if (item.getType()==Material.GOLDEN_APPLE) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); - } - if (item.getType()==Material.PUMPKIN_PIE) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); - } - if (item.getType()==Material.CAKE) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); - } - if (item.getType()==Material.IRON_SWORD) { - this.plugin.gainMoneyExp(p,"Support",0.015*amount,3*amount); - } - if (item.getType()==Material.IRON_CHESTPLATE || item.getType()==Material.IRON_HELMET || item.getType()==Material.IRON_BOOTS || item.getType()==Material.IRON_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Support",0.025*amount,5*amount); - } - if (item.getType()==Material.DIAMOND_SWORD) { - this.plugin.gainMoneyExp(p,"Support",0.075*amount,8*amount); - } - if (item.getType()==Material.DIAMOND_CHESTPLATE || item.getType()==Material.DIAMOND_HELMET || item.getType()==Material.DIAMOND_BOOTS || item.getType()==Material.DIAMOND_LEGGINGS) { - this.plugin.gainMoneyExp(p,"Support",0.20*amount,20*amount); - } - if (item.getType()==Material.CAKE) { - this.plugin.gainMoneyExp(p,"Support",0.03*amount,2*amount); - } - }*/ - } - - private void handleCrafting(InventoryClickEvent event) { - - HumanEntity player = event.getWhoClicked(); - ItemStack toCraft = event.getCurrentItem(); - ItemStack toStore = event.getCursor(); - - // Make sure we are actually crafting anything - if (player != null && hasItems(toCraft)) { - - if (event.isShiftClick()) { - // Hack ahoy - schedulePostDetection(player, toCraft); - } else { - // The items are stored in the cursor. Make sure there's enough space. - if (isStackSumLegal(toCraft, toStore)) { - int newItemsCount = toCraft.getAmount(); - - rewardCraft(toCraft,newItemsCount,player); - } - } - } - } - - public String[] getJobs(Player p) { - return this.plugin.getJobs(p); - } - - public String[] getJobs(String p) { - return this.plugin.getJobs(p); - } - - public boolean PlayerinJob(String p,String job) { - return this.plugin.PlayerinJob(p, job); - } - - public boolean PlayerinJob(Player p,String job) { - return this.plugin.PlayerinJob(p, job); - } - - - public int getJobLv(String job, String p) { - return this.plugin.getJobLv(job, p); - } - - public boolean validItem_Weaponsmith(ItemStack i) { - if (i.getType()==Material.ARROW || - //i.getType()==Material.WOODEN_SWORD || - i.getType()==Material.FLINT_AND_STEEL || - i.getType()==Material.BOW || - i.getType()==Material.IRON_SWORD || - i.getType()==Material.GOLD_SWORD || - i.getType()==Material.DIAMOND_SWORD) { - return true; - } - else { - return false; - } - } - - public boolean validItem_Blacksmith(ItemStack i) { - if (i.getType()==Material.LEATHER_BOOTS || - //i.getType()==Material.WOODEN_SWORD || - i.getType()==Material.LEATHER_HELMET || - i.getType()==Material.LEATHER_LEGGINGS || - i.getType()==Material.LEATHER_CHESTPLATE || - i.getType()==Material.IRON_SPADE || - i.getType()==Material.IRON_HOE || - i.getType()==Material.IRON_BOOTS || - i.getType()==Material.IRON_PICKAXE || - i.getType()==Material.IRON_LEGGINGS || - i.getType()==Material.IRON_CHESTPLATE || - i.getType()==Material.IRON_HELMET || - i.getType()==Material.IRON_AXE || - i.getType()==Material.GOLD_SPADE || - i.getType()==Material.GOLD_HOE || - i.getType()==Material.GOLD_BOOTS || - i.getType()==Material.GOLD_CHESTPLATE || - i.getType()==Material.GOLD_LEGGINGS || - i.getType()==Material.GOLD_HELMET || - i.getType()==Material.GOLD_AXE || - i.getType()==Material.DIAMOND_PICKAXE || - i.getType()==Material.DIAMOND_HOE || - i.getType()==Material.DIAMOND_SPADE || - i.getType()==Material.DIAMOND_AXE || - i.getType()==Material.DIAMOND_HELMET || - i.getType()==Material.DIAMOND_CHESTPLATE || - i.getType()==Material.DIAMOND_LEGGINGS || - i.getType()==Material.DIAMOND_BOOTS) { - return true; - } - else { - return false; - } - } - - - public ItemStack EnchantItem(ItemStack item,int lv, Player p) { - return this.plugin.EnchantItem(item, lv, p, true); - } - - // HACK! The API doesn't allow us to easily determine the resulting number of - // crafted items, so we're forced to compare the inventory before and after. - private void schedulePostDetection(final HumanEntity player, final ItemStack compareItem) { - final ItemStack[] preInv = player.getInventory().getContents(); - final int ticks = 1; - - - // Clone the array. The content may (was for me) be mutable. - for (int i = 0; i < preInv.length; i++) { - preInv[i] = preInv[i] != null ? preInv[i].clone() : null; - } - Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { - @Override - public void run() { - final ItemStack[] postInv = player.getInventory().getContents(); - int newItemsCount = 0; - - for (int i = 0; i < preInv.length; i++) { - ItemStack pre = preInv[i]; - ItemStack post = postInv[i]; - if (pre!=null && post!=null) { - //See if they are the same item. - if (pre.getTypeId()==post.getTypeId() && pre.getDurability()==post.getDurability() && - pre.getItemMeta().equals(post.getItemMeta()) && pre.getEnchantments().equals(post.getEnchantments()) && - compareItem.getTypeId()==post.getTypeId() && compareItem.getDurability()==post.getDurability() && - compareItem.getItemMeta().equals(post.getItemMeta()) && compareItem.getEnchantments().equals(post.getEnchantments())) { - //See if the quantities differ. - newItemsCount += post.getAmount()-pre.getAmount(); - //Bukkit.getPlayer("sigonasr2").sendMessage("Item amounts differ. New count: "+newItemsCount); - } - } else { - if (post!=null) { - //pre is null, so we just add the amount. - if (compareItem.getTypeId()==post.getTypeId() && compareItem.getDurability()==post.getDurability() && - compareItem.getItemMeta().equals(post.getItemMeta()) && compareItem.getEnchantments().equals(post.getEnchantments())) { - newItemsCount += post.getAmount(); - //Do any enchants we need to do here. - if (PlayerinJob((Player)player,"Weaponsmith")) { - if (getJobLv("Weaponsmith", player.getName())>=10 && validItem_Weaponsmith(post)) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - ItemStack clone = post.clone(); - ItemStack resulting = EnchantItem(clone,5,(Player)player); - player.getInventory().setItem(i, resulting); - } - } - if (PlayerinJob((Player)player,"Blacksmith")) { - if (getJobLv("Blacksmith", player.getName())>=10 && validItem_Blacksmith(post)) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - ItemStack clone = post.clone(); - ItemStack resulting = EnchantItem(clone,10,(Player)player); - player.getInventory().setItem(i, resulting); - } else - if (getJobLv("Blacksmith", player.getName())>=5 && validItem_Blacksmith(post)) { - //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); - ItemStack clone = post.clone(); - ItemStack resulting = EnchantItem(clone,5,(Player)player); - player.getInventory().setItem(i, resulting); - } - } - } - //Bukkit.getPlayer("sigonasr2").sendMessage("Item amounts differ. New count: "+newItemsCount); - } - } - } - - if (newItemsCount > 0) { - //Bukkit.getPlayer("AaMay").sendMessage(newItemsCount+" New Items have been detected."); - if (plugin.getAccountsConfig().getBoolean(player.getName()+".settings.notify2")) { - if (special_convert(compareItem.getType())) { - Bukkit.getPlayer(player.getName()).sendMessage(ChatColor.DARK_AQUA+""+ChatColor.ITALIC+"Crafted "+newItemsCount+" "+convertToItemName(compareItem.getType().name(), compareItem.getData().getData(), compareItem.getType())+"."); - } else { - Bukkit.getPlayer(player.getName()).sendMessage(ChatColor.DARK_AQUA+""+ChatColor.ITALIC+"Crafted "+newItemsCount+" "+convertToItemName(compareItem.getType().name())+"."); - } - } - rewardCraft(compareItem,newItemsCount,player); - } - } - }, ticks); - } - - private boolean hasSameItem(ItemStack a, ItemStack b) { - if (a == null) - return b == null; - else if (b == null) - return a == null; - return a.getTypeId() == b.getTypeId() && - a.getDurability() == b.getDurability() && - ((a.getItemMeta()!=null && b.getItemMeta()!=null)?Objects.equal(a.getItemMeta(), b.getItemMeta()):true) && - ((a.getEnchantments()!=null && b.getEnchantments()!=null)?Objects.equal(a.getEnchantments(), b.getEnchantments()):true); - } - - private boolean hasItems(ItemStack stack) { - return stack != null && stack.getAmount() > 0; - } - - private boolean isStackSumLegal(ItemStack a, ItemStack b) { - // See if we can create a new item stack with the combined elements of a and b - if (a == null || b == null) - return true; // Treat null as an empty stack - else - return a.getAmount() + b.getAmount() <= a.getType().getMaxStackSize(); - } - - /*@EventHandler - public void onItemSpawn(ItemSpawnEvent e) { - if (e.getEntity().getType()==EntityType.DROPPED_ITEM) { - if (e.getEntity().getItemStack().getType()==Material.IRON_ORE) { - e.getEntity().getItemStack().setType(Material.IRON_INGOT); - } else if (e.getEntity().getItemStack().getType()==Material.GOLD_ORE) { - e.getEntity().getItemStack().setType(Material.GOLD_INGOT); - } - return; - } - } - */ - @EventHandler - public void onItemDespawn(ItemDespawnEvent e) { - Item i = e.getEntity(); - Player p = Bukkit.getPlayer("sigonasr2"); - boolean allow=true; - if (this.plugin.getConfig().getBoolean("halloween-enabled") && ( - i.getItemStack().getType()==Material.PUMPKIN_PIE || - i.getItemStack().getType()==Material.SUGAR || - i.getItemStack().getType()==Material.PUMPKIN || - i.getItemStack().getType()==Material.EGG - )) { - allow=false; - } - //p.sendMessage("Item "+i.getItemStack().getItemMeta().getDisplayName()+" despawned.");// <-- CHECK THIS FOR NULL TO DETERMINE IF IT'S A REAL ITEM. - //String metastring = "Has name: "+i.getItemStack().getItemMeta().hasDisplayName(); - //p.sendMessage(metastring); - if (allow) { - //Find the nearest recycling center to dump to...usually. - RecyclingCenterNode center = null; - double distance = 99999999d; - for (int j=0;j0) { - if (i.getWorld()==this.plugin.recycling_center_list.get(j).locations.get(0).getWorld() && i.getLocation().distanceSquared(this.plugin.recycling_center_list.get(j).locations.get(0))0) { - if (center1==null) { - //Choose one randomly, if it's not equal to center2. - int randomnumb = (int)(Math.random()*this.plugin.recycling_center_list.size()); - if (center2==null) { - center1=this.plugin.recycling_center_list.get(randomnumb); - } else { - if (!center2.equals(this.plugin.recycling_center_list.get(randomnumb))) { - center1=this.plugin.recycling_center_list.get(randomnumb); - } - } - } - if (center2==null) { - //Choose one randomly, if it's not equal to center2. - int randomnumb = (int)(Math.random()*this.plugin.recycling_center_list.size()); - if (center1==null) { - center2=this.plugin.recycling_center_list.get(randomnumb); - } else { - if (!center1.equals(this.plugin.recycling_center_list.get(randomnumb))) { - center2=this.plugin.recycling_center_list.get(randomnumb); - } - } - } - if (center1==null || center2==null) { - maxiterator--; - } else { - maxiterator=0; - } - } - if (center1!=null && center2!=null) { - //Do a swap. - center1.swapItem(center2); - } - } - } - } - return; - } - //c.getBlockInventory().getSize(); - /* - if (Bukkit.getWorld("world").getBlockAt(l).getType()==Material.CHEST) { - p.sendMessage("Added item "+i.getItemStack().getTypeId()+" to chest."); - Chest c = (Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); - c.getBlockInventory(). - c.getBlockInventory().addItem(i.getItemStack()); - }*/ - /*// WORKING ITEM CODE. - Location l = new Location(Bukkit.getWorld("world"), 1617, 67, -351); - if (Bukkit.getWorld("world").getBlockAt(l).getType()==Material.CHEST) { - p.sendMessage("Added item to chest."); - Chest c = (Chest)Bukkit.getWorld("world").getBlockAt(l).getState(); - c.getBlockInventory().addItem(i.getItemStack()); - } - */ - - /* - @EventHandler - public void onDamage(EntityDamageEvent e) { - if (e.getEntity().getType() == EntityType.PLAYER) { - Player p = (Player) e.getEntity(); - TagAPI.refreshPlayer(p); - } else { - return; - } - //Player p = e.getPlayer(); - //Player p = Bukkit.getPlayer("sigonasr2"); - //p.setDisplayName(ChatColor.RED+"TEST"); - //p.setPlayerListName(ChatColor.RED+"TEST"); - } - - @EventHandler - public void onHeal(EntityRegainHealthEvent e) { - if (e.getEntity().getType() == EntityType.PLAYER) { - Player p = (Player) e.getEntity(); - TagAPI.refreshPlayer(p); - } else { - return; - } - //Player p = e.getPlayer(); - //Player p = Bukkit.getPlayer("sigonasr2"); - //p.setDisplayName(ChatColor.RED+"TEST"); - //p.setPlayerListName(ChatColor.RED+"TEST"); - } - */ - @EventHandler - public void onRedstoneChange(BlockRedstoneEvent e) { - if (e.getBlock().getType()==Material.REDSTONE_LAMP_ON || e.getBlock().getType()==Material.REDSTONE_LAMP_OFF) { - if (e.getBlock().getX()>=1562 && e.getBlock().getX()<=1644 && e.getBlock().getY()>=64 && e.getBlock().getY()<=79 && e.getBlock().getZ()>=-357 && e.getBlock().getZ()<=-211) { - e.setNewCurrent(15); - } - } - } - - @EventHandler -public void onMinecartExit(VehicleExitEvent e) { - if (e.getVehicle().getType()==EntityType.MINECART && e.getVehicle().getPassenger().getType()==EntityType.PLAYER && ((Player)e.getVehicle().getPassenger()).isOnline()) { - Bukkit.getWorld("world").dropItemNaturally(e.getVehicle().getLocation(),new ItemStack(Material.MINECART)); - e.getVehicle().remove(); - } - } - - @EventHandler -public void onMinecartEnter(VehicleEnterEvent e) { - /*if (e.getEntered().getType()==EntityType.PLAYER) { - if (e.getVehicle().getType()==EntityType.MINECART) { - Minecart m = (Minecart)e.getVehicle(); - if (e.getEntered().getLocation().getBlockZ()==-328 || e.getEntered().getLocation().getBlockZ()==-316) { - m.setMaxSpeed(8.0); - } else { - m.setMaxSpeed(4.0); - } - } - }*/ - } - /* - @EventHandler - public void onEntityEvent(EntityEvent e) { - return; - if (e.getEntity().getType()==EntityType.ZOMBIE) { - LivingEntity f = (LivingEntity)e.getEntity(); - if (f.getCustomName()!=null && (f.getCustomName().compareTo("&eCharge Zombie")==0 || f.getCustomName().compareTo("&6Charge Zombie II")==0)) { - //Destroy blocks around it. - - boolean doit=true; - if (f.getKiller()!=null && f.getKiller().getLocation().getY()>f.getLocation().getY()) { - doit=false; - } - if (doit) { - Bukkit.getPlayer("sigonasr2").sendMessage("Charge Zombie!"); - for (int i=-1;i<2;i++) { - for (int j=-1;j<2;j++) { - Location checkloc = f.getLocation().add(i,f.getLocation().getY()+1,j); - Bukkit.getWorld("world").getBlockAt(checkloc).breakNaturally(); - checkloc = f.getLocation().add(i,f.getLocation().getY()+2,j); - Bukkit.getWorld("world").getBlockAt(checkloc).breakNaturally(); - } - } - } - } else { - if (f.getCustomName()!=null) { - Bukkit.getPlayer("sigonasr2").sendMessage(f.getCustomName()); - } - } - } - }*/ - -@EventHandler -public void onShootArrow(ProjectileHitEvent e) { - LivingEntity l = e.getEntity().getShooter(); - if (l!=null && l.getType()==EntityType.SKELETON && l.getCustomName()!=null) { - if ((l.getCustomName().compareTo(ChatColor.YELLOW+"Sniper")==0)) { - boolean found=false; - if (!found) { - //Create a new shooter from this skeleton only if they are not shooting already. - this.plugin.ARROW_SHOOTERS.add(new ArrowShooter(e.getEntity().getVelocity(), e.getEntity().getLocation(),50,10,l)); - } - } else - if (l.getCustomName().compareTo(ChatColor.GOLD+"Sniper II")==0) { - boolean found=false; - if (!found) { - //Create a new shooter from this skeleton only if they are not shooting already. - for (int i=-2;i<3;i+=2) { - this.plugin.ARROW_SHOOTERS.add(new ArrowShooter(e.getEntity().getVelocity(), e.getEntity().getLocation().add(0,i,0),50,5,l)); - this.plugin.ARROW_SHOOTERS.add(new ArrowShooter(e.getEntity().getVelocity(), e.getEntity().getLocation().add(0,i,0),50,5,l)); - } - } - } - } -} - -@EventHandler -public void onEntityExpode(ExplosionPrimeEvent e) { - //Bukkit.getPlayer("AaMay").sendMessage("Entity Type: "+e.getEntity().getType().getName()); - if (e.getEntity().getType()==EntityType.CREEPER) { - LivingEntity c = (LivingEntity)e.getEntity(); - //Bukkit.getPlayer("AaMay").sendMessage("A Creeper exploded."); - if (c.getCustomName()!=null) { - //Bukkit.getPlayer("AaMay").sendMessage("Detected a name."); - if (c.getCustomName().compareTo(ChatColor.YELLOW+"Explosive Creeper")==0) { - Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),3f,false,true); - //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); - e.setCancelled(true); - //e.setRadius(3f); - //e.setFire(false); - } else - if (c.getCustomName().compareTo(ChatColor.GOLD+"Explosive Creeper II")==0) { - Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),5f,false,true); - //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); - e.setCancelled(true); - //e.setRadius(5f); - //e.setFire(false); - } else - if (c.getCustomName().compareTo(ChatColor.YELLOW+"Destructive Creeper")==0) { - Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),2f,true,true); - //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); - e.setCancelled(true); - //e.setRadius(2f); - //e.setFire(true); - } else - if (c.getCustomName().compareTo(ChatColor.GOLD+"Destructive Creeper II")==0) { - Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),4f,true,true); - //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); - e.setCancelled(true); - //e.setRadius(4f); - //e.setFire(true); - } - } - } - //Bukkit.broadcastMessage("Explosion occurs."); -} - -/* - @SuppressWarnings("deprecation") -@EventHandler - public void onPlayerMove(PlayerMoveEvent e) { - Player p = e.getPlayer(); - if (this.plugin.getConfig().getBoolean("spleef4insession")) { - //Check to see if we fall off. - if ((p.getLocation().getX()<1585 || p.getLocation().getX()>1600 || p.getLocation().getZ()<24 || p.getLocation().getZ()>39 || p.getLocation().getY()<86.5d) && ( - (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequesta4player"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestb4player"))==0 - || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestc4player"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestd4player"))==0))) { - //You lose. - //See if we're the winner. - int countdead=0; //We're looking for 3. - - - Player winningplayer = p,losingplayer = p; - if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo("none")==0) { - countdead++; - } else { - if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequesta4player")); - } else { - winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequesta4player")); - } - } - if (this.plugin.getConfig().getString("spleefrequestb4player").compareTo("none")==0) { - countdead++; - } else { - if (this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestb4player")); - } else { - winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestb4player")); - } - } - if (this.plugin.getConfig().getString("spleefrequestc4player").compareTo("none")==0) { - countdead++; - } else { - if (this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestc4player")); - } else { - winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestc4player")); - } - } - if (this.plugin.getConfig().getString("spleefrequestd4player").compareTo("none")==0) { - countdead++; - } else { - if (this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0) { - losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestd4player")); - } else { - winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestd4player")); - } - } - if (countdead==2) { - this.plugin.getConfig().set("spleef4insession", Boolean.valueOf(false)); - - - - - - //Stand someplace else when you win. - - - //Losing player has losing player stuff happen. - //This was a player that lost. - //Move them out, give them back their stuff. - Location newloc = p.getLocation(); - //Look for the special shovel for the sake of storing it. - p.getInventory().clear(); - p.getInventory().clear(p.getInventory().getHeldItemSlot()); - //Give inventories back. - if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { - for (int i=0;i=400) { - //WE have come to a standstill. Pick winner based on who has more blocks. - int player_a_blocks=0,player_b_blocks=0; - for (int i=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getLocation().getBlockX()-4;iplayer_b_blocks) { - blockwinner=1; - } else { - blockwinner=2; - } - } else - if ((p.getLocation().getY()<86.5d || p.getLocation().getZ()<52.0d || p.getLocation().getZ()>65.0d || p.getLocation().getX()>1628.0d || p.getLocation().getX()<1615.0d) || blockwinner!=0) { - //We lose. Other player wins. - this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(false)); - //Find out if we're player A, or player B. - Player winningplayer,losingplayer; - if (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))==0 || blockwinner==2) { - //We're player A. - //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestbplayer")+" is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestaplayer")+" loses."); - losingplayer=p; - winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")); - - double val1,val2,value,newval1,newval2; - if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { - val1 = this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); - } else { - val1 = 1000.0d; - } - if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { - val2 = this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); - } else { - val2 = 1000.0d; - } - value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); - if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); - } else { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); - } - if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); - } else { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); - } - if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); - } else { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); - } - if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); - } else { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); - } - newval1 = (val1+Math.round(((50.0d/((this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); - newval2 = (val2+Math.round(((50.0d/((this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); - Location newloc = winningplayer.getLocation(); - - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+(int)newval2/10+"] loses."); - newloc.setX(1622.5d); - newloc.setY(87.0d); - newloc.setZ(51.65d); - winningplayer.teleport(newloc); - updateTopSPLEEFSigns(); - this.plugin.saveAccountsConfig(); - } else { - //We're player B. - //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+" is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestbplayer")+" loses."); - losingplayer=p; - winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")); - double val1,val2,value,newval1,newval2; - if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { - val1 = this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); - } else { - val1 = 1000.0d; - } - if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { - val2 = this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); - } else { - val2 = 1000.0d; - } - value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); - if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); - } else { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); - } - if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); - } else { - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); - } - if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); - } else { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); - } - if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); - } else { - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); - } - newval1 = ((val1+Math.round((50.0d/((this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); - newval2 = ((val2+Math.round((50.0d/((this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); - this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); - this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); - Location newloc = winningplayer.getLocation(); - - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+(int)newval2/10+"] loses."); - newloc.setX(1622.5d); - newloc.setY(87.0d); - newloc.setZ(51.65d); - winningplayer.teleport(newloc); - updateTopSPLEEFSigns(); - this.plugin.saveAccountsConfig(); - } - //Look for the special shovel. - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getHeldItemSlot()); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getHeldItemSlot()); - //Give inventories back. - for (int i=0;i78.0d && p.getLocation().getZ()>53.0d && p.getLocation().getZ()<64.0d && p.getLocation().getX()<1627.0d && p.getLocation().getX()>1616.0d) { - Location newloc = p.getLocation(); - newloc.setX(1622.5d); - newloc.setY(87.0d); - newloc.setZ(51.65d); - p.teleport(newloc); - p.sendMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"You are a spectator! What are you thinking?!"); - } - } - } - } - */ - - /* - @EventHandler - public void onNameTag(PlayerReceiveNameTagEvent event) { - //String event.getNamedPlayer().getName() - String name = event.getNamedPlayer().getName(); - //Divide name into two sections based on health. - double healthratio = (double)event.getNamedPlayer().getHealth() / (double)event.getNamedPlayer().getMaxHealth(); - String firstpart=name.substring(0,(int)(name.length() * healthratio)); - String secondpart=name.substring(firstpart.length(),name.length()-firstpart.length()); - event.setTag(ChatColor.GREEN + firstpart + ChatColor.DARK_RED + secondpart); -} -*/ - - @EventHandler - public void onPlayerLeave(PlayerQuitEvent e) { - Player p = e.getPlayer(); - for (int i=0;i=10) { - //Check to see if our "fatal s urvivor" effect is available. - for (int i=0;i drops = new ArrayList(); - for (int i=0;i=20) { - finalcost*=0.25; - } - if (mymoney>=mincost) { - p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive. To revive, type /revive me."); - } else { - p.sendMessage("You died. You do not have enough money in your bank to revive."); - p.sendMessage("Cost: $"+df.format(finalcost)+". If you want to revive, type "+ChatColor.AQUA+"/revive me"+ChatColor.WHITE+" when you have enough."); - } - } - } - - @EventHandler - public void onSignPlace(SignChangeEvent e) - { - Player p = e.getPlayer(); - String[] lines = e.getLines(); - updateTopSPLEEFSigns(); - if (p.hasPermission("bankeconomy.sign.create")) { - if ((lines[0].equalsIgnoreCase("[Bank]")) && (lines[1].equalsIgnoreCase("Deposit"))) { - e.setLine(0, ChatColor.DARK_GREEN + "[Bank]"); - e.setLine(1, ChatColor.DARK_RED + "Deposit"); - e.setLine(2, "Right-Click"); - e.setLine(3, "to use"); - } else - if ((lines[0].equalsIgnoreCase("[Bank]")) && (lines[1].equalsIgnoreCase("Withdraw"))) { - e.setLine(0, ChatColor.DARK_GREEN + "[Bank]"); - e.setLine(1, ChatColor.DARK_BLUE + "Withdraw"); - e.setLine(2, "Right-Click"); - e.setLine(3, "to use"); - } else - if ((lines[0].equalsIgnoreCase("[Bank]")) && (lines[1].equalsIgnoreCase("Check Balance"))) { - e.setLine(0, ChatColor.DARK_GREEN + "[Bank]"); - e.setLine(1, ChatColor.DARK_GRAY + "Check Balance"); - e.setLine(2, "Right-Click"); - e.setLine(3, "to use"); - } else { - if ((lines[0].equalsIgnoreCase("[Bank]"))) { - e.setCancelled(true); - p.sendMessage("�ァcYou do not have permission to create [Bank] signs."); - } - } - } - /* - if (p.hasPermission("bankeconomy.sign.create")) { - if ((lines[0].equalsIgnoreCase("[BankEconomy]")) && (lines[1].equalsIgnoreCase("deposit"))) { - e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); - if (!lines[2].matches("^[0-9]+$")) { - e.setLine(1, ChatColor.DARK_RED + "Error"); - e.setLine(2, " "); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " The amount of money is invalid. (line 3)"); - } else if (!lines[3].isEmpty()) { - e.setLine(1, ChatColor.DARK_RED + "Error"); - e.setLine(2, " "); - e.setLine(3, " "); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " The line 4 must be empty."); - } else { - e.setLine(1, ChatColor.YELLOW + "deposit"); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " Sign created successfully!"); - } - } else if ((lines[0].equalsIgnoreCase("[BankEconomy]")) && (lines[1].equalsIgnoreCase("withdraw"))) { - e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); - if (!lines[3].isEmpty()) { - e.setLine(1, ChatColor.DARK_RED + "Error"); - e.setLine(2, " "); - e.setLine(3, " "); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " The line 4 must be empty."); - } else if (!lines[2].matches("^[0-9]+$")) { - e.setLine(1, ChatColor.DARK_RED + "Error"); - e.setLine(2, " "); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " The amount of money is invalid. (line 3)"); - } else { - e.setLine(1, ChatColor.YELLOW + "withdraw"); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " Sign created successfully!"); - } - } else if ((lines[0].equalsIgnoreCase("[BankEconomy]")) && (lines[1].equalsIgnoreCase("information"))) { - e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); - if ((!lines[2].isEmpty()) || (!lines[3].isEmpty())) { - e.setLine(1, ChatColor.DARK_RED + "Error"); - e.setLine(2, " "); - e.setLine(3, " "); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " Lines 3 and 4 must be empty."); - } else { - e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); - e.setLine(1, ChatColor.YELLOW + "information"); - } - } else if (lines[0].equalsIgnoreCase("[BankEconomy]")) { - e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); - e.setLine(1, ChatColor.DARK_RED + "Error"); - e.setLine(2, " "); - e.setLine(3, " "); - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " Invalid action."); - } - } else { - if ((lines[0].equalsIgnoreCase("[BankEconomy]"))) { - e.setCancelled(true); - p.sendMessage("�ァcYou do not have permission."); - } - }*/ - } - - public int getSongDuration(Material record) { - int padding=20; - if (record==Material.RECORD_3) { - return 345/2+5+padding; - } else - if (record==Material.RECORD_4) { - return 185/2+5+padding; - } else - if (record==Material.RECORD_5) { - return 174/2+5+padding; - } else - if (record==Material.RECORD_6) { - return 197/2+5+padding; - } else - if (record==Material.RECORD_7) { - return 96/2+5+padding; - } else - if (record==Material.RECORD_8) { - return 150/2+5+padding; - } else - if (record==Material.RECORD_9) { - return 188/2+5+padding; - } else - if (record==Material.RECORD_10) { - return 251/2+5+padding; - } else - if (record==Material.RECORD_11) { - return 71/2+5+padding; - } else - if (record==Material.RECORD_12) { - return 238/2+5+padding; - } else - if (record==Material.GOLD_RECORD) { - return 178/2+5+padding; - } else - if (record==Material.GREEN_RECORD) { - return 185/2+5+padding; - } else - return 0; - } - - @EventHandler - public void onPlayerChat(PlayerChatEvent e) { - //Check if they are withdrawing or depositing money. - DecimalFormat df = new DecimalFormat("#0.00"); - if (e.getPlayer().getName().equalsIgnoreCase(this.plugin.last_bank_deposit_user) && this.plugin.last_bank_deposit_use_time+200>Main.SERVER_TICK_TIME) { - //Parse the amount. - double val=0; - if (e.getMessage().equalsIgnoreCase("all")) { - //Deposit all the money into their account. - val = this.plugin.economy.getBalance(e.getPlayer().getName()); - this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val); - double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney+val)); - this.plugin.saveAccountsConfig(); - e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); - this.plugin.last_bank_deposit_use_time=0; - } else { - try { - val = Double.parseDouble(e.getMessage()); - //Make sure the user is holding at least that much money. - if (this.plugin.economy.getBalance(e.getPlayer().getName())>=val && val>0) { - //Deposit the money into their account. - //this.plugin.economy.bankDeposit(e.getPlayer().getName(), val); - this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val); - double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney+val)); - this.plugin.saveAccountsConfig(); - e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); - this.plugin.last_bank_deposit_use_time=0; - } else { - e.getPlayer().sendMessage(ChatColor.RED+"You are not holding that much! " + ChatColor.YELLOW +"Enter a value equal to or lower than $" + ChatColor.GREEN+ df.format(this.plugin.economy.getBalance(e.getPlayer().getName())) + "" + ChatColor.GRAY + ChatColor.ITALIC + " (Remember you can also use the word all)"); - this.plugin.last_bank_deposit_use_time=Main.SERVER_TICK_TIME; - } - } catch (NumberFormatException ex_e) { - e.getPlayer().sendMessage(ChatColor.RED+"That is not a valid amount! Please try again."); - this.plugin.last_bank_deposit_use_time=Main.SERVER_TICK_TIME; - } - } - e.setCancelled(true); - } else - if (e.getPlayer().getName().equalsIgnoreCase(this.plugin.last_bank_withdraw_user) && this.plugin.last_bank_withdraw_use_time+200>Main.SERVER_TICK_TIME) { - //Parse the amount. - double val=0; - if (e.getMessage().equalsIgnoreCase("all")) { - //Withdraw all the money in their account. - val = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(0)); - this.plugin.saveAccountsConfig(); - this.plugin.economy.depositPlayer(e.getPlayer().getName(), val); - e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); - this.plugin.last_bank_withdraw_use_time=0; - } else { - try { - val = Double.parseDouble(e.getMessage()); - //Make sure the user is holding at least that much money. - if (this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money")>=val && val>0) { - //Deposit the money into their account. - //this.plugin.economy.bankDeposit(e.getPlayer().getName(), val); - this.plugin.economy.depositPlayer(e.getPlayer().getName(), val); - double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney-val)); - this.plugin.saveAccountsConfig(); - e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); - this.plugin.last_bank_withdraw_use_time=0; - } else { - e.getPlayer().sendMessage(ChatColor.RED+"You do not have that much! " + ChatColor.YELLOW +"Enter a value equal to or lower than $" + ChatColor.GREEN+ df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money")) + "" + ChatColor.GRAY + ChatColor.ITALIC + " (Remember you can also use the word all)"); - this.plugin.last_bank_withdraw_use_time=Main.SERVER_TICK_TIME; - } - } catch (NumberFormatException ex_e) { - e.getPlayer().sendMessage(ChatColor.RED+"That is not a valid amount! Please try again."); - this.plugin.last_bank_withdraw_use_time=Main.SERVER_TICK_TIME; - } - } - e.setCancelled(true); - } else - { - if (e.getMessage().replaceAll("[0-9.]","").length()>0) { - Player[] playerlist = Bukkit.getOnlinePlayers(); - for (int i=0;i1) { - ItemStack newitem = item_cube.clone(); - newitem.setAmount(item_cube.getAmount()-1); - item_cube.setAmount(1); - //Drop the rest on the ground. - p.getWorld().dropItemNaturally(p.getLocation(), newitem); - } - ItemMeta meta = item_cube.getItemMeta(); - List newlore = meta.getLore(); - newlore.add("ID#"+identifier); - meta.setLore(newlore); - item_cube.setItemMeta(meta); - - if (cube_type == Cube.ENDER) { - item_cube.setAmount(2); - } - } - Inventory screen = null; - switch (cube_type) { - case SMALL: { - FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); - if (!f.contains("created")) { - for (int i=0;i<9;i++) { - f.set("item-"+i, new ItemStack(Material.AIR)); - } - f.set("created", Boolean.valueOf(true)); - } - //List items = new ArrayList(); - screen=Bukkit.createInventory(p, 9, "Item Cube #"+identifier); - for (int i=0;i<9;i++) { - //items.add(f.getItemStack("item-"+i)); - screen.setItem(i, f.getItemStack("item-"+i)); - } - this.plugin.saveItemCubeConfig(f, identifier); - }break; - case LARGE: { - FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); - if (!f.contains("created")) { - for (int i=0;i<54;i++) { - f.set("item-"+i, new ItemStack(Material.AIR)); - } - f.set("created", Boolean.valueOf(true)); - } - //List items = new ArrayList(); - screen=Bukkit.createInventory(p, 54, "Large Item Cube #"+identifier); - for (int i=0;i<54;i++) { - //items.add(f.getItemStack("item-"+i)); - screen.setItem(i, f.getItemStack("item-"+i)); - } - this.plugin.saveItemCubeConfig(f, identifier); - }break; - case ENDER: { - FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); - if (!f.contains("created")) { - for (int i=0;i<27;i++) { - f.set("item-"+i, new ItemStack(Material.AIR)); - } - f.set("created", Boolean.valueOf(true)); - } - //List items = new ArrayList(); - screen=Bukkit.createInventory(p, 27, "Ender Item Cube #"+identifier); - for (int i=0;i<27;i++) { - //items.add(f.getItemStack("item-"+i)); - screen.setItem(i, f.getItemStack("item-"+i)); - } - this.plugin.saveItemCubeConfig(f, identifier); - }break; - } - if (screen!=null) { - p.closeInventory(); - p.openInventory(screen); - } - } - } - - public boolean isViewingEnderCube(Player p) { - //Returns whether or not this player is viewing an ender cube. - //This is useful for determining if you have to update the ender cube for other viewers. - if (p.getOpenInventory().getTopInventory()!=null && p.getOpenInventory().getTopInventory().getTitle().contains("Ender Item Cube")) { - return true; - } else { - return false; - } - } - - public int getViewingEnderCubeID(Player p) { - //Returns whether or not this player is viewing an ender cube. - //This is useful for determining if you have to update the ender cube for other viewers. - if (p.getOpenInventory().getTopInventory()!=null && p.getOpenInventory().getTopInventory().getTitle().contains("Ender Item Cube")) { - return Integer.valueOf(p.getOpenInventory().getTopInventory().getTitle().substring(p.getOpenInventory().getTopInventory().getTitle().indexOf("#")).replace("#", "")); - } else { - return -1; //Invalid use. - } - } - - public void ItemCube_updateSameEnderCube(int cube_id, Player player) { - //If a player attempts to do something in an Ender Cube, update the Ender Cube for all other viewers that is not player. (The player argument is the player making modifications to the inventory.) - for (int i=0;i0) { - if (Integer.valueOf(Bukkit.getOnlinePlayers()[i].getOpenInventory().getTopInventory().getTitle().substring(Bukkit.getOnlinePlayers()[i].getOpenInventory().getTopInventory().getTitle().indexOf("#")).replace("#", ""))==cube_id) { - //It is! We need to close it out and re-open with the updated properties of the cube. - Inventory new_inven = player.getOpenInventory().getTopInventory(); - Bukkit.getOnlinePlayers()[i].closeInventory(); - Bukkit.getOnlinePlayers()[i].openInventory(new_inven); - } - } - } - } - } - } - - private void ItemCube_addSameEnderCube(ItemStack add_item, int cube_id, Player player) { - //Helper function for ItemCube_add. - //Checks for any players that are viewing the same Ender Item Cube as player, and updating it accordingly so the changes are reflected. - for (int i=0;i0) { - if (Integer.valueOf(Bukkit.getOnlinePlayers()[i].getOpenInventory().getTopInventory().getTitle().substring(Bukkit.getOnlinePlayers()[i].getOpenInventory().getTopInventory().getTitle().indexOf("#")).replace("#", ""))==cube_id) { - //It is! "Add" it to that inventory list too. - player.getOpenInventory().getTopInventory().addItem(add_item); - } - } - } - } - } - } - - private ItemStack ItemCube_add(Player p, int identifier, Cube size, ItemStack insert_item) { - //Helper function for InsertIntoItemCube(). Inserts the item into the correct cube. - //If this is an Ender Item Cube, also attempts to refresh the inventories of any players viewing it. - - int slots = 0; - - String heading = ""; - - switch (size) { - case SMALL: { - slots = 9; - heading = ""; - }break; - case LARGE: { - slots = 54; - heading = "Large"; - }break; - case ENDER: { - slots = 27; - heading = "Ender"; - }break; - } - - if (!heading.equalsIgnoreCase("")) { - heading+=" "; //Add a space to separate the heading from "Item Cube". - } - - FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); - if (!f.contains("created")) { - for (int i=0;i0) { - if (Integer.valueOf(p.getOpenInventory().getTopInventory().getTitle().substring(p.getOpenInventory().getTopInventory().getTitle().indexOf("#")).replace("#", ""))==identifier) { - thisinven=p.getOpenInventory().getTopInventory(); - changeinven=true; - } - } - if (!changeinven) { - for (int i=0;i=insert_item.getAmount()) { - //We can simply add it in no problem. - thisinven.addItem(insert_item); - for (int i=0;i0) { - //We can at least fit a few. - int fit = insert_item.getAmount()-countinven; - //Leave behind this many. - ItemStack thisitem = insert_item, thisitem2 = insert_item; - thisitem.setAmount(fit); - //Bukkit.getPlayer("sigonasr2").sendMessage("Cursor gets "+thisitem.getAmount()); - thisitem2.setAmount(countinven); - thisinven.addItem(thisitem2); - if (size == Cube.ENDER) { - //This is an Ender Item Cube. We have to check if any other players are looking at the correspnding Ender Item Cube inventory. - ItemCube_addSameEnderCube(thisitem2, identifier, p); - } - //Bukkit.getPlayer("sigonasr2").sendMessage("Item Cube gets "+thisitem2.getAmount()); - for (int i=0;i1) { - ItemStack newitem = item_cube.clone(); - newitem.setAmount(item_cube.getAmount()-1); - item_cube.setAmount(1); - //Drop the rest on the ground. - p.getWorld().dropItemNaturally(p.getLocation(), newitem); - } - ItemMeta meta = item_cube.getItemMeta(); - List newlore = meta.getLore(); - newlore.add("ID#"+identifier); - meta.setLore(newlore); - item_cube.setItemMeta(meta); - if (cube_type == Cube.ENDER) { - item_cube.setAmount(2); - } - } - return ItemCube_add(p, identifier, cube_type, insert_item); - } - return new ItemStack(Material.AIR); //Something went wrong. Just return a blank item. - } - - @EventHandler - public void onPlayerInteract(PlayerInteractEvent e) - { - Player p = e.getPlayer(); - Action blockAction = e.getAction(); - String currencySG = Main.economy.currencyNameSingular(); - String currencyPL = Main.economy.currencyNamePlural(); - boolean stats = this.plugin.getAccountsConfig().getBoolean(p.getName() + ".status"); - double actMon = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); - int actHand = (int)Main.economy.getBalance(p.getName()); - if (this.plugin.PlayerinJob(p, "Explorer")) { - for (int i=0;i=5) { - p.getItemInHand().setDurability((short)0); - p.updateInventory(); - } - if (e.getClickedBlock().getType() == Material.JUKEBOX && e.getItem()!=null && (e.getItem().getType()==Material.RECORD_3 || - e.getItem().getType()==Material.RECORD_4 || e.getItem().getType()==Material.RECORD_5 || - e.getItem().getType()==Material.RECORD_6 || e.getItem().getType()==Material.RECORD_7 || - e.getItem().getType()==Material.RECORD_8 || e.getItem().getType()==Material.RECORD_9 || - e.getItem().getType()==Material.RECORD_10 || e.getItem().getType()==Material.RECORD_11 || - e.getItem().getType()==Material.RECORD_12 || e.getItem().getType()==Material.GOLD_RECORD || - e.getItem().getType()==Material.GREEN_RECORD)) { - //if (p.getName().compareTo("sigonasr2")==0) {p.sendMessage("This is a jukebox.");} - //if (p.getName().compareTo("sigonasr2")==0) {p.sendMessage("Item in hand: "+e.getItem().getType().toString());} - boolean contains=false; - for (int i=0;i newlore = new ArrayList(); - newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory"); - newlore.add("to convert to a legendary equipment item."); - meta.setLore(newlore); - meta.setDisplayName(ChatColor.GREEN+"Magical Pumpkin Pie"); - pump.setItemMeta(meta); - c.getInventory().setItem(i, pump); - break; - } - } - } - } - } - /* - if (p.getName().compareTo("sigonasr2")==0) { - int v=2; - final Vector direction = p.getEyeLocation().getDirection().multiply(v); - Bukkit.getWorld("world").spawnEntity(p.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), EntityType.SILVERFISH); - }*/ - //if (p.getName().compareTo("sigonasr2")==0) {Bukkit.getPlayer("sigonasr2").sendMessage("This block is at "+e.getClickedBlock().getX()+" "+e.getClickedBlock().getY()+" "+e.getClickedBlock().getZ()+" Data value:"+e.getClickedBlock().getData());} - if ((e.getClickedBlock().getState() instanceof BrewingStand)) { - BrewingStand brewingstand = (BrewingStand)e.getClickedBlock().getState(); - //Bukkit.getPlayer("sigonasr2").sendMessage("This is a furnace "+furnace.getBurnTime()+","+furnace.getCookTime()); - boolean contains=false; - //This furnace becomes owned. Add it to list if it doesn't exist. - for (int i=0;i400) { - if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400 && (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))!=0 || p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestbtime")>400)) { - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"Spleef Player "+p.getName()+" requested a game in slot A. Join within 20 seconds."); - this.plugin.getConfig().set("spleefrequestatime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestaplayer", String.valueOf(p.getName())); - } - } else { - if (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))!=0) { - //This is a confirmed Spleef game. - int playerarating,playerbrating; - Player playera,playerb; - playera=p; - this.plugin.getConfig().set("spleefrequestatime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestaplayer", String.valueOf(p.getName())); - playerb=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")); - if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")) { - playerarating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")/10; - } else { - playerarating=1000; - } - if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")) { - playerbrating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")/10; - } else { - playerbrating=1000; - } - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.GREEN+"Spleef Game Started: "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+playerarating+"] vs. "+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+playerbrating+"]"); - this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(true)); - this.plugin.spleef_inventory_a = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getContents(); - this.plugin.spleef_inventory_b = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getContents(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getHeldItemSlot()); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getHeldItemSlot()); - //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).updateInventory(); - //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).updateInventory(); - for (int i=1617;i<1627;i++) { - for (int j=54;j<64;j++) { - Bukkit.getWorld("world").getBlockAt(i,86,j).setType(Material.DIRT); - } - } - Location theshovel = new Location(Bukkit.getWorld("world"), 1627, 50, 27); - Chest shovelchest = (Chest)Bukkit.getWorld("world").getBlockAt(theshovel).getState(); - for (int i=0;i<27;i++) { - if (shovelchest.getBlockInventory().getContents()[i]!=null && shovelchest.getBlockInventory().getContents()[i].getType()==Material.WOOD_SPADE) { - this.plugin.store_shovel=shovelchest.getBlockInventory().getContents()[i]; - break; - } - } - Location l1 = new Location(Bukkit.getWorld("world"), 1622, 85, 58); - Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); - if (!c.getBlockInventory().contains(this.plugin.store_shovel)) { - c.getBlockInventory().setItem((int)(Math.random()*27.0d), this.plugin.store_shovel); - } - for (int i=1617;i<1627;i++) { - for (int j=54;j<64;j++) { - Bukkit.getWorld("world").getBlockAt(i,86,j).setType(Material.DIRT); - } - } - Bukkit.getWorld("world").getBlockAt(1622,86,58).setType(Material.WOOD); - Location newloc=playera.getLocation(); - newloc.setX(1622.49d); - newloc.setY(87.0d); - newloc.setZ(54.53d); - playera.teleport(newloc); - newloc.setZ(63.5d); - playerb.teleport(newloc); - this.plugin.spleef_last_broken_block=p.getPlayerTime(); - } - } - this.plugin.saveConfig(); - this.plugin.saveAccountsConfig(); - } - } else - if (sign.getBlock().getX()==1620 && sign.getBlock().getY()==83 && sign.getBlock().getZ()==45) { //Side B Request. - //If not requested already. - if (!this.plugin.getConfig().getBoolean("spleefinsession")) { - if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400) { - if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestbtime")>400 && (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))!=0 || p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400)) { - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"Spleef Player "+p.getName()+" requested a game in slot B. Join within 20 seconds."); - this.plugin.getConfig().set("spleefrequestbtime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestbplayer", String.valueOf(p.getName())); - } - } else { - if (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))!=0) { - //This is a confirmed Spleef game. - int playerarating,playerbrating; - Player playera,playerb; - this.plugin.getConfig().set("spleefrequestbtime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestbplayer", String.valueOf(p.getName())); - playera=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")); - playerb=p; - if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")) { - playerarating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")/10; - } else { - playerarating=100; - } - if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")) { - playerbrating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")/10; - } else { - playerbrating=100; - } - Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.GREEN+"Spleef Game Started: "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+playerarating+"] vs. "+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+playerbrating+"]"); - this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(true)); - this.plugin.spleef_inventory_a = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getContents(); - this.plugin.spleef_inventory_b = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getContents(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getHeldItemSlot()); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(); - Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getHeldItemSlot()); - //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).updateInventory(); - //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).updateInventory(); - Location theshovel = new Location(Bukkit.getWorld("world"), 1627, 50, 27); - Chest shovelchest = (Chest)Bukkit.getWorld("world").getBlockAt(theshovel).getState(); - for (int i=0;i<27;i++) { - if (shovelchest.getBlockInventory().getContents()[i]!=null && shovelchest.getBlockInventory().getContents()[i].getType()==Material.WOOD_SPADE) { - this.plugin.store_shovel=shovelchest.getBlockInventory().getContents()[i]; - break; - } - } - Location l1 = new Location(Bukkit.getWorld("world"), 1622, 85, 58); - Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); - if (!c.getBlockInventory().contains(this.plugin.store_shovel)) { - c.getBlockInventory().setItem((int)(Math.random()*27.0d), this.plugin.store_shovel); - } - for (int i=1617;i<1627;i++) { - for (int j=54;j<64;j++) { - Bukkit.getWorld("world").getBlockAt(i,86,j).setType(Material.DIRT); - } - } - Bukkit.getWorld("world").getBlockAt(1622,86,58).setType(Material.WOOD); - Location newloc=playera.getLocation(); - newloc.setX(1622.49d); - newloc.setY(87.0d); - newloc.setZ(54.53d); - playera.teleport(newloc); - newloc.setZ(63.5d); - playerb.teleport(newloc); - this.plugin.spleef_last_broken_block=p.getPlayerTime(); - } - } - this.plugin.saveConfig(); - this.plugin.saveAccountsConfig(); - } - } - if (stats) { - if (p.hasPermission("bankeconomy.sign.use")) { - if ((sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_GREEN + "[Bank]")) && (sign.getLine(1).equalsIgnoreCase(ChatColor.DARK_RED + "Deposit"))) { - /*double value = Double.parseDouble(arg0); - double total = actMon + value; - if (value <= actHand) { - this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(total)); - this.plugin.saveAccountsConfig(); - if (value <= 1) - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " You added " + value + " " + currencySG + " to your bank account."); - else { - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " You added " + value + " " + currencyPL + " to your bank account."); - } - Main.economy.withdrawPlayer(p.getName(), value); - } else { - p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " Sorry, you can't deposit that amount of money."); - }*/ - //If they were using the withdraw bank before, clear them from it. - if (this.plugin.last_bank_withdraw_user.equalsIgnoreCase(p.getName())) { - this.plugin.last_bank_withdraw_user=""; - } - if (this.plugin.last_bank_deposit_use_time+200='a'&&mod[i]<='z') { - mod[i]-=32; - first=true; - } else - if (i==0) { - if (mod[i]>='A'&&mod[i]<='Z') { - first=true; - } - } else { - if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { - first=true; - } - } - } else { - if (mod[i-1]!=' ') { - if (mod[i]>='A'&&mod[i]<='Z') { - mod[i]+=32; - } - } - } - } - return String.valueOf(mod); -} - -public String convertToItemName(String val, short data, Material material_id) { - String color = ""; - String name = ""; - switch (material_id) { - case WOOL:{ - name = "Wool"; - }break; - case INK_SACK:{ - name = "Dye"; - }break; - case CARPET:{ - name = "Carpet"; - }break; - } - if (name.equalsIgnoreCase("Dye")) { - switch (data) { - case 0:{ - color = "Black"; - }break; - case 1:{ - color = "Red"; - }break; - case 2:{ - color = "Green"; - }break; - case 3:{ - color = "Brown"; - }break; - case 4:{ - color = "Blue"; - }break; - case 5:{ - color = "Purple"; - }break; - case 6:{ - color = "Cyan"; - }break; - case 7:{ - color = "Light Gray"; - }break; - case 8:{ - color = "Gray"; - }break; - case 9:{ - color = "Pink"; - }break; - case 10:{ - color = "Lime"; - }break; - case 11:{ - color = "Yellow"; - }break; - case 12:{ - color = "Light Blue"; - }break; - case 13:{ - color = "Green"; - }break; - case 14:{ - color = "Red"; - }break; - case 15:{ - color = "Black"; - }break; - } - } else { - switch (data) { - case 0:{ - color = "White"; - }break; - case 1:{ - color = "Orange"; - }break; - case 2:{ - color = "Magenta"; - }break; - case 3:{ - color = "Light Blue"; - }break; - case 4:{ - color = "Yellow"; - }break; - case 5:{ - color = "Lime"; - }break; - case 6:{ - color = "Pink"; - }break; - case 7:{ - color = "Gray"; - }break; - case 8:{ - color = "Light Gray"; - }break; - case 9:{ - color = "Cyan"; - }break; - case 10:{ - color = "Purple"; - }break; - case 11:{ - color = "Blue"; - }break; - case 12:{ - color = "Brown"; - }break; - case 13:{ - color = "Green"; - }break; - case 14:{ - color = "Red"; - }break; - case 15:{ - color = "Black"; - }break; - } - } - return String.valueOf(color+" "+name); -} - -@EventHandler -public void onHangingBreak(HangingBreakEvent e) { - //Bukkit.broadcastMessage(""+e.getCause()); - if (e.getCause().name().equalsIgnoreCase(RemoveCause.DEFAULT.name()) || e.getCause().name().equalsIgnoreCase(RemoveCause.EXPLOSION.name())) { - //Prevent this from happening here. - e.setCancelled(true); - } -} - -@EventHandler -public void onHangingBreakEntity(HangingBreakByEntityEvent e) { - //Bukkit.broadcastMessage(""+e.getRemover().getType()); - if (e.getRemover().getType()==EntityType.LIGHTNING || (e.getRemover() instanceof Monster)) { - //Prevent this from happening here. - e.setCancelled(true); - } -} - -/* - @EventHandler - public void onLightningStrike(LightningStrikeEvent e) { - Bukkit.getWorld("world").strikeLightning(new Location("world", Bukkit.getOnlinePlayers()[(int)(Math.random()*Bukkit.getOnlinePlayers().length)].getLocation().getX(), 0d, 0d)); - }*/ - -} -