Mob Heads are added, MobHead class implemented. Just need to add

functionality. All possible head combinations can be obtained via mobs
or obtained via '/event cheatheads'
dev
sigonasr2 11 years ago
parent 8cbffd75e1
commit 2b40b15d50
  1. 156
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 849
      BankEconomyMod/src/me/kaZep/Base/MobHead.java
  3. 369
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  4. 4
      BankEconomyMod/src/me/kaZep/Base/RecyclingCenterNode.java
  5. 59
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -22,6 +22,8 @@ import java.util.logging.Logger;
import java.text.*;
import me.kaZep.Base.BonusEnchantment.ItemType;
import me.kaZep.Base.MobHead.MobHeadRareType;
import me.kaZep.Base.MobHead.MobHeadType;
import me.kaZep.Base.PlayerListener.Cube;
import me.kaZep.Commands.JobsDataInfo;
import me.kaZep.Commands.JobsDataInfo.Job;
@ -43,6 +45,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.SkullType;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -74,6 +77,7 @@ import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Wither;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -118,6 +122,7 @@ public class Main extends JavaPlugin
{
public final Logger logger = Logger.getLogger("Minecraft");
public static Economy economy = null;
public static Main plugin = null;
public ItemStack[] spleef_inventory_a,spleef_inventory_b;
public ItemStack[] spleef4_inventory_a,spleef4_inventory_b,spleef4_inventory_c,spleef4_inventory_d;
public ItemStack store_shovel=null;
@ -154,6 +159,8 @@ public class Main extends JavaPlugin
public Location BOSS_DEFEAT_LOC;
public int POLYMORPH=0;
public Location POLYMORPH_LOC;
public static double HEAD_DROP_CHANCE = 0.01;
public static double RARE_HEAD_DROP_CHANCE = 0.000953125;
public int LOGGING_UPDATE_COUNTS=-1;
public int MAX_LOGGING_COUNT=12;
@ -248,6 +255,8 @@ public class Main extends JavaPlugin
{
getServer().getPluginManager().registerEvents(this.pl, this);
plugin = this;
cleaned=false;
if (Bukkit.getPluginManager().isPluginEnabled("MCTowns")) {
@ -288,6 +297,28 @@ public class Main extends JavaPlugin
getConfig().addDefault("thanksgiving-enabled", Boolean.valueOf(false));
getConfig().addDefault("item-cube-numb", Integer.valueOf(0));
getConfig().addDefault("server-tick-time", Long.valueOf(143000000l));
getConfig().addDefault("mob.skeleton", Integer.valueOf(0));
getConfig().addDefault("mob.witherskeleton", Integer.valueOf(0));
getConfig().addDefault("mob.zombie", Integer.valueOf(0));
getConfig().addDefault("mob.creeper", Integer.valueOf(0));
getConfig().addDefault("mob.spider", Integer.valueOf(0));
getConfig().addDefault("mob.enderman", Integer.valueOf(0));
getConfig().addDefault("mob.cavespider", Integer.valueOf(0));
getConfig().addDefault("mob.blaze", Integer.valueOf(0));
getConfig().addDefault("mob.ghast", Integer.valueOf(0));
getConfig().addDefault("mob.zombiepigman", Integer.valueOf(0));
getConfig().addDefault("mob.magmacube", Integer.valueOf(0));
getConfig().addDefault("mob.rareskeleton", Integer.valueOf(0));
getConfig().addDefault("mob.rarewitherskeleton", Integer.valueOf(0));
getConfig().addDefault("mob.rarezombie", Integer.valueOf(0));
getConfig().addDefault("mob.rarecreeper", Integer.valueOf(0));
getConfig().addDefault("mob.rarespider", Integer.valueOf(0));
getConfig().addDefault("mob.rareenderman", Integer.valueOf(0));
getConfig().addDefault("mob.rarecavespider", Integer.valueOf(0));
getConfig().addDefault("mob.rareblaze", Integer.valueOf(0));
getConfig().addDefault("mob.rareghast", Integer.valueOf(0));
getConfig().addDefault("mob.rarezombiepigman", Integer.valueOf(0));
getConfig().addDefault("mob.raremagmacube", Integer.valueOf(0));
saveConfig();
SERVER_TICK_TIME = getConfig().getLong("server-tick-time");
@ -694,6 +725,29 @@ public class Main extends JavaPlugin
artifact_clay.addIngredient(Material.EYE_OF_ENDER);
Bukkit.addRecipe(artifact_clay);
//Add Powered Mob Head recipe.
for (int i=0;i<5;i++) {
ItemStack skull_stack = new ItemStack(Material.SKULL_ITEM);
MaterialData newskull = new MaterialData(Material.SKULL_ITEM,(byte)i);
skull_stack.setDurability((short)i);
ShapedRecipe powered_heads = new ShapedRecipe(skull_stack);
powered_heads.shape(" a ","aba"," a ");
powered_heads.setIngredient('a', Material.GOLD_BLOCK);
powered_heads.setIngredient('b', newskull);
Bukkit.addRecipe(powered_heads);
}
//Add Powered Rare Mob Head recipe.
for (int i=0;i<5;i++) {
ItemStack skull_stack = new ItemStack(Material.SKULL_ITEM);
MaterialData newskull = new MaterialData(Material.SKULL_ITEM,(byte)i);
skull_stack.setDurability((short)i);
ShapedRecipe powered_rare_heads = new ShapedRecipe(skull_stack);
powered_rare_heads.shape(" a ","aba"," a ");
powered_rare_heads.setIngredient('a', Material.BEACON);
powered_rare_heads.setIngredient('b', newskull);
Bukkit.addRecipe(powered_rare_heads);
}
//Add deconversion recipes.
ShapelessRecipe DeConv_diamond_chestplate = new ShapelessRecipe(new ItemStack(Material.DIAMOND));
DeConv_diamond_chestplate.addIngredient(Material.DIAMOND_CHESTPLATE);
@ -1768,6 +1822,8 @@ public void runTick() {
meta.setOwner("MHF_Enderman");
skull.setItemMeta(meta);
zombie.getEquipment().setHelmet(skull);
Zombie z = (Zombie)zombie;
z.setBaby(false);
enderdragon.setCustomName(ChatColor.DARK_PURPLE+"Charge Zombie III");
enderdragon.setMaxHealth(200);
@ -5427,6 +5483,22 @@ public void payDay(int time)
}
}
/**
* Compounds the interest for the player and updates their account balance appropriately.
* Use whenever you need to update their balance.
* @param p The player to update the balance for.
* @return Returns what the new balance is for displaying / processing.
*/
public double compoundInterest(Player p) {
double oldmon = getAccountsConfig().getDouble(p.getName().toLowerCase()+".money");
double newbalance = getAccountsConfig().getDouble(p.getName().toLowerCase()+".money")*Math.pow(Math.E, getConfig().getDouble("payday.amount") * ((Main.SERVER_TICK_TIME - getAccountsConfig().getLong(p.getName().toLowerCase()+".interestdistributedtime")) / 1728000d));
Bukkit.getLogger().info("Money compounded from "+oldmon+" to "+newbalance);
//Bukkit.getLogger().info("Equation is "+getAccountsConfig().getDouble(p.getName().toLowerCase()+".money")+"*Math.pow("+Math.E+","+getConfig().getDouble("payday.amount")+"*(("+Main.SERVER_TICK_TIME+"-"+getAccountsConfig().getLong(p.getName().toLowerCase()+".interestdistributedtime")+")/1728000d))");
getAccountsConfig().set(p.getName().toLowerCase()+".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME));
getAccountsConfig().set(p.getName().toLowerCase()+".money", Double.valueOf(newbalance));
return newbalance;
}
public void notifyBuffMessages(Player p) {
notifyBuffMessages(p, 20);
}
@ -6374,6 +6446,90 @@ public void payDay(int time)
}
return finallist;
}
/**
* Checks if the given head is powered or
* unpowered.
* @param head The mob head to check for.
* @return Returns true if the head is powered
* or false otherwise.
*/
public boolean isUnpoweredHead(MobHead head) {
return !head.is_powered;
}
/**
* Checks if the given head is rare or
* unrare.
* @param head The mob head to check for.
* @return Returns true if the head is rare
* or false otherwise.
*/
public boolean isRareHead(MobHead head) {
//Bukkit.getLogger().info("Checking mobhead "+head.toString());
return head.rare_head;
}
/**
* Linker function for MobHead.convertToPoweredHead()
* @param item
* @return
*/
public ItemStack convertToPoweredHead(ItemStack item) {
return MobHead.convertToPoweredHead(item);
}
/**
* Linker function for MobHead.getMobHead()
* @param item
* @return
*/
public MobHead getMobHead(ItemStack item) {
return MobHead.getMobHead(item);
}
/**
* Gets a list of all the valid mob heads that the player
* has in their inventory.
* @param p The player to check for.
* @return A list containing all the MobHead
* objects the player has in their inventory.
* In the case there are none, null is returned.
*/
public List<MobHead> getMobHeads(Player p) {
List<MobHead> mobheadlist = new ArrayList<MobHead>();
for (int i=0;i<p.getInventory().getContents().length;i++) {
ItemStack item = p.getInventory().getContents()[i];
if (item!=null && item.getType()==Material.SKULL_ITEM && item.hasItemMeta() && item.getItemMeta().hasLore()) {
//Check the lore for a valid mob head.
if (getMobHead(item)!=null) {
mobheadlist.add(getMobHead(item));
Bukkit.getLogger().info("Mob head "+getMobHead(item).toString()+" added.");
}
}
}
if (mobheadlist.size()>0) {
return mobheadlist;
} else {
return null;
}
}
/**
* Gets how many mob heads of a certain type of MobHead
* exist in the mobhead list provided.
* @return Returns the number of that type of head
* in the given list. (0 if there are none)
*/
public int getMobHeadAmt(MobHead mobhead, List<MobHead> mobheads) {
int same_amt=0;
for (int i=0;i<mobheads.size();i++) {
if (mobhead.equals(mobheads.get(i))) {
same_amt++;
}
}
return same_amt;
}
}
class BonusEnchantment {

@ -0,0 +1,849 @@
package me.kaZep.Base;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
/**
* Represents a mob head
*/
public class MobHead {
public enum MobHeadType {
SKELETON, WITHER_SKELETON, ZOMBIE, CREEPER,
SPIDER, ENDERMAN, CAVE_SPIDER, BLAZE, GHAST,
ZOMBIE_PIGMAN, MAGMA_CUBE
}
public enum MobHeadRareType {
RARE_TYPE_A, RARE_TYPE_B
}
MobHeadType head_type = null;
MobHeadRareType rare_head_type =null;
boolean rare_head;
boolean is_powered=false;
/**
* Compares if two MobHeads are equal to each other
* @param m The MobHead to compare to this MobHead.
* @return true if the two mob heads are the same,
* false otherwise.
*/
public boolean equals(MobHead m) {
if (head_type.equals(m.head_type) &&
rare_head_type.equals(m.rare_head_type) &&
is_powered==m.is_powered && rare_head==m.rare_head) {
return true;
}
return false;
}
/**
* Returns the ItemStack version of this defined Mob Head.
* This is useful for creating new heads that have specific
* attributes.
* @return
*/
public ItemStack getItemStack() {
ItemStack finalhead = new ItemStack(Material.AIR);
if (!rare_head) {
switch (head_type) {
case SKELETON:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.skeleton";
meta.setDisplayName(ChatColor.WHITE+"Skeleton Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Ranged Damage");
meta.setLore(newlore);
newhead.setItemMeta(meta);
finalhead = newhead;
}break;
case WITHER_SKELETON:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)1);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.witherskeleton";
meta.setDisplayName(ChatColor.WHITE+"Wither Skeleton Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither I"+ChatColor.GOLD+" duration");
newlore.add(ChatColor.GOLD+" on hit.");
meta.setLore(newlore);
newhead.setItemMeta(meta);
finalhead = newhead;
}break;
case ZOMBIE:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)2);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.zombie";
meta.setDisplayName(ChatColor.WHITE+"Zombie Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Lifesteal");
meta.setLore(newlore);
newhead.setItemMeta(meta);
finalhead = newhead;
}break;
case CREEPER:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)4);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.creeper";
meta.setDisplayName(ChatColor.WHITE+"Creeper Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"AoE Damage");
meta.setLore(newlore);
newhead.setItemMeta(meta);
finalhead = newhead;
}break;
case SPIDER:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.spider";
skullMeta.setDisplayName(ChatColor.WHITE+"Spider Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_Spider");
newhead.setItemMeta(skullMeta);
ItemMeta meta = newhead.getItemMeta();
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit");
meta.setLore(newlore);
newhead.setItemMeta(meta);
finalhead = newhead;
}break;
case ENDERMAN:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.enderman";
skullMeta.setDisplayName(ChatColor.WHITE+"Enderman Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_Enderman");
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Critical Chance");
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
finalhead = newhead;
}break;
case CAVE_SPIDER:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.cavespider";
skullMeta.setDisplayName(ChatColor.WHITE+"Cave Spider Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_CaveSpider");
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration");
newlore.add(ChatColor.GOLD+" on hit.");
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
finalhead = newhead;
}break;
case BLAZE:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.blaze";
skullMeta.setDisplayName(ChatColor.WHITE+"Blaze Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_Blaze");
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second ignite duration");
newlore.add(ChatColor.GOLD+" on hit.");
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
finalhead = newhead;
}break;
case GHAST:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.ghast";
skullMeta.setDisplayName(ChatColor.WHITE+"Ghast Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_Ghast");
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"-1% "+ChatColor.GOLD+"damage taken on hit");
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
finalhead = newhead;
}break;
case ZOMBIE_PIGMAN:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.zombiepigman";
skullMeta.setDisplayName(ChatColor.WHITE+"Zombie Pigman Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_PigZombie");
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of being fully");
newlore.add(ChatColor.GOLD+" healed on kill.");
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
finalhead = newhead;
}break;
case MAGMA_CUBE:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.magmacube";
skullMeta.setDisplayName(ChatColor.WHITE+"Magma Cube Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_LavaSlime");
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of setting the");
newlore.add(ChatColor.GOLD+" mob and surrounding mobs on fire");
newlore.add(ChatColor.GOLD+" for 10 seconds.");
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
finalhead = newhead;
}break;
}
} else {
switch (head_type) {
case WITHER_SKELETON:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)1);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.rarewitherskeleton";
meta.setDisplayName(ChatColor.BLUE+"Rare Wither Skeleton Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
newlore.add(ChatColor.LIGHT_PURPLE+"+15 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither III"+ChatColor.GOLD+" duration");
newlore.add(ChatColor.GOLD+" on hit.");
meta.setLore(newlore);
newhead.setItemMeta(meta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case SKELETON:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.rareskeleton";
meta.setDisplayName(ChatColor.BLUE+"Rare Skeleton Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Ranged Damage");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"m/s Projectile Speed");
}
meta.setLore(newlore);
newhead.setItemMeta(meta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case ZOMBIE:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)2);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.rarezombie";
meta.setDisplayName(ChatColor.BLUE+"Rare Zombie Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Lifesteal");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Max Health");
}
meta.setLore(newlore);
newhead.setItemMeta(meta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case CREEPER:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)4);
ItemMeta meta = newhead.getItemMeta();
String key = "mob.rarecreeper";
meta.setDisplayName(ChatColor.BLUE+"Rare Creeper Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Damage to all nearby enemies.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+20% "+ChatColor.GOLD+"AoE Damage");
}
meta.setLore(newlore);
newhead.setItemMeta(meta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case SPIDER:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
skullMeta.setOwner("MHF_Spider");
String key = "mob.rarespider";
skullMeta.setDisplayName(ChatColor.BLUE+"Rare Spider Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
newhead.setItemMeta(skullMeta);
ItemMeta meta = newhead.getItemMeta();
meta.setDisplayName(ChatColor.BLUE+"Rare Spider Head");
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration");
newlore.add(ChatColor.GOLD+" on hit.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+15% "+ChatColor.GOLD+"Slow on hit");
}
meta.setLore(newlore);
newhead.setItemMeta(meta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case ENDERMAN:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
skullMeta.setOwner("MHF_Enderman");
String key = "mob.rareenderman";
skullMeta.setDisplayName(ChatColor.BLUE+"Rare Enderman Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Item Drop Amount Increase");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Critical Chance");
}
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case CAVE_SPIDER:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.rarecavespider";
skullMeta.setDisplayName(ChatColor.BLUE+"Rare Cave Spider Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_CaveSpider");
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"of snaring a target");
newlore.add(ChatColor.GOLD+" for 5 seconds.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second Poison duration");
newlore.add(ChatColor.GOLD+" on hit.");
}
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case BLAZE:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.rareblaze";
skullMeta.setDisplayName(ChatColor.BLUE+"Rare Blaze Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_Blaze");
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy");
newlore.add(ChatColor.GOLD+" airborne.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration");
newlore.add(ChatColor.GOLD+" on hit.");
}
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case GHAST:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.rareghast";
skullMeta.setDisplayName(ChatColor.BLUE+"Rare Ghast Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_Ghast");
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send down");
newlore.add(ChatColor.GOLD+" lightning on a target.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"-5% "+ChatColor.GOLD+"damage taken on hit");
}
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case ZOMBIE_PIGMAN:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.rarezombiepigman";
skullMeta.setDisplayName(ChatColor.BLUE+"Rare Pig Zombie Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_PigZombie");
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of dropping a");
newlore.add(ChatColor.GOLD+" Golden Nugget on a kill.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance of being fully");
newlore.add(ChatColor.GOLD+" healed on kill.");
}
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
case MAGMA_CUBE:{
ItemStack newhead = new ItemStack(Material.SKULL_ITEM);
newhead.setDurability((short)SkullType.PLAYER.ordinal());
SkullMeta skullMeta = (SkullMeta) newhead.getItemMeta();
String key = "mob.raremagmacube";
skullMeta.setDisplayName(ChatColor.BLUE+"Rare Magma Cube Head "+ChatColor.ITALIC+"#"+Main.plugin.getConfig().getInt(key));
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
skullMeta.setOwner("MHF_LavaSlime");
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of burning an");
newlore.add(ChatColor.GOLD+" enemy to a crisp.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of setting the");
newlore.add(ChatColor.GOLD+" mob and surrounding mobs on fire");
newlore.add(ChatColor.GOLD+" for 10 seconds.");
}
skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta);
newhead.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
finalhead = newhead;
}break;
}
}
//Bukkit.getLogger().info("Mobhead is "+toString()+" currently.");
if (is_powered) {
short numb = finalhead.clone().getDurability();
ItemStack poweredhead = convertToPoweredHead(finalhead.clone());
//Bukkit.getLogger().info("Converted head item is "+this.plugin.convertToPoweredHead(result.getMatrix()[i]).toString());
poweredhead.setDurability(numb);
finalhead = poweredhead;
}
return finalhead;
}
/**
* Attempts to get the mob head object that
* corresponds to this item, by checking its lore.
* @param item The item to check for.
* @return Returns null if this item is not a
* valid mob head. Returns the MobHead object
* otherwise.
*/
static public MobHead getMobHead(ItemStack item) {
if (item!=null && item.getType()==Material.SKULL_ITEM && item.hasItemMeta() && item.getItemMeta().hasLore()) {
List<String> getLore = item.getItemMeta().getLore();
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither I"+ChatColor.GOLD+" duration")) {
return new MobHead(MobHeadType.WITHER_SKELETON);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Ranged Damage")) {
return new MobHead(MobHeadType.SKELETON);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Lifesteal")) {
return new MobHead(MobHeadType.ZOMBIE);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"AoE Damage")) {
return new MobHead(MobHeadType.CREEPER);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit")) {
return new MobHead(MobHeadType.SPIDER);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Critical Chance")) {
return new MobHead(MobHeadType.ENDERMAN);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration")) {
return new MobHead(MobHeadType.CAVE_SPIDER);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second ignite duration")) {
return new MobHead(MobHeadType.BLAZE);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"-1% "+ChatColor.GOLD+"damage taken on hit")) {
return new MobHead(MobHeadType.GHAST);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of being fully")) {
return new MobHead(MobHeadType.ZOMBIE_PIGMAN);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of setting the")) {
return new MobHead(MobHeadType.MAGMA_CUBE);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+15 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither III"+ChatColor.GOLD+" duration")) {
return new MobHead(MobHeadType.WITHER_SKELETON, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Ranged Damage")) {
return new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"m/s Projectile Speed")) {
return new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Lifesteal")) {
return new MobHead(MobHeadType.ZOMBIE, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Max Health")) {
return new MobHead(MobHeadType.ZOMBIE, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Damage to all nearby enemies.")) {
return new MobHead(MobHeadType.CREEPER, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+20% "+ChatColor.GOLD+"AoE Damage")) {
return new MobHead(MobHeadType.CREEPER, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration on hit")) {
return new MobHead(MobHeadType.SPIDER, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+15% "+ChatColor.GOLD+"Slow on hit")) {
return new MobHead(MobHeadType.SPIDER, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Item Drop Amount Increase")) {
return new MobHead(MobHeadType.ENDERMAN, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Critical Chance")) {
return new MobHead(MobHeadType.ENDERMAN, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"of snaring a target")) {
return new MobHead(MobHeadType.CAVE_SPIDER, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second Poison duration")) {
return new MobHead(MobHeadType.CAVE_SPIDER, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send down")) {
return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"-5% "+ChatColor.GOLD+"damage taken on hit")) {
return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of dropping a")) {
return new MobHead(MobHeadType.ZOMBIE_PIGMAN, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance of being fully")) {
return new MobHead(MobHeadType.ZOMBIE_PIGMAN, true, MobHeadRareType.RARE_TYPE_B);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of burning an")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of setting the")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
}
}
return null;
}
/**
* Checks if the given head is powered or
* unpowered.
* @param head The mob head to check for.
* @return Returns true if the head is powered
* or false otherwise.
*/
static public boolean isUnpoweredHead(MobHead head) {
return !head.is_powered;
}
/**
* Converts an unpowered mob head to a powered
* version. If this head is not an unpowered version
* or something bad happens along the way, it
* simply returns the same ItemStack that was
* given.
* @param item The head item we are converting.
* @return The converted mob head. (Or the same
* mob head that was given if something bad
* happened.)
*/
static public ItemStack convertToPoweredHead(ItemStack item) {
if (item!=null && item.getType()==Material.SKULL_ITEM && item.hasItemMeta() && item.getItemMeta().hasLore()) {
ItemStack newitem = new ItemStack(Material.SKULL_ITEM);
List<String> getLore = item.getItemMeta().getLore();
ItemMeta newitem_meta = item.getItemMeta();
newitem.setData(item.getData());
if (newitem_meta.getDisplayName().contains("Rare")) {
newitem_meta.setDisplayName(ChatColor.BLUE+"Powered "+newitem_meta.getDisplayName());
} else {
newitem_meta.setDisplayName(ChatColor.RESET+"Powered "+newitem_meta.getDisplayName());
}
newitem.setItemMeta(newitem_meta);
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither I"+ChatColor.GOLD+" duration")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.GOLD+"Stacks Wither effect by 1");
newLore.add(ChatColor.GOLD+"per hit for 5 seconds.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Ranged Damage")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Ranged Damage "+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"m/s Projectile Speed");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Lifesteal")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Lifesteal"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Max Health");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"AoE Damage")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"AoE Damage"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Damage over time to");
newLore.add(ChatColor.GOLD+" all nearby enemies.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration");
newLore.add(ChatColor.GOLD+" on hit.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Critical Chance")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Critical Chance"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Item Drop Increase");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration");
newLore.add(ChatColor.GOLD+" on hit."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of snaring the");
newLore.add(ChatColor.GOLD+" target for 5 seconds.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second ignite duration")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second ignite duration");
newLore.add(ChatColor.GOLD+" on hit."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of sending the");
newLore.add(ChatColor.GOLD+" enemy airborne.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"-1% "+ChatColor.GOLD+"damage taken on hit")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"-1% "+ChatColor.GOLD+"damage taken on hit"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance to send down");
newLore.add(ChatColor.GOLD+" lightning onto your enemy.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of being fully")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of being fully");
newLore.add(ChatColor.GOLD+" healed on a kill."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance of dropping a");
newLore.add(ChatColor.GOLD+" Golden Nugget on a kill");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of setting the")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of setting the");
newLore.add(ChatColor.GOLD+" mob and surrounding mobs on fire");
newLore.add(ChatColor.GOLD+" for 10 seconds."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of burning an");
newLore.add(ChatColor.GOLD+" enemy to a crisp.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+15 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither III"+ChatColor.GOLD+" duration")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.GOLD+"Stacks Wither effect by 2");
newLore.add(ChatColor.GOLD+"per hit for 20 seconds.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Ranged Damage") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"m/s Projectile Speed")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Ranged Damage "+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"m/s Projectile Speed");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Lifesteal") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Max Health")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Lifesteal"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+4 "+ChatColor.GOLD+"Max Health");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Damage to all nearby enemies.") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+20% "+ChatColor.GOLD+"AoE Damage")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+30% "+ChatColor.GOLD+"AoE Damage"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"Damage over time to");
newLore.add(ChatColor.GOLD+" all nearby enemies.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+15% "+ChatColor.GOLD+"Slow on hit")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+30% "+ChatColor.GOLD+"Slow on hit"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second Poison duration");
newLore.add(ChatColor.GOLD+" on hit.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Item Drop Amount Increase") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Critical Chance")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"Critical Chance"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Item Drop Increase");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"of snaring a target") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second Poison duration")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second Poison duration");
newLore.add(ChatColor.GOLD+" on hit."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+8% "+ChatColor.GOLD+"chance of snaring the");
newLore.add(ChatColor.GOLD+" target for 5 seconds.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second ignite duration");
newLore.add(ChatColor.GOLD+" on hit."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of sending the");
newLore.add(ChatColor.GOLD+" enemy airborne.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send down") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"-5% "+ChatColor.GOLD+"damage taken on hit")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"-10% "+ChatColor.GOLD+"damage taken on hit"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance to send down");
newLore.add(ChatColor.GOLD+" lightning onto your enemy.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of dropping a") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance of being fully")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of being fully");
newLore.add(ChatColor.GOLD+" healed on a kill."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+20% "+ChatColor.GOLD+"chance of dropping a");
newLore.add(ChatColor.GOLD+" Golden Nugget on a kill");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of burning an") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of setting the")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of setting the");
newLore.add(ChatColor.GOLD+" mob and surrounding mobs on fire");
newLore.add(ChatColor.GOLD+" for 10 seconds."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of burning an");
newLore.add(ChatColor.GOLD+" enemy to a crisp.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
return newitem;
}
}
return item;
}
@Override
public String toString() {
return "MobHead(Type: "+head_type.name()+", Rare Type: "+rare_head_type.name()+", is_rare:"+rare_head+", is_powered:"+is_powered+")";
}
public MobHead(MobHeadType head_type) {
MobHead(head_type, false, MobHeadRareType.RARE_TYPE_A, false);
}
public MobHead(MobHeadType head_type, boolean is_rare) {
MobHead(head_type, is_rare, MobHeadRareType.RARE_TYPE_A, false);
}
public MobHead(MobHeadType head_type, boolean is_rare, MobHeadRareType rare_head_type) {
MobHead(head_type, is_rare, rare_head_type, false);
}
public MobHead(MobHeadType head_type, boolean is_rare, boolean is_powered) {
MobHead(head_type, is_rare, MobHeadRareType.RARE_TYPE_A, is_powered);
}
public MobHead(MobHeadType head_type, boolean is_rare, MobHeadRareType rare_head_type, boolean is_powered) {
MobHead(head_type, is_rare, rare_head_type, is_powered);
}
void MobHead(MobHeadType head_type, boolean is_rare, MobHeadRareType rare_head_type, boolean is_powered) {
this.head_type=head_type;
this.rare_head_type=rare_head_type;
this.rare_head=is_rare;
this.is_powered=is_powered;
}
}

