Solved Chunk

Discussion in 'Spigot Plugin Development' started by chochoco4777, Jun 11, 2021.

Thread Status:
Not open for further replies.
  1. I don't know how to change this code in version 1.17. I tried a lot but failed, I need your help.

    Code (Text):
            plot.getChunksInPlot().forEach(c -> {
                plot.getArena().getPlayers().forEach(p -> {
                    try {
                        ReflectionUtils.sendPacket(p, ReflectionUtils.getNMSClass("PacketPlayOutMapChunk").getConstructor(ReflectionUtils.getNMSClass("Chunk"), boolean.class, int.class).newInstance(c.getClass().getMethod("getHandle").invoke(c), true, 65535));
                    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
                        try {
                            ReflectionUtils.sendPacket(p, ReflectionUtils.getNMSClass("PacketPlayOutMapChunk").getConstructor(ReflectionUtils.getNMSClass("Chunk"), int.class).newInstance(c.getClass().getMethod("getHandle").invoke(c), 65535));
                        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e1) {
                            try {
                                plot.getBlocksInPlot().forEach(l -> {
                                    l.getBlock().setBiome(currentBiome.getBiome().getBiome());
                                });
                            } catch (Exception ex) {
                                ex.printStackTrace();
                            }
                        }
                    }
                });
            });
        }
    console issue
    Code (Text):
    [20:53:33] [Server thread/WARN]: java.lang.ClassNotFoundException: net.minecraft.server.v1_17_R1.PacketPlayOutMapChunk
    [20:53:33] [Server thread/WARN]:        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:140)
    [20:53:33] [Server thread/WARN]:        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99)
    [20:53:33] [Server thread/WARN]:        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
    [20:53:33] [Server thread/WARN]:        at java.base/java.lang.Class.forName0(Native Method)
    [20:53:33] [Server thread/WARN]:        at java.base/java.lang.Class.forName(Class.java:375)
    [20:53:33] [Server thread/WARN]:        at me.drawethree.buildbattle.utility.ReflectionUtils.getNMSClass(ReflectionUtils.java:361)
    [20:53:33] [Server thread/WARN]:        at me.drawethree.buildbattle.objects.plot.BBPlotOptions.lambda$null$4(BBPlotOptions.java:119)
    [20:53:33] [Server thread/WARN]:        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    [20:53:33] [Server thread/WARN]:        at me.drawethree.buildbattle.objects.plot.BBPlotOptions.lambda$setCurrentBiome$5(BBPlotOptions.java:117)
     
  2. Some of the packets were removed in 1.17 NMS, but in your case the package was changed from net.minecraft.server.v1_17_R1.PacketPlayOutMapChunk to
    net.minecraft.network.protocol.game.PacketPlayOutMapChunk
     
  3. So where did the Chunk nms class go?
     
  4. If read the annoucment down below at developer notes they did something to the mappings
     
Thread Status:
Not open for further replies.