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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3220 - (show annotations) (download)
Sat Jan 6 14:41:35 2018 UTC (6 years, 4 months ago) by torben
File size: 1450 byte(s)
Re-enable explosive snowballs and /zap
1 package dk.thoerup.bukkit.hoeruputils.deprecated;
2
3 import org.bukkit.ChatColor;
4 import org.bukkit.Location;
5 import org.bukkit.Server;
6 import org.bukkit.World;
7 import org.bukkit.command.Command;
8 import org.bukkit.command.CommandExecutor;
9 import org.bukkit.command.CommandSender;
10 import org.bukkit.entity.Player;
11
12 @Deprecated
13 public class ZapCommand implements CommandExecutor {
14
15
16 @Override
17 public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
18
19 if (!(sender instanceof Player)) {
20 return false;
21 }
22
23 Player p = (Player) sender;
24
25 if (args.length <1 || args.length > 2) {
26 p.sendMessage("Usage: /zap <player> [hard]");
27 return true;
28 }
29 boolean hard = false;
30 if (args.length == 2) {
31 if ( !args[1].equals("hard") ) {
32 p.sendMessage("Usage: /zap <player> [hard]");
33 return true;
34 } else if (p.isOp() ){
35 hard = true;
36 } else {
37 p.sendMessage("Only ops can zap hard");
38 return true;
39 }
40 }
41
42
43 Server server = p.getServer();
44
45 Player target = server.getPlayer(args[0]);
46 if (target == null) {
47 p.sendMessage("/zap: could not find player " + args[0] );
48 return true;
49 }
50
51 World w = target.getWorld();
52 Location l = target.getLocation();
53 if (hard == true) {
54 w.strikeLightning(l);
55 } else {
56 w.strikeLightningEffect( l );
57 }
58 server.broadcastMessage( ChatColor.YELLOW + target.getName() + " was zapped by " + p.getName() );
59
60 return true;
61 }
62 }

Properties

Name Value
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.20