Fixed: Player list
This commit is contained in:
@@ -425,6 +425,7 @@ public class InnerCoreServer {
|
|||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("Available modpacks: ");
|
builder.append("Available modpacks: ");
|
||||||
for (ModPack modpack : modpacks) {
|
for (ModPack modpack : modpacks) {
|
||||||
|
builder.append(',');
|
||||||
builder.append(modpack.getRootDirectory().getName());
|
builder.append(modpack.getRootDirectory().getName());
|
||||||
}
|
}
|
||||||
builder.append('.');
|
builder.append('.');
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.reider745.hooks;
|
package com.reider745.hooks;
|
||||||
|
|
||||||
|
import cn.nukkit.Player;
|
||||||
import cn.nukkit.entity.Entity;
|
import cn.nukkit.entity.Entity;
|
||||||
import cn.nukkit.entity.custom.EntityDefinition;
|
import cn.nukkit.entity.custom.EntityDefinition;
|
||||||
import cn.nukkit.entity.custom.EntityManager;
|
import cn.nukkit.entity.custom.EntityManager;
|
||||||
import cn.nukkit.level.format.FullChunk;
|
import cn.nukkit.level.format.FullChunk;
|
||||||
import cn.nukkit.nbt.tag.CompoundTag;
|
import cn.nukkit.nbt.tag.CompoundTag;
|
||||||
|
import cn.nukkit.network.protocol.DataPacket;
|
||||||
|
import cn.nukkit.network.protocol.PlayerListPacket;
|
||||||
import com.reider745.api.ReflectHelper;
|
import com.reider745.api.ReflectHelper;
|
||||||
import com.reider745.api.hooks.HookClass;
|
import com.reider745.api.hooks.HookClass;
|
||||||
import com.reider745.api.hooks.annotation.Hooks;
|
import com.reider745.api.hooks.annotation.Hooks;
|
||||||
@@ -87,8 +90,17 @@ public class EntityOverrides implements HookClass {
|
|||||||
@Inject(className = "cn.nukkit.entity.Entity")
|
@Inject(className = "cn.nukkit.entity.Entity")
|
||||||
public static void scheduleUpdate(Entity self){
|
public static void scheduleUpdate(Entity self){
|
||||||
try {
|
try {
|
||||||
if(self.isPlayer)
|
if(self instanceof Player player) {
|
||||||
|
final long id_pre = self.getId();
|
||||||
fieldId.set(self, (long) getOrCreate(self.getUniqueId()));
|
fieldId.set(self, (long) getOrCreate(self.getUniqueId()));
|
||||||
|
|
||||||
|
final PlayerListPacket pk = new PlayerListPacket();
|
||||||
|
pk.type = PlayerListPacket.TYPE_REMOVE;
|
||||||
|
pk.entries = new PlayerListPacket.Entry[]{
|
||||||
|
new PlayerListPacket.Entry(player.getUniqueId(), id_pre, player.getDisplayName(), player.getSkin(), "")
|
||||||
|
};
|
||||||
|
player.dataPacket(pk);
|
||||||
|
}
|
||||||
} catch (IllegalAccessException | IOException e) {
|
} catch (IllegalAccessException | IOException e) {
|
||||||
self.getServer().getLogger().logException(e);
|
self.getServer().getLogger().logException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user