-1
嘿家伙我只是让我的tablist插件。我一直在尝试这一点。我已经尝试了很多东西,迄今为止还没有人出来工作。我的目标是自动添加一个派系成员名称,如果他们加入显示在线成员的列表并自动删除它。自动添加和删除列表中的项目
更清晰的解释: 派系成员的名字必须在他们加入时显示在tablist上。我尝试过,并且将它们全部组合在Tablist的1条或1条插槽中。 我希望他们在1个tablot中显示1个名字。
我怎么能这样做任何想法?
任何人有任何想法?这里是我的代码(这不包括自动加入和离开)
代码几乎是无用的,但在这里它是
if (fplayer.hasFaction())
{
list.setSlot(0, "", ChatColor.DARK_PURPLE + "Home:", "");
if (faction.hasHome())
{
int x = faction.getHome().getBlockX();
int z = faction.getHome().getBlockZ();
String xz = x + ", " + z;
list.setSlot(3, "", ChatColor.BLUE.toString(), ChatColor.YELLOW + xz);
}
else
{
list.setSlot(3, "", ChatColor.DARK_RED.toString(), ChatColor.YELLOW + "Not Set");
}
list.setSlot(1, "", ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("SERVER-NAME")), "");
list.setSlot(2, "", ChatColor.DARK_PURPLE + "End Portals:", "");
list.setSlot(5, "", ChatColor.YELLOW + plugin.getConfig().getString("END-PORTAL-COORDS"), "");
list.setSlot(8, "", ChatColor.YELLOW + "in each ", ChatColor.YELLOW + "quadrant.");
int KILLS = Stats.kdc.getInt("p." + p.getUniqueId().toString() + ".kills");
String KILLSS = Integer.toString(KILLS);
int DEATHS = Stats.kdc.getInt("p." + p.getUniqueId().toString() + ".deaths");
String DEATHSS = Integer.toString(DEATHS);
list.setSlot(22, "", ChatColor.DARK_BLUE.toString(), ChatColor.DARK_PURPLE + "Player Info:");
list.setSlot(25, "", ChatColor.YELLOW + "Kills: ", ChatColor.YELLOW + KILLSS);
list.setSlot(28, "", ChatColor.YELLOW + "Deaths: ", ChatColor.YELLOW + DEATHSS);
DecimalFormat dtrf = new DecimalFormat("#.###");
list.setSlot(10, "", ChatColor.DARK_GREEN.toString(), ChatColor.DARK_PURPLE + "Faction Info:");
list.setSlot(13, "", ChatColor.YELLOW + "DTR: ", String.valueOf(dtrf.format(faction.getDTR())));
list.setSlot(16, "", ChatColor.YELLOW + "Online: ", String.valueOf(faction.getOnlinePlayers().size() + "/" + faction.getSize()));
int x = p.getLocation().getBlockX();
int z = p.getLocation().getBlockZ();
String xz = "(" + x + ", " + z + ")";
list.setSlot(34, "", ChatColor.DARK_PURPLE + "Location:", "");
list.setSlot(37, "", ChatColor.UNDERLINE.toString(), ChatColor.YELLOW + "Unknown");
list.setSlot(40, ChatColor.GRAY + "[" + getCardinalDirection(p) + "] ", ChatColor.MAGIC.toString(), ChatColor.GRAY + xz);
list.setSlot(46, "", ChatColor.DARK_PURPLE + "KoTH:", "");
list.setSlot(49, "", ChatColor.YELLOW + "Name: ", ChatColor.YELLOW + "None");
list.setSlot(52, "", ChatColor.YELLOW + "Loc: ", ChatColor.YELLOW + "None");
list.setSlot(55, "", ChatColor.YELLOW + "Time: ", ChatColor.YELLOW + "None");
list.setSlot(15, "", ChatColor.DARK_PURPLE + "Kit:", "");
list.setSlot(18, "", ChatColor.YELLOW + plugin.getConfig().getString("MAP-KIT"), "");
list.setSlot(24, "", ChatColor.DARK_PURPLE + "Border:", "");
list.setSlot(27, "", ChatColor.YELLOW + plugin.getConfig().getString("BORDER-COORDS"), "");
int i = 0;
for (Player o : Bukkit.getOnlinePlayers()) {
i++;
}
list.setSlot(33, "", ChatColor.DARK_PURPLE + "Players Online ", ChatColor.DARK_PURPLE + ": ");
list.setSlot(36, "", ChatColor.WHITE.toString(), ChatColor.YELLOW + String.valueOf(i));
list.setDefaultPing(1);
也许你应该看看这里http://docs.oracle.com/javase/tutorial/uiswing/components/table.html – MikeJRamsey56
看看泰德星2015年12月28日答案#16。 https://www.spigotmc.org/threads/add-fake-players-to-tablist.111142/ – MikeJRamsey56
@ MikeJRamsey56我的tablist工作正常。我面临的问题是通过自动创建自定义插槽来添加和移除其他玩家阵营中的玩家 – jackc