Change to individual methods to override event resolution. Shuffle.

This commit is contained in:
asofold 2017-05-01 13:03:09 +02:00
parent c21f1075c9
commit 90d6ab97c5

View File

@ -159,6 +159,35 @@ public class BlockInteractData extends ACheckData {
resetConsumedChecks();
}
/**
* Resets the last block (and passed checks).
*/
public void resetLastBlock() {
lastTick = 0;
lastAction = null;
lastX = Integer.MAX_VALUE;
lastType = null;
lastAllowUseBlock = false;
lastAllowUseItem = false;
lastIsCancelled = true;
resetPassedChecks();
resetConsumedChecks();
}
/**
* Reset passed checks (concern the last block interacted with).
*/
public void resetPassedChecks() {
passedChecks.clear();
}
/**
* Reset consumed checks (concern the last block interacted with).
*/
public void resetConsumedChecks() {
consumedChecks.clear();
}
/**
* Full state comparison.
* @param material
@ -260,28 +289,6 @@ public class BlockInteractData extends ACheckData {
return lastAction;
}
/**
* Resets the last block (and passed checks).
*/
public void resetLastBlock() {
lastTick = 0;
lastAction = null;
lastX = Integer.MAX_VALUE;
lastType = null;
lastAllowUseBlock = false;
lastAllowUseItem = false;
lastIsCancelled = true;
resetPassedChecks();
resetConsumedChecks();
}
/**
* Reset passed checks (concern the last block interacted with).
*/
public void resetPassedChecks() {
passedChecks.clear();
}
/**
* Set the check type to be passed for the last block.
*
@ -291,6 +298,16 @@ public class BlockInteractData extends ACheckData {
passedChecks.add(checkType);
}
/**
* Check if this check type was set as passed for the last block.
*
* @param checkType
* @return
*/
public boolean isPassedCheck(final CheckType checkType) {
return passedChecks.contains(checkType);
}
/**
* Check if the last block was set to be consumed by this check type.
*
@ -301,13 +318,6 @@ public class BlockInteractData extends ACheckData {
return consumedChecks.contains(checkType);
}
/**
* Reset consumed checks (concern the last block interacted with).
*/
public void resetConsumedChecks() {
consumedChecks.clear();
}
/**
* Set last block to be consumed by the given check type.
*
@ -317,16 +327,6 @@ public class BlockInteractData extends ACheckData {
consumedChecks.add(checkType);
}
/**
* Check if this check type was set as passed for the last block.
*
* @param checkType
* @return
*/
public boolean isPassedCheck(final CheckType checkType) {
return passedChecks.contains(checkType);
}
/**
* Adjust to the results of a BlockInteractEvent - only the results, the
* coordinates and action is not updated.
@ -349,23 +349,30 @@ public class BlockInteractData extends ACheckData {
}
/**
* Adjust to the results of a BlockInteractEvent.
* Allow overriding the last PlayerInteractEvent resolution.
*
* @param isCancelled
*/
public void setLastIsCancelled(final boolean isCancelled) {
this.lastIsCancelled = isCancelled;
}
/**
* Allow overriding the last PlayerInteractEvent resolution.
*
* @param allowUseItem
*/
public void setLastAllowUseItem(final boolean allowUseItem) {
this.lastAllowUseItem = allowUseItem;
}
/**
* Allow overriding the last PlayerInteractEvent resolution.
*
* @param allowUseBlock
*/
public void setPlayerInteractEventResolution(final boolean isCancelled,
final boolean allowUseItem, final boolean allowUseBlock) {
this.lastIsCancelled = isCancelled;
public void setLastAllowUseBlock(final boolean allowUseBlock) {
this.lastAllowUseBlock = allowUseBlock;
this.lastAllowUseItem = allowUseItem;
if (isCancelled) {
resetLastBlock();
}
else {
}
}
}