summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorceulemansl <ceulemansl@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-23 00:26:10 +0000
committerceulemansl <ceulemansl@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-23 00:26:10 +0000
commit998b0253105e3c5f43771d27c5f87e90fe059c22 (patch)
tree237544f695f3889c9cbcf95f3ada479aab296be2
parentab3d6779dea7fbc513c889e3accc1290a21d8f6d (diff)
downloadEssentials-998b0253105e3c5f43771d27c5f87e90fe059c22.tar
Essentials-998b0253105e3c5f43771d27c5f87e90fe059c22.tar.gz
Essentials-998b0253105e3c5f43771d27c5f87e90fe059c22.tar.lz
Essentials-998b0253105e3c5f43771d27c5f87e90fe059c22.tar.xz
Essentials-998b0253105e3c5f43771d27c5f87e90fe059c22.zip
added wheather,
usage /weather <sun/storm> [time in seconds] git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1264 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandweather.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java
new file mode 100644
index 000000000..2a8589694
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java
@@ -0,0 +1,70 @@
+package com.earth2me.essentials.commands;
+
+import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.User;
+
+import org.bukkit.Server;
+
+public class Commandweather extends EssentialsCommand
+{
+ public Commandweather()
+ {
+ super("weather");
+ }
+
+ @Override
+ public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception
+ {
+ switch (args.length)
+ {
+ case 0:
+ if (user.isAuthorized("essentials.weather"))
+ {
+ user.sendMessage("§cUsage: /" + commandLabel + " <storm/sun> [duration]");
+ break;
+ }
+ user.sendMessage("§cYou are not allowed to change the weather");
+ break;
+ case 1:
+ if (user.isAuthorized("essentials.weather"))
+ {
+ if(args[0].equalsIgnoreCase("storm"))
+ {
+ user.getWorld().setStorm(true);
+ user.sendMessage("§7You set the weather in your world to storm");
+ break;
+ }
+ if(args[0].equalsIgnoreCase("sun"))
+ {
+ user.getWorld().setStorm(false);
+ user.sendMessage("§7You set the weather in your world to sun");
+ break;
+ }
+ user.sendMessage("§cUsage: /" + commandLabel + " <storm/sun> [duration]");
+ }
+ user.sendMessage("§cYou are not allowed to change the weather");
+ break;
+ case 2:
+ if (user.isAuthorized("essentials.weather"))
+ {
+ if(args[0].equalsIgnoreCase("storm"))
+ {
+ user.getWorld().setStorm(true);
+ user.getWorld().setWeatherDuration(Integer.parseInt(args[1]) * 20);
+ user.sendMessage("§7You set the weather in your world to storm for " + args[1] + " seconds");
+ break;
+ }
+ if(args[0].equalsIgnoreCase("sun"))
+ {
+ user.getWorld().setStorm(false);
+ user.getWorld().setWeatherDuration(Integer.parseInt(args[1]) * 20);
+ user.sendMessage("§7You set the weather in your world to sun for " + args[1] + " seconds");
+ break;
+ }
+ user.sendMessage("§cUsage: /" + commandLabel + " <storm/sun> [duration]");
+ }
+ user.sendMessage("§cYou are not allowed to change the weather");
+ break;
+ }
+ }
+}