Fixed tab name issue, added metrics, changed version to 2.6-SNAPSHOT
This commit is contained in:
+1
-1
@@ -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_8_R2</artifactId>
|
||||
|
||||
+4
-7
@@ -10,6 +10,7 @@ import net.minecraft.server.v1_8_R2.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_8_R2.WorldSettings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,14 +24,10 @@ public class PacketPlayOutPlayerInfoWrapper {
|
||||
.set(packetPlayOutPlayerInfo, action);
|
||||
|
||||
PacketPlayOutPlayerInfo.PlayerInfoData playerInfoData = packetPlayOutPlayerInfo.new PlayerInfoData(gameProfile, 1,
|
||||
WorldSettings.EnumGamemode.NOT_SET, IChatBaseComponent.ChatSerializer.a(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;
|
||||
}
|
||||
|
||||
+2
-7
@@ -6,9 +6,9 @@ package net.jitse.npclib.nms.v1_8_R2.packets;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutScoreboardTeam;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author Jitse Boonstra
|
||||
@@ -28,14 +28,9 @@ public class PacketPlayOutScoreboardTeamWrapper {
|
||||
.set(packetPlayOutScoreboardTeam, "never");
|
||||
Reflection.getField(packetPlayOutScoreboardTeam.getClass(), "i", int.class)
|
||||
.set(packetPlayOutScoreboardTeam, 1);
|
||||
// Could not get this working in the PacketPlayOutPlayerInfoWrapper class.
|
||||
Reflection.getField(packetPlayOutScoreboardTeam.getClass(), "c", String.class)
|
||||
.set(packetPlayOutScoreboardTeam, ChatColor.BLUE + "[NPC] ");
|
||||
Reflection.FieldAccessor<Collection> collectionFieldAccessor = Reflection.getField(
|
||||
packetPlayOutScoreboardTeam.getClass(), "g", Collection.class);
|
||||
Collection collection = collectionFieldAccessor.get(packetPlayOutScoreboardTeam);
|
||||
collection.add(name);
|
||||
collectionFieldAccessor.set(packetPlayOutScoreboardTeam, collection);
|
||||
collectionFieldAccessor.set(packetPlayOutScoreboardTeam, Collections.singletonList(name));
|
||||
|
||||
return packetPlayOutScoreboardTeam;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user