I Made this plugin which if you have the permission such as staffjoin.mod when the player with that specific permission joins they will get a message saying [Mod]{playername} Has Joined! Aswell as a sound. even without the permission it still executes the code. Even if i dont have the permission. Here is the code: [Removed] Also need to say it is a staff announce plugin. Basically it executes the two if statements even when the player dosen't have the permission! ;o
Need more details; Are the player testing it OPed?: Yes/No And also a copy of your plugin.yml please.
Yes i was OP when testing it. I deoped myself just there to test it that way and it looks like it works when not opped. But when a op joins i dont want it to say the messages for an owner which is opped. Here is my plugin.yml
Here is your problem, you did not register your permissions, add your permissions in this format (making an example with this): Code (Text): permissions: staffjoin.mod: default: op More details over there: http://wiki.bukkit.org/Plugin_YAML If your problem is solved, please tag your post as "Solved"!
Umm, look at the syntax in the link I gave you. Go all the way down and you'll find the example, follow the same syntax and you'll understand! If you have any doubts you may ask me again.
I added the permissions part to my plugin.yml and exported the plugin again but when i am opped i still get those messages when im owner so i wouldn't like them messages to appear. Here is a minecraft screenshot: And here is my updated plugin.yml:
You see those two "if" blocks? Try linking them with an "else", it should do "if(){//BlaBla} else if(){//BlaBla)}" Ok you know what, wait, I am remaking your whole onPlayerJoin block...
Ok, here it is, make the auto adjustments needed (I have not tested it, just made it). Code (Text): @EventHandler public void onPlayerJoin(PlayerJoinEvent e){ if(e.getPlayer().hasPermission("staffjoin.mod")){ for(Player p : Bukkit.getOnlinePlayers()){ p.playSound(p.getLocation(), Sound.valueOf(ModJoinSound), 50.0F, 50.0F); } Bukkit.broadcastMessage(ChatColor.GREEN + "[Mod] " + ChatColor.AQUA + e.getPlayer().getName() + " Has Joined!"); } else if(e.getPlayer().hasPermission("staffjoin.admin")){ for(Player p : Bukkit.getOnlinePlayers()){ p.playSound(p.getLocation(), Sound.valueOf(AdminJoinSound), 50.0F, 50.0F); } Bukkit.broadcastMessage(ChatColor.GREEN + "[Admin] " + ChatColor.AQUA + e.getPlayer().getName() + " Has Joined!"); } } Keep me updated
Seems better... And for you, Orinion77 is right, didnt think about it but change "default: op" by "default: false". Any error log in console?
And you should use e.setJoinMessage() and put the message there. And also you should make an else and put there a message to show when a normal player joins... F.e. Code (Text): @EventHandler public void onPlayerJoin(PlayerJoinEvent e){ if(e.getPlayer().hasPermission("staffjoin.mod")){ for(Player p : Bukkit.getOnlinePlayers()){ p.playSound(p.getLocation(), Sound.valueOf(ModJoinSound), 50.0F, 50.0F); } e.setJoinMessage(ChatColor.GREEN + "[Mod] " + ChatColor.AQUA + e.getPlayer().getName() + " Has Joined!"); } else if(e.getPlayer().hasPermission("staffjoin.admin")){ for(Player p : Bukkit.getOnlinePlayers()){ p.playSound(p.getLocation(), Sound.valueOf(AdminJoinSound), 50.0F, 50.0F); } e.setJoinMessage(ChatColor.GREEN + "[Admin] " + ChatColor.AQUA + e.getPlayer().getName() + " Has Joined!"); }else{ e.setJoinMessage(ChatColor.GREEN + "[Player] " + ChatColor.AQUA + e.getPlayer().getName() + " Has Joined!"); } }
I do not agree... if he still wants to see the normal join messages and the additionnal ones he does not have to use it. There's a difference between a "you should" and a "you can"...
Thats how I would do it... Sry when I didn't use the correct word because English is not my first language... But the default messages are very ugly.... xD