@ -33,6 +33,7 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.SkullType;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Biome;
@ -49,6 +50,7 @@ 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.Arrow;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creature;
@ -129,6 +131,7 @@ 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.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
@ -223,6 +226,8 @@ import me.kaZep.Base.PersistentExplorerList;
import me.kaZep.Base.PlayerData;
import me.kaZep.Base.SupportEntity;
import me.kaZep.Base.SupportPlayer;
import me.kaZep.Base.MobHead.MobHeadRareType;
import me.kaZep.Base.MobHead.MobHeadType;
import me.kaZep.Commands.JobsDataInfo.Job;
public class PlayerListener
@ -334,9 +339,9 @@ implements Listener
public void onServerListPing(ServerListPingEvent e) {
e.setMaxPlayers(16);
if (this.plugin.getConfig().getBoolean("maintenance-mode")) {
e.setMotd(ChatColor.RED+"Currently in Maintenance Mode.");
e.setMotd(ChatColor.AQUA+"Sig's Minecraft!\n"+ChatColor.RED+"Currently in Maintenance Mode.");
} else {
e.setMotd("Sig's Minecraft - "+ChatColor.BLUE+"Currently Online.");
e.setMotd(ChatColor.AQUA+"Sig's Minecraft!\n"+ChatColor.BLUE+"Currently Online.");
}
return;
}
@ -1957,6 +1962,7 @@ implements Listener
Main.economy.depositPlayer(p.getName().toLowerCase(), 70);
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".status", Boolean.valueOf(true));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".money", Double.valueOf(this.plugin.getConfig().getDouble("start-balance")));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefrating", Double.valueOf(1000.0d));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefwins", Integer.valueOf(0));
@ -2022,6 +2028,10 @@ implements Listener
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().toLowerCase()).balance)+", Bank Balance: $"+df.format(this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase()+".money")));
if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".interestdistributedtime")) {
this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME));
//this.plugin.saveAccountsConfig();
}
//Update account information for the stat point update.
if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".jobs.job1_30")) {
this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job1_30", Integer.valueOf(0));
@ -6098,6 +6108,8 @@ implements Listener
public void onItemPrepareCraft(PrepareItemCraftEvent e) {
CraftingInventory result = e.getInventory();
//Bukkit.getLogger().info("Triggered PrepareItemCraftEvent.");
//****************************// Job Boofs poof here.
if (result.getResult().getType()==Material.WOOD) {
@ -6152,6 +6164,62 @@ implements Listener
}
}
if (result.getResult().getType()==Material.SKULL_ITEM) {
//This could potentially be a mob head.
//Find the mob head.
boolean found=false;
for (int i=0;i<result.getMatrix().length;i++) {
if (result.getMatrix()[i]!=null &&
result.getMatrix()[i].getType()==Material.SKULL_ITEM) {
//Bukkit.getLogger().info("Detected a skull item here.");
int gold_blocks=0;
int beacons=0;
for (int j=0;j<result.getMatrix().length;j++) {
if (result.getMatrix()[j]!=null &&
result.getMatrix()[j].getType()==Material.GOLD_BLOCK) {
gold_blocks++;
}
if (result.getMatrix()[j]!=null &&
result.getMatrix()[j].getType()==Material.BEACON) {
beacons++;
}
}
//Bukkit.getLogger().info("Found "+gold_blocks+" gold blocks and "+beacons+" beacons.");
if (this.plugin.getMobHead(result.getMatrix()[i])!=null) {
//Bukkit.getLogger().info("Mob head is "+this.plugin.getMobHead(result.getMatrix()[i]).toString());
if (this.plugin.isUnpoweredHead(this.plugin.getMobHead(result.getMatrix()[i]))) {
//Bukkit.getLogger().info("Mob head is considered unpowered, convert.");
//Allow this conversion to occur.
if (this.plugin.isRareHead(this.plugin.getMobHead(result.getMatrix()[i])) && beacons==4) {
short numb = result.getMatrix()[i].clone().getDurability();
ItemStack poweredhead = this.plugin.convertToPoweredHead(result.getMatrix()[i].clone());
poweredhead.setData(result.getMatrix()[i].getData());
found=true;
//Bukkit.getLogger().info("Converted head item is "+this.plugin.convertToPoweredHead(result.getMatrix()[i]).toString());
poweredhead.setDurability(numb);
result.setResult(poweredhead);
break;
}
else
if (!this.plugin.isRareHead(this.plugin.getMobHead(result.getMatrix()[i])) && gold_blocks==4) {
short numb = result.getMatrix()[i].clone().getDurability();
ItemStack poweredhead = this.plugin.convertToPoweredHead(result.getMatrix()[i].clone());
found=true;
//Bukkit.getLogger().info("Converted head item is "+this.plugin.convertToPoweredHead(result.getMatrix()[i]).toString());
poweredhead.setDurability(numb);
result.setResult(poweredhead);
break;
}
}
}
}
}
if (!found) {
result.setResult(new ItemStack(Material.AIR));
return;
}
}
boolean is_battleShovel=false;
if (result.getResult().getType()==Material.WOOD_SPADE) {
//See if we're trying to make the battle shovel.
@ -8215,6 +8283,130 @@ implements Listener
e.getDrops().remove(i);
}
}
if (e.getDrops().get(i).getAmount()>1) {
//Every stack only has half a chance of the previous one to still exist.
int newamt=1;
for (int j=0;j<e.getDrops().get(i).getAmount()-1 && Math.random()<=0.5;j++) {
newamt++;
}
e.getDrops().get(i).setAmount(newamt);
}
}
if (Math.random()<=Main.HEAD_DROP_CHANCE*chance_increase) {
switch (e.getEntity().getType()) {
case SKELETON:{
if (((Skeleton)e.getEntity()).getSkeletonType()==SkeletonType.WITHER) {
e.getDrops().add(new MobHead(MobHeadType.CREEPER).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.SKELETON).getItemStack());
}
}break;
case ZOMBIE:{
e.getDrops().add(new MobHead(MobHeadType.ZOMBIE).getItemStack());
}break;
case CREEPER:{
e.getDrops().add(new MobHead(MobHeadType.CREEPER).getItemStack());
}break;
case SPIDER:{
e.getDrops().add(new MobHead(MobHeadType.SPIDER).getItemStack());
}break;
case ENDERMAN:{
e.getDrops().add(new MobHead(MobHeadType.ENDERMAN).getItemStack());
}break;
case CAVE_SPIDER:{
e.getDrops().add(new MobHead(MobHeadType.CAVE_SPIDER).getItemStack());
}break;
case BLAZE:{
e.getDrops().add(new MobHead(MobHeadType.BLAZE).getItemStack());
}break;
case GHAST:{
e.getDrops().add(new MobHead(MobHeadType.GHAST).getItemStack());
}break;
case PIG_ZOMBIE:{
e.getDrops().add(new MobHead(MobHeadType.ZOMBIE_PIGMAN).getItemStack());
}break;
case MAGMA_CUBE:{
e.getDrops().add(new MobHead(MobHeadType.MAGMA_CUBE).getItemStack());
}break;
}
}
if (Math.random()<=Main.RARE_HEAD_DROP_CHANCE*chance_increase) {
switch (e.getEntity().getType()) {
case SKELETON:{
if (((Skeleton)e.getEntity()).getSkeletonType()==SkeletonType.WITHER) {
e.getDrops().add(new MobHead(MobHeadType.WITHER_SKELETON,true).getItemStack());
} else {
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.SKELETON,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.SKELETON,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}
}break;
case ZOMBIE:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case CREEPER:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.CREEPER,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.CREEPER,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case SPIDER:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.SPIDER,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.SPIDER,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case ENDERMAN:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.ENDERMAN,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.ENDERMAN,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case CAVE_SPIDER:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.CAVE_SPIDER,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.CAVE_SPIDER,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case BLAZE:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.BLAZE,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.BLAZE,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case GHAST:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.GHAST,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.GHAST,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case PIG_ZOMBIE:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.ZOMBIE_PIGMAN,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.ZOMBIE_PIGMAN,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
case MAGMA_CUBE:{
if (Math.random()<=0.5) {
e.getDrops().add(new MobHead(MobHeadType.MAGMA_CUBE,true,MobHeadRareType.RARE_TYPE_A).getItemStack());
} else {
e.getDrops().add(new MobHead(MobHeadType.MAGMA_CUBE,true,MobHeadRareType.RARE_TYPE_B).getItemStack());
}
}break;
}
}
if (Math.random()<=0.00390625*chance_increase) {
ItemStack rename_token = new ItemStack(Material.NAME_TAG);
@ -8941,7 +9133,6 @@ implements Listener
@EventHandler
public void onInventoryOpen(InventoryOpenEvent e) {
boolean disabled = false; // set to true to disable custom anvils
// Inventory override if anvil.
@ -10723,7 +10914,7 @@ implements Listener
if (e.getEntity() instanceof LivingEntity) {
final LivingEntity f = (LivingEntity) e.getEntity();
final double enemy_starthp = f.getHealth();
if (e.getDamager().getType()==EntityType.PLAYER || e.getDamager().getType()==EntityType.ARROW) {
if (e.getDamager().getType()==EntityType.PLAYER || (e.getDamager() instanceof Projectile)) {
if (e.getEntity() instanceof LivingEntity) {
LivingEntity enemy = (LivingEntity)e.getEntity();
if (enemy.getCustomName()!=null) {
@ -10960,6 +11151,31 @@ implements Listener
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel()));
ItemStack item = p.getItemInHand();
double critical_chance=0,armor_pen=0,life_steal=0,attack_speed=0,dmg=0,armor_pen_dmg=0;
List<MobHead> player_mobheads = this.plugin.getMobHeads(p);
int skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON), player_mobheads);
int powered_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, false, true), player_mobheads);
int rare_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A), player_mobheads);
int powered_rare_skeleton_heads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A, true), player_mobheads);
/*if (skeleton_heads>0) {
Bukkit.getLogger().info("Found "+skeleton_heads+" skeleton mob heads.");
}
if (powered_skeleton_heads>0) {
Bukkit.getLogger().info("Found "+powered_skeleton_heads+" powered skeleton mob heads.");
}
if (rare_skeleton_heads>0) {
Bukkit.getLogger().info("Found "+rare_skeleton_heads+" rare skeleton mob heads.");
}
if (powered_rare_skeleton_heads>0) {
Bukkit.getLogger().info("Found "+powered_rare_skeleton_heads+" powered rare skeleton "s.");
}*/
if (skeleton_heads+powered_skeleton_heads+rare_skeleton_heads+powered_rare_skeleton_heads>0) {
//Bukkit.getLogger().info("Old damage was "+e.getDamage());
e.setDamage(e.getDamage()+(e.getDamage()*(0.01*skeleton_heads)));
e.setDamage(e.getDamage()+(e.getDamage()*(0.01*powered_skeleton_heads)));
e.setDamage(e.getDamage()+(e.getDamage()*(0.03*rare_skeleton_heads)));
e.setDamage(e.getDamage()+(e.getDamage()*(0.05*powered_rare_skeleton_heads)));
//Bukkit.getLogger().info("New damage is "+e.getDamage());
}
if (this.plugin.hasJobBuff("Hunter", p, Job.JOB30B)) {
armor_pen+=10;
}
@ -11127,8 +11343,10 @@ implements Listener
if (f.getCustomName()!=null) {
if (enemy_starthp-f.getHealth()+armor_dmg>0.1) {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+f.getCustomName()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
}
} else {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+ChatColor.WHITE+f.getType()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
if (enemy_starthp-f.getHealth()+armor_dmg>0.1) {
p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+"Dealt "+df.format(enemy_starthp-f.getHealth()+armor_dmg)+" damage to "+ChatColor.WHITE+f.getType().name()+ChatColor.RED+""+ChatColor.ITALIC+" (-"+df2.format(((enemy_starthp-f.getHealth())/f.getMaxHealth())*100)+"%)");
}
}
}
@ -12414,7 +12632,7 @@ implements Listener
//Subtract 1 from cursor.
//If the item matches or it's blank.
if (event.getInventory().getItem(3)!=null) {
if (event.getClick()==ClickType.LEFT) {
if (event.getClick()==ClickType.LEFT && event.getAction()!=InventoryAction.COLLECT_TO_CURSOR) {
if (event.getInventory().getItem(3).getType()==event.getCursor().getType() || event.getInventory().getItem(3).getType()==Material.AIR) {
int amt = event.getInventory().getItem(3).getAmount();
if (amt+event.getCursor().getAmount()>event.getInventory().getItem(3).getMaxStackSize()) {
@ -12425,16 +12643,19 @@ implements Listener
newamt.setAmount(leftover);
event.getInventory().setItem(3, newamt2);
event.setCursor(newamt);
event.setResult(Result.ALLOW);
} else {
//Just transfer it all.
event.getInventory().setItem(3, event.getCursor());
event.setCursor(new ItemStack(Material.AIR));
event.setResult(Result.ALLOW);
}
} else {
//Swap them.
ItemStack swap = event.getInventory().getItem(3).clone();
event.getInventory().setItem(3, event.getCursor());
event.setCursor(swap);
event.setResult(Result.ALLOW);
}
} else
if (event.getClick()==ClickType.RIGHT) {
@ -12448,6 +12669,7 @@ implements Listener
newamt.setAmount(leftover);
event.getInventory().setItem(3, newamt2);
event.setCursor(newamt);
event.setResult(Result.ALLOW);
} else {
//Just transfer 1.
ItemStack curs = event.getCursor().clone();
@ -12456,28 +12678,33 @@ implements Listener
inven.setAmount(inven.getAmount()+1);
event.getInventory().setItem(3, inven);
event.setCursor(curs);
event.setResult(Result.ALLOW);
}
} else {
//Swap them.
ItemStack swap = event.getInventory().getItem(3).clone();
event.getInventory().setItem(3, event.getCursor());
event.setCursor(swap);
event.setResult(Result.ALLOW);
}
}
} else {
if (event.getClick()==ClickType.LEFT) {
event.getInventory().setItem(3, event.getCursor());
event.setCursor(new ItemStack(Material.AIR));
event.setResult(Result.ALLOW);
} else
if (event.getClick()==ClickType.RIGHT) {
if (event.getCursor().getAmount()==1) {
event.getInventory().setItem(3, event.getCursor());
event.setCursor(new ItemStack(Material.AIR));
event.setResult(Result.ALLOW);
} else {
ItemStack curs = event.getCursor().clone(); curs.setAmount(curs.getAmount()-1);
ItemStack curs2 = event.getCursor().clone(); curs2.setAmount(1);
event.getInventory().setItem(3, curs2);
event.setCursor(curs);
event.setResult(Result.ALLOW);
}
}
}
@ -12507,6 +12734,7 @@ implements Listener
if (pot1!=null && pot1.getDurability()==0) {brew=true;}
if (pot2!=null && pot2.getDurability()==0) {brew=true;}
if (pot3!=null && pot3.getDurability()==0) {brew=true;}
Bukkit.getLogger().info("Checking in slot 3: "+event.getInventory().getItem(3).toString());
if (event.getInventory().getItem(3).getType()==Material.INK_SACK && brew) {
ItemStack pot = new ItemStack(Material.POTION);
pot.setDurability((short)16391);
@ -13676,7 +13904,20 @@ implements Listener
// Clicked the inventory. Leave the operation alone UNLESS it's a shift-click operation.
if (event.isShiftClick()) {
// Call the scheduled task to validate and update the inventory
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
int task=-1, tries=100;
do {
task = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
tries--;
Bukkit.getLogger().info("Trying updateInventoryTask(). tries="+tries);
} while (task==-1 && tries>0);
if (tries<0) {
Bukkit.getLogger().severe("Could not updateInventoryTask() for whatever reason. Stop trying.");
//Failed for some reason. Cancel the click instead.
event.setCancelled(true);
event.getWhoClicked().getInventory().setContents(event.getWhoClicked().getInventory().getContents());
event.getInventory().setContents(event.getInventory().getContents());
p.updateInventory();
}
}
} else {
// Clicked the anvil. If GUI items are clicked or an invalid operation happens, cancel the operation.
@ -13786,8 +14027,20 @@ implements Listener
}
event.getInventory().setItem(OUTPUT, new ItemStack(Material.AIR));
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
int task=-1, tries=100;
do {
task = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
tries--;
Bukkit.getLogger().info("Trying updateInventoryTask(). tries="+tries);
} while (task==-1 && tries>0);
if (tries<0) {
Bukkit.getLogger().severe("Could not updateInventoryTask() for whatever reason. Stop trying.");
//Failed for some reason. Cancel the click instead.
event.setCancelled(true);
event.getWhoClicked().getInventory().setContents(event.getWhoClicked().getInventory().getContents());
event.getInventory().setContents(event.getInventory().getContents());
p.updateInventory();
}
}
}
} else {
@ -13871,7 +14124,20 @@ implements Listener
event.getInventory().setItem(OUTPUT, new ItemStack(Material.AIR));
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
int task=-1, tries=100;
do {
task = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
tries--;
Bukkit.getLogger().info("Trying updateInventoryTask(). tries="+tries);
} while (task==-1 && tries>0);
if (tries<0) {
Bukkit.getLogger().severe("Could not updateInventoryTask() for whatever reason. Stop trying.");
//Failed for some reason. Cancel the click instead.
event.setCancelled(true);
event.getWhoClicked().getInventory().setContents(event.getWhoClicked().getInventory().getContents());
event.getInventory().setContents(event.getInventory().getContents());
p.updateInventory();
}
}
} else {
// Bukkit.getLogger().info("Normal click");
@ -13935,8 +14201,20 @@ implements Listener
Bukkit.getPlayer(event.getWhoClicked().getName()).getWorld().playSound(Bukkit.getPlayer(event.getWhoClicked().getName()).getLocation(), Sound.LEVEL_UP, 10, 1);
}
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
int task=-1, tries=100;
do {
task = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
tries--;
Bukkit.getLogger().info("Trying updateInventoryTask(). tries="+tries);
} while (task==-1 && tries>0);
if (tries<0) {
Bukkit.getLogger().severe("Could not updateInventoryTask() for whatever reason. Stop trying.");
//Failed for some reason. Cancel the click instead.
event.setCancelled(true);
event.getWhoClicked().getInventory().setContents(event.getWhoClicked().getInventory().getContents());
event.getInventory().setContents(event.getInventory().getContents());
p.updateInventory();
}
}
}
@ -14022,7 +14300,20 @@ implements Listener
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
}
*/
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
int task=-1, tries=100;
do {
task = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new updateInventoryTask(event.getWhoClicked().getName()));
tries--;
Bukkit.getLogger().info("Trying updateInventoryTask(). tries="+tries);
} while (task==-1 && tries>0);
if (tries<0) {
Bukkit.getLogger().severe("Could not updateInventoryTask() for whatever reason. Stop trying.");
//Failed for some reason. Cancel the click instead.
event.setCancelled(true);
event.getWhoClicked().getInventory().setContents(event.getWhoClicked().getInventory().getContents());
event.getInventory().setContents(event.getInventory().getContents());
p.updateInventory();
}
} else {
event.setCancelled(true);
}
@ -14067,6 +14358,19 @@ implements Listener
}
}
if (event.isCancelled()) {
final Player p2 = p;
final InventoryClickEvent e2 = event;
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new
Runnable() {
@Override
public void run() {
e2.getInventory().setContents(e2.getInventory().getContents());
p2.getInventory().setContents(p2.getInventory().getContents());
p2.updateInventory();
}
}, 1);
}
}
private void rewardCraft(ItemStack item, int amount, HumanEntity pl) {
@ -14841,6 +15145,28 @@ implements Listener
@EventHandler
public void onProjectilLaunch(ProjectileLaunchEvent e) {
Projectile thrown_obj = e.getEntity();
if (thrown_obj instanceof Arrow) {
if (thrown_obj.getShooter()!=null && (thrown_obj.getShooter() instanceof Player)) {
Player p = (Player)thrown_obj.getShooter();
List<MobHead> mobheads = this.plugin.getMobHeads(p);
int skeleton_mob_head = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_B), mobheads);
int powered_skeleton_mob_head = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, false, true), mobheads);
int powered_rare_skeleton_mob_head = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A, true), mobheads);
if (skeleton_mob_head+powered_skeleton_mob_head+powered_rare_skeleton_mob_head>0) {
//Bukkit.getLogger().info("Old Projectile speed: "+thrown_obj.getVelocity().toString());
for (int i=0;i<skeleton_mob_head;i++) {
thrown_obj.setVelocity(thrown_obj.getVelocity().add(thrown_obj.getVelocity().multiply((double)1/thrown_obj.getVelocity().length())));
}
for (int i=0;i<powered_skeleton_mob_head;i++) {
thrown_obj.setVelocity(thrown_obj.getVelocity().add(thrown_obj.getVelocity().multiply((double)1/thrown_obj.getVelocity().length())));
}
for (int i=0;i<powered_rare_skeleton_mob_head*3;i++) {
thrown_obj.setVelocity(thrown_obj.getVelocity().add(thrown_obj.getVelocity().multiply((double)1/thrown_obj.getVelocity().length())));
}
//Bukkit.getLogger().info("New Projectile speed: "+thrown_obj.getVelocity().toString());
}
}
}
if (thrown_obj instanceof ThrownPotion) {
ThrownPotion thrownpot = (ThrownPotion)thrown_obj;
thrownpot.setVelocity(thrownpot.getVelocity().setX(thrownpot.getVelocity().getX()*4).setZ(thrownpot.getVelocity().getZ()*4).setY(thrownpot.getVelocity().getY()*3-0.375));
@ -16322,8 +16648,10 @@ implements Listener
@EventHandler
public void onPlayerChat(PlayerChatEvent e) {
//Check if they are withdrawing or depositing money.
Bukkit.getLogger().info(e.getMessage());
DecimalFormat df = new DecimalFormat("#0.00");
//e.getPlayer().playSound(e.getPlayer().getLocation(), Sound.SPIDER_DEATH, 5.0f, 0.04f);
/*
if (this.plugin.getPlayerData(e.getPlayer()).is_renaming_item) {
boolean found=false;
for (int i=0;i<e.getPlayer().getInventory().getContents().length;i++) {
@ -16343,7 +16671,7 @@ implements Listener
if (!found) {
e.getPlayer().sendMessage(ChatColor.RED+"Something bad happened! Please let the administrator know about this event. Your name change did not go through.");
}
}
}*/
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;
@ -16353,6 +16681,7 @@ implements Listener
this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val);
double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money");
this.plugin.getAccountsConfig().set(e.getPlayer().getName().toLowerCase() + ".money", Double.valueOf(mymoney+val));
this.plugin.compoundInterest(e.getPlayer());
//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().toLowerCase() + ".money")));
this.plugin.last_bank_deposit_use_time=0;
@ -16366,6 +16695,7 @@ implements Listener
this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val);
double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money");
this.plugin.getAccountsConfig().set(e.getPlayer().getName().toLowerCase() + ".money", Double.valueOf(mymoney+val));
this.plugin.compoundInterest(e.getPlayer());
//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().toLowerCase() + ".money")));
this.plugin.last_bank_deposit_use_time=0;
@ -16385,6 +16715,7 @@ implements Listener
double val=0;
if (e.getMessage().equalsIgnoreCase("all")) {
//Withdraw all the money in their account.
this.plugin.compoundInterest(e.getPlayer());
val = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money");
this.plugin.getAccountsConfig().set(e.getPlayer().getName().toLowerCase() + ".money", Double.valueOf(0));
//this.plugin.saveAccountsConfig();
@ -16395,6 +16726,7 @@ implements Listener
try {
val = Double.parseDouble(e.getMessage());
//Make sure the user is holding at least that much money.
this.plugin.compoundInterest(e.getPlayer());
if (this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money")>=val && val>0) {
//Deposit the money into their account.
//this.plugin.economy.bankDeposit(e.getPlayer().getName(), val);
@ -17579,7 +17911,7 @@ implements Listener
//******************************//End Job related buffs.
if (e.getAction()==Action.RIGHT_CLICK_BLOCK && p.isSneaking() && e.getClickedBlock().getType()==Material.BOOKSHELF) {
if (e.getAction()==Action.RIGHT_CLICK_BLOCK && !p.isSneaking() && e.getClickedBlock().getType()==Material.BOOKSHELF) {
viewBookshelf(p, e.getClickedBlock().getLocation());
e.setCancelled(true);
}
@ -18093,18 +18425,15 @@ implements Listener
} else if ((sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_GREEN + "[Bank]")) && (sign.getLine(1).equalsIgnoreCase(ChatColor.DARK_GRAY + "Check Balance"))) {
p.sendMessage(ChatColor.GRAY + "===========[ " + ChatColor.LIGHT_PURPLE + "Current Balance" + ChatColor.GRAY + " ]===========");
DecimalFormat df = new DecimalFormat("#0.00");
if (actMon <= 1)
p.sendMessage(ChatColor.DARK_GREEN + "Balance: $" + ChatColor.BOLD + ChatColor.AQUA + df.format(actMon));
else {
//Update money with interest.
actMon=this.plugin.compoundInterest(p);
p.sendMessage(ChatColor.DARK_GREEN + "Balance: $" + ChatColor.BOLD + ChatColor.AQUA + df.format(actMon));
}
/*
if (stats)
p.sendMessage(ChatColor.DARK_GREEN + "Status: " + ChatColor.AQUA + "enabled");
else if (!stats) {
p.sendMessage(ChatColor.DARK_GREEN + "Status: " + ChatColor.AQUA + "disabled");
}*/
p.sendMessage(ChatColor.GRAY + "======================================");
}
}
else

@ -91,7 +91,9 @@ public class RecyclingCenterNode {
}
public void recycleItem(ItemStack item) {
if (item.getItemMeta().hasDisplayName()==false) {
boolean allowed=true;
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().toLowerCase().contains("quickshop")) {allowed=false;}
if (allowed) {
//Choose one of the random recycling centers.
int center=(int)(Math.random()*locations.size());
double tempchance = chance; //Store the current chance so we can check for duplicates.

@ -10,6 +10,9 @@ import java.util.List;
import java.util.Map;
import me.kaZep.Base.Main;
import me.kaZep.Base.MobHead;
import me.kaZep.Base.MobHead.MobHeadRareType;
import me.kaZep.Base.MobHead.MobHeadType;
import me.kaZep.Commands.JobsDataInfo.Job;
import net.jmhertlein.mctowns.MCTowns;
import net.jmhertlein.mctowns.MCTownsPlugin;
@ -357,7 +360,8 @@ public String convertToItemName(String val) {
Player p = (Player)sender;
boolean status = this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase() + ".status");
int playerBankBalance = this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase() + ".money");
double playerBankBalance = this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase() + ".money");
playerBankBalance = this.plugin.compoundInterest(p);
String currencySingular = Main.economy.currencyNameSingular();
String currencyPlural = Main.economy.currencyNamePlural();
@ -387,7 +391,7 @@ public String convertToItemName(String val) {
}
} else
if (cmd.getName().toLowerCase().equalsIgnoreCase("tele")) {
p.sendMessage("Usage: "+ChatColor.RED+"/tele to "+ChatColor.GREEN+" <player>"+ChatColor.WHITE+" - Teleport to a player for a cost.");
p.sendMessage("Usage: "+ChatColor.RED+"/tele to "+ChatColor.GREEN+" <player/town>"+ChatColor.WHITE+" - Teleport to a player/town for a cost.");
} else
if (cmd.getName().toLowerCase().equalsIgnoreCase("settings")) {
Inventory i = Bukkit.createInventory(p, 27, "Notification Options");
@ -567,8 +571,12 @@ public String convertToItemName(String val) {
meta.setDisplayName(ChatColor.RESET+"");
}
for (int i=0;i<args.length;i++) {
if (meta.getDisplayName().equals(ChatColor.RESET+"")) {
meta.setDisplayName(args[i]);
} else {
meta.setDisplayName(meta.getDisplayName()+" "+args[i]);
}
}
p.getItemInHand().setItemMeta(meta);
p.sendMessage("Changed name tag's title to "+p.getItemInHand().getItemMeta().getDisplayName()+".");
}
@ -594,6 +602,39 @@ public String convertToItemName(String val) {
}
this.plugin.saveConfig();
}
if (args[0].equalsIgnoreCase("cheatheads")) {
if (p.hasPermission("maintenance-mode-admin")) {
Inventory i = Bukkit.createInventory(p, 63, "Mob Head Inventory");
ItemStack temp = null;
int count = -1;
for (int k=0;k<MobHeadType.values().length;k++) {
temp = new MobHead(MobHeadType.values()[k]).getItemStack();
temp.setAmount(3);
i.setItem(count+=1, temp);
}
for (int k=0;k<MobHeadType.values().length;k++) {
for (int l=0;l<MobHeadRareType.values().length;l++) {
temp = new MobHead(MobHeadType.values()[k],true,MobHeadRareType.values()[l]).getItemStack();
temp.setAmount(3);
i.setItem(count+=1, temp);
}
}
for (int k=0;k<MobHeadType.values().length;k++) {
temp = new MobHead(MobHeadType.values()[k],false,true).getItemStack();
temp.setAmount(3);
i.setItem(count+=1, temp);
}
for (int k=0;k<MobHeadType.values().length;k++) {
temp = new MobHead(MobHeadType.values()[k],true,true).getItemStack();
temp.setAmount(3);
i.setItem(count+=1, temp);
}
p.openInventory(i);
}
}
if (args[0].equalsIgnoreCase("cheat")) {
if (p.hasPermission("maintenance-mode-admin")) {
p.sendMessage("Permission granted. Now loading Aperture Science Laboratory Equipment.");
@ -834,7 +875,10 @@ public String convertToItemName(String val) {
// Arrows
i.setItem(count+=1, new ItemStack(Material.ARROW, 64));
temp = new ItemStack(Material.getMaterial(34),64);
//Food
i.setItem(count+=1, new ItemStack(Material.COOKED_CHICKEN,64));
temp = new ItemStack(Material.SIGN,64);
ItemMeta meta = temp.getItemMeta();
meta.setDisplayName(ChatColor.LIGHT_PURPLE+"Job Boost Card");
List<String> lore = new ArrayList<String>();
@ -845,8 +889,6 @@ public String convertToItemName(String val) {
i.setItem(count+=1, temp);
p.openInventory(i);
}
}
if (args[0].equalsIgnoreCase("newmobs")) {
@ -1835,10 +1877,9 @@ public String convertToItemName(String val) {
}
else if (cmd.getName().toLowerCase().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("info")) && (p.hasPermission("bankeconomy.info"))) {
if (args.length == 1) {
if (playerBankBalance <= 1)
p.sendMessage(this.prefix + " " + this.cmdInfo + " " + playerBankBalance + currencySingular + "<EFBFBD>˜a.");
else if (playerBankBalance > 1)
p.sendMessage(this.prefix + " " + this.cmdInfo + " " + playerBankBalance + currencyPlural + "<EFBFBD>˜a.");
p.sendMessage(ChatColor.GRAY + "===========[ " + ChatColor.LIGHT_PURPLE + "Current Balance" + ChatColor.GRAY + " ]===========");
DecimalFormat df = new DecimalFormat("#0.00");
p.sendMessage(ChatColor.DARK_GREEN + "Balance: $" + ChatColor.BOLD + ChatColor.AQUA + df.format(playerBankBalance));
}
else
p.sendMessage(this.invARG);

Loading…
Cancel
Save