diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java index 72a6c1dfd..9c3b2c0b0 100644 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ b/mcMMO/com/gmail/nossr50/mcCombat.java @@ -584,33 +584,29 @@ public class mcCombat { if(x instanceof Animals){ Animals animals = (Animals)x; if(animals.getHealth() >= 1){ - animals.setHealth(mcm.getInstance().calculateMinusHealth(animals.getHealth(), 2)); + animals.damage(1); } if(animals.getHealth() <= 0){ - mcm.getInstance().simulateNaturalDrops(x); + animals.damage(1); } } if(x instanceof Monster){ Monster monster = (Monster)x; if(monster.getHealth() >= 1){ - monster.setHealth(mcm.getInstance().calculateMinusHealth(monster.getHealth(), 2)); + monster.damage(1); } if(monster.getHealth() <= 0){ - mcm.getInstance().simulateNaturalDrops(x); + monster.damage(1); } } if(x instanceof Player){ Player player = (Player)x; if(player.getHealth() >= 1 && mcUsers.getProfile(player).getBleedTicks() >= 1){ - player.setHealth(mcm.getInstance().calculateMinusHealth(player.getHealth(), 1)); + player.damage(1); player.sendMessage(ChatColor.RED+"**BLEED**"); if(player.getHealth() <= 0){ - mcUsers.getProfile(player).setBleedTicks(0); - for(ItemStack items : player.getInventory().getContents()){ - if(items.getTypeId() != 0) - player.getLocation().getWorld().dropItemNaturally(player.getLocation(), items); - } + mcUsers.getProfile(player).setBleedTicks(0); } if(mcUsers.getProfile(player).getBleedTicks() >= 1){ mcUsers.getProfile(player).setBleedTicks(mcUsers.getProfile(player).getBleedTicks() - 1); @@ -618,7 +614,7 @@ public class mcCombat { } } } - } + } } diff --git a/mcMMO/com/gmail/nossr50/mcConfig.java b/mcMMO/com/gmail/nossr50/mcConfig.java index c41389d28..4a640c7d6 100644 --- a/mcMMO/com/gmail/nossr50/mcConfig.java +++ b/mcMMO/com/gmail/nossr50/mcConfig.java @@ -27,6 +27,7 @@ public class mcConfig { public void addTreeFeller(Block block) {treeFeller.add(block);} public void addBleedTrack(Entity entity) {bleedTracker.add(entity);} public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);} + public void removeMobSpawnTrack(Entity entity) {mobSpawnTracker.remove(entity);} public ArrayList getBleedTracked() {return bleedTracker;} public void addArrowTrack(Entity entity, Integer arrowcount) {arrowTracker.put(entity, arrowcount);} public Integer getArrowCount(Entity entity) {return arrowTracker.get(entity);} diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java index 546f9a24b..5c86a34dd 100644 --- a/mcMMO/com/gmail/nossr50/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java @@ -125,6 +125,9 @@ public class mcEntityListener extends EntityListener { public void onEntityDeath(EntityDeathEvent event) { Entity x = event.getEntity(); mcSkills.getInstance().arrowRetrievalCheck(x); + if(mcConfig.getInstance().isMobSpawnTracked(x)){ + mcConfig.getInstance().removeMobSpawnTrack(x); + } if(x instanceof Player){ Player player = (Player)x; if(mcUsers.getProfile(player).isDead()){ diff --git a/mcMMO/com/gmail/nossr50/mcSkills.java b/mcMMO/com/gmail/nossr50/mcSkills.java index 8d37ccea6..7191c99ff 100644 --- a/mcMMO/com/gmail/nossr50/mcSkills.java +++ b/mcMMO/com/gmail/nossr50/mcSkills.java @@ -33,6 +33,16 @@ public class mcSkills { } } } + public void decreaseCooldowns(Player player){ + mcUsers.getProfile(player).decreaseTreeFellerCooldown(); + if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ + player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!"); + } + mcUsers.getProfile(player).decreaseSuperBreakerCooldown(); + if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ + player.sendMessage(ChatColor.GREEN+"Your Super Breaker ability is refreshed!"); + } + } public void XpCheck(Player player){ /* * ACROBATICS diff --git a/mcMMO/com/gmail/nossr50/mcTimer.java b/mcMMO/com/gmail/nossr50/mcTimer.java index cda7a1daf..9acf6ff2f 100644 --- a/mcMMO/com/gmail/nossr50/mcTimer.java +++ b/mcMMO/com/gmail/nossr50/mcTimer.java @@ -15,58 +15,37 @@ public class mcTimer extends TimerTask{ public void run() { Player[] playerlist = plugin.getServer().getOnlinePlayers(); - /* - if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){ - for(Player player : playerlist){ - if(player != null && - player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel() >= 1000 - && mcUsers.getProfile(player).getRecentlyHurt() == 0 - && mcPermissions.getInstance().regeneration(player)){ - player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); - } - } - } - if(thecount == 10 || thecount == 20){ - for(Player player : playerlist){ - if(player != null && - player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel() >= 500 - && mcUsers.getProfile(player).getPowerLevel() < 1000 - && mcUsers.getProfile(player).getRecentlyHurt() == 0 - && mcPermissions.getInstance().regeneration(player)){ - player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); - } - } - } - if(thecount == 20){ - for(Player player : playerlist){ - if(player != null && - player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel() < 500 - && mcUsers.getProfile(player).getRecentlyHurt() == 0 - && mcPermissions.getInstance().regeneration(player)){ - player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); - } - } - } for(Player player : playerlist){ - if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){ - mcUsers.getProfile(player).decreaseLastHurt(); + if(mcPermissions.getInstance().regeneration(player)){ + if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){ + if(player != null && + player.getHealth() > 0 && player.getHealth() < 20 + && mcUsers.getProfile(player).getPowerLevel() >= 1000 + && mcUsers.getProfile(player).getRecentlyHurt() == 0){ + player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); + } + } + if(thecount == 10 || thecount == 20){ + if(player != null && + player.getHealth() > 0 && player.getHealth() < 20 + && mcUsers.getProfile(player).getPowerLevel() >= 500 + && mcUsers.getProfile(player).getPowerLevel() < 1000 + && mcUsers.getProfile(player).getRecentlyHurt() == 0){ + player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); + } + } + if(thecount == 20){ + if(player != null && + player.getHealth() > 0 && player.getHealth() < 20 + && mcUsers.getProfile(player).getPowerLevel() < 500 + && mcUsers.getProfile(player).getRecentlyHurt() == 0){ + player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); + } + } + if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){ + mcUsers.getProfile(player).decreaseLastHurt(); + } } - } - if(thecount < 20){ - thecount++; - } else { - thecount = 1; - } - mcCombat.getInstance().bleedSimulate(); - */ - - /* - * COOLDOWN INTERACTIONS - */ - for(Player player : playerlist){ /* * WOODCUTTING ABILITY */ @@ -80,13 +59,6 @@ public class mcTimer extends TimerTask{ player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**"); } } - //Monitor the cooldown - if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){ - mcUsers.getProfile(player).decreaseTreeFellerCooldown(); - if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!"); - } - } } /* * MINING ABILITY @@ -101,14 +73,21 @@ public class mcTimer extends TimerTask{ player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**"); } } - //Monitor the cooldown - if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){ - mcUsers.getProfile(player).decreaseSuperBreakerCooldown(); - if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your Super Breaker ability is refreshed!"); - } - } } + /* + * COOLDOWN MONITORING + */ + if(mcUsers.getProfile(player).hasCooldowns()) + mcSkills.getInstance().decreaseCooldowns(player); } + if(thecount < 20){ + thecount++; + } else { + thecount = 1; + } + /* + * BLEED MONITORING + */ + mcCombat.getInstance().bleedSimulate(); } } diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index 3986e6ece..00274285f 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -433,6 +433,13 @@ class PlayerList public void setBleedTicks(Integer newvalue){ bleedticks = newvalue; } + public Boolean hasCooldowns(){ + if((treefellercooldown + superbreakercooldown) >= 1){ + return true; + } else { + return false; + } + } /* * TREE FELLER STUFF */ diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java index f7fae2717..912bbf9bd 100644 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ b/mcMMO/com/gmail/nossr50/mcWoodCutting.java @@ -87,6 +87,7 @@ public class mcWoodCutting { if(!mcConfig.getInstance().isTreeFellerWatched(x)) mcConfig.getInstance().addTreeFeller(x); } + toAdd.clear(); } public void addBlocksToTreeFelling(ArrayList blocklist, ArrayList toAdd, Integer radius){ int u = 0;