Tweaked a few things

This commit is contained in:
bm01 2012-06-12 06:08:54 +02:00
parent 5cff6ed67b
commit 534a165c45
6 changed files with 24 additions and 26 deletions

View File

@ -26,7 +26,7 @@ public class PlayerProfile {
/* HUD */ /* HUD */
private HUDType hud; private HUDType hud;
private int xpbarinc = 0; private int xpbarinc;
private SkillType lastgained; private SkillType lastgained;
private SkillType skillLock; private SkillType skillLock;
@ -35,16 +35,16 @@ public class PlayerProfile {
private Party invite; private Party invite;
/* Toggles */ /* Toggles */
private boolean loaded = false; private boolean loaded;
private boolean partyhud = true, spoutcraft = false, xpbarlocked = false; private boolean partyhud = true, spoutcraft, xpbarlocked;
private boolean placedAnvil = false; private boolean placedAnvil;
private boolean partyChatMode = false, adminChatMode = false; private boolean partyChatMode, adminChatMode;
private boolean godMode = false; private boolean godMode;
private boolean greenTerraMode, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, skullSplitterMode, berserkMode; private boolean greenTerraMode, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, skullSplitterMode, berserkMode;
private boolean greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, private boolean greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
superBreakerInformed = true, blastMiningInformed = true, serratedStrikesInformed = true, treeFellerInformed = true; superBreakerInformed = true, blastMiningInformed = true, serratedStrikesInformed = true, treeFellerInformed = true;
private boolean hoePreparationMode = false, shovelPreparationMode = false, swordsPreparationMode = false, fistsPreparationMode = false, private boolean hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode,
pickaxePreparationMode = false, axePreparationMode = false; pickaxePreparationMode, axePreparationMode;
private boolean abilityuse = true; private boolean abilityuse = true;
/* Timestamps */ /* Timestamps */
@ -864,12 +864,16 @@ public class PlayerProfile {
* Recently Hurt * Recently Hurt
*/ */
public long getRecentlyHurt() { public int getRecentlyHurt() {
return recentlyHurt; return recentlyHurt;
} }
public void setRecentlyHurt(long newvalue) { public void setRecentlyHurt(int value) {
recentlyHurt = (int) (newvalue / 1000); recentlyHurt = value;
}
public void actualizeRecentlyHurt() {
respawnATS = (int) (System.currentTimeMillis() / 1000);
} }
/* /*
@ -914,7 +918,7 @@ public class PlayerProfile {
return respawnATS; return respawnATS;
} }
public void ActualizeRespawnATS() { public void actualizeRespawnATS() {
respawnATS = (int) (System.currentTimeMillis() / 1000); respawnATS = (int) (System.currentTimeMillis() / 1000);
} }

View File

@ -137,7 +137,7 @@ public class EntityListener implements Listener {
} }
if (event.getDamage() >= 1) { if (event.getDamage() >= 1) {
PP.setRecentlyHurt(System.currentTimeMillis()); PP.actualizeRecentlyHurt();
} }
} }
} else if (lEntity instanceof Tameable) { } else if (lEntity instanceof Tameable) {

View File

@ -124,7 +124,7 @@ public class PlayerListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLogin(PlayerLoginEvent event) { public void onPlayerLogin(PlayerLoginEvent event) {
Users.addUser(event.getPlayer()).ActualizeRespawnATS(); Users.addUser(event.getPlayer()).actualizeRespawnATS();
} }
/** /**
@ -197,7 +197,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
Users.getProfile(event.getPlayer()).ActualizeRespawnATS(); Users.getProfile(event.getPlayer()).actualizeRespawnATS();
} }
/** /**

View File

@ -38,7 +38,7 @@ public class AcrobaticsManager {
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER); eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER);
} }
else if (!eventHandler.isFatal(event.getDamage())){ else if (!eventHandler.isFatal(event.getDamage()) && permHandler.canGainXP()){
eventHandler.processXPGain(eventHandler.damage * Acrobatics.FALL_XP_MODIFIER); eventHandler.processXPGain(eventHandler.damage * Acrobatics.FALL_XP_MODIFIER);
} }
} }
@ -59,7 +59,7 @@ public class AcrobaticsManager {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
if (System.currentTimeMillis() >= profile.getRespawnATS() + 5) { if (System.currentTimeMillis() >= profile.getRespawnATS() + 5 && permHandler.canGainXP()) {
eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER); eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER);
} }
} }

View File

@ -38,8 +38,6 @@ public class DodgeEventHandler extends AcrobaticsEventHandler{
} }
protected void processXPGain(int xp) { protected void processXPGain(int xp) {
if (manager.getPermissionsHandler().canGainXP()) { Skills.xpProcessing(player, manager.getProfile(), SkillType.ACROBATICS, xp);
Skills.xpProcessing(player, manager.getProfile(), SkillType.ACROBATICS, xp);
}
} }
} }

View File

@ -8,13 +8,11 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills; import com.gmail.nossr50.util.Skills;
public class RollEventHandler extends AcrobaticsEventHandler{ public class RollEventHandler extends AcrobaticsEventHandler{
private AcrobaticsPermissionsHandler permHandler;
private boolean isGraceful; private boolean isGraceful;
private int damageThreshold; private int damageThreshold;
protected RollEventHandler(AcrobaticsManager manager, EntityDamageEvent event) { protected RollEventHandler(AcrobaticsManager manager, EntityDamageEvent event) {
super(manager, event); super(manager, event);
this.permHandler = manager.getPermissionsHandler();
isGracefulRoll(); isGracefulRoll();
calculateSkillModifier(); calculateSkillModifier();
@ -63,16 +61,14 @@ public class RollEventHandler extends AcrobaticsEventHandler{
protected void processXPGain(int xpGain) { protected void processXPGain(int xpGain) {
if (permHandler.canGainXP()) { Skills.xpProcessing(player, manager.getProfile(), SkillType.ACROBATICS, xpGain);
Skills.xpProcessing(player, manager.getProfile(), SkillType.ACROBATICS, xpGain);
}
} }
/** /**
* Check if this is a graceful roll. * Check if this is a graceful roll.
*/ */
private void isGracefulRoll() { private void isGracefulRoll() {
if (permHandler.canGracefulRoll()) { if (manager.getPermissionsHandler().canGracefulRoll()) {
this.isGraceful = player.isSneaking(); this.isGraceful = player.isSneaking();
} }
else { else {