diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index d0ddaf1..38372f9 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index bc07a58..cc13c9b 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.8.5c +version: 3.8.5dBUGSPLEASEGOAWAYWTFWHYAREYOUSTILLHEREOMGIHATETHISPLSFIXNOCOPYPASTERINO commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java index fb7e94c..fd7d170 100644 --- a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java +++ b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java @@ -12,8 +12,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import com.google.common.collect.Iterables; - import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; @@ -74,7 +72,7 @@ public class AwakenedArtifact { //LEVEL UP! ItemStack item = addLV(artifact,totalval/1000, p); item = setEXP(item,totalval%1000); - item = addAP(item,1); + item = addAP(item,totalval/1000); double potentialred = 10.0d; potentialred *= 1 - GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact)/100d; TwosideKeeper.log("Potential reduction is reduced by "+(10-potentialred), 4); @@ -145,7 +143,23 @@ public class AwakenedArtifact { ItemMeta m = artifact.getItemMeta(); List lore = m.getLore(); int currentAP = getAP(artifact); - lore.set(6, ChatColor.GOLD+"Ability Points: "+(currentAP)+"/"+getLV(artifact)); + lore.set(6, ChatColor.GOLD+"Ability Points: "+(currentAP+amt)+"/"+getMaxAP(artifact)); + m.setLore(lore); + artifact.setItemMeta(m); + return artifact; + } + TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); + return null; + } + public static ItemStack setAP(ItemStack artifact, int newamt) { + if (artifact!=null && + artifact.getType()!=Material.AIR && + artifact.hasItemMeta() && + artifact.getItemMeta().hasLore() && + Artifact.isArtifact(artifact)) { + ItemMeta m = artifact.getItemMeta(); + List lore = m.getLore(); + lore.set(6, ChatColor.GOLD+"Ability Points: "+(newamt)+"/"+getMaxAP(artifact)); m.setLore(lore); artifact.setItemMeta(m); return artifact; @@ -159,18 +173,75 @@ public class AwakenedArtifact { artifact.hasItemMeta() && artifact.getItemMeta().hasLore() && Artifact.isArtifact(artifact)) { - int level = getLV(artifact); //This is how many total we have. + ItemMeta m = artifact.getItemMeta(); + List lore = m.getLore(); + String apline = lore.get(6); + /*int level = getLV(artifact); //This is how many total we have. int apused = 0; HashMap enchants = ArtifactAbility.getEnchantments(artifact); for (int i=0;i lore = m.getLore(); + int currentMaxAP = getMaxAP(artifact); + lore.set(6, ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(currentMaxAP+amt)); + m.setLore(lore); + artifact.setItemMeta(m); + return artifact; + } + TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); + return null; + } + public static ItemStack setMaxAP(ItemStack artifact, int newamt) { + if (artifact!=null && + artifact.getType()!=Material.AIR && + artifact.hasItemMeta() && + artifact.getItemMeta().hasLore() && + Artifact.isArtifact(artifact)) { + ItemMeta m = artifact.getItemMeta(); + List lore = m.getLore(); + lore.set(6, ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+(newamt)); + m.setLore(lore); + artifact.setItemMeta(m); + return artifact; + } + TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); + return null; + } + public static int getMaxAP(ItemStack artifact) { + if (artifact!=null && + artifact.getType()!=Material.AIR && + artifact.hasItemMeta() && + artifact.getItemMeta().hasLore() && + Artifact.isArtifact(artifact)) { + ItemMeta m = artifact.getItemMeta(); + List lore = m.getLore(); + String apline = lore.get(6); + /*int level = getLV(artifact); //This is how many total we have. + int apused = 0; + HashMap enchants = ArtifactAbility.getEnchantments(artifact); + for (int i=0;i=5 && + item.getItemMeta().getLore().contains(ChatColor.ITALIC+"Cash into any local bank") && + item.getItemMeta().getLore().contains(ChatColor.ITALIC+"for money!")) { return true; } else { return false; } } - public static ItemStack createSignedBankCheckItem(double amt, String signedby) { + public static boolean isVerifiedBankCheck(ItemStack item) { + if (item!=null && + item.getType()==Material.PAPER && + item.getEnchantmentLevel(Enchantment.LUCK)==1 && + item.getItemMeta().hasLore() && + item.getItemMeta().getLore().size()>=5 && + item.getItemMeta().getLore().contains(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Verified Check")) { + return true; + } else { + return false; + } + } + public static ItemStack createSignedBankCheckItem(double amt, String signedby, boolean verified) { DecimalFormat df = new DecimalFormat("0.00"); ItemStack check = new ItemStack(Material.PAPER); check.addUnsafeEnchantment(Enchantment.LUCK, 1); @@ -56,6 +68,7 @@ public class Check { List lore = new ArrayList(); lore.add(ChatColor.ITALIC+""+ChatColor.WHITE+"Check for "+ChatColor.YELLOW+"$"+df.format(amt)); lore.add(ChatColor.BLUE+"Signed by "+ChatColor.LIGHT_PURPLE+signedby); + if (verified) {lore.add(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Verified Check");} lore.add(""); lore.add(ChatColor.ITALIC+"Cash into any local bank"); lore.add(ChatColor.ITALIC+"for money!"); diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 91f4c90..13aabcb 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -35,8 +35,6 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; -import com.google.common.collect.Iterables; - import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.BowMode; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; @@ -53,7 +51,8 @@ public class CustomDamage { public static final int CRITICALSTRIKE = 1; public static final int IGNOREDODGE = 2; public static final int TRUEDMG = 4; - public static final int SPECIALATTACK = 8; //Used internally to specifically define a special attack. + public static final int IGNORE_DAMAGE_TICK = 8; //Ignores damage ticks, which guarantees this attack will land regardless if the player's gotten hit by this before. + public static final int SPECIALATTACK = 16; //Used internally to specifically define a special attack. //////////////////THE FLAGS BELOW ARE SYSTEM FLAGS!! DO NOT USE THEM! public static final int IS_CRIT = 1; //System Flag. Used for telling a player structure their last hit was a crit. @@ -631,9 +630,9 @@ public class CustomDamage { private static void rallyNearbyMonsters(Monster m, Player p, double range) { Collection nearby =m.getLocation().getWorld().getNearbyEntities(m.getLocation(), range, range, range); - for (int i=0;i=9) { + return false; + } + } + } + return true; + } + private static void calculateGracefulDodgeTicks(LivingEntity target) { if (target instanceof Player) { ItemStack[] equip = GenericFunctions.getEquipment(target); @@ -981,9 +995,9 @@ public class CustomDamage { //Check for resistance effect. Collection target_effects = target.getActivePotionEffects(); - for (int i=0;i0) { adjustWillpower(); - weakenTeam(); + //weakenTeam(); retargetInAir(); destroyLiquids(2); reapplyGlow(); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java index 3037873..a49cbb2 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -169,11 +169,11 @@ public enum ArtifactAbility { } private static String LevelCost(int i) { - return "\n\n"+ChatColor.RED+"Costs "+i+" Artifact Level"+((i==1)?"":"s"); + return "\n\n"+ChatColor.RED+"Costs "+i+" AP"; } private static String TemporarySkill() { - return "\n\n"+ChatColor.RED+"Costs 1 Artifact Level."; + return "\n\n"+ChatColor.RED+"Consumes 1 Max AP Point when knocked off."; } public String GetName() { @@ -300,7 +300,7 @@ public enum ArtifactAbility { TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2); item = removeEnchantment(ab,item); } - item = AwakenedArtifact.addAP(item, 0); + item = AwakenedArtifact.setAP(item, AwakenedArtifact.getLV(item)); return item; } @@ -453,7 +453,7 @@ public enum ArtifactAbility { p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!"); if (ability.equals(ArtifactAbility.GRACEFULDODGE)) { //Remove a level from using a temporary ability. - AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-10, p); + AwakenedArtifact.addAP(item, -9); } int apamt = AwakenedArtifact.getAP(item); if (apamt>0) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index b5c4cec..d44e87a 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -38,8 +38,6 @@ import org.bukkit.util.Vector; import org.inventivetalent.glow.GlowAPI; import org.inventivetalent.glow.GlowAPI.Color; -import com.google.common.collect.Iterables; - import aPlugin.DiscordMessageSender; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -308,12 +306,11 @@ public class GenericFunctions { public static int getMaxThornsLevel(LivingEntity e) { int maxlv = 0; - ItemStack[] equips = e.getEquipment().getArmorContents(); - for (int i=0;i=maxlv) { - maxlv = equips[i].getEnchantmentLevel(Enchantment.THORNS); + for (ItemStack equip : e.getEquipment().getArmorContents()) { + if (equip!=null && + equip.getType()!=Material.AIR) { + if (equip.getEnchantmentLevel(Enchantment.THORNS)>=maxlv) { + maxlv = equip.getEnchantmentLevel(Enchantment.THORNS); } } } @@ -1865,10 +1862,10 @@ public class GenericFunctions { */ public static int CountItems(Inventory it, ItemStack item) { int totalcount=0; - for (int i=0;i lore = item.getItemMeta().getLore(); - for (int i=0;i lore = item.getItemMeta().getLore(); PotionMeta pm = (PotionMeta)item.getItemMeta(); - for (int i=0;i players = getNearbyPlayers(l,range); //We cleared the non-living entities, deal damage to the rest. - for (int i=0;i0) { //Prevent knockups if we die to the attack. + for (Player p : players) { + //TwosideKeeperAPI.DealDamageToEntity(NewCombat.CalculateDamageReduction(((fullcalculation)?NewCombat.CalculateWeaponDamage(damager, p):1.0)*basedmg,p,null), (Player)players.get(i), damager); + /*if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack. + p.setVelocity(new Vector(0,knockupamt,0)); + }*/ + if (CustomDamage.ApplyDamage(basedmg, damager, p, null, reason, (truedmg)?CustomDamage.TRUEDMG:CustomDamage.NONE)) { + if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack. p.setVelocity(new Vector(0,knockupamt,0)); - }*/ - if (CustomDamage.ApplyDamage(basedmg, damager, p, null, reason, (truedmg)?CustomDamage.TRUEDMG:CustomDamage.NONE)) { - if (knockup && p.getHealth()>0) { //Prevent knockups if we die to the attack. - p.setVelocity(new Vector(0,knockupamt,0)); - } } } } @@ -3427,9 +3418,9 @@ public class GenericFunctions { } public static EliteMonster getEliteMonster(Monster m) { - for (int i=0;i ents = CustomDamage.trimNonMonsterEntities(entities); double closest=9999999d; Monster m = null; - for (int i=0;i lore = item.getItemMeta().getLore(); - for (int i=0;iSlayers can use the Assassination ability. Press the Drop key while looking at an enemy to perform an assassination: You jump directly behind the enemy, gaining 0.5 seconds of invulnerability. If the next hit after Assassination is performed kills the target, you gain 1 Heart (2 Health) back along with a speed and strength buff. These buffs cap at Speed V and Strength X respectively. Assassination cooldown is reset whenever a target is instantly killed in this manner, and you get immediately put back into stealth, preventing further detection from other monsters.\n"), SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner", ChatColor.DARK_PURPLE+""+ChatColor.BOLD+"Summoner mode Perks: "+ChatColor.RESET+"\n"), - NORMAL(ChatColor.WHITE,"","", + NORMAL(ChatColor.WHITE,"","Normal", "This mode has no perks!"); ; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java b/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java index 73bd353..5eeb142 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java @@ -35,8 +35,6 @@ import org.bukkit.inventory.meta.Repairable; import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; -import com.google.common.collect.Iterables; - import sig.plugin.TwosideKeeper.Artifact; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.WorldShopManager; @@ -745,8 +743,7 @@ public class WorldShop { boolean item_here=false; Collection entities = signloc.getWorld().getNearbyEntities(signloc, 0.2, 0.2, 0.2); - for (int i=0;i nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3); - for (int i=0;i entities = ev.getPlayer().getLocation().getWorld().getNearbyEntities(loc, 1, 1, 1); - for (int i=0;i obj = null; + Object removal = null; + Set obj2 = null; + List obj3 = null; + + public ThreadSafeCollection(Collection obj, Object remove) { + this.obj=obj; + this.removal=remove; + } + + public ThreadSafeCollection(Set obj, Object remove) { + this.obj2=obj; + this.removal=remove; + } + + public ThreadSafeCollection(List obj, Object remove) { + this.obj3=obj; + this.removal=remove; + } + + @Override + public void run() { + if (this.obj!=null) { + this.obj.remove(this.removal); + } else + if (this.obj2!=null) { + this.obj2.remove(this.removal); + } else + if (this.obj3!=null) { + this.obj3.remove(removal); + } + } + +} diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 3b36fa1..e5cfdb9 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -16,6 +16,7 @@ import org.apache.commons.lang.WordUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; +import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; @@ -138,7 +139,6 @@ import org.bukkit.potion.PotionType; import org.bukkit.util.Vector; import org.inventivetalent.glow.GlowAPI; -import com.google.common.collect.Iterables; import aPlugin.DiscordMessageSender; import aPlugin.API.Chests; import events.PluginLoadEvent; @@ -263,7 +263,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void run() { if (check.getAmount()>1) { check.setAmount(check.getAmount()-1); - ev.getPlayer().getLocation().getWorld().dropItem(ev.getPlayer().getLocation(), finalcheck); + //ev.getPlayer().getLocation().getWorld().dropItem(ev.getPlayer().getLocation(), finalcheck); + GenericFunctions.giveItem(ev.getPlayer(), finalcheck); } else { ev.getPlayer().getEquipment().setItemInMainHand(finalcheck); } @@ -324,9 +325,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { log("[DEBUG] Time: "+Bukkit.getWorld("world").getTime()+" Full Time: "+Bukkit.getWorld("world").getFullTime() + " SERVERTICKTIME: "+getServerTickTime(),4); //This functionality only makes sense when two or more players are on. int sleeping=0; - for (int i=0;i=16) { double totalregen = 1+(p.getMaxHealth()*0.05); - ItemStack[] equips = p.getEquipment().getArmorContents(); double bonusregen = 0.0; - for (int i1=0;i1p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen); - + p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen); } } //See if this player is sleeping. @@ -526,35 +519,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (!p.isDead()) {log("Player is not dead.",5); setPlayerMaxHealth(p);} p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p)); p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p)); - /*double old_weapondmg = pd.prev_weapondmg; - double old_buffdmg = pd.prev_buffdmg; - double old_partydmg = pd.prev_partydmg; - double old_armordef = pd.prev_armordef; - double store1=CalculateDamageReduction(1,p,p); - double store2=old_weapondmg; - if (GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand())) { - store2 = CalculateWeaponDamage(p,null); - } - if (store1!=pd.damagereduction || store2!=pd.damagedealt) { - log("Values: "+old_weapondmg+"," - +old_buffdmg+"," - +old_partydmg+"," - +old_armordef+"::"+pd.prev_weapondmg+"," - +pd.prev_buffdmg+"," - +pd.prev_partydmg+"," - +pd.prev_armordef,5); - pd.damagereduction = store1; - pd.damagedealt = store2; - DecimalFormat df = new DecimalFormat("0.0"); - if (((old_weapondmg != pd.prev_weapondmg && GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand())) || - (old_armordef != pd.prev_armordef)) - && old_partydmg == pd.prev_partydmg && old_buffdmg == pd.prev_buffdmg) { - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(pd.damagedealt)+" "+ChatColor.GRAY+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+Math.round((1.0-pd.damagereduction)*100)+"%"); - } - }*/ - for (int i3=0;i3=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) { GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.SPEED,20,1,p); } @@ -571,73 +538,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } GenericFunctions.AutoRepairItems(p); - - //Try to fit into an already existing party. - /*boolean inParty=false; //LEGACY PARTY CODE. - for (int j=0;j0) { @@ -647,8 +559,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { private double subtractVanillaArmorBar(ItemStack[] armorContents) { double lostamt = 0.0d; - for (int i=0;i0) { if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) { @@ -742,61 +652,67 @@ public class TwosideKeeper extends JavaPlugin implements Listener { private final class ControlChargeZombies implements Runnable { public void run(){ - //Control charge zombies.. - for (int i=0;i32) { - //This has to be removed... - chargezombies.remove(i); - i--; - } else { - //This is fine! Clear away blocks. - Monster m = cz.GetZombie(); - if (m.getTarget().getLocation().getY()>=m.getLocation().getY()+2 && - Math.abs(m.getTarget().getLocation().getX()-m.getLocation().getX())<1 && - Math.abs(m.getTarget().getLocation().getZ()-m.getLocation().getZ())<1) { - //This target is higher than we can reach... Let's pillar. - Random r = new Random(); - r.setSeed(m.getUniqueId().getMostSignificantBits()); - //Block type is chosen based on the seed. Will be cobblestone, dirt, or gravel. - if (m.getLocation().getBlock().getType()==Material.AIR && - m.getLocation().add(0,-1,0).getBlock().getType()!=Material.AIR && - !m.getLocation().add(0,-1,0).getBlock().isLiquid()) { - m.setVelocity(new Vector(0,0.5,0)); - if (m.getLocation().getWorld().getName().equalsIgnoreCase("world_nether")) { - m.getLocation().getBlock().setType(Material.NETHERRACK); - m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f); - } else { - switch (r.nextInt(3)) { - case 0:{ - m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f); - }break; - case 1:{ - m.getLocation().getBlock().setType(Material.COBBLESTONE); - m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f); - }break; - case 2:{ - m.getLocation().getBlock().setType(Material.GRAVEL); - m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f); - }break; + //Control charge zombies.. + for (ChargeZombie cz : chargezombies) { + if (cz.m==null || !cz.m.isValid() || !cz.isAlive() || !cz.hasTarget() || cz.GetZombie().getLocation().getY()>32) { + //This has to be removed... + ScheduleRemoval(chargezombies,cz); + } else { + //This is fine! Clear away blocks. + Monster m = cz.GetZombie(); + if (m.getTarget().getLocation().getY()>=m.getLocation().getY()+2 && + Math.abs(m.getTarget().getLocation().getX()-m.getLocation().getX())<1 && + Math.abs(m.getTarget().getLocation().getZ()-m.getLocation().getZ())<1) { + //This target is higher than we can reach... Let's pillar. + Random r = new Random(); + r.setSeed(m.getUniqueId().getMostSignificantBits()); + //Block type is chosen based on the seed. Will be cobblestone, dirt, or gravel. + if (m.getLocation().getBlock().getType()==Material.AIR && + m.getLocation().add(0,-1,0).getBlock().getType()!=Material.AIR && + !m.getLocation().add(0,-1,0).getBlock().isLiquid()) { + m.setVelocity(new Vector(0,0.5,0)); + if (m.getLocation().getWorld().getName().equalsIgnoreCase("world_nether")) { + m.getLocation().getBlock().setType(Material.NETHERRACK); + m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f); + } else { + switch (r.nextInt(3)) { + case 0:{ + m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f); + }break; + case 1:{ + m.getLocation().getBlock().setType(Material.COBBLESTONE); + m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f); + }break; + case 2:{ + m.getLocation().getBlock().setType(Material.GRAVEL); + m.getLocation().getWorld().playSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f); + }break; + } } } } + cz.BreakBlocksAroundArea(1); + } + } + //Control elite monsters. + for (EliteMonster em : elitemonsters) { + if (!em.m.isValid()) { + ScheduleRemoval(elitemonsters,em); + } else { + em.runTick(); } - cz.BreakBlocksAroundArea(1); } } - //Control elite monsters. - for (int i=0;i list, Object remove) { + Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1); + } + public static void ScheduleRemoval(Collection list, Object remove) { + Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1); + } + public static void ScheduleRemoval(List list, Object remove) { + Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1); } private final class SetupPlayerMode implements Runnable { @@ -1189,6 +1105,29 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } else if (cmd.getName().equalsIgnoreCase("stats")) { if (args.length>=1) { + if (args[0].equalsIgnoreCase("equip")) { + showPlayerStats((Player)sender,"equip"); + } else + if (args[0].equalsIgnoreCase("all")) { + showPlayerStats((Player)sender,"all"); + } else + if (args.length>=2) { + if (Bukkit.getPlayer(args[0])!=null) { + //If we can grab their stats, then calculate it. + Player p = Bukkit.getPlayer(args[0]); + sender.sendMessage("Displaying stats for "+ChatColor.YELLOW+p.getName()); + if (args[1].equalsIgnoreCase("equip")) { + showPlayerStats(p,sender,"equip"); + } else + if (args[1].equalsIgnoreCase("all")) { + showPlayerStats(p,sender,"all"); + } else { + showPlayerStats(p,sender); + } + } else { + sender.sendMessage("Player "+ChatColor.YELLOW+args[0]+" is not online!"); + } + } else if (Bukkit.getPlayer(args[0])!=null) { //If we can grab their stats, then calculate it. Player p = Bukkit.getPlayer(args[0]); @@ -1334,8 +1273,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener { AwakenedArtifact.addPotentialEXP(p.getEquipment().getArmorContents()[i], 500, p); } } - ItemStack item = p.getEquipment().getItemInMainHand(); + */ + /*ItemStack item = p.getEquipment().getItemInMainHand(); AwakenedArtifact.addPotentialEXP(item, 50000, p);*/ + TwosideKeeperAPI.removeAllArtifactAbilityPoints(p.getEquipment().getItemInMainHand()); //p.sendMessage(tpstracker.getTPS()+""); //GenericFunctions.addObscureHardenedItemBreaks(p.getEquipment().getItemInMainHand(), 4); } @@ -1772,8 +1713,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (Check.isUnsignedBankCheck(check)) { ev.getPlayer().sendMessage(ChatColor.GOLD+"SIGNING COMPLETE!"); ev.getPlayer().sendMessage(ChatColor.AQUA+" You have successfully written a check for "+ChatColor.YELLOW+"$"+df.format(value)+ChatColor.WHITE+"."); - final ItemStack finalcheck = Check.createSignedBankCheckItem(value, ev.getPlayer().getName()); - Bukkit.getScheduler().scheduleSyncDelayedTask(this, new WriteAndSignCheck(finalcheck, check, ev),1); + double bankmoney = getPlayerBankMoney(ev.getPlayer()); + if (bankmoney=getServerTickTime()) { + return; + } switch (mode) { case CLOSE:{ p.playSound(p.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f); @@ -2249,9 +2205,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.setBowMode(p.getEquipment().getItemInMainHand(),BowMode.SNIPE); }break; } + pd.lastbowmodeswitch=getServerTickTime(); } GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand()); p.updateInventory(); + ev.setCancelled(true); + return; } } @@ -2293,6 +2252,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (bursted) { //Cancel this then, because we decided to burst our stacks instead. ev.setCancelled(true); + return; } } @@ -2316,6 +2276,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { banksessions.put(ev.getPlayer().getUniqueId(), bs); ev.getPlayer().sendMessage("Input how much you want to sign this "+ChatColor.YELLOW+"check"+ChatColor.WHITE+" for:"); } + ev.setCancelled(true); + return; } } @@ -2365,6 +2327,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (!shop.GetOwner().equalsIgnoreCase(ev.getPlayer().getName())) { ev.getPlayer().sendMessage("This shop belongs to "+ChatColor.LIGHT_PURPLE+shop.GetOwner()+ChatColor.WHITE+"! You cannot look at other's shops!"); ev.setCancelled(true); + return; } } } @@ -2411,6 +2374,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } } + ev.setCancelled(true); + return; } //Check for a bed right-click. Set the new bed save point. @@ -2438,6 +2403,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) { ev.setCancelled(true); //Do not place minecarts on rails -.- ev.getPlayer().updateInventory(); + return; } if (ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && !GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()))) { if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() && @@ -2468,6 +2434,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { pd.isViewingItemCube=true; ev.getPlayer().playSound(ev.getPlayer().getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f); } + ev.setCancelled(true); + return; } } else if (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType())) { @@ -2562,9 +2530,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener { itemCube_saveConfig(itemcube_id,save_items,cub); //This may have been a shop. Update the shop too. WorldShop.updateShopSign(ev.getClickedBlock()); + ev.setCancelled(true); + return; } else { ev.getPlayer().sendMessage("This shop is owned by "+ChatColor.LIGHT_PURPLE+owner+ChatColor.WHITE+". You cannot dump item cubes into others' shops!"); - //ev.setCancelled(true); + ev.setCancelled(true); + return; } } } @@ -2612,12 +2583,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener { finalmsg.addExtra(message2); finalmsg.addExtra(message3); ev.getPlayer().spigot().sendMessage(finalmsg); + ev.setCancelled(true); + return; } else { player.sendMessage(ChatColor.RED+"Cannot create a shop with nothing! "+ChatColor.WHITE+"Right-click the sign" + " with the item you want to sell in your hand."); + ev.setCancelled(true); + return; } } else { player.sendMessage(ChatColor.RED+"Sorry! "+ChatColor.WHITE+" A shop has already been setup here!"); + ev.setCancelled(true); + return; } } else if (s.getLine(0).equalsIgnoreCase(ChatColor.BLUE+"-- SHOP --")) { @@ -2646,6 +2623,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { finalmsg.addExtra(message3); ev.getPlayer().spigot().sendMessage(finalmsg); TwosideShops.AddSession(SessionState.UPDATE, player, s); + ev.setCancelled(true); + return; } else { if (shop.GetAmount()>0) { //player.sendMessage("How many "+Cha tColor.GREEN+shop.GetItemName()+ChatColor.WHITE+" would you like to buy? "+ChatColor.GREEN+"(MAX: "+((getPlayerMoney(player)<(shop.GetAmount()*shop.GetUnitPrice()))?(int)(getPlayerMoney(player)/shop.GetUnitPrice()):shop.GetAmount())+")"); @@ -2662,8 +2641,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener { TwosideShops.AddSession(SessionState.PURCHASE, player, s); log("Added a shop session for "+player.getName()+".",4); //shop.sendItemInfo(player); + ev.setCancelled(true); + return; } else { player.sendMessage(ChatColor.GOLD+"Sorry! "+ChatColor.WHITE+"This shop is sold out! Let "+ChatColor.LIGHT_PURPLE+shop.GetOwner()+ChatColor.WHITE+" know to restock the shop!"); + ev.setCancelled(true); + return; } } } else @@ -2696,12 +2679,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.getPlayer().spigot().sendMessage(finalmsg); //player.sendMessage("How many of this item do you want to buy?"); + + ev.setCancelled(true); + return; } else { player.sendMessage(ChatColor.RED+"Cannot create a shop with nothing! "+ChatColor.WHITE+"Right-click the sign" + " with the item you want to buy in your hand."); + ev.setCancelled(true); + return; } } else { player.sendMessage(ChatColor.RED+"Sorry! "+ChatColor.WHITE+" A shop has already been setup here!"); + ev.setCancelled(true); + return; } } else if (s.getLine(0).equalsIgnoreCase(ChatColor.BLUE+"- BUYING SHOP -") || @@ -2733,6 +2723,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { finalmsg.addExtra(message3); ev.getPlayer().spigot().sendMessage(finalmsg); TwosideShops.AddSession(SessionState.BUY_UPDATE, player, s); + ev.setCancelled(true); + return; } else { if (shop.GetAmount()>0) { //player.sendMessage(+ChatColor.GREEN+shop.GetItemName()+ChatColor.WHITE+); @@ -2749,8 +2741,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener { TwosideShops.AddSession(SessionState.SELL, player, s); log("Added a shop session for "+player.getName()+".",4); //shop.sendItemInfo(player); + ev.setCancelled(true); + return; } else { player.sendMessage(ChatColor.GOLD+"Sorry! "+ChatColor.WHITE+"This shop is not buying anymore items! "+ChatColor.LIGHT_PURPLE+shop.GetOwner()+ChatColor.WHITE+" needs to edit the shop!"); + ev.setCancelled(true); + return; } } } @@ -2763,6 +2759,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Display the balance to the user. DecimalFormat df = new DecimalFormat("0.00"); ev.getPlayer().sendMessage("Your Bank Account currently has: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer()))); + ev.setCancelled(true); + return; } else if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_RED+"WITHDRAW")) { BankSession bs = null; @@ -2778,6 +2776,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount you want to WITHDRAW today."); DecimalFormat df = new DecimalFormat("0.00"); ev.getPlayer().sendMessage(" In Bank: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer()))); + ev.setCancelled(true); + return; } else if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_BLUE+"DEPOSIT")) { BankSession bs = null; @@ -2793,6 +2793,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount you want to DEPOSIT today."); DecimalFormat df = new DecimalFormat("0.00"); ev.getPlayer().sendMessage(" Currently Holding: "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(ev.getPlayer()))); + ev.setCancelled(true); + return; } else if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_BLUE+"EXP CONVERSION")) { BankSession bs = null; @@ -2807,6 +2809,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount of experience you want to convert today."); ev.getPlayer().sendMessage(" Currently Have: "+ChatColor.GREEN+aPlugin.API.getTotalExperience(ev.getPlayer())+" experience points"); + ev.setCancelled(true); + return; } else if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_GREEN+"CASH CHECK")) { if (Check.isSignedBankCheck(ev.getPlayer().getEquipment().getItemInMainHand())) { @@ -2814,9 +2818,31 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Check c = new Check(ev.getPlayer().getEquipment().getItemInMainHand()); if (c.player!=null) { //We found a player for this check. See if they have enough money. - if (c.amt<=getPlayerBankMoney(c.player)) { - //We're good. Subtract money from that player's bank account. And Add money to the player with the check. Destroy the check. - givePlayerBankMoney(c.player,-c.amt); + if (!Check.isVerifiedBankCheck(ev.getPlayer().getEquipment().getItemInMainHand())) { + if (c.amt<=getPlayerBankMoney(c.player)) { + //We're good. Subtract money from that player's bank account. And Add money to the player with the check. Destroy the check. + givePlayerBankMoney(c.player,-c.amt); + givePlayerBankMoney(ev.getPlayer(),c.amt); + DecimalFormat df = new DecimalFormat("0.00"); + ev.getPlayer().sendMessage(ChatColor.AQUA+"Cashed in the check for "+ChatColor.YELLOW+"$"+df.format(c.amt)+ChatColor.WHITE+"."); + ev.getPlayer().sendMessage(" Now In Bank: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer()))); + if (ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1) { + ev.getPlayer().getEquipment().getItemInMainHand().setAmount(ev.getPlayer().getEquipment().getItemInMainHand().getAmount()-1); + } else { + ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); + } + ev.setCancelled(true); + return; + } else { + DecimalFormat df = new DecimalFormat("0.00"); + ev.getPlayer().sendMessage(ChatColor.RED+"We're sorry! "+ChatColor.WHITE+"But the check cannot be processed since the check signer, "+ChatColor.LIGHT_PURPLE+c.player+ChatColor.WHITE+" has poor money management skills and does not have "+ChatColor.YELLOW+"$"+df.format(c.amt)+ChatColor.WHITE+" available in their account!"); + ev.getPlayer().sendMessage(ChatColor.AQUA+"We are sorry about this inconvenience. "+ChatColor.WHITE+"Have a nice day!"); + ev.setCancelled(true); + return; + } + } + else { + //This is verified. Just give the player their money. givePlayerBankMoney(ev.getPlayer(),c.amt); DecimalFormat df = new DecimalFormat("0.00"); ev.getPlayer().sendMessage(ChatColor.AQUA+"Cashed in the check for "+ChatColor.YELLOW+"$"+df.format(c.amt)+ChatColor.WHITE+"."); @@ -2826,16 +2852,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } else { ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); } - } else { - DecimalFormat df = new DecimalFormat("0.00"); - ev.getPlayer().sendMessage(ChatColor.RED+"We're sorry! "+ChatColor.WHITE+"But the check cannot be processed since the check signer, "+ChatColor.LIGHT_PURPLE+c.player+ChatColor.WHITE+" has poor money management skills and does not have "+ChatColor.YELLOW+"$"+df.format(c.amt)+ChatColor.WHITE+" available in their account!"); - ev.getPlayer().sendMessage(ChatColor.AQUA+"We are sorry about this inconvenience. "+ChatColor.WHITE+"Have a nice day!"); + ev.setCancelled(true); + return; } } else { GenericFunctions.produceError(1,ev.getPlayer()); + ev.setCancelled(true); + return; } } else { ev.getPlayer().sendMessage(ChatColor.YELLOW+"You are not holding a properly signed check!"); + ev.setCancelled(true); + return; } } } @@ -3277,41 +3305,30 @@ public class TwosideKeeper extends JavaPlugin implements Listener { GenericFunctions.addIFrame(ev1.getPlayer(), 10); ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f); final Location newpos=new Location(ev1.getPlayer().getWorld(),xpos,ypos,zpos); - AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(newpos, EntityType.AREA_EFFECT_CLOUD); double dmgdealt=CustomDamage.getBaseWeaponDamage(ev.getItemDrop().getItemStack(), ev1.getPlayer(), null); List monsters = GenericFunctions.getNearbyMobs(newpos, 2); for (int i=0;i64)?64:amt); ev.setCursor(arrow); + return; } } } @@ -3695,7 +3714,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Player p = ((Player)ev.getWhoClicked()); //p.playSound(p.getLocation(), Sound.BLOCK_NOTE_HARP, 0.4f, 0.2f); ev.setCancelled(true); - break; + return; } } } @@ -3777,6 +3796,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Don't allow it. ev.setCancelled(true); ev.setCursor(ev.getCurrentItem()); + return; } else //Make sure we are not already inside the cube we're placing into. @@ -3811,6 +3831,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } CubeType cub = clicked_size==9?CubeType.NORMAL:CubeType.LARGE; itemCube_saveConfig(idnumb,itemslist,cub); + return; } else { //Well, we're already in here, I don't know why they didn't just use the //minecraft inventory management system. Now I have to do math... @@ -3829,6 +3850,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { itemslist.add(ev.getWhoClicked().getOpenInventory().getTopInventory().getItem(i)); } itemCube_saveConfig(idnumb,itemslist); + return; } } } @@ -3861,6 +3883,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Player p = ((Player)ev.getWhoClicked()); //p.playSound(p.getLocation(), Sound.BLOCK_NOTE_HARP, 0.4f, 0.2f); ev.setCancelled(true); + return; } else { Player p = (Player)ev.getWhoClicked(); if (itemcubeid!=-1 && ev.getRawSlot()<=ev.getView().getTopInventory().getSize()-1) { @@ -3890,6 +3913,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { pd.opened_another_cube=false; pd.isViewingItemCube=true; p.playSound(p.getLocation(),Sound.BLOCK_CHEST_OPEN,1.0f,1.0f); + return; } else { ev.setCancelled(true); ev.setResult(Result.DENY); @@ -3900,6 +3924,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { pd.isViewingItemCube=true; pd.opened_another_cube=false; p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f); + return; } } } @@ -3996,6 +4021,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { CustomDamage.trimNonLivingEntities(ev.getEntity().getNearbyEntities(8, 8, 8)).size()>20) { ev.setCancelled(true); log("Denied chicken spawn.",4); + return; } if ((ev.getSpawnReason().equals(SpawnReason.NATURAL) || @@ -4017,12 +4043,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ev.getEntity().remove(); } else { - if (!habitat_data.addNewStartingLocation(ev.getEntity())) { - ev.getEntity().remove(); - ev.setCancelled(true); - } + if (!ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG)) { + if (!habitat_data.addNewStartingLocation(ev.getEntity())) { + ev.getEntity().remove(); + ev.setCancelled(true); + return; + } + } if (!MonsterController.MobHeightControl(ev.getEntity(),false)) { ev.setCancelled(true); + return; //This spawn was not allowed by the mob height controller. } } @@ -4036,6 +4066,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //This is a skeleton horse in the overworld. We are going to disable these for now. Future plans for them... ev.getEntity().remove(); log("Prevented a skeleton horse from spawning at Location "+ev.getLocation().toString()+".",3); + return; } } } @@ -4064,30 +4095,30 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Witch w = (Witch)ps; boolean isPoison=false; int duration=0; - for (int j=0;j affected = ev.getAffectedEntities(); - for (int i=0;i nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3); - for (int i=0;i0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%");} + double lifestealamt = CustomDamage.calculateLifeStealAmount(p,p.getEquipment().getItemInMainHand())*100; + if (all || lifestealamt>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Life Steal: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(lifestealamt)+"%");} + double critchance = (CustomDamage.calculateCriticalStrikeChance(p.getEquipment().getItemInMainHand(), p))*100; + if (all || critchance>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Critical Strike Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(critchance)+"%");} if (PlayerMode.isDefender(p)) { double dodgechance=0.0; if (!p.isBlocking()) { dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d; } - receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Block Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((CustomDamage.CalculateDodgeChance(p)+dodgechance)*100)+"%"); + if (all || dodgechance>0) { + receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Block Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((CustomDamage.CalculateDodgeChance(p)+dodgechance)*100)+"%"); + } } else { - receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Dodge Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((CustomDamage.CalculateDodgeChance(p))*100)+"%"); + double dodgechance = (CustomDamage.CalculateDodgeChance(p))*100; + if (all || dodgechance>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Dodge Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(dodgechance)+"%");} } TextComponent f = new TextComponent(ChatColor.GRAY+""+ChatColor.ITALIC+"Current Mode: "); f.addExtra(GenericFunctions.PlayerModeName(p)); @@ -6809,13 +6780,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } else { receiver.sendMessage(f.toPlainText()); } - TextComponent msg = DisplayPerks(p.getEquipment().getItemInMainHand(),"Weapon",p,0);if (!msg.toPlainText().equalsIgnoreCase("")) { - if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; - msg = DisplayPerks(p.getEquipment().getHelmet(),"Helmet",p,903);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; - msg = DisplayPerks(p.getEquipment().getChestplate(),"Chestplate",p,902);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; - msg = DisplayPerks(p.getEquipment().getLeggings(),"Legging",p,901);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; - msg = DisplayPerks(p.getEquipment().getBoots(),"Boot",p,900);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; - + if (equip || all) { + TextComponent msg = DisplayPerks(p.getEquipment().getItemInMainHand(),"Weapon",p,0);if (!msg.toPlainText().equalsIgnoreCase("")) { + if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; + msg = DisplayPerks(p.getEquipment().getHelmet(),"Helmet",p,903);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; + msg = DisplayPerks(p.getEquipment().getChestplate(),"Chestplate",p,902);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; + msg = DisplayPerks(p.getEquipment().getLeggings(),"Legging",p,901);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; + msg = DisplayPerks(p.getEquipment().getBoots(),"Boot",p,900);if (!msg.toPlainText().equalsIgnoreCase("")) {if (receiver instanceof Player) {((Player)receiver).spigot().sendMessage(msg);} else {receiver.sendMessage(msg.toPlainText());}}; + } if (receiver instanceof Player) { ((Player)receiver).sendMessage("----------"); } else {