I am Not Sure where the Problem is....

Off topicProgramming → I am Not Sure where the Problem is....

I’m making staffchat plugin.. I don’n know why it doesn’t work:

Code

Can anyone help me?

What doesn’t work tho? For me it works as intended. No description given -> It shall do nothing. It does nothing -> works as intended. xD

Oh and, move this to git maybe?

…. It’s just a staff chat plugin lol… Should work as other staff chat plugins lol
Oh and btw this isn’t even everything. What’s your plugin structure? I (once again) suggest moving it to git so I can actually see everything of it lol

@LogalCoder Before changing anything, me and @Mr_RedSheep were testing the plugin… Seems like only other players can see it and not the sender… Not sure why.

for(Player staff : Bukkit.getOnlinePlayers()){ p.sendMessage(ChatColor.BLACK + "[" + ChatColor.AQUA + "Staff Chat" + ChatColor.BLACK + "] " + ChatColor.RED + sender.getName() + ":" + ChatColor.YELLOW + str.toString().trim()); staff.sendMessage(ChatColor.BLACK + "[" + ChatColor.AQUA + "Staff Chat" + ChatColor.BLACK + "] " + ChatColor.RED + sender.getName() + ":" + ChatColor.YELLOW + str.toString().trim()); } This will send the staff message to every player online… Not only that, it will send it to the sender the amount of players online times… (Great sentence)

Nope, it won’t. If you’ll do

for(Player staff : Bukkit.getOnlinePlayers().size){ }

It will. Size get’s the amount of players online at the time of the executemiontion (nice spelling huh?) Example:

if(label.equalsIgnoreCase("list")) sender.sendMessage("There are " + Bukkit.getOnlinePlayers().size + "/" + Bukkit.getMaxPlayers() + " online.");

@LogalCoder Have you read the first sentence..? Anyways I don’t want to argue, I’m not sure why the sender can’t see the message. It doesn’t make a loop as you said, as me an @Mr_RedSheep were testing this..
@K0alaCraft While testing I found out you atlas messed up the arguments… Also when I use it it repeats it 3 times. No idea whats going on.
for(int i = 1; i < args.length; i++){ str.append(args[i] + " "); Shouldn’t i be 0? Just wondering…

String message = args.join(" “);

Done.

Ok thanks. @LogalCoder I’m pretty sure I can use alias on the plugin.yml; like: commnds: s alias: [staffchat, sc]