Renaming.

This commit is contained in:
asofold 2012-10-27 00:39:53 +02:00
parent 7a14c7fc1f
commit 20065d0baf
3 changed files with 14 additions and 11 deletions

View File

@ -50,13 +50,13 @@ public class InstantBow extends Check {
final long expectedPullDuration = (long) (maxTime - maxTime * (1f - force) * (1f - force)) - cc.instantBowDelay;
// Time taken to pull the string.
final long pullDuration = now - data.instantBowInteractTime;
final long pullDuration = now - data.instantBowInteract;
if (data.instantBowInteractTime > 0 && pullDuration >= expectedPullDuration){
if (data.instantBowInteract > 0 && pullDuration >= expectedPullDuration){
// The player was slow enough, reward him by lowering his violation level.
data.instantBowVL *= 0.9D;
}
else if (data.instantBowInteractTime > now){
else if (data.instantBowInteract > now){
// Security check if time ran backwards.
// TODO: Maybe this can be removed, though TickTask does not reset at the exact moment.
}
@ -78,7 +78,7 @@ public class InstantBow extends Check {
}
// Reset data here.
data.instantBowInteractTime = 0;
data.instantBowInteract = 0;
return cancel;
}

View File

@ -82,7 +82,7 @@ public class InventoryData extends ACheckData {
public long fastClickLastTime;
// Data of the instant bow check.
public long instantBowInteractTime;
public long instantBowInteract;
// Data of the instant eat check.
public Material instantEatFood;

View File

@ -219,21 +219,24 @@ public class InventoryListener implements Listener {
if (event.hasItem()){
final ItemStack item = event.getItem();
final Material type = item.getType();
if (type == Material.BOW)
if (type == Material.BOW){
final long now = System.currentTimeMillis();
// It was a bow, the player starts to pull the string, remember this time.
data.instantBowInteractTime = System.currentTimeMillis();
data.instantBowInteract = (data.instantBowInteract > 0 && now - data.instantBowInteract < 800) ? Math.min(System.currentTimeMillis(), data.instantBowInteract) : System.currentTimeMillis();
}
else if (type.isEdible()) {
final long now = System.currentTimeMillis();
// It was food, the player starts to eat some food, remember this time and the type of food.
data.instantEatFood = type;
data.instantEatInteract = System.currentTimeMillis();
data.instantBowInteractTime = 0;
data.instantEatInteract = (data.instantEatInteract > 0 && now - data.instantEatInteract < 800) ? Math.min(System.currentTimeMillis(), data.instantEatInteract) : System.currentTimeMillis();
data.instantBowInteract = 0;
} else resetAll = true;
}
else resetAll = true;
if (resetAll){
// Nothing that we are interested in, reset data.
data.instantBowInteractTime = 0;
data.instantBowInteract = 0;
data.instantEatInteract = 0;
data.instantEatFood = null;
}
@ -243,7 +246,7 @@ public class InventoryListener implements Listener {
public void onItemHeldChange(final PlayerItemHeldEvent event){
final Player player = event.getPlayer();
final InventoryData data = InventoryData.getData(player);
data.instantBowInteractTime = 0;
data.instantBowInteract = 0;
data.instantEatInteract = 0;
data.instantEatFood = null;
}