TODOs: - Test if techhider still applied in sendChunk - Test if 1.15 CraftMagicNumbers loads class
Dieser Commit ist enthalten in:
Ursprung
447fe7b6b3
Commit
e97d6a48c3
@ -22,6 +22,8 @@ package de.steamwar.core;
|
|||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
@ -322,4 +324,25 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
public Object formatDisplayName(String displayName) {
|
public Object formatDisplayName(String displayName) {
|
||||||
return displayName != null ? Optional.of(ChatWrapper.impl.stringToChatComponent(displayName)) : Optional.empty();
|
return displayName != null ? Optional.of(ChatWrapper.impl.stringToChatComponent(displayName)) : Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Reflection.FieldAccessor<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, Reflection.getClass("{nms.world.entity}.EntityTypes"), 0);
|
||||||
|
private static final Reflection.FieldAccessor<?> spawnLivingType = Core.getVersion() > 19 ? spawnType : Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
||||||
|
private static final Reflection.MethodInvoker getEntityTypes = Reflection.getMethod("{obc}.util.CraftMagicNumbers", "getEntityTypes", EntityType.class);
|
||||||
|
private static final Map<EntityType, Object> types = new HashMap<>();
|
||||||
|
static {
|
||||||
|
types.put(EntityType.ARMOR_STAND, 1);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setSpawnPacketType(Object packet, EntityType type) {
|
||||||
|
if(type.isAlive()) {
|
||||||
|
spawnLivingType.set(packet, Core.getVersion() > 18 ? getEntityTypes.invoke(null, type) : types.get(type));
|
||||||
|
} else {
|
||||||
|
spawnType.set(packet, getEntityTypes.invoke(null, type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getViewDistance(Player player) {
|
||||||
|
return player.getClientViewDistance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,19 +19,21 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.level.chunk.Chunk;
|
import net.minecraft.world.level.chunk.Chunk;
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.CraftChunk;
|
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CraftbukkitWrapper18 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
public class CraftbukkitWrapper18 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
||||||
|
|
||||||
|
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
||||||
Chunk chunk = ((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle();
|
Chunk chunk = (Chunk) getHandle.invoke(p.getWorld().getChunkAt(chunkX, chunkZ));
|
||||||
((CraftPlayer)p).getHandle().b.a(new ClientboundLevelChunkWithLightPacket(chunk, chunk.q.l_(), null, null, false));
|
TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, chunk.q.l_(), null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,8 +22,6 @@ package de.steamwar.core;
|
|||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import net.minecraft.world.entity.EntityTypes;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -36,34 +34,6 @@ public class ProtocolWrapper18 implements ProtocolWrapper {
|
|||||||
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, EntityTypes.class, 0);
|
|
||||||
private static final Reflection.FieldAccessor<Integer> spawnLivingType = Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
|
||||||
@Override
|
|
||||||
public void setSpawnPacketType(Object packet, EntityType type) {
|
|
||||||
switch(type) {
|
|
||||||
case PRIMED_TNT:
|
|
||||||
spawnType.set(packet, EntityTypes.as);
|
|
||||||
break;
|
|
||||||
case ARROW:
|
|
||||||
spawnType.set(packet, EntityTypes.d);
|
|
||||||
break;
|
|
||||||
case FIREBALL:
|
|
||||||
spawnType.set(packet, EntityTypes.S);
|
|
||||||
break;
|
|
||||||
case ITEM_FRAME:
|
|
||||||
spawnType.set(packet, EntityTypes.R);
|
|
||||||
break;
|
|
||||||
case FALLING_BLOCK:
|
|
||||||
spawnType.set(packet, EntityTypes.C);
|
|
||||||
break;
|
|
||||||
case ARMOR_STAND:
|
|
||||||
spawnLivingType.set(packet, 1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException(type.name() + " is not implemented");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
||||||
@Override
|
@Override
|
||||||
public Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode) {
|
public Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode) {
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is a part of the SteamWar software.
|
|
||||||
|
|
||||||
Copyright (C) 2021 SteamWar.de-Serverteam
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.core;
|
|
||||||
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.world.level.chunk.Chunk;
|
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.CraftChunk;
|
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CraftbukkitWrapper19 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
|
||||||
Chunk chunk = ((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle();
|
|
||||||
((CraftPlayer)p).getHandle().b.a(new ClientboundLevelChunkWithLightPacket(chunk, chunk.q.l_(), null, null, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public double[] getSpigotTPS() {
|
|
||||||
return MinecraftServer.getServer().recentTps;
|
|
||||||
}
|
|
||||||
}
|
|
@ -22,8 +22,6 @@ package de.steamwar.core;
|
|||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import net.minecraft.world.entity.EntityTypes;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -36,33 +34,6 @@ public class ProtocolWrapper19 implements ProtocolWrapper {
|
|||||||
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, EntityTypes.class, 0);
|
|
||||||
@Override
|
|
||||||
public void setSpawnPacketType(Object packet, EntityType type) {
|
|
||||||
switch(type) {
|
|
||||||
case PRIMED_TNT:
|
|
||||||
spawnType.set(packet, EntityTypes.av);
|
|
||||||
break;
|
|
||||||
case ARROW:
|
|
||||||
spawnType.set(packet, EntityTypes.e);
|
|
||||||
break;
|
|
||||||
case FIREBALL:
|
|
||||||
spawnType.set(packet, EntityTypes.V);
|
|
||||||
break;
|
|
||||||
case ITEM_FRAME:
|
|
||||||
spawnType.set(packet, EntityTypes.U);
|
|
||||||
break;
|
|
||||||
case ARMOR_STAND:
|
|
||||||
spawnType.set(packet, EntityTypes.d);
|
|
||||||
break;
|
|
||||||
case FALLING_BLOCK:
|
|
||||||
spawnType.set(packet, EntityTypes.E);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException(type.name() + " is not implemented");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, GameProfile.class, int.class, enumGamemode, iChatBaseComponent, Reflection.getClass("net.minecraft.world.entity.player.ProfilePublicKey$a"));
|
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, GameProfile.class, int.class, enumGamemode, iChatBaseComponent, Reflection.getClass("net.minecraft.world.entity.player.ProfilePublicKey$a"));
|
||||||
@Override
|
@Override
|
||||||
public Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode) {
|
public Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode) {
|
||||||
|
@ -21,9 +21,14 @@ package de.steamwar.core;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper {
|
public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<String> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 1);
|
private static final Reflection.FieldAccessor<String> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 1);
|
||||||
@ -84,4 +89,26 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
public Object formatDisplayName(String displayName) {
|
public Object formatDisplayName(String displayName) {
|
||||||
return displayName != null ? displayName : "";
|
return displayName != null ? displayName : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final Reflection.FieldAccessor<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, int.class, Core.getVersion() > 8 ? 6 : 9);
|
||||||
|
private static final Reflection.FieldAccessor<Integer> spawnLivingType = Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
||||||
|
private static final Map<EntityType, Object> types = new HashMap<>();
|
||||||
|
static {
|
||||||
|
types.put(EntityType.PRIMED_TNT, 50);
|
||||||
|
types.put(EntityType.ARMOR_STAND, 30);
|
||||||
|
types.put(EntityType.ARROW, 60);
|
||||||
|
types.put(EntityType.FIREBALL, 63);
|
||||||
|
types.put(EntityType.ITEM_FRAME, 18);
|
||||||
|
types.put(EntityType.FALLING_BLOCK, 21);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setSpawnPacketType(Object packet, EntityType type) {
|
||||||
|
(type.isAlive() ? spawnLivingType : spawnType).set(packet, types.get(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getViewDistance(Player player) {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,6 @@ package de.steamwar.core;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ProtocolWrapper8 implements ProtocolWrapper {
|
public class ProtocolWrapper8 implements ProtocolWrapper {
|
||||||
|
|
||||||
@ -45,35 +41,6 @@ public class ProtocolWrapper8 implements ProtocolWrapper {
|
|||||||
equipmentStack.set(packet, stack);
|
equipmentStack.set(packet, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<?> spawnType;
|
|
||||||
private static final Reflection.FieldAccessor<Integer> spawnLivingType = Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
|
||||||
private static final Map<EntityType, Object> types = new HashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
if(Core.getVersion() < 14) {
|
|
||||||
spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, int.class, Core.getVersion() > 8 ? 6 : 9);
|
|
||||||
types.put(EntityType.PRIMED_TNT, 50);
|
|
||||||
types.put(EntityType.ARMOR_STAND, 30);
|
|
||||||
types.put(EntityType.ARROW, 60);
|
|
||||||
types.put(EntityType.FIREBALL, 63);
|
|
||||||
types.put(EntityType.ITEM_FRAME, 18);
|
|
||||||
types.put(EntityType.FALLING_BLOCK, 21);
|
|
||||||
} else {
|
|
||||||
Class<?> entityTypes = Reflection.getClass("{nms.world.entity}.EntityTypes");
|
|
||||||
spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, entityTypes, 0);
|
|
||||||
types.put(EntityType.ARMOR_STAND, 1);
|
|
||||||
for(EntityType type : new EntityType[]{EntityType.PRIMED_TNT, EntityType.ARROW, EntityType.FIREBALL, EntityType.ITEM_FRAME, EntityType.FALLING_BLOCK})
|
|
||||||
types.put(type, Reflection.getField(entityTypes, type != EntityType.PRIMED_TNT ? type.name() : "TNT", entityTypes).get(null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void setSpawnPacketType(Object packet, EntityType type) {
|
|
||||||
if(type.isAlive())
|
|
||||||
spawnLivingType.set(packet, types.get(type));
|
|
||||||
else
|
|
||||||
spawnType.set(packet, types.get(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
||||||
@Override
|
@Override
|
||||||
public Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode) {
|
public Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode) {
|
||||||
|
@ -46,28 +46,8 @@ public class Core extends JavaPlugin{
|
|||||||
|
|
||||||
public static final Message MESSAGE = new Message("SpigotCore", Core.class.getClassLoader());
|
public static final Message MESSAGE = new Message("SpigotCore", Core.class.getClassLoader());
|
||||||
|
|
||||||
private static final int VERSION;
|
private static final int VERSION = Integer.parseInt(Bukkit.getServer().getClass().getPackage().getName().split("_", 3)[1]);
|
||||||
static{
|
|
||||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
|
||||||
if(packageName.contains("1_19"))
|
|
||||||
VERSION = 19;
|
|
||||||
else if(packageName.contains("1_18"))
|
|
||||||
VERSION = 18;
|
|
||||||
else if(packageName.contains("1_15"))
|
|
||||||
VERSION = 15;
|
|
||||||
else if(packageName.contains("1_14"))
|
|
||||||
VERSION = 14;
|
|
||||||
else if(packageName.contains("1_12"))
|
|
||||||
VERSION = 12;
|
|
||||||
else if(packageName.contains("1_10"))
|
|
||||||
VERSION = 10;
|
|
||||||
else if(packageName.contains("1_9"))
|
|
||||||
VERSION = 9;
|
|
||||||
else if(packageName.contains("1_8"))
|
|
||||||
VERSION = 8;
|
|
||||||
else
|
|
||||||
VERSION = 18;
|
|
||||||
}
|
|
||||||
public static int getVersion(){
|
public static int getVersion(){
|
||||||
return VERSION;
|
return VERSION;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ package de.steamwar.core;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class FlatteningWrapper {
|
public class FlatteningWrapper {
|
||||||
@ -42,6 +44,10 @@ public class FlatteningWrapper {
|
|||||||
Object getPose(EntityPose pose);
|
Object getPose(EntityPose pose);
|
||||||
void setNamedSpawnPacketDataWatcher(Object packet);
|
void setNamedSpawnPacketDataWatcher(Object packet);
|
||||||
Object formatDisplayName(String displayName);
|
Object formatDisplayName(String displayName);
|
||||||
|
|
||||||
|
void setSpawnPacketType(Object packet, EntityType type);
|
||||||
|
|
||||||
|
int getViewDistance(Player player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum EntityPose {
|
public enum EntityPose {
|
||||||
|
@ -21,7 +21,6 @@ package de.steamwar.core;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
|
|
||||||
public interface ProtocolWrapper {
|
public interface ProtocolWrapper {
|
||||||
|
|
||||||
@ -41,8 +40,6 @@ public interface ProtocolWrapper {
|
|||||||
|
|
||||||
void setEquipmentPacketStack(Object packet, Object slot, Object stack);
|
void setEquipmentPacketStack(Object packet, Object slot, Object stack);
|
||||||
|
|
||||||
void setSpawnPacketType(Object packet, EntityType type);
|
|
||||||
|
|
||||||
Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode);
|
Object playerInfoDataConstructor(Object packet, GameProfile profile, Object mode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ public class REntity {
|
|||||||
return entity -> {
|
return entity -> {
|
||||||
Object packet = packetGenerator.apply(entity);
|
Object packet = packetGenerator.apply(entity);
|
||||||
uuid.set(packet, entity.uuid);
|
uuid.set(packet, entity.uuid);
|
||||||
ProtocolWrapper.impl.setSpawnPacketType(packet, entity.entityType);
|
FlatteningWrapper.impl.setSpawnPacketType(packet, entity.entityType);
|
||||||
return packet;
|
return packet;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package de.steamwar.entity;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
|
import de.steamwar.core.FlatteningWrapper;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -212,7 +213,7 @@ public class REntityServer implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int viewRadius(Player player) {
|
private int viewRadius(Player player) {
|
||||||
return player.getClientViewDistance() / 2;
|
return FlatteningWrapper.impl.getViewDistance(player) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long entityToId(REntity entity) {
|
private long entityToId(REntity entity) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren