I'm currently coding on a TabList prefix plugin, and no matter what I try, the prefix is never given. Currently the plugins folder contains the PermissionsEx, Vault and Essentials in addition to the plugin. The server runs on 1.8.
Here is the code:
package me.didi.main;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
public class TabList {
private static scoreboard sb;
public static void setScoreBoard () {
sb = Bukkit.getScoreboardManager (). GetNewScoreboard ();
sb.registerNewTeam ("000Owner");
sb.registerNewTeam ("001Admin");
sb.registerNewTeam ("002Developer");
sb.registerNewTeam ("003Mod");
sb.registerNewTeam ("005Vip");
sb.registerNewTeam ("006Player");
sb.getTeam ("000Owner"). SetPrefix ("§r [§4Owner§r]");
sb.getTeam ("001Admin"). SetPrefix ("§r [§cAdmin§r]");
sb.getTeam ("002Developer"). SetPrefix ("§r [§bDev§r]");
sb.getTeam ("003Mod"). SetPrefix ("§r [§eMod§r]");
sb.getTeam ("005Vip"). SetPrefix ("§r [§6VIP§r]");
sb.getTeam ("006Player"). SetPrefix ("§7");
for (Player all: Bukkit.getOnlinePlayers ()) {
setTeams (all);
}
}
private static void setTeams (Player p) {
String team = "";
if (p.hasPermission ("server.owner")) {
team = "000Owner";
}
if (p.hasPermission ("server.admin")) {
team = "001Admin";
}
if (p.hasPermission ("server.developer") || p.isOp ()) {
team = "002Developer";
}
if (p.hasPermission ("server.mod")) {
team = "003Mod";
}
if (p.hasPermission ("server.vip")) {
team = "005Vip";
}
if (p.hasPermission ("server.player")) {
team = "006Player";
}
sb.getTeam (team) .addPlayer (p);
p.setScoreboard (sb);
}
}
If you know an answer, please help me.
Pastebin or something like that would have been better, so you can hardly read the code
Edit:
When do you carry out the method?
At a PlayerJoinEvent
Pack up
p.setScoreboard (sb);
for all players according to the for loop mti setTeams
Do you mean in the loop?
In a second loop
How?
Found the error, is with the permissions. The question is, how do I set the permissions in the Plugin.yml and at PermissionsEx in the permissions.yml?
With permissionsex in permissions.yml is enough
In general, it might be better to query the ranks with Vault instead of using permissions…
I would also advise against PermissionsEx at the moment. The main reason for this can be found on the Bukkit page of PermissionsEx
How to do it with vault?
No, above I wrote yes if (player.hasPermission ("server.owner"), if I now enter it in the group admin in permissionsEx, nothing happens
https://www.spigotmc.org/...nto-vault/
There's even an example of how to use the economy part.
If you can speak a little English, you will quickly find out how to use the Permissions section
Server restarted?
Yes, is it maybe the essentials?
Above all, with the query if (PermissionsEx.inGroup (p)) it worked for a chat plugin
No… It's not because
Then why is it?
If you were so friendly and could search the log…
There's an error message from your plugin somewhere.
But honestly:
Why permissions at all? Is I a little stupid…