mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-03-29 13:19:43 +01:00

Folia Support --------- Co-authored-by: Rockyers <ethan@yocom.org> Co-authored-by: TechnicallyCoded <technicallycoded@gmail.com> Co-authored-by: HSGamer <huynhqtienvtag@gmail.com>
28 lines
890 B
Java
28 lines
890 B
Java
package com.gmail.nossr50.runnables;
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
import com.gmail.nossr50.util.CancellableRunnable;
|
|
import com.gmail.nossr50.util.MetadataConstants;
|
|
import org.bukkit.entity.Entity;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
public class TravelingBlockMetaCleanup extends CancellableRunnable {
|
|
private final @NotNull Entity entity;
|
|
private final @NotNull mcMMO pluginRef;
|
|
|
|
public TravelingBlockMetaCleanup(@NotNull Entity entity, @NotNull mcMMO pluginRef) {
|
|
this.entity = entity;
|
|
this.pluginRef = pluginRef;
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
if(!entity.isValid()) {
|
|
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
|
|
this.cancel();
|
|
} else if (!entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) {
|
|
this.cancel();
|
|
}
|
|
}
|
|
}
|