mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-19 15:09:18 +00:00
fix deleting object ids with mantle cleanup
This commit is contained in:
@@ -34,6 +34,7 @@ import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -45,6 +46,7 @@ import java.util.Map;
|
||||
* Hope you packed snacks & road sodas.
|
||||
*/
|
||||
public class IrisToolbelt {
|
||||
@ApiStatus.Internal
|
||||
public static Map<String, Boolean> toolbeltConfiguration = new HashMap<>();
|
||||
|
||||
/**
|
||||
@@ -235,6 +237,10 @@ public class IrisToolbelt {
|
||||
toolbeltConfiguration.put("retain.mantle." + className, true);
|
||||
}
|
||||
|
||||
public static boolean isRetainingMantleDataForSlice(String className) {
|
||||
return !toolbeltConfiguration.isEmpty() && toolbeltConfiguration.get("retain.mantle." + className) == Boolean.TRUE;
|
||||
}
|
||||
|
||||
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of) {
|
||||
PlatformChunkGenerator e = access(world);
|
||||
if (e == null) {
|
||||
|
||||
@@ -623,7 +623,7 @@ public class Mantle {
|
||||
}
|
||||
|
||||
public void deleteChunkSlice(int x, int z, Class<?> c) {
|
||||
if (!IrisToolbelt.toolbeltConfiguration.isEmpty() && IrisToolbelt.toolbeltConfiguration.getOrDefault("retain.mantle." + c.getCanonicalName(), false)) {
|
||||
if (IrisToolbelt.isRetainingMantleDataForSlice(c.getCanonicalName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.util.mantle;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.documentation.ChunkRelativeBlockCoordinates;
|
||||
import com.volmit.iris.util.function.Consumer4;
|
||||
@@ -270,6 +271,8 @@ public class MantleChunk extends FlaggedChunk {
|
||||
}
|
||||
|
||||
public void deleteSlices(Class<?> c) {
|
||||
if (IrisToolbelt.isRetainingMantleDataForSlice(c.getCanonicalName()))
|
||||
return;
|
||||
for (int i = 0; i < sections.length(); i++) {
|
||||
Matter m = sections.get(i);
|
||||
if (m != null && m.hasSlice(c)) {
|
||||
|
||||
Reference in New Issue
Block a user