Fixed tab name issue, added metrics, changed version to 2.6-SNAPSHOT

This commit is contained in:
Jitse Boonstra
2020-04-18 13:39:10 +02:00
parent ab57a9b861
commit ce251d8167
41 changed files with 829 additions and 143 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
<parent>
<groupId>net.jitse</groupId>
<artifactId>npclib-nms</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6-SNAPSHOT</version>
</parent>
<artifactId>npclib-nms-v1_11_R1</artifactId>
@@ -9,8 +9,8 @@ import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_11_R1.EnumGamemode;
import net.minecraft.server.v1_11_R1.IChatBaseComponent;
import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo;
import org.bukkit.ChatColor;
import java.util.Collections;
import java.util.List;
/**
@@ -28,15 +28,11 @@ public class PacketPlayOutPlayerInfoWrapper {
Reflection.getField(packetPlayOutPlayerInfo.getClass(), "a", PacketPlayOutPlayerInfo.EnumPlayerInfoAction.class)
.set(packetPlayOutPlayerInfo, action);
Object playerInfoData = playerInfoDataConstructor.invoke(packetPlayOutPlayerInfo,
gameProfile, 1, EnumGamemode.NOT_SET,
IChatBaseComponent.ChatSerializer.b("{\"text\":\"" + ChatColor.BLUE + "[NPC] " + name + "\"}")
);
Object playerInfoData = playerInfoDataConstructor.invoke(packetPlayOutPlayerInfo, gameProfile, 1, EnumGamemode.NOT_SET,
IChatBaseComponent.ChatSerializer.b("{\"text\":\"[NPC] " + name + "\",\"color\":\"dark_gray\"}"));
Reflection.FieldAccessor<List> fieldAccessor = Reflection.getField(packetPlayOutPlayerInfo.getClass(), "b", List.class);
List list = fieldAccessor.get(packetPlayOutPlayerInfo);
list.add(playerInfoData);
fieldAccessor.set(packetPlayOutPlayerInfo, list);
fieldAccessor.set(packetPlayOutPlayerInfo, Collections.singletonList(playerInfoData));
return packetPlayOutPlayerInfo;
}
@@ -8,6 +8,7 @@ import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_11_R1.PacketPlayOutScoreboardTeam;
import java.util.Collection;
import java.util.Collections;
/**
* @author Jitse Boonstra
@@ -31,9 +32,7 @@ public class PacketPlayOutScoreboardTeamWrapper {
.set(packetPlayOutScoreboardTeam, 0);
Reflection.FieldAccessor<Collection> collectionFieldAccessor = Reflection.getField(
packetPlayOutScoreboardTeam.getClass(), "h", Collection.class);
Collection collection = collectionFieldAccessor.get(packetPlayOutScoreboardTeam);
collection.add(name);
collectionFieldAccessor.set(packetPlayOutScoreboardTeam, collection);
collectionFieldAccessor.set(packetPlayOutScoreboardTeam, Collections.singletonList(name));
return packetPlayOutScoreboardTeam;
}