Merge pull request #143 from nossr50/master

Shrinking PlayerProfile, fixed a small bug as well.
This commit is contained in:
Grant 2012-02-09 11:16:14 -08:00
commit 4fdbce24d7
11 changed files with 123 additions and 164 deletions

View File

@ -54,37 +54,16 @@ public class McrefreshCommand implements CommandExecutor {
PP.setFistsPreparationMode(false); PP.setFistsPreparationMode(false);
PP.setSwordsPreparationMode(false); PP.setSwordsPreparationMode(false);
PP.setPickaxePreparationMode(false); PP.setPickaxePreparationMode(false);
/*
* GREEN TERRA
*/
PP.setGreenTerraMode(false);
PP.setGreenTerraDeactivatedTimeStamp((long) 0);
/*
* GIGA DRILL BREAKER //RESET COOLDOWNS
*/ PP.resetCooldowns();
PP.setGreenTerraMode(false);
PP.setGigaDrillBreakerMode(false); PP.setGigaDrillBreakerMode(false);
PP.setGigaDrillBreakerDeactivatedTimeStamp((long) 0);
/*
* SERRATED STRIKE
*/
PP.setSerratedStrikesMode(false); PP.setSerratedStrikesMode(false);
PP.setSerratedStrikesDeactivatedTimeStamp((long) 0);
/*
* SUPER BREAKER
*/
PP.setSuperBreakerMode(false); PP.setSuperBreakerMode(false);
PP.setSuperBreakerDeactivatedTimeStamp((long) 0);
/*
* TREE FELLER
*/
PP.setTreeFellerMode(false); PP.setTreeFellerMode(false);
PP.setTreeFellerDeactivatedTimeStamp((long) 0);
/*
* BERSERK
*/
PP.setBerserkMode(false); PP.setBerserkMode(false);
PP.setBerserkDeactivatedTimeStamp((long) 0);
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed")); player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed"));

View File

@ -0,0 +1,11 @@
package com.gmail.nossr50.datatypes;
public enum AbilityType {
BERSERK,
SUPER_BREAKER,
GIGA_DRILL_BREAKER,
GREEN_TERRA,
SKULL_SPLIITER,
TREE_FELLER,
SERRATED_STRIKES;
}

View File

