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_9_R1</artifactId>
@@ -9,8 +9,8 @@ import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_9_R1.IChatBaseComponent;
import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_9_R1.WorldSettings;
import org.bukkit.ChatColor;
import java.util.Collections;
import java.util.List;
/**
@@ -24,14 +24,10 @@ public class PacketPlayOutPlayerInfoWrapper {
.set(packetPlayOutPlayerInfo, action);
PacketPlayOutPlayerInfo.PlayerInfoData playerInfoData = new PacketPlayOutPlayerInfo().new PlayerInfoData(gameProfile, 1,
WorldSettings.EnumGamemode.NOT_SET, IChatBaseComponent.ChatSerializer.b("{\"text\":\"" + ChatColor.BLUE + "[NPC] " + name + "\"}"));
WorldSettings.EnumGamemode.NOT_SET, IChatBaseComponent.ChatSerializer.a("{\"text\":\"[NPC] " + name + "\",\"color\":\"dark_gray\"}"));
Reflection.FieldAccessor<List> fieldAccessor = Reflection.getField(packetPlayOutPlayerInfo.getClass(),
"b", List.class);
List<PacketPlayOutPlayerInfo.PlayerInfoData> list = fieldAccessor.get(packetPlayOutPlayerInfo);
list.add(playerInfoData);
fieldAccessor.set(packetPlayOutPlayerInfo, list);
Reflection.FieldAccessor<List> fieldAccessor = Reflection.getField(packetPlayOutPlayerInfo.getClass(), "b", List.class);
fieldAccessor.set(packetPlayOutPlayerInfo, Collections.singletonList(playerInfoData));
return packetPlayOutPlayerInfo;
}
@@ -8,6 +8,7 @@ import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_9_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;
}