Minecraft plugins code error?

gr
- in Plugins
12

? I'm currently writing a prefix plugin that works with permissions.

I always get an error when joining the server.

how can that be?

here the error:

org.bukkit.event.EventException

at org.bukkit.plugin.java.JavaPluginLoader $ 1.execute (JavaPluginLoader.java:310) ~ [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at org.bukkit.plugin.RegisteredListener.callEvent (RegisteredListener.java:62) ~ [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at org.bukkit.plugin.SimplePluginManager.fireEvent (SimplePluginManager.java:502) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at org.bukkit.plugin.SimplePluginManager.callEvent (SimplePluginManager.java:487) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin (PlayerList.java:298) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.PlayerList.a (PlayerList.java:157) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.LoginListener.b (LoginListener.java:144) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.LoginListener.c (LoginListener.java:54) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.NetworkManager.a (NetworkManager.java:231) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.ServerConnection.c (ServerConnection.java:148) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.MinecraftServer.B (MinecraftServer.java:814) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.DedicatedServer.B (DedicatedServer.java:374) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.MinecraftServer.A (MinecraftServer.java:654) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at net.minecraft.server.v1_8_R3.MinecraftServer.run (MinecraftServer.java:557) [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at java.lang.Thread.run (Unknown Source) [?: 1.8.0_261]

Caused by: java.lang.IllegalArgumentException: Team name '000Staff' is already in use

at org.apache.commons.lang.Validate.isTrue (Validate.java:136) ~ [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftScoreboard.registerNewTeam (CraftScoreboard.java:140) ~ [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

at Luka.Prefix.prefix.setSb (prefix.java:13) ~ [?:?]

at Luka.Prefix.PlayerJoinListener.onJoin (PlayerJoinListener.java:11) ~ [?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) ~ [?: 1.8.0_261]

at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source) ~ [?: 1.8.0_261]

at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source) ~ [?: 1.8.0_261]

at java.lang.reflect.Method.invoke (Unknown Source) ~ [?: 1.8.0_261]

at org.bukkit.plugin.java.JavaPluginLoader $ 1.execute (JavaPluginLoader.java:306) ~ [spigot1.8.8.jar: git-Spigot-db6de12-18fbb24]

… 14 more

As

Caused by: java.lang.IllegalArgumentException: Team name '000Staff' is already in use

Seems to be causing the error. Do you have multiple answers somewhere? Variable declared multiple times?

gr

Don't know wait a minute

gr

No I don't, here is the code: (not the main class)

public class prefix {
private static scoreboard sb;

public static void setScoreboard () {
sb = Bukkit.getScoreboardManager (). GetMainScoreboard ();

sb.registerNewTeam ("000Staff");
sb.registerNewTeam ("001Mod");
sb.registerNewTeam ("002Dev");
sb.registerNewTeam ("003Sup");
sb.registerNewTeam ("004Build");
sb.registerNewTeam ("005YT");
sb.registerNewTeam ("006Freund");
sb.registerNewTeam ("007VIP +");
sb.registerNewTeam ("008VIP");
sb.registerNewTeam ("009Player");
sb.getTeam ("000Staff"). SetPrefix ("§4Staff §8┃§4");
sb.getTeam ("001Mod"). SetPrefix ("§cMod §8┃ §c");
sb.getTeam ("002Dev"). SetPrefix ("§bDev §8┃ §b");
sb.getTeam ("003Sup"). SetPrefix ("§aSup §8┃ §a");
sb.getTeam ("004Build"). SetPrefix ("§aBuild §8┃ §a");
sb.getTeam ("005YT"). SetPrefix ("§cY§fT §8┃ §c");
sb.getTeam ("006Freund"). SetPrefix ("§aFreund §8┃ §a");
sb.getTeam ("007VIP +"). SetPrefix ("§6VIP + §8┃ §6");
sb.getTeam ("008VIP"). SetPrefix ("§6VIP §8┃ §6");
sb.getTeam ("009player"). SetPrefix ("§8player §8┃ §8");
for (Player all: Bukkit.getOnlinePlayers ()) {
setTeams (all);
}

}
public static void setTeams (Player p) {

String team = "";
if (p.hasPermission ("rank.admin")) {
team = "000Staff";
} else {
if (p.hasPermission ("rank.mod")) {
team = "001Mod";
} else {
if (p.hasPermission ("rank.dev")) {
team = "002Dev";
} else {
if (p.hasPermission ("rank.sup")) {
team = "003Sup";
} else {
if (p.hasPermission ("rank.build")) {
team = "004Build";
} else {
if (p.hasPermission ("rank.yt")) {
team = "005YT";
} else {
if (p.hasPermission ("rank.friend")) {
team = "006friend";
} else {
if (p.hasPermission ("rank.vip +")) {
team = "007VIP +";
} else {
if (p.hasPermission ("rank.vip")) {
team = "008VIP";
} else {
team = "009player";
}
}
}
}
}
}
}
}
}
p.setDisplayName (sb.getTeam (team) .getPrefix () + p.getName ());
p.setScoreboard (sb);
}

}

As

Everything is right so far. Are you using 000Staff anywhere else independent of this code fragment?

gr

Wait

gr

This is for the chat public class cprefix implements listener {
public String staff = "§4Staff §8┃ §4";

public String mod = "§cMod §8┃ §c";

public string dev = "§bDev §8┃ §b";

public string sup = "§aSup§8 ┃§a";

public String build = "§aBuild §8┃ §a";

public string yt = "§5YT §8┃ §5";

public String friend = "§aFreund §8┃ §a";

public string vipplus = "§eVIP§6 + §8┃ §8";

public string vip = "§6VIP §8┃ §6";

public String player = "§8player §8┃ §8";

@EventHandler
public void onChat (AsyncPlayerChatEvent event) {
Player player = event.getPlayer ();
String Msg = event.getMessage ();
Msg = Msg.replace ("&", "§");
if (player.hasPermission ("rank.staff")) {
event.setFormat (staff + player.getName () + "§8» §f "+ Msg);
} else if (player.hasPermission ("rank.mod")) {
event.setFormat (mod + player.getName () + "§8» §f "+ Msg);
} else if (player.hasPermission ("rank.dev")) {
event.setFormat (dev + player.getName () + "§8» §f "+ Msg);
} else if (player.hasPermission ("rank.sup")) {
event.setFormat (sup + player.getName () + "§8» §f "+ Msg);
} else if (player.hasPermission ("rank.build")) {
event.setFormat (build + player.getName () + "§8» §f "+ Msg);
} else if (player.hasPermission ("rank.friend")) {
event.setFormat (friend + player.getName () + "§8» §f "+ Msg);
} else {
if (player.hasPermission ("rank.yt")) {
event.setFormat (yt + player.getName () + "§8» §f "+ Msg);
} else if (player.hasPermission ("rank.vip +")) {
event.setFormat (vipplus + player.getName () + "§8» §f "+ Msg);
} else if (player.hasPermission ("rank.vip")) {
event.setFormat (vip + player.getName () + "§8» §f "+ Msg);
}
event.setFormat (player + player.getName () + "§8» §f "+ Msg);
}
}
}

gr

And I also have a joinlistener class that triggers the setScoreboard method

As

You register using

sb.registerNewTeam ("000Staff");

A team, and then assigns exactly the same name to a player below, did I understand you correctly?

if (p.hasPermission ("rank.admin")) {
team = "000Staff";

gr

So first it is checked (with the permissions) which group I belonged to, and then the string team is set to the respective group name.

then I'll be transferred to the team

So the player does not get a new name, but is simply added to the group based on this "000Staff"

As

I see… Does this help you? https://bukkit.org/threads/deprecated-team-addplayer-p.474895/

gr

I don't think I've registered everything

As

https://bukkit.org/threads/error-with-teams-scoreboards.155860/

And this?

Script Error Message? Sh Shockbakery71
What is this message? St StephanieItchy
Minecraft crashes (Opengl)? tu turtlebrayan