Change getDisplayName() to getPlayerListName()

This commit is contained in:
libraryaddict 2018-01-03 15:32:29 +13:00
parent 5b86025fa0
commit 68a4f125e9
2 changed files with 15 additions and 16 deletions

View File

@ -530,7 +530,7 @@ public abstract class Disguise {
deleteTab.getPlayerInfoDataLists().write(0, Arrays.asList(
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0,
NativeGameMode.SURVIVAL,
WrappedChatComponent.fromText(((Player) getEntity()).getDisplayName()))));
WrappedChatComponent.fromText(((Player) getEntity()).getPlayerListName()))));
try {
for (Player player : Bukkit.getOnlinePlayers()) {

View File

@ -1,14 +1,5 @@
package me.libraryaddict.disguise.disguisetypes;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketContainer;
@ -16,10 +7,17 @@ import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
import com.comphenix.protocol.wrappers.PlayerInfoData;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.ReflectionManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public abstract class TargetedDisguise extends Disguise {
@ -28,7 +26,8 @@ public abstract class TargetedDisguise extends Disguise {
}
public enum TargetType {
HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS, SHOW_TO_EVERYONE_BUT_THESE_PLAYERS
HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS,
SHOW_TO_EVERYONE_BUT_THESE_PLAYERS
}
private ArrayList<String> disguiseViewers = new ArrayList<>();
@ -59,8 +58,8 @@ public abstract class TargetedDisguise extends Disguise {
canSee(player) ? PlayerInfoAction.REMOVE_PLAYER : PlayerInfoAction.ADD_PLAYER);
deleteTab.getPlayerInfoDataLists().write(0, Arrays.asList(
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0,
NativeGameMode.SURVIVAL,
WrappedChatComponent.fromText(((Player) getEntity()).getDisplayName()))));
NativeGameMode.SURVIVAL, WrappedChatComponent
.fromText(((Player) getEntity()).getPlayerListName()))));
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
}
@ -122,8 +121,8 @@ public abstract class TargetedDisguise extends Disguise {
canSee(player) ? PlayerInfoAction.ADD_PLAYER : PlayerInfoAction.REMOVE_PLAYER);
deleteTab.getPlayerInfoDataLists().write(0, Arrays.asList(
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0,
NativeGameMode.SURVIVAL,
WrappedChatComponent.fromText(((Player) getEntity()).getDisplayName()))));
NativeGameMode.SURVIVAL, WrappedChatComponent
.fromText(((Player) getEntity()).getPlayerListName()))));
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
}