Set channel size limit to 1024 (#247)
Because we can run atm6 and it has lots of mods
This commit is contained in:
parent
4cab3062ff
commit
69a9b0c4b9
@ -35,6 +35,7 @@ import org.bukkit.craftbukkit.v.entity.CraftGolem;
|
|||||||
import org.bukkit.craftbukkit.v.entity.CraftTameableAnimal;
|
import org.bukkit.craftbukkit.v.entity.CraftTameableAnimal;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -48,6 +49,7 @@ import java.util.Objects;
|
|||||||
public abstract class CraftEntityMixin implements org.bukkit.entity.Entity {
|
public abstract class CraftEntityMixin implements org.bukkit.entity.Entity {
|
||||||
|
|
||||||
@Shadow protected Entity entity;
|
@Shadow protected Entity entity;
|
||||||
|
@Shadow @Final protected CraftServer server;
|
||||||
|
|
||||||
private EntityType arclight$type;
|
private EntityType arclight$type;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
package io.izzel.arclight.common.mixin.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import org.bukkit.craftbukkit.v.entity.CraftPlayer;
|
||||||
|
import org.bukkit.event.player.PlayerRegisterChannelEvent;
|
||||||
|
import org.bukkit.plugin.messaging.StandardMessenger;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Mixin(value = CraftPlayer.class, remap = false)
|
||||||
|
public abstract class CraftPlayerMixin extends CraftEntityMixin {
|
||||||
|
|
||||||
|
@Shadow @Final private Set<String> channels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author IzzelAliz
|
||||||
|
* @reason
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public void addChannel(String channel) {
|
||||||
|
Preconditions.checkState(this.channels.size() < 1024, "Cannot register channel '%s'. Too many channels registered!", channel);
|
||||||
|
channel = StandardMessenger.validateAndCorrectChannel(channel);
|
||||||
|
if (this.channels.add(channel)) {
|
||||||
|
this.server.getPluginManager().callEvent(new PlayerRegisterChannelEvent((CraftPlayer) (Object) this, channel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -27,6 +27,7 @@
|
|||||||
"CraftLegacyUtilMixin",
|
"CraftLegacyUtilMixin",
|
||||||
"CraftMagicNumbersMixin",
|
"CraftMagicNumbersMixin",
|
||||||
"CraftMetaItemMixin",
|
"CraftMetaItemMixin",
|
||||||
|
"CraftPlayerMixin",
|
||||||
"CraftServerMixin",
|
"CraftServerMixin",
|
||||||
"CraftVillagerMixin",
|
"CraftVillagerMixin",
|
||||||
"CraftWorldMixin",
|
"CraftWorldMixin",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user