mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-06-26 06:14:42 +02:00
Ensure not to update with an older block change entry. +comments.
This commit is contained in:
parent
c477f1af72
commit
30979935ce
|
@ -1199,12 +1199,16 @@ public class MovingData extends ACheckData {
|
|||
* @param to
|
||||
*/
|
||||
public void updateBlockChangeReference(final BlockChangeEntry entry, final RichBoundsLocation to) {
|
||||
blockChangeRef.lastUsedEntry = entry; // Unchecked.
|
||||
if (to.isBlockIntersecting(entry.x, entry.y, entry.z)) {
|
||||
blockChangeRef.valid = true;
|
||||
}
|
||||
else {
|
||||
blockChangeRef.valid = false;
|
||||
// TODO: Move method to BlockChangeReference to keep things easy to overview for now.
|
||||
// TODO: updateBlockChangeReference ... Span(entry, to !?)|Final()
|
||||
if (blockChangeRef.lastUsedEntry == null || blockChangeRef.lastUsedEntry.id < entry.id) {
|
||||
blockChangeRef.lastUsedEntry = entry; // Unchecked.
|
||||
if (to.isBlockIntersecting(entry.x, entry.y, entry.z)) {
|
||||
blockChangeRef.valid = true;
|
||||
}
|
||||
else {
|
||||
blockChangeRef.valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ public class BlockChangeTracker {
|
|||
* Simple class for helping with query functionality. Reference a
|
||||
* BlockChangeEntry and contain more information, such as validity for
|
||||
* further use/effects. This is meant for storing the state of last-consumed
|
||||
* ids for a context within some data.
|
||||
* block change entries for a context within some data.
|
||||
*
|
||||
* @author asofold
|
||||
*
|
||||
|
@ -214,7 +214,13 @@ public class BlockChangeTracker {
|
|||
/** Last used block change entry, highest id.*/
|
||||
public BlockChangeEntry lastUsedEntry = null;
|
||||
|
||||
/** Indicate if the set id can still be used.*/
|
||||
/**
|
||||
* Indicate if the timing of the last entry is still regarded as valid.
|
||||
*/
|
||||
/*
|
||||
* TODO: Subject to change, switching to tick rather than id (ids can be
|
||||
* inverted, thus lock out paths).
|
||||
*/
|
||||
public boolean valid = false;
|
||||
|
||||
/**
|
||||
|
@ -228,7 +234,9 @@ public class BlockChangeTracker {
|
|||
* @return
|
||||
*/
|
||||
public boolean canUpdateWith(final BlockChangeEntry entry) {
|
||||
return this.lastUsedEntry == null || entry.id > this.lastUsedEntry.id || entry.id == this.lastUsedEntry.id && valid;
|
||||
// Love access methods: return this.lastUsedEntry == null || entry.id > this.lastUsedEntry.id || entry.id == this.lastUsedEntry.id && valid;
|
||||
// TODO: There'll be a span perhaps.
|
||||
return this.lastUsedEntry == null || entry.tick > this.lastUsedEntry.tick || entry.tick == this.lastUsedEntry.tick && valid;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user