From 24fc12b9c6ba23bed8d865ce828905e96ab96830 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 10 Apr 2011 09:44:57 -0700 Subject: [PATCH] 0.9.21 --- mcMMO/Changelog.txt | 6 + mcMMO/com/gmail/nossr50/mcExcavation.java | 19 +-- mcMMO/com/gmail/nossr50/mcItem.java | 4 +- mcMMO/com/gmail/nossr50/mcMining.java | 19 +-- mcMMO/com/gmail/nossr50/mcPlayerListener.java | 21 +-- mcMMO/com/gmail/nossr50/mcSkills.java | 59 ++------- mcMMO/com/gmail/nossr50/mcWoodCutting.java | 19 +-- mcMMO/com/gmail/nossr50/mcm.java | 122 ++++-------------- mcMMO/plugin.yml | 2 +- 9 files changed, 72 insertions(+), 199 deletions(-) diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 0e361677d..0193cf31c 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,11 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# +Version 0.9.21 +/mcrefresh fixed to work properly with the new ability monitoring system +Ability lengths are now based on your skill level directly rather than a tiered system +Chimaera Wings won't trigger on things they shouldn't (Doors, Chests, ETC) +Chimaera Wings will properly tell you how long you have to wait to use it if you've been recently hurt + Version 0.9.20 Fixed Tree Feller not checking if their cooldown was refreshed and always activating /stats and /whois will now show the powerlevel based on permissions diff --git a/mcMMO/com/gmail/nossr50/mcExcavation.java b/mcMMO/com/gmail/nossr50/mcExcavation.java index e67f85f62..63777308b 100644 --- a/mcMMO/com/gmail/nossr50/mcExcavation.java +++ b/mcMMO/com/gmail/nossr50/mcExcavation.java @@ -30,22 +30,11 @@ public class mcExcavation { mcUsers.getProfile(player).setShovelPreparationMode(false); } int ticks = 2; - if(mcUsers.getProfile(player).getExcavationInt() >= 50) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 750) + int x = mcUsers.getProfile(player).getExcavationInt(); + while(x >= 50){ + x-=50; ticks++; + } if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**"); diff --git a/mcMMO/com/gmail/nossr50/mcItem.java b/mcMMO/com/gmail/nossr50/mcItem.java index 38ed8419e..f08b79d0a 100644 --- a/mcMMO/com/gmail/nossr50/mcItem.java +++ b/mcMMO/com/gmail/nossr50/mcItem.java @@ -28,7 +28,7 @@ public class mcItem { public void chimaerawing(Player player){ ItemStack is = player.getItemInHand(); Block block = player.getLocation().getBlock(); - if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288 && mcm.getInstance().abilityBlockCheck(block)){ + if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){ if(mcUsers.getProfile(player).getRecentlyHurt() == 0 && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){ Block derp = player.getLocation().getBlock(); int y = derp.getY(); @@ -67,7 +67,7 @@ public class mcItem { player.sendMessage("**CHIMAERA WING**"); } else if (mcUsers.getProfile(player).getRecentlyHurt() >= 1 && is.getAmount() >= 10) { player.sendMessage("You were injured recently and must wait to use this." - +ChatColor.YELLOW+" ("+(mcUsers.getProfile(player).getRecentlyHurt() * 2)+"s)"); + +ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, mcUsers.getProfile(player).getRecentlyHurt(), 60)+"s)"); } else if (is.getTypeId() == 288 && is.getAmount() <= 9){ player.sendMessage("You need more of that to use it"); } diff --git a/mcMMO/com/gmail/nossr50/mcMining.java b/mcMMO/com/gmail/nossr50/mcMining.java index b47da5ccc..a15eb9bf9 100644 --- a/mcMMO/com/gmail/nossr50/mcMining.java +++ b/mcMMO/com/gmail/nossr50/mcMining.java @@ -31,22 +31,11 @@ public class mcMining { mcUsers.getProfile(player).setPickaxePreparationMode(false); } int ticks = 2; - if(mcUsers.getProfile(player).getMiningInt() >= 50) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 750) + int x = mcUsers.getProfile(player).getMiningInt(); + while(x >= 50){ + x-=50; ticks++; + } if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**"); diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index c9a0ee993..664a4fbaf 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -110,11 +110,14 @@ public class mcPlayerListener extends PlayerListener { mcHerbalism.getInstance().stewCheck(player, player.getItemInHand()); } } - if(action == Action.RIGHT_CLICK_AIR || action == action.RIGHT_CLICK_BLOCK){ - /* - * ITEM INTERACTIONS - */ + /* + * ITEM CHECKS + */ + if(action == Action.RIGHT_CLICK_AIR) mcItem.getInstance().itemChecks(player); + if(action == Action.RIGHT_CLICK_BLOCK){ + if(mcm.getInstance().abilityBlockCheck(event.getClickedBlock())) + mcItem.getInstance().itemChecks(player); } } public void onPlayerBedEnter(PlayerBedEnterEvent event) { @@ -162,27 +165,27 @@ public class mcPlayerListener extends PlayerListener { * GIGA DRILL BREAKER */ mcUsers.getProfile(player).setGigaDrillBreakerMode(false); - mcUsers.getProfile(player).setGigaDrillBreakerActivatedTimeStamp((long) 0); + mcUsers.getProfile(player).setGigaDrillBreakerDeactivatedTimeStamp((long) 0); /* * SERRATED STRIKE */ mcUsers.getProfile(player).setSerratedStrikesMode(false); - mcUsers.getProfile(player).setSerratedStrikesActivatedTimeStamp((long) 0); + mcUsers.getProfile(player).setSerratedStrikesDeactivatedTimeStamp((long) 0); /* * SUPER BREAKER */ mcUsers.getProfile(player).setSuperBreakerMode(false); - mcUsers.getProfile(player).setSuperBreakerActivatedTimeStamp((long) 0); + mcUsers.getProfile(player).setSuperBreakerDeactivatedTimeStamp((long) 0); /* * TREE FELLER */ mcUsers.getProfile(player).setTreeFellerMode(false); - mcUsers.getProfile(player).setTreeFellerActivatedTimeStamp((long) 0); + mcUsers.getProfile(player).setTreeFellerDeactivatedTimeStamp((long) 0); /* * BERSERK */ mcUsers.getProfile(player).setBerserkMode(false); - mcUsers.getProfile(player).setBerserkActivatedTimeStamp((long)0); + mcUsers.getProfile(player).setBerserkDeactivatedTimeStamp((long)0); player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**"); } diff --git a/mcMMO/com/gmail/nossr50/mcSkills.java b/mcMMO/com/gmail/nossr50/mcSkills.java index c46a89782..f3b6e1d0c 100644 --- a/mcMMO/com/gmail/nossr50/mcSkills.java +++ b/mcMMO/com/gmail/nossr50/mcSkills.java @@ -138,26 +138,15 @@ public class mcSkills { mcUsers.getProfile(player).setSwordsPreparationMode(false); } int ticks = 2; - if(mcUsers.getProfile(player).getSwordsInt() >= 50) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 750) + int x = mcUsers.getProfile(player).getSwordsInt(); + while(x >= 50){ + x-=50; ticks++; + } if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**"); - mcUsers.getProfile(player).setSerratedStrikesTicks(ticks * 1000); + mcUsers.getProfile(player).setSerratedStrikesTicks((ticks * 2) * 1000); mcUsers.getProfile(player).setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis()); mcUsers.getProfile(player).setSerratedStrikesMode(true); } @@ -170,22 +159,11 @@ public class mcSkills { mcUsers.getProfile(player).setFistsPreparationMode(false); } int ticks = 2; - if(mcUsers.getProfile(player).getUnarmedInt() >= 50) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 750) + int x = mcUsers.getProfile(player).getUnarmedInt(); + while(x >= 50){ + x-=50; ticks++; + } if(!mcUsers.getProfile(player).getBerserkMode() && cooldownOver(player, mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**"); @@ -205,22 +183,11 @@ public class mcSkills { PP.setAxePreparationMode(false); } int ticks = 2; - if(PP.getAxesInt() >= 50) - ticks++; - if(PP.getAxesInt() >= 150) - ticks++; - if(PP.getAxesInt() >= 250) - ticks++; - if(PP.getAxesInt() >= 350) - ticks++; - if(PP.getAxesInt() >= 450) - ticks++; - if(PP.getAxesInt() >= 550) - ticks++; - if(PP.getAxesInt() >= 650) - ticks++; - if(PP.getAxesInt() >= 750) + int x = mcUsers.getProfile(player).getAxesInt(); + while(x >= 50){ + x-=50; ticks++; + } if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){ player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**"); diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java index f6b37fe78..b695b5d7e 100644 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ b/mcMMO/com/gmail/nossr50/mcWoodCutting.java @@ -50,22 +50,11 @@ public class mcWoodCutting { PP.setAxePreparationMode(false); } int ticks = 2; - if(PP.getWoodCuttingInt() >= 50) - ticks++; - if(PP.getWoodCuttingInt() >= 150) - ticks++; - if(PP.getWoodCuttingInt() >= 250) - ticks++; - if(PP.getWoodCuttingInt() >= 350) - ticks++; - if(PP.getWoodCuttingInt() >= 450) - ticks++; - if(PP.getWoodCuttingInt() >= 550) - ticks++; - if(PP.getWoodCuttingInt() >= 650) - ticks++; - if(PP.getWoodCuttingInt() >= 750) + int x = mcUsers.getProfile(player).getWoodCuttingInt(); + while(x >= 50){ + x-=50; ticks++; + } if(!PP.getTreeFellerMode() && mcSkills.getInstance().cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){ player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**"); diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index 2ac8afca2..a8f581620 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -281,23 +281,11 @@ public class mcm { event.setCancelled(true); float skillvalue = (float)mcUsers.getProfile(player).getWoodCuttingInt(); int ticks = 2; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50) + int x = mcUsers.getProfile(player).getWoodCuttingInt(); + while(x >= 50){ + x-=50; ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750) - ticks++; - ticks = ticks * 2; + } String percentage = String.valueOf((skillvalue / 1000) * 100); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Chopping down trees"); @@ -365,23 +353,12 @@ public class mcm { percentage = "75"; } int ticks = 2; - if(mcUsers.getProfile(player).getAxesInt() >= 50) + int x = mcUsers.getProfile(player).getAxesInt(); + while(x >= 50){ + x-=50; ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 750) - ticks++; - ticks = ticks * 2; + } + player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"AXES"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); @@ -423,23 +400,12 @@ public class mcm { } int ticks = 2; - if(mcUsers.getProfile(player).getSwordsInt() >= 50) + int x = mcUsers.getProfile(player).getSwordsInt(); + while(x >= 50){ + x-=50; ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getSwordsInt() >= 750) - ticks++; - ticks = ticks * 2; + } + player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"SWORDS"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); @@ -483,23 +449,11 @@ public class mcm { float skillvalue = (float)mcUsers.getProfile(player).getMiningInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); int ticks = 2; - if(mcUsers.getProfile(player).getMiningInt() >= 50) + int x = mcUsers.getProfile(player).getMiningInt(); + while(x >= 50){ + x-=50; ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 750) - ticks++; - ticks = ticks * 2; + } event.setCancelled(true); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"MINING"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Mining Stone & Ore"); @@ -545,23 +499,11 @@ public class mcm { int ticks = 2; - if(mcUsers.getProfile(player).getUnarmedInt() >= 50) + int x = mcUsers.getProfile(player).getUnarmedInt(); + while(x >= 50){ + x-=50; ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getUnarmedInt() >= 750) - ticks++; - ticks = ticks * 2; + } player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"UNARMED"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); @@ -617,23 +559,11 @@ public class mcm { if(split[0].equalsIgnoreCase("/excavation")){ event.setCancelled(true); int ticks = 2; - if(mcUsers.getProfile(player).getExcavationInt() >= 50) + int x = mcUsers.getProfile(player).getExcavationInt(); + while(x >= 50){ + x-=50; ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 150) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 250) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 350) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 450) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 550) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 650) - ticks++; - if(mcUsers.getProfile(player).getExcavationInt() >= 750) - ticks++; - ticks = ticks * 2; + } player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"EXCAVATION"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Digging and finding treasures"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index d224feb4b..ac8fad4c6 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.9.20 \ No newline at end of file +version: 0.9.21 \ No newline at end of file