Hello, Can someone help me? I am trying to write a small plugin for my server that kills all players at once with the command kall. I am still very new to java and doing all this. I have made a heal all function, I just need help with the kill all. Thank You so much in advance.
Thanks. I actually figured it out about 5 minutes before you posted. Thanks anyways. Do you think you could help me with something else? I am trying to get both of the commands to work together but I am having no suck luck: Code: public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if(cmd.getName().equalsIgnoreCase("healall")){ for (Player p : Bukkit.getServer().getOnlinePlayers()) { p.setHealth(p.getMaxHealth()); } for (Player p : Bukkit.getServer().getOnlinePlayers()) { p.setFoodLevel(20); } return true; } return false; } } How would I add the kill all command with the command /kall? Thanks in advance if you can help or not. Sorry for all the questions, I am trying to learn as best I can.
these 2 pages are your friends: http://wiki.bukkit.org/Plugin_Tutorial http://jd.bukkit.org/doxygen/index.html
Yeah I have been on both of those pages for like 5 hours. I am sure I will get it figured out, again thanks for the help.
Also, this goes in Plugin Development, not Plugin Requests. Just a tip to help stay popular with the general public ^.^
@pat231 Code: for (Player p : Bukkit.getServer().getOnlinePlayers()) { p.setHealth(p.getMaxHealth()); } to: Code: for (Player p : Bukkit.getServer().getOnlinePlayers()) { p.setHealth(20); }
sverre26 Several reasons, we have a small Hunger Games instance. Some times I need to kill all the players, it is just a handy function I think.