/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/OpkillCommand.java
ViewVC logotype

Contents of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/OpkillCommand.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2436 - (show annotations) (download)
Mon Mar 9 14:19:55 2015 UTC (9 years, 2 months ago) by torben
File size: 976 byte(s)
Deprecation
1 package dk.thoerup.bukkit.hoeruputils;
2
3 import org.bukkit.Location;
4 import org.bukkit.command.Command;
5 import org.bukkit.command.CommandExecutor;
6 import org.bukkit.command.CommandSender;
7 import org.bukkit.entity.Player;
8
9 import org.bukkit.ChatColor;
10
11 public class OpkillCommand implements CommandExecutor {
12
13 @Override
14 public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
15 if (! (sender instanceof Player) ) {
16 return false;
17 }
18
19 Player p = (Player) sender;
20
21 if (! p.isOp() ) {
22 p.sendMessage("Only server operators may use this command");
23 return true;
24 }
25
26 if (args.length != 1) {
27 p.sendMessage("Usage: /opkill <player>");
28 return true;
29 }
30
31
32 @SuppressWarnings("deprecation")
33 Player p2 = p.getServer().getPlayer(args[0]);
34
35 p2.setHealth(0);
36 p.getServer().broadcastMessage( ChatColor.YELLOW + p2.getName() + " was slained by server operator (" + p.getName() + ")" );
37
38
39
40 return true;
41 }
42
43 }

  ViewVC Help
Powered by ViewVC 1.1.20