From f87f7f6febd1a992d59df80bc2a0b83176ea48fc Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 10 Feb 2012 09:44:17 -0800 Subject: [PATCH] Fixed the instant refresh bug. Fixed blockListener checking skills. --- Changelog.txt | 2 ++ .../java/com/gmail/nossr50/datatypes/AbilityType.java | 2 +- .../java/com/gmail/nossr50/datatypes/PlayerProfile.java | 8 +++----- .../java/com/gmail/nossr50/listeners/mcBlockListener.java | 2 -- src/main/java/com/gmail/nossr50/skills/Skills.java | 6 ++---- src/main/java/com/gmail/nossr50/skills/Unarmed.java | 5 ++++- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 57ce031b8..7d94cbd99 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -5,6 +5,8 @@ Version 2.0-dev - Removed legacy Permission & PEX support. SuperPerms support only now. - Added framework for new Mining sub-skill: Blast Mining. - Made Smooth Brick to Mossy Brick and Dirt to Grass for green thumb configurable (Issue #120) + - Changed mcMMO to save data periodically to optimize performance with FlatFile & MySQL + - Added a configurable save interval for the new save system Version 1.2.10 - Fixed issue with receiving Woodcutting XP for all blocks broken (Issue #103) diff --git a/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java b/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java index 60fa75cbb..c0e1ec5df 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java @@ -8,4 +8,4 @@ GREEN_TERRA, SKULL_SPLIITER, TREE_FELLER, SERRATED_STRIKES; -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index 11e290272..92260792b 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -76,7 +76,7 @@ public class PlayerProfile public PlayerProfile(Player player) { hud = LoadProperties.defaulthud; - //Setup the HashMap for ability ATS & DATS + //Setup the HashMap for ability DATS for(AbilityType abilityType : AbilityType.values()) { skillsDATS.put(abilityType, 0); @@ -822,17 +822,15 @@ public class PlayerProfile { skills.put(skillType, 0); } - public int getSkillDATS(AbilityType abilityType) + public long getSkillDATS(AbilityType abilityType) { + long convertedBack = skillsDATS.get(abilityType) * 1000; return skillsDATS.get(abilityType); } public void setSkillDATS(AbilityType abilityType, long value) { - System.out.println("Storing to DATS: "+value); int wearsOff = (int) (value * .001D); - System.out.println("After dividing by 1000: "+wearsOff); skillsDATS.put(abilityType, wearsOff); - System.out.println("Should be the same as the above value: "+skillsDATS.get(abilityType)); } public void resetCooldowns() { diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index ba26b40f9..9d8d99925 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -297,8 +297,6 @@ public class mcBlockListener implements Listener PlayerProfile PP = Users.getProfile(player); ItemStack inhand = player.getItemInHand(); Block block = event.getBlock(); - - Skills.monitorSkills(player, PP); /* * ABILITY PREPARATION CHECKS diff --git a/src/main/java/com/gmail/nossr50/skills/Skills.java b/src/main/java/com/gmail/nossr50/skills/Skills.java index 60b1790e6..d13095e74 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -95,7 +95,7 @@ public class Skills PP.setSerratedStrikesInformed(true); player.sendMessage(mcLocale.getString("Skills.YourSerratedStrikes")); } - if(!PP.getBerserkInformed() && curTime - (PP.getSkillDATS(AbilityType.BERSERK)*1000) >= (LoadProperties.berserkCooldown * 1000)){ + if(!PP.getBerserkInformed() && (curTime - (PP.getSkillDATS(AbilityType.BERSERK)*1000)) >= (LoadProperties.berserkCooldown * 1000)){ PP.setBerserkInformed(true); player.sendMessage(mcLocale.getString("Skills.YourBerserk")); } @@ -126,9 +126,7 @@ public class Skills PP.setHoePreparationMode(true); } } - public static void monitorSkills(Player player, PlayerProfile PP) { - monitorSkills(player, PP, System.currentTimeMillis()); - } + public static void monitorSkills(Player player, PlayerProfile PP, long curTime){ if(PP.getHoePreparationMode() && curTime - (PP.getHoePreparationATS()*1000) >= 4000){ PP.setHoePreparationMode(false); diff --git a/src/main/java/com/gmail/nossr50/skills/Unarmed.java b/src/main/java/com/gmail/nossr50/skills/Unarmed.java index fbf1d6e6d..f96661aab 100644 --- a/src/main/java/com/gmail/nossr50/skills/Unarmed.java +++ b/src/main/java/com/gmail/nossr50/skills/Unarmed.java @@ -38,9 +38,12 @@ public class Unarmed { { PP.setFistsPreparationMode(false); } + int ticks = 2; int x = PP.getSkillLevel(SkillType.UNARMED); - while(x >= 50){ + + while(x >= 50) + { x-=50; ticks++; }