OvercastNetwork / SportBukkit

CraftBukkit and Bukkit modifications that improve stability and add new features
99 stars 84 forks source link

I coded a TabList Plugin with SportBukkit, but I have some error. #165

Closed OrigamiDream closed 9 years ago

OrigamiDream commented 9 years ago

first, this is my code. class name> TabList.java

this is the error code.

public void InitializePlayer(Player player) {
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.removePlayer(((CraftPlayer) player).getHandle()));
    PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
    for(int i = 0; i < 60; i++) {
        packet.action = 0;
        GameProfile profile = new GameProfile(UUID.fromString("40f08c66-da55-4816-bd94-8ccb21446547"), this.GetNullSlotName(i));
        Entry entry = new Entry(profile.getId(), this.GetNullSlotName(i), ChatSerializer.a(CraftChatMessage.fromString(this.GetNullSlotName(i))[0]), 0, 1100, profile.getProperties());

        packet.entries = Collections.singletonList(entry);

        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
    }
}

This code doesn't have error. this method fill tab slots with null strings and run in the event, PlayerJoinEvent

public void SendTab(Player player, int index, String fakePrefix, String fakeSuffix) {
    PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam();
    packet.a = this.GetNullSlotName(index);
    packet.b = this.GetNullSlotName(index);
    packet.c = fakePrefix;
    packet.d = fakeSuffix;
    packet.f = 2;
    packet.g = 0;
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}

this method have error. when I join this server, my minecraft client crash. the client error log: 'Expected Error' or 'Ticking screen'

How I know: If I remove it, client didn't crash.

Can i know why client crash? and can you help me to fix?

ElliottWhyman commented 9 years ago

This is not for technical assistance, but for reporting bugs

TheMolkaPL commented 9 years ago

Use markdown please.

```java
public static void main(String[] args) {
    System.out.println("Hello world");
}
OrigamiDream commented 9 years ago

@CaptainElliott This is report. When I run code with another bukkit, It works well. (but very laggy)

tonybruess commented 9 years ago

Using NMS is at your own risk. We only provide support for the API.