Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-09 01:50:05 +01:00
Protocol: Limit Views ArrayList to 64
Dieser Commit ist enthalten in:
Ursprung
83b60d3c6f
Commit
54564c188b
@ -1,11 +1,15 @@
|
||||
package com.moulberry.axiom.packet;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.moulberry.axiom.AxiomConstants;
|
||||
import com.moulberry.axiom.AxiomPaper;
|
||||
import com.moulberry.axiom.View;
|
||||
import com.moulberry.axiom.persistence.UUIDDataType;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
@ -13,7 +17,9 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
public class SetEditorViewsPacketListener implements PluginMessageListener {
|
||||
|
||||
@ -30,7 +36,8 @@ public class SetEditorViewsPacketListener implements PluginMessageListener {
|
||||
|
||||
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(message));
|
||||
UUID uuid = friendlyByteBuf.readUUID();
|
||||
List<View> views = friendlyByteBuf.readList(View::read);
|
||||
IntFunction<List<View>> listFunction = FriendlyByteBuf.limitValue(Lists::newArrayListWithCapacity, 64);
|
||||
List<View> views = friendlyByteBuf.readCollection(listFunction, View::read);
|
||||
|
||||
PersistentDataContainer container = player.getPersistentDataContainer();
|
||||
container.set(AxiomConstants.ACTIVE_VIEW, UUIDDataType.INSTANCE, uuid);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren