mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 01:49:30 +00:00
feat(core): 添加外部数据构建循环检测
This commit is contained in:
@@ -7,13 +7,10 @@ import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextPar
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Deque;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
|
||||
public class ItemBuildContext extends PlayerOptionalContext {
|
||||
public static final ItemBuildContext EMPTY = new ItemBuildContext(null, ContextHolder.EMPTY);
|
||||
private Deque<String> externalBuildStack;
|
||||
|
||||
public ItemBuildContext(@Nullable Player player, @NotNull ContextHolder contexts) {
|
||||
super(player, contexts);
|
||||
@@ -35,16 +32,4 @@ public class ItemBuildContext extends PlayerOptionalContext {
|
||||
if (player == null) return new ItemBuildContext(null, ContextHolder.EMPTY);
|
||||
return new ItemBuildContext(player, new ContextHolder(Map.of(DirectContextParameters.PLAYER, () -> player)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Deque<String> getExternalBuildStack() {
|
||||
if (externalBuildStack == null) {
|
||||
externalBuildStack = new ConcurrentLinkedDeque<>();
|
||||
}
|
||||
return externalBuildStack;
|
||||
}
|
||||
|
||||
public void clearExternalBuildStack() {
|
||||
externalBuildStack = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user