@ -57,9 +57,7 @@ public class PlayerProfile
//TIMESTAMPS //TIMESTAMPS
//ATS = (Time of) Activation Time Stamp //ATS = (Time of) Activation Time Stamp
//DATS = (Time of) Deactivation Time Stamp //DATS = (Time of) Deactivation Time Stamp
private int xpGainATS = 0, recentlyHurt = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0, private int xpGainATS = 0, recentlyHurt = 0, mySpawnATS, respawnATS, hoePreparationATS, shovelPreparationATS, swordsPreparationATS, fistsPreparationATS, axePreparationATS, pickaxePreparationATS;
respawnATS = 0, mySpawnATS = 0, greenTerraATS = 0, greenTerraDATS = 0, superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0,
skullSplitterATS = 0, skullSplitterDATS = 0, hoePreparationATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0;
private SkillType lastgained = null, skillLock = null; private SkillType lastgained = null, skillLock = null;
@ -71,6 +69,8 @@ public class PlayerProfile
//Time to HashMap this shiz //Time to HashMap this shiz
HashMap<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); //Skills and XP HashMap<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); //Skills and XP
HashMap<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); //Skills and XP HashMap<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); //Skills and XP
HashMap<AbilityType, Integer> skillsATS = new HashMap<AbilityType, Integer>(); //Skill ATS
HashMap<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); //Skill ATS
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
@ -151,13 +151,13 @@ public class PlayerProfile
} }
else else
{ {
superBreakerDATS = Integer.valueOf(cooldowns.get(1).get(0)); skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(cooldowns.get(1).get(0)));
treeFellerDATS = Integer.valueOf(cooldowns.get(1).get(1)); skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(cooldowns.get(1).get(1)));
berserkDATS = Integer.valueOf(cooldowns.get(1).get(2)); skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(cooldowns.get(1).get(2)));
greenTerraDATS = Integer.valueOf(cooldowns.get(1).get(3)); skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldowns.get(1).get(3)));
gigaDrillBreakerDATS = Integer.valueOf(cooldowns.get(1).get(4)); skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldowns.get(1).get(4)));
serratedStrikesDATS = Integer.valueOf(cooldowns.get(1).get(5)); skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldowns.get(1).get(5)));
skullSplitterDATS = Integer.valueOf(cooldowns.get(1).get(6)); skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldowns.get(1).get(6)));
} }
HashMap<Integer, ArrayList<String>> stats = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id); HashMap<Integer, ArrayList<String>> stats = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id);
skills.put(SkillType.TAMING, Integer.valueOf(stats.get(1).get(0))); skills.put(SkillType.TAMING, Integer.valueOf(stats.get(1).get(0)));
@ -271,19 +271,19 @@ public class PlayerProfile
if(character.length > 25 && m.isInt(character[25])) if(character.length > 25 && m.isInt(character[25]))
skillsXp.put(SkillType.TAMING, Integer.valueOf(character[25])); skillsXp.put(SkillType.TAMING, Integer.valueOf(character[25]));
if(character.length > 26) if(character.length > 26)
berserkDATS = Integer.valueOf(character[26]); skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(character[26]));
if(character.length > 27) if(character.length > 27)
gigaDrillBreakerDATS = Integer.valueOf(character[27]); skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(character[27]));
if(character.length > 28) if(character.length > 28)
treeFellerDATS = Integer.valueOf(character[28]); skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(character[28]));
if(character.length > 29) if(character.length > 29)
greenTerraDATS = Integer.valueOf(character[29]); skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(character[29]));
if(character.length > 30) if(character.length > 30)
serratedStrikesDATS = Integer.valueOf(character[30]); skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(character[30]));
if(character.length > 31) if(character.length > 31)
skullSplitterDATS = Integer.valueOf(character[31]); skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(character[31]));
if(character.length > 32) if(character.length > 32)
superBreakerDATS = Integer.valueOf(character[32]); skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[32]));
if(character.length > 33) if(character.length > 33)
{ {
for(HUDType x : HUDType.values()) for(HUDType x : HUDType.values())
@ -321,13 +321,13 @@ public class PlayerProfile
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET " mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET "
+" mining = "+(superBreakerDATS) +" mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER)
+", woodcutting = "+(treeFellerDATS) +", woodcutting = " + skillsDATS.get(AbilityType.TREE_FELLER)
+", unarmed = "+(berserkDATS) +", unarmed = " + skillsDATS.get(AbilityType.BERSERK)
+", herbalism = "+(greenTerraDATS) +", herbalism = " + skillsDATS.get(AbilityType.GREEN_TERRA)
+", excavation = "+(gigaDrillBreakerDATS) +", excavation = " + skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER)
+", swords = " +(serratedStrikesDATS) +", swords = " + skillsDATS.get(AbilityType.SERRATED_STRIKES)
+", axes = "+(skullSplitterDATS) +", axes = " + skillsDATS.get(AbilityType.SKULL_SPLIITER)
+" WHERE user_id = "+this.userid); +" WHERE user_id = "+this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET " mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET "
+" taming = "+skills.get(SkillType.TAMING) +" taming = "+skills.get(SkillType.TAMING)
@ -406,13 +406,13 @@ public class PlayerProfile
writer.append(skillsXp.get(SkillType.TAMING) + ":"); writer.append(skillsXp.get(SkillType.TAMING) + ":");
//Need to store the DATS of abilities nao //Need to store the DATS of abilities nao
//Berserk, Gigadrillbreaker, Tree Feller, Green Terra, Serrated Strikes, Skull Splitter, Super Breaker //Berserk, Gigadrillbreaker, Tree Feller, Green Terra, Serrated Strikes, Skull Splitter, Super Breaker
writer.append(String.valueOf(berserkDATS)+":"); writer.append(String.valueOf(skillsDATS.get(AbilityType.BERSERK))+":");
writer.append(String.valueOf(gigaDrillBreakerDATS)+":"); writer.append(String.valueOf(skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER))+":");
writer.append(String.valueOf(treeFellerDATS)+":"); writer.append(String.valueOf(skillsDATS.get(AbilityType.TREE_FELLER))+":");
writer.append(String.valueOf(greenTerraDATS)+":"); writer.append(String.valueOf(skillsDATS.get(AbilityType.GREEN_TERRA))+":");
writer.append(String.valueOf(serratedStrikesDATS)+":"); writer.append(String.valueOf(skillsDATS.get(AbilityType.SERRATED_STRIKES))+":");
writer.append(String.valueOf(skullSplitterDATS)+":"); writer.append(String.valueOf(skillsDATS.get(AbilityType.SKULL_SPLIITER))+":");
writer.append(String.valueOf(superBreakerDATS)+":"); writer.append(String.valueOf(skillsDATS.get(AbilityType.SUPER_BREAKER))+":");
writer.append(hud.toString()+":"); writer.append(hud.toString()+":");
writer.append(skills.get(SkillType.FISHING) + ":"); writer.append(skills.get(SkillType.FISHING) + ":");
writer.append(skillsXp.get(SkillType.FISHING) + ":"); writer.append(skillsXp.get(SkillType.FISHING) + ":");
@ -716,14 +716,7 @@ public class PlayerProfile
public void setGreenTerraMode(Boolean bool){ public void setGreenTerraMode(Boolean bool){
greenTerraMode = bool; greenTerraMode = bool;
} }
public long getGreenTerraActivatedTimeStamp() {return greenTerraATS;}
public void setGreenTerraActivatedTimeStamp(Long newvalue){
greenTerraATS = (int) (newvalue/1000);
}
public long getGreenTerraDeactivatedTimeStamp() {return greenTerraDATS;}
public void setGreenTerraDeactivatedTimeStamp(Long newvalue){
greenTerraDATS = (int) (newvalue/1000);
}
/* /*
* BERSERK MODE * BERSERK MODE
*/ */
@ -737,14 +730,6 @@ public class PlayerProfile
public void setBerserkMode(Boolean bool){ public void setBerserkMode(Boolean bool){
berserkMode = bool; berserkMode = bool;
} }
public long getBerserkActivatedTimeStamp() {return berserkATS;}
public void setBerserkActivatedTimeStamp(Long newvalue){
berserkATS = (int) (newvalue/1000);
}
public long getBerserkDeactivatedTimeStamp() {return berserkDATS;}
public void setBerserkDeactivatedTimeStamp(Long newvalue){
berserkDATS = (int) (newvalue/1000);
}
/* /*
* SKULL SPLITTER * SKULL SPLITTER
*/ */
@ -758,14 +743,6 @@ public class PlayerProfile
public void setSkullSplitterMode(Boolean bool){ public void setSkullSplitterMode(Boolean bool){
skullSplitterMode = bool; skullSplitterMode = bool;
} }
public long getSkullSplitterActivatedTimeStamp() {return skullSplitterATS;}
public void setSkullSplitterActivatedTimeStamp(Long newvalue){
skullSplitterATS = (int) (newvalue/1000);
}
public long getSkullSplitterDeactivatedTimeStamp() {return skullSplitterDATS;}
public void setSkullSplitterDeactivatedTimeStamp(Long newvalue){
skullSplitterDATS = (int) (newvalue/1000);
}
/* /*
* SERRATED STRIKES * SERRATED STRIKES
*/ */
@ -779,14 +756,6 @@ public class PlayerProfile
public void setSerratedStrikesMode(Boolean bool){ public void setSerratedStrikesMode(Boolean bool){
serratedStrikesMode = bool; serratedStrikesMode = bool;
} }
public long getSerratedStrikesActivatedTimeStamp() {return serratedStrikesATS;}
public void setSerratedStrikesActivatedTimeStamp(Long newvalue){
serratedStrikesATS = (int) (newvalue/1000);
}
public long getSerratedStrikesDeactivatedTimeStamp() {return serratedStrikesDATS;}
public void setSerratedStrikesDeactivatedTimeStamp(Long newvalue){
serratedStrikesDATS = (int) (newvalue/1000);
}
/* /*
* GIGA DRILL BREAKER * GIGA DRILL BREAKER
*/ */
@ -800,14 +769,6 @@ public class PlayerProfile
public void setGigaDrillBreakerMode(Boolean bool){ public void setGigaDrillBreakerMode(Boolean bool){
gigaDrillBreakerMode = bool; gigaDrillBreakerMode = bool;
} }
public long getGigaDrillBreakerActivatedTimeStamp() {return gigaDrillBreakerATS;}
public void setGigaDrillBreakerActivatedTimeStamp(Long newvalue){
gigaDrillBreakerATS = (int) (newvalue/1000);
}
public long getGigaDrillBreakerDeactivatedTimeStamp() {return gigaDrillBreakerDATS;}
public void setGigaDrillBreakerDeactivatedTimeStamp(Long newvalue){
gigaDrillBreakerDATS = (int) (newvalue/1000);
}
/* /*
* TREE FELLER STUFF * TREE FELLER STUFF
*/ */
@ -821,14 +782,6 @@ public class PlayerProfile
public void setTreeFellerMode(Boolean bool){ public void setTreeFellerMode(Boolean bool){
treeFellerMode = bool; treeFellerMode = bool;
} }
public long getTreeFellerActivatedTimeStamp() {return treeFellerATS;}
public void setTreeFellerActivatedTimeStamp(Long newvalue){
treeFellerATS = (int) (newvalue/1000);
}
public long getTreeFellerDeactivatedTimeStamp() {return treeFellerDATS;}
public void setTreeFellerDeactivatedTimeStamp(Long newvalue){
treeFellerDATS = (int) (newvalue/1000);
}
/* /*
* MINING * MINING
*/ */
@ -842,14 +795,6 @@ public class PlayerProfile
public void setSuperBreakerMode(Boolean bool){ public void setSuperBreakerMode(Boolean bool){
superBreakerMode = bool; superBreakerMode = bool;
} }
public long getSuperBreakerActivatedTimeStamp() {return superBreakerATS;}
public void setSuperBreakerActivatedTimeStamp(Long newvalue){
superBreakerATS = (int) (newvalue/1000);
}
public long getSuperBreakerDeactivatedTimeStamp() {return superBreakerDATS;}
public void setSuperBreakerDeactivatedTimeStamp(Long newvalue){
superBreakerDATS = (int) (newvalue/1000);
}
public long getRecentlyHurt(){ public long getRecentlyHurt(){
return recentlyHurt; return recentlyHurt;
} }
@ -872,7 +817,30 @@ public class PlayerProfile
{ {
skills.put(skillType, 0); skills.put(skillType, 0);
} }
public int getSkillATS(AbilityType abilityType)
{
return skillsATS.get(abilityType);
}
public void setSkillATS(AbilityType abilityType, int ticks)
{
skillsATS.put(abilityType, (int) System.currentTimeMillis()/1000);
setSkillDATS(abilityType, ticks);
}
public int getSkillDATS(AbilityType abilityType)
{
return skillsDATS.get(abilityType);
}
private void setSkillDATS(AbilityType abilityType, int ticks)
{
skillsDATS.put(abilityType, (int) (System.currentTimeMillis() + (ticks * 1000))/1000);
}
public void resetCooldowns()
{
for(AbilityType x : skillsDATS.keySet())
{
skillsDATS.put(x, 0);
}
}
/** /**
* Adds XP to the player, this ignores skill modifiers * Adds XP to the player, this ignores skill modifiers
* @param skillType The skill to add XP to * @param skillType The skill to add XP to

View File

@ -30,6 +30,7 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
@ -52,20 +53,19 @@ public class Axes {
ticks++; ticks++;
} }
if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)) if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn")); player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn"));
for(Player y : player.getWorld().getPlayers()){ for(Player y : player.getWorld().getPlayers()){
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SkullSplitterPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.SkullSplitterPlayer", new Object[] {player.getName()}));
} }
PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis()); PP.setSkillATS(AbilityType.SKULL_SPLIITER, ticks);
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkullSplitterMode(true); PP.setSkullSplitterMode(true);
} }
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)){ if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)){
player.sendMessage(mcLocale.getString("Skills.TooTired") player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)+"s)"); +ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)+"s)");
} }
} }
} }

View File

@ -32,6 +32,7 @@ import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import org.getspout.spoutapi.sound.SoundEffect; import org.getspout.spoutapi.sound.SoundEffect;
@ -60,7 +61,7 @@ public class Excavation
ticks++; ticks++;
} }
if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerDeactivatedTimeStamp() < System.currentTimeMillis()) if(!PP.getGigaDrillBreakerMode() && PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) < System.currentTimeMillis())
{ {
player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOn")); player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOn"));
for(Player y : player.getWorld().getPlayers()) for(Player y : player.getWorld().getPlayers())
@ -68,8 +69,7 @@ public class Excavation
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerPlayer", new Object[] {player.getName()}));
} }
PP.setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis()); PP.setSkillATS(AbilityType.GIGA_DRILL_BREAKER, ticks);
PP.setGigaDrillBreakerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setGigaDrillBreakerMode(true); PP.setGigaDrillBreakerMode(true);
} }

View File

@ -27,6 +27,7 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
@ -57,7 +58,7 @@ public class Herbalism
ticks++; ticks++;
} }
if(!PP.getGreenTerraMode() && Skills.cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), LoadProperties.greenTerraCooldown)) if(!PP.getGreenTerraMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.GREEN_TERRA), LoadProperties.greenTerraCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.GreenTerraOn")); player.sendMessage(mcLocale.getString("Skills.GreenTerraOn"));
for(Player y : player.getWorld().getPlayers()) for(Player y : player.getWorld().getPlayers())
@ -65,8 +66,7 @@ public class Herbalism
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.GreenTerraPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.GreenTerraPlayer", new Object[] {player.getName()}));
} }
PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis()); PP.setSkillATS(AbilityType.GREEN_TERRA, ticks);
PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setGreenTerraMode(true); PP.setGreenTerraMode(true);
} }

View File

@ -31,6 +31,7 @@ import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
@ -62,15 +63,14 @@ public class Mining
ticks++; ticks++;
} }
if(!PP.getSuperBreakerMode() && Skills.cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), LoadProperties.superBreakerCooldown)){ if(!PP.getSuperBreakerMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.SUPER_BREAKER), LoadProperties.superBreakerCooldown)){
player.sendMessage(mcLocale.getString("Skills.SuperBreakerOn")); player.sendMessage(mcLocale.getString("Skills.SuperBreakerOn"));
for(Player y : player.getWorld().getPlayers()) for(Player y : player.getWorld().getPlayers())
{ {
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SuperBreakerPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.SuperBreakerPlayer", new Object[] {player.getName()}));
} }
PP.setSuperBreakerActivatedTimeStamp(System.currentTimeMillis()); PP.setSkillATS(AbilityType.SUPER_BREAKER, ticks);
PP.setSuperBreakerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSuperBreakerMode(true); PP.setSuperBreakerMode(true);
} }

View File

@ -33,6 +33,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.PlayerStat; import com.gmail.nossr50.datatypes.PlayerStat;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
@ -78,31 +79,31 @@ public class Skills
} }
public static void watchCooldowns(Player player, PlayerProfile PP, long curTime){ public static void watchCooldowns(Player player, PlayerProfile PP, long curTime){
if(!PP.getGreenTerraInformed() && curTime - (PP.getGreenTerraDeactivatedTimeStamp()*1000) >= (LoadProperties.greenTerraCooldown * 1000)){ if(!PP.getGreenTerraInformed() && curTime - (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000) >= (LoadProperties.greenTerraCooldown * 1000)){
PP.setGreenTerraInformed(true); PP.setGreenTerraInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourGreenTerra")); player.sendMessage(mcLocale.getString("Skills.YourGreenTerra"));
} }
if(!PP.getTreeFellerInformed() && curTime - (PP.getTreeFellerDeactivatedTimeStamp()*1000) >= (LoadProperties.greenTerraCooldown * 1000)){ if(!PP.getTreeFellerInformed() && curTime - (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000) >= (LoadProperties.treeFellerCooldown * 1000)){
PP.setTreeFellerInformed(true); PP.setTreeFellerInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourTreeFeller")); player.sendMessage(mcLocale.getString("Skills.YourTreeFeller"));
} }
if(!PP.getSuperBreakerInformed() && curTime - (PP.getSuperBreakerDeactivatedTimeStamp()*1000) >= (LoadProperties.superBreakerCooldown * 1000)){ if(!PP.getSuperBreakerInformed() && curTime - (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000) >= (LoadProperties.superBreakerCooldown * 1000)){
PP.setSuperBreakerInformed(true); PP.setSuperBreakerInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourSuperBreaker")); player.sendMessage(mcLocale.getString("Skills.YourSuperBreaker"));
} }
if(!PP.getSerratedStrikesInformed() && curTime - (PP.getSerratedStrikesDeactivatedTimeStamp()*1000) >= (LoadProperties.serratedStrikeCooldown * 1000)){ if(!PP.getSerratedStrikesInformed() && curTime - (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000) >= (LoadProperties.serratedStrikeCooldown * 1000)){
PP.setSerratedStrikesInformed(true); PP.setSerratedStrikesInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourSerratedStrikes")); player.sendMessage(mcLocale.getString("Skills.YourSerratedStrikes"));
} }
if(!PP.getBerserkInformed() && curTime - (PP.getBerserkDeactivatedTimeStamp()*1000) >= (LoadProperties.berserkCooldown * 1000)){ if(!PP.getBerserkInformed() && curTime - (PP.getSkillDATS(AbilityType.BERSERK)*1000) >= (LoadProperties.berserkCooldown * 1000)){
PP.setBerserkInformed(true); PP.setBerserkInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourBerserk")); player.sendMessage(mcLocale.getString("Skills.YourBerserk"));
} }
if(!PP.getSkullSplitterInformed() && curTime - (PP.getSkullSplitterDeactivatedTimeStamp()*1000) >= (LoadProperties.skullSplitterCooldown * 1000)){ if(!PP.getSkullSplitterInformed() && curTime - (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000) >= (LoadProperties.skullSplitterCooldown * 1000)){
PP.setSkullSplitterInformed(true); PP.setSkullSplitterInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourSkullSplitter")); player.sendMessage(mcLocale.getString("Skills.YourSkullSplitter"));
} }
if(!PP.getGigaDrillBreakerInformed() && curTime - (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000) >= (LoadProperties.gigaDrillBreakerCooldown * 1000)){ if(!PP.getGigaDrillBreakerInformed() && curTime - (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000) >= (LoadProperties.gigaDrillBreakerCooldown * 1000)){
PP.setGigaDrillBreakerInformed(true); PP.setGigaDrillBreakerInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourGigaDrillBreaker")); player.sendMessage(mcLocale.getString("Skills.YourGigaDrillBreaker"));
} }
@ -114,9 +115,9 @@ public class Skills
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(mcPermissions.getInstance().herbalismAbility(player) && m.isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){ if(mcPermissions.getInstance().herbalismAbility(player) && m.isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){
if(!PP.getGreenTerraMode() && !cooldownOver(player, (PP.getGreenTerraDeactivatedTimeStamp()*1000), LoadProperties.greenTerraCooldown)){ if(!PP.getGreenTerraMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000), LoadProperties.greenTerraCooldown)){
player.sendMessage(mcLocale.getString("Skills.TooTired") player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getGreenTerraDeactivatedTimeStamp()*1000), LoadProperties.greenTerraCooldown)+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000), LoadProperties.greenTerraCooldown)+"s)");
return; return;
} }
if(LoadProperties.enableAbilityMessages) if(LoadProperties.enableAbilityMessages)
@ -158,7 +159,7 @@ public class Skills
* HERBALISM ABILITY * HERBALISM ABILITY
*/ */
if(mcPermissions.getInstance().herbalismAbility(player)){ if(mcPermissions.getInstance().herbalismAbility(player)){
if(PP.getGreenTerraMode() && (PP.getGreenTerraDeactivatedTimeStamp()*1000) <= curTime){ if(PP.getGreenTerraMode() && (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000) <= curTime){
PP.setGreenTerraMode(false); PP.setGreenTerraMode(false);
PP.setGreenTerraInformed(false); PP.setGreenTerraInformed(false);
player.sendMessage(mcLocale.getString("Skills.GreenTerraOff")); player.sendMessage(mcLocale.getString("Skills.GreenTerraOff"));
@ -168,7 +169,7 @@ public class Skills
* AXES ABILITY * AXES ABILITY
*/ */
if(mcPermissions.getInstance().axesAbility(player)){ if(mcPermissions.getInstance().axesAbility(player)){
if(PP.getSkullSplitterMode() && (PP.getSkullSplitterDeactivatedTimeStamp()*1000) <= curTime){ if(PP.getSkullSplitterMode() && (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000) <= curTime){
PP.setSkullSplitterMode(false); PP.setSkullSplitterMode(false);
PP.setSkullSplitterInformed(false); PP.setSkullSplitterInformed(false);
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOff")); player.sendMessage(mcLocale.getString("Skills.SkullSplitterOff"));
@ -178,7 +179,7 @@ public class Skills
* WOODCUTTING ABILITY * WOODCUTTING ABILITY
*/ */
if(mcPermissions.getInstance().woodCuttingAbility(player)){ if(mcPermissions.getInstance().woodCuttingAbility(player)){
if(PP.getTreeFellerMode() && (PP.getTreeFellerDeactivatedTimeStamp()*1000) <= curTime){ if(PP.getTreeFellerMode() && (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000) <= curTime){
PP.setTreeFellerMode(false); PP.setTreeFellerMode(false);
PP.setTreeFellerInformed(false); PP.setTreeFellerInformed(false);
player.sendMessage(mcLocale.getString("Skills.TreeFellerOff")); player.sendMessage(mcLocale.getString("Skills.TreeFellerOff"));
@ -188,7 +189,7 @@ public class Skills
* MINING ABILITY * MINING ABILITY
*/ */
if(mcPermissions.getInstance().miningAbility(player)){ if(mcPermissions.getInstance().miningAbility(player)){
if(PP.getSuperBreakerMode() && (PP.getSuperBreakerDeactivatedTimeStamp()*1000) <= curTime){ if(PP.getSuperBreakerMode() && (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000) <= curTime){
PP.setSuperBreakerMode(false); PP.setSuperBreakerMode(false);
PP.setSuperBreakerInformed(false); PP.setSuperBreakerInformed(false);
player.sendMessage(mcLocale.getString("Skills.SuperBreakerOff")); player.sendMessage(mcLocale.getString("Skills.SuperBreakerOff"));
@ -198,7 +199,7 @@ public class Skills
* EXCAVATION ABILITY * EXCAVATION ABILITY
*/ */
if(mcPermissions.getInstance().excavationAbility(player)){ if(mcPermissions.getInstance().excavationAbility(player)){
if(PP.getGigaDrillBreakerMode() && (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000) <= curTime){ if(PP.getGigaDrillBreakerMode() && (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000) <= curTime){
PP.setGigaDrillBreakerMode(false); PP.setGigaDrillBreakerMode(false);
PP.setGigaDrillBreakerInformed(false); PP.setGigaDrillBreakerInformed(false);
player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOff")); player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOff"));
@ -208,7 +209,7 @@ public class Skills
* SWORDS ABILITY * SWORDS ABILITY
*/ */
if(mcPermissions.getInstance().swordsAbility(player)){ if(mcPermissions.getInstance().swordsAbility(player)){
if(PP.getSerratedStrikesMode() && (PP.getSerratedStrikesDeactivatedTimeStamp()*1000) <= curTime){ if(PP.getSerratedStrikesMode() && (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000) <= curTime){
PP.setSerratedStrikesMode(false); PP.setSerratedStrikesMode(false);
PP.setSerratedStrikesInformed(false); PP.setSerratedStrikesInformed(false);
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOff")); player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOff"));
@ -218,7 +219,7 @@ public class Skills
* UNARMED ABILITY * UNARMED ABILITY
*/ */
if(mcPermissions.getInstance().unarmedAbility(player)){ if(mcPermissions.getInstance().unarmedAbility(player)){
if(PP.getBerserkMode() && (PP.getBerserkDeactivatedTimeStamp()*1000) <= curTime){ if(PP.getBerserkMode() && (PP.getSkillDATS(AbilityType.BERSERK)*1000) <= curTime){
PP.setBerserkMode(false); PP.setBerserkMode(false);
PP.setBerserkInformed(false); PP.setBerserkInformed(false);
player.sendMessage(mcLocale.getString("Skills.BerserkOff")); player.sendMessage(mcLocale.getString("Skills.BerserkOff"));
@ -237,10 +238,10 @@ public class Skills
return; return;
if(mcPermissions.getInstance().miningAbility(player) && m.isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()) if(mcPermissions.getInstance().miningAbility(player) && m.isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode())
{ {
if(!PP.getSuperBreakerMode() && !cooldownOver(player, (PP.getSuperBreakerDeactivatedTimeStamp()*1000), LoadProperties.superBreakerCooldown)) if(!PP.getSuperBreakerMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000), LoadProperties.superBreakerCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.TooTired") player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSuperBreakerDeactivatedTimeStamp()*1000), LoadProperties.superBreakerCooldown)+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000), LoadProperties.superBreakerCooldown)+"s)");
return; return;
} }
if(LoadProperties.enableAbilityMessages) if(LoadProperties.enableAbilityMessages)
@ -250,10 +251,10 @@ public class Skills
} }
if(mcPermissions.getInstance().excavationAbility(player) && m.isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode()) if(mcPermissions.getInstance().excavationAbility(player) && m.isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode())
{ {
if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000), LoadProperties.gigaDrillBreakerCooldown)) if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000), LoadProperties.gigaDrillBreakerCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.TooTired") player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000), LoadProperties.gigaDrillBreakerCooldown)+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000), LoadProperties.gigaDrillBreakerCooldown)+"s)");
return; return;
} }
if(LoadProperties.enableAbilityMessages) if(LoadProperties.enableAbilityMessages)
@ -263,10 +264,10 @@ public class Skills
} }
if(mcPermissions.getInstance().swordsAbility(player) && m.isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode()) if(mcPermissions.getInstance().swordsAbility(player) && m.isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode())
{ {
if(!PP.getSerratedStrikesMode() && !cooldownOver(player, (PP.getSerratedStrikesDeactivatedTimeStamp()*1000), LoadProperties.serratedStrikeCooldown)) if(!PP.getSerratedStrikesMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000), LoadProperties.serratedStrikeCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.TooTired") player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSerratedStrikesDeactivatedTimeStamp()*1000), LoadProperties.serratedStrikeCooldown)+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000), LoadProperties.serratedStrikeCooldown)+"s)");
return; return;
} }
if(LoadProperties.enableAbilityMessages) if(LoadProperties.enableAbilityMessages)
@ -276,10 +277,10 @@ public class Skills
} }
if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !PP.getFistsPreparationMode()) if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !PP.getFistsPreparationMode())
{ {
if(!PP.getBerserkMode() && !cooldownOver(player, (PP.getBerserkDeactivatedTimeStamp()*1000), LoadProperties.berserkCooldown)) if(!PP.getBerserkMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.BERSERK)*1000), LoadProperties.berserkCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.TooTired") player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getBerserkDeactivatedTimeStamp()*1000), LoadProperties.berserkCooldown)+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.BERSERK)*1000), LoadProperties.berserkCooldown)+"s)");
return; return;
} }
if(LoadProperties.enableAbilityMessages) if(LoadProperties.enableAbilityMessages)

View File

@ -27,6 +27,7 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
@ -50,7 +51,7 @@ public class Swords
ticks++; ticks++;
} }
if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesDeactivatedTimeStamp() < System.currentTimeMillis()) if(!PP.getSerratedStrikesMode() && PP.getSkillDATS(AbilityType.SERRATED_STRIKES) < System.currentTimeMillis())
{ {
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOn")); player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOn"));
for(Player y : player.getWorld().getPlayers()) for(Player y : player.getWorld().getPlayers())
@ -58,8 +59,7 @@ public class Swords
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SerratedStrikesPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.SerratedStrikesPlayer", new Object[] {player.getName()}));
} }
PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis()); PP.setSkillATS(AbilityType.SERRATED_STRIKES, ticks);
PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSerratedStrikesMode(true); PP.setSerratedStrikesMode(true);
} }

View File

@ -23,6 +23,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
@ -44,7 +45,7 @@ public class Unarmed {
ticks++; ticks++;
} }
if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), LoadProperties.berserkCooldown)) if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.BERSERK), LoadProperties.berserkCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.BerserkOn")); player.sendMessage(mcLocale.getString("Skills.BerserkOn"));
for(Player y : player.getWorld().getPlayers()) for(Player y : player.getWorld().getPlayers())
@ -52,8 +53,7 @@ public class Unarmed {
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()}));
} }
PP.setBerserkActivatedTimeStamp(System.currentTimeMillis()); PP.setSkillATS(AbilityType.BERSERK, ticks);
PP.setBerserkDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setBerserkMode(true); PP.setBerserkMode(true);
} }
} }

View File

@ -29,6 +29,7 @@ import org.bukkit.Bukkit;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
@ -81,7 +82,7 @@ public class WoodCutting
ticks++; ticks++;
} }
if(!PP.getTreeFellerMode() && Skills.cooldownOver(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)) if(!PP.getTreeFellerMode() && Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000), LoadProperties.treeFellerCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.TreeFellerOn")); player.sendMessage(mcLocale.getString("Skills.TreeFellerOn"));
for(Player y : player.getWorld().getPlayers()) for(Player y : player.getWorld().getPlayers())
@ -89,13 +90,12 @@ public class WoodCutting
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()}));
} }
PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis()); PP.setSkillATS(AbilityType.TREE_FELLER, ticks);
PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setTreeFellerMode(true); PP.setTreeFellerMode(true);
} }
if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)){ if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000), LoadProperties.treeFellerCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)+"s)"); +ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000), LoadProperties.treeFellerCooldown)+"s)");
} }
} }
} }