Fix NullPointerException when trying to find gadgets in a group suite

This commit is contained in:
KingRainbow44 2023-06-03 12:41:20 -04:00
parent e8bfdc3c01
commit 5441094e47
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE

View File

@ -1,7 +1,5 @@
package emu.grasscutter.scripts; package emu.grasscutter.scripts;
import static emu.grasscutter.scripts.constants.EventType.EVENT_TIMER_EVENT;
import com.github.davidmoten.rtreemulti.RTree; import com.github.davidmoten.rtreemulti.RTree;
import com.github.davidmoten.rtreemulti.geometry.Geometry; import com.github.davidmoten.rtreemulti.geometry.Geometry;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
@ -21,17 +19,20 @@ import emu.grasscutter.server.packet.send.PacketGroupSuiteNotify;
import emu.grasscutter.utils.*; import emu.grasscutter.utils.*;
import io.netty.util.concurrent.FastThreadLocalThread; import io.netty.util.concurrent.FastThreadLocalThread;
import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.ints.*;
import kotlin.Pair;
import lombok.val;
import org.luaj.vm2.*;
import org.luaj.vm2.lib.jse.CoerceJavaToLua;
import javax.annotation.*;
import java.io.*; import java.io.*;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.*;
import kotlin.Pair; import static emu.grasscutter.scripts.constants.EventType.EVENT_TIMER_EVENT;
import lombok.val;
import org.luaj.vm2.*;
import org.luaj.vm2.lib.jse.CoerceJavaToLua;
public class SceneScriptManager { public class SceneScriptManager {
private final Scene scene; private final Scene scene;
@ -681,8 +682,8 @@ public class SceneScriptManager {
|| !groupInstance.getDeadEntities().contains(m.config_id)); || !groupInstance.getDeadEntities().contains(m.config_id));
}) })
.map(g -> createGadget(group.id, group.block_id, g, groupInstance.getCachedGadgetState(g))) .map(g -> createGadget(group.id, group.block_id, g, groupInstance.getCachedGadgetState(g)))
.peek(g -> groupInstance.cacheGadgetState(g.getMetaGadget(), g.getState()))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.peek(g -> groupInstance.cacheGadgetState(g.getMetaGadget(), g.getState()))
.toList(); .toList();
} }