Minecraft Spigot TabList Prefix plugin write?

La
- in Mods
19

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.

Ca

Pastebin or something like that would have been better, so you can hardly read the code

Edit:

Lo

When do you carry out the method?

La

At a PlayerJoinEvent

Lo

Pack up

p.setScoreboard (sb);

for all players according to the for loop mti setTeams

La

Do you mean in the loop?

Lo

In a second loop

La

How?

La

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?

Lo

With permissionsex in permissions.yml is enough

Dr

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

La

How to do it with vault?

La

No, above I wrote yes if (player.hasPermission ("server.owner"), if I now enter it in the group admin in permissionsEx, nothing happens

Dr

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

Dr

Server restarted?

La

Yes, is it maybe the essentials?

La

Above all, with the query if (PermissionsEx.inGroup (p)) it worked for a chat plugin

Dr

No… It's not because

La

Then why is it?

Dr

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…