diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 86b3571..6a0bb76 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -885,7 +885,7 @@ public class Main extends JavaPlugin Hunter_job.addData("WITHER", 550.00, 7800, 1); Hunter_job.setBuffData("Damage dealt increased by 4.", "Sneaking gives you invisibility. Anything targeting you loses aggro.", - "Swords inflict Poison II on mobs. Movement speed increased by 20%.", + "Swords inflict Poison II on mobs for 6 seconds. Movement speed increased by 20%.", "Each time you get hit, the next hit has a 10% increased stacking chance of blocking for 10 seconds. Hitting an enemy removes this buff.", "Attacks deal an additional 10 armor penetration damage.", "Damage dealt increased by 4, damage taken decreased by 30%, at night you are invisible. Health increased by 20."); @@ -1847,14 +1847,6 @@ public void runTick() { } } } - if (nearby.get(i) instanceof Monster) { - Monster m = (Monster)nearby.get(i); - if (m.getTarget() instanceof Player) { - if (hasJobBuff("Hunter",(Player)(m.getTarget()),Job.JOB10) && ((Player)(m.getTarget())).hasPotionEffect(PotionEffectType.INVISIBILITY)) { - m.setTarget(null); - } - } - } } } } @@ -2570,6 +2562,14 @@ public void checkJukeboxes() { LOGGING_UPDATE_COUNTS++; //2 Player[] list = Bukkit.getOnlinePlayers(); for (int i=0;i13000) { + list[i].addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY,199,1)); + } + } + if (hasJobBuff("Hunter", list[i], Job.JOB30A)) { + getPlayerData(list[i]).blockstack=0; + } if (list[i].getAllowFlight() && hasJobBuff("Builder", list[i], Job.JOB40) && SERVER_TICK_TIME-getPlayerData(list[i]).lastflighttime>=200) { list[i].setAllowFlight(false); list[i].sendMessage(ChatColor.DARK_RED+""+ChatColor.ITALIC+"Flight disabled..."); diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java index cc0906a..0483dc8 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java @@ -8,6 +8,8 @@ import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.List; +import me.kaZep.Commands.JobsDataInfo.Job; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -29,6 +31,7 @@ public class PlayerBuffData { double extra_hp=0; double money_gained=0; long last_money_report_time=0; + long last_sneak_time=0; public Main plugin; public String toString() { @@ -156,6 +159,9 @@ public class PlayerBuffData { if (!p.isDead()) { //Don't even try to set things if we're dead. base_hplv=20; base_hplv+=hpbufflist.size()*10; + if (this.plugin.hasJobBuff("Hunter", p, Job.JOB40)) { + base_hplv+=20; + } if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat8")>0) { base_hplv+=this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat8")/2); } diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerData.java index 19216bb..400e5dc 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerData.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerData.java @@ -10,16 +10,20 @@ public class PlayerData { Material lastblocktype=null; long lastinteracttime=0; long lastminetime=0; + long lastsneaktime=0; int minestreak=0; + int blockstack=0; //The amount of times you've gotten hit (The amount of "blocking" stacks you now have) + int fishingrodfails=0; //The amount of times in a row you've failed to catch fish. + long fishingroduse=0; //The last time you threw the fishing rod in the water. Location clickedblock1=null; //Stores the location of a clicked block. Player data=null; long lastflighttime=0; public PlayerData(Player p) { this.data=p; this.lastblocktype=Material.DIRT; - lastinteracttime=Main.SERVER_TICK_TIME; - lastminetime=Main.SERVER_TICK_TIME; - lastflighttime=Main.SERVER_TICK_TIME; + lastinteracttime= + lastminetime= + lastflighttime=Main.SERVER_TICK_TIME; minestreak=0; } public boolean CheckMineStreak() { diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 7fd343b..369e3fb 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -97,6 +97,8 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.ItemSpawnEvent; @@ -1325,14 +1327,43 @@ implements Listener return; } + @EventHandler + public void onEnemyTarget(EntityTargetLivingEntityEvent e) { + if (e.getTarget() instanceof Player) { + Player p = (Player)e.getTarget(); + if (Main.SERVER_TICK_TIME-this.plugin.getPlayerData(((Player)(e.getTarget()))).lastsneaktime<=60) { + //Disallow it, since they are sneaking. + e.setCancelled(true); + } + } + } + @EventHandler public void onPlayerSneak(PlayerToggleSneakEvent e) { if (e.isSneaking()) { - if (this.plugin.PlayerinJob(e.getPlayer(),"Hunter") && this.plugin.getJobLv("Hunter", e.getPlayer())>=10) { + if (this.plugin.hasJobBuff("Hunter", e.getPlayer(), Job.JOB10)) { e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 0, true)); + if (Main.SERVER_TICK_TIME-this.plugin.getPlayerData(e.getPlayer()).lastsneaktime>60) { + this.plugin.getPlayerData(e.getPlayer()).lastsneaktime=Main.SERVER_TICK_TIME; + Player p = e.getPlayer(); + List nearby = p.getNearbyEntities(20, 12, 20); + //List nearby2 = p.getNearbyEntities(10, 6, 10); + for (int i=0;i=10) { + if (this.plugin.hasJobBuff("Hunter", e.getPlayer(), Job.JOB10)) { if (e.getPlayer().hasPotionEffect(PotionEffectType.INVISIBILITY)) { try { Collection effects = e.getPlayer().getActivePotionEffects(); @@ -1499,9 +1530,9 @@ implements Listener p.updateInventory(); if (this.plugin.PlayerinJob(p, "Explorer") && this.plugin.getJobLv("Explorer", p)>=5) { //p.sendMessage("Explorer speed buff set."); - newplayer.setBaseSpd(1); + newplayer.setBaseSpd(newplayer.base_spdlv+1); } - if (this.plugin.PlayerinJob(p, "Hunter") && this.plugin.getJobLv("Hunter", p)>=20) { + if (this.plugin.hasJobBuff("Hunter", p, Job.JOB20)) { //p.sendMessage("Explorer speed buff set."); newplayer.setBaseSpd(newplayer.base_spdlv+1); } @@ -7136,7 +7167,7 @@ implements Listener Player p = e.getPlayer(); if (this.plugin.PlayerinJob(p, "Fisherman")) { this.plugin.gainMoneyExp(p,"Fisherman",0.175,3); - if (this.plugin.getJobLv("Fisherman", p)>=5) { + if (this.plugin.hasJobBuff("Fisherman", p, Job.JOB5)) { //Half chance to set the durability back by one. if (p.getItemInHand().getType()==Material.FISHING_ROD) { if (p.getItemInHand().getDurability()>0) { @@ -7146,7 +7177,7 @@ implements Listener } } } - if (this.plugin.getJobLv("Fisherman", p)>=20) { + if (this.plugin.hasJobBuff("Fisherman", p, Job.JOB20)) { e.setExpToDrop(e.getExpToDrop()*2); int i=4; while (i>0) { @@ -7553,6 +7584,9 @@ implements Listener final EntityDamageEvent f = e; if (e.getEntity().getType()==EntityType.PLAYER) { final Player p = (Player)e.getEntity(); + if (this.plugin.hasJobBuff("Hunter", p, Job.JOB40)) { + e.setDamage(e.getDamage()*0.70d); + } if (e.getCause()==DamageCause.ENTITY_EXPLOSION || e.getCause()==DamageCause.BLOCK_EXPLOSION) { e.setDamage(e.getDamage()*2); } @@ -8014,6 +8048,9 @@ implements Listener }*/ if (e.getEntity().getType()==EntityType.PLAYER) { final Player p = (Player)e.getEntity(); + if (p.getNoDamageTicks() nearby = p.getNearbyEntities(10, 10, 10); for (int i=0;i=20) { @@ -8089,6 +8126,9 @@ implements Listener Listblocks = new ArrayList(); //Corresponds to helmet, chestplate, leggings, and boots. //Found the slot. Check armor values. double block_chance=0,speed_boost_chance=0; + if (this.plugin.hasJobBuff("Hunter", p, Job.JOB30A)) { + block_chance+=(double)10*this.plugin.getPlayerData(p).blockstack; + } if (p.getEquipment().getBoots()!=null) { ItemStack item = p.getEquipment().getBoots(); if (this.plugin.isBroken(item)) { @@ -8451,20 +8491,22 @@ implements Listener if (Math.random()<=block_chance/100.0d) { e.setDamage(0); //Choose a random set to mark off. - int armor = blocks.get((int)(Math.random()*blocks.size())); - switch (armor) { - case 0:{ - p.getInventory().getHelmet().setDurability((short)(p.getInventory().getHelmet().getDurability()+1)); - }break; - case 1:{ - p.getInventory().getChestplate().setDurability((short)(p.getInventory().getChestplate().getDurability()+1)); - }break; - case 2:{ - p.getInventory().getLeggings().setDurability((short)(p.getInventory().getLeggings().getDurability()+1)); - }break; - case 3:{ - p.getInventory().getBoots().setDurability((short)(p.getInventory().getBoots().getDurability()+1)); - }break; + if (blocks.size()>0) { + int armor = blocks.get((int)(Math.random()*blocks.size())); + switch (armor) { + case 0:{ + p.getInventory().getHelmet().setDurability((short)(p.getInventory().getHelmet().getDurability()+1)); + }break; + case 1:{ + p.getInventory().getChestplate().setDurability((short)(p.getInventory().getChestplate().getDurability()+1)); + }break; + case 2:{ + p.getInventory().getLeggings().setDurability((short)(p.getInventory().getLeggings().getDurability()+1)); + }break; + case 3:{ + p.getInventory().getBoots().setDurability((short)(p.getInventory().getBoots().getDurability()+1)); + }break; + } } e.setCancelled(true); } @@ -8784,6 +8826,40 @@ implements Listener } } final Player p = (Player) e.getDamager(); + if (e.getEntity() instanceof Monster) { + Monster m = (Monster)e.getEntity(); + /*if (m.hasPotionEffect(PotionEffectType.SLOW) && Main.SERVER_TICK_TIME-this.plugin.getPlayerData(p).lastsneaktime<=60) { + m.removePotionEffect(PotionEffectType.SLOW); + }*/ + try { + Iterator effects = m.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + //Bukkit.getLogger().info("Effect Type is "+nexteffect.getType().getName()+", amplifier is "+nexteffect.getAmplifier()+", duration is "+nexteffect.getDuration()); + if (nexteffect.getType().getName().compareTo(PotionEffectType.SLOW.getName())==0 && nexteffect.getAmplifier()==6 && nexteffect.getDuration()<=60) { + m.removePotionEffect(PotionEffectType.SLOW); + //Bukkit.getLogger().info("Removed slow."); + //p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 200, nexteffect.getAmplifier()+1, true)); + break; + } + /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { + p.removePotionEffect(PotionEffectType.JUMP); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); + }*/ + effects.remove(); + } + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to remove slow debuff."); + } + } + if (this.plugin.hasJobBuff("Hunter", p, Job.JOB20) && p.getItemInHand().getType().name().toLowerCase().contains("sword")) { + if (e.getEntity() instanceof Monster) { + Monster m = (Monster)e.getEntity(); + m.addPotionEffect(new PotionEffect(PotionEffectType.POISON,120,1)); + } + } + this.plugin.getPlayerData(p).lastsneaktime=0; if (p.getItemInHand().hasItemMeta() && p.getItemInHand().getItemMeta().getDisplayName()!=null && p.getItemInHand().getItemMeta().getDisplayName().contains(ChatColor.DARK_GRAY+"[BROKEN]")) { e.setDamage(0); e.setCancelled(true); @@ -8792,6 +8868,9 @@ implements Listener //p.sendMessage("No Damage Ticks: "+f.getNoDamageTicks()); ItemStack item = p.getItemInHand(); double critical_chance=0,armor_pen=0,life_steal=0,attack_speed=0,dmg=0,armor_pen_dmg=0; + if (this.plugin.hasJobBuff("Hunter", p, Job.JOB30B)) { + armor_pen+=10; + } if (item.getType()!=Material.BOW && item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { //Make sure this isn't a ranged weapon. for (int i=0;i0) { @@ -8898,7 +8981,7 @@ implements Listener //This means piercing would do extra damage. Just subtract throughdmg. if (f.getHealth()-throughdmg>0) { f.setHealth(f.getHealth()-throughdmg); - armor_pen_dmg=throughdmg; + //armor_pen_dmg=throughdmg; if (f!=null) { if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) { if (f.getCustomName()!=null) { @@ -8941,9 +9024,13 @@ implements Listener } else { if (((Projectile)e.getDamager()).getShooter()!=null && ((Projectile)e.getDamager()).getShooter().getType()==EntityType.PLAYER) { final Player p = (Player)((Projectile)e.getDamager()).getShooter(); + this.plugin.getPlayerData(p).lastsneaktime=0; 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; + if (this.plugin.hasJobBuff("Hunter", p, Job.JOB30B)) { + armor_pen+=10; + } if (item.getType()==Material.BOW && item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { //Make sure we are using a ranged weapon. for (int i=0;i0) { @@ -9068,7 +9159,7 @@ implements Listener //This means piercing would do extra damage. Just subtract throughdmg. if (f.getHealth()-throughdmg>0) { f.setHealth(f.getHealth()-throughdmg); - armor_pen_dmg=throughdmg; + ////armor_pen_dmg=throughdmg; if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) { if (f.getCustomName()!=null) { //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+".");