summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-01-27 15:26:46 +0000
committerKHobbits <rob@khobbits.co.uk>2013-01-27 15:26:46 +0000
commit4f35a72174e87a4cf562ac1d080e9e9cef14ac65 (patch)
tree8d9294f4e69f93ee4458ce3083e7f808b94cba67
parentaddd55228b79efdeda6092a293303b9d8cb7a5d3 (diff)
downloadEssentials-4f35a72174e87a4cf562ac1d080e9e9cef14ac65.tar
Essentials-4f35a72174e87a4cf562ac1d080e9e9cef14ac65.tar.gz
Essentials-4f35a72174e87a4cf562ac1d080e9e9cef14ac65.tar.lz
Essentials-4f35a72174e87a4cf562ac1d080e9e9cef14ac65.tar.xz
Essentials-4f35a72174e87a4cf562ac1d080e9e9cef14ac65.zip
Add command syntax comment, for clarification.
Merge branch '2.9' of github.com:essentials/Essentials into 2.9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandfirework.java35
1 files changed, 31 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java
index a9ad48dbb..5a3ad502d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.MetaItemStack;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
@@ -14,7 +15,23 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
+import org.bukkit.util.Vector;
+//This command has quite a complicated syntax, in theory it has 4 seperate syntaxes which are all variable:
+//
+//1: /firework clear - This clears all of the effects on a firework stack
+//
+//2: /firework power <int> - This changes the base power of a firework
+//
+//3: /firework fire - This 'fires' a copy of the firework held.
+//3: /firework fire <int> - This 'fires' a number of copies of the firework held.
+//3: /firework fire <other> - This 'fires' a copy of the firework held, in the direction you are looking, #easteregg
+//
+//4: /firework [meta] - This will add an effect to the firework stack held
+//4: /firework color:<color> - The minimum you need to set an effect is 'color'
+//4: Full Syntax: color:<color[,color,..]> [fade:<color[,color,..]>] [shape:<shape>] [effect:<effect[,effect]>]
+//4: Possible Shapes: star, ball, large, creeper, burst
+//4: Possible Effects trail, twinkle
public class Commandfirework extends EssentialsCommand
{
@@ -71,8 +88,9 @@ public class Commandfirework extends EssentialsCommand
else if ((args[0].equalsIgnoreCase("fire") || (args[0].equalsIgnoreCase("p")))
&& user.isAuthorized("essentials.firework.fire"))
{
- int amount;
- try
+ int amount = 1;
+ boolean direction = false;
+ if (Util.isInt(args[1]))
{
final int serverLimit = ess.getSettings().getSpawnMobLimit();
amount = Integer.parseInt(args[1]);
@@ -82,14 +100,23 @@ public class Commandfirework extends EssentialsCommand
user.sendMessage(_("mobSpawnLimit"));
}
}
- catch (Exception e)
+ else
{
- amount = 1;
+ direction = true;
}
for (int i = 0; i < amount; i++)
{
Firework firework = (Firework)user.getWorld().spawnEntity(user.getLocation(), EntityType.FIREWORK);
FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta();
+ if (direction)
+ {
+ final Vector vector = user.getEyeLocation().getDirection().multiply(0.075);
+ if (fmeta.getPower() > 1)
+ {
+ fmeta.setPower(1);
+ }
+ firework.setVelocity(vector);
+ }
firework.setFireworkMeta(fmeta);
}
}