Hey, Making this plugin where if you left click a player with a blazerod it mutes them. When a player "mutes" a player by hitting them, it says that the player is muted in Chat, but they can still speak. Can you spot the issue? CODE: http://pastebin.com/MHGeL56z Config file: mutedplayers:
@Abyssal Why don't you just store it in variables and let the config be a clone of that instead of the other way around? And it probably has to do with the fact that you are removing the old muted players every time that you mute somebody.
Hi, I am very new to doing plugins, this is my second one. I remove the muted players from the list so it doesn't keep adding the same muted players to the list again, but it seems to only add one name, I have no idea what is happening, I am out of my depth to be honest, but I just want to know what is wrong.. XD Is there a way to add a name to a config list instead of setting the list? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
@Abyssal Use a Set, then it won't add him again. And you add a user, set the list, then you remove the user, you never look at what is actually in the list.
But when the server restarts the string list(not config one) will become empty, so then it will set the list again and unmute them automatically, or am I wrong
@Abyssal You can create a method that inputs the objects into the config onDisable(); then add them again in the onEnable(); EDIT: Sniped.
I have tried this public void onEnable() { Bukkit.getServer().getPluginManager().registerEvents(this, this); muted.set(this.getConfig().getList("restart")); } public void onDisable() { this.getConfig().set("restart", muted); } But, I can't set the "muted" in the onEnable because it's a list
Thanks for your help, and I am sorry that I am being such a pain. I have another issue now, when I hit the player (with mute mode enabled) this error comes up: http://i.imgur.com/bD80m4h.png - caused by the EntityDamageByEntity event Code: http://pastebin.com/Rw1XBWhm
@Abyssal 1. There is a method getStringList, then you don't need to cast it. 2. There is no value in the config yet, so muted is set to null in the onEnable