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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3201 - (show annotations) (download)
Wed May 31 08:56:00 2017 UTC (6 years, 11 months ago) by torben
File size: 1207 byte(s)
Code cleanup(still doesn't compile)
1 package dk.thoerup.bukkit.hoeruputils;
2
3 import org.bukkit.World;
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 public class WeatherCommand implements CommandExecutor {
10
11
12 @Override
13 public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
14
15 if (!(sender instanceof Player)) {
16 return false;
17 }
18
19 Player p = (Player) sender;
20
21 if (args.length != 1 || !( args[0].equals("clear") || args[0].equals("rain") || args[0].equals("thunder") ) ) {
22 p.sendMessage("Usage /weather <clear|rain|thunder>");
23 return true;
24 }
25
26 World w = p.getWorld();
27 if ( args[0].equals("clear") ) {
28 w.setThundering( false );
29 w.setStorm( false );
30 p.getServer().broadcastMessage("A nice blue sky appears");
31 } else if (args[0].equals("rain") ) {
32 w.setStorm( true );
33 w.setThundering( false );
34 p.getServer().broadcastMessage("Dark clouds are gathering");
35 } else if (args[0].equals("thunder") ) {
36 w.setStorm( true );
37 w.setThundering( true );
38 p.getServer().broadcastMessage("looks like a thunderstorm is comming");
39 }
40
41
42 return true;
43 }
44 }

  ViewVC Help
Powered by ViewVC 1.1.20