When using commands, world name can now be specified in quotation marks if it has a space in it (example: /wb "you world name" set 4000 0 0); also made new "whoosh" knockback effect default to disabled so that it's opt-in, since it could potentially be considered annoying

This commit is contained in:
Brettflan 2011-07-27 22:25:16 -05:00
parent 04971a2007
commit 01c5ccab7d
2 changed files with 37 additions and 2 deletions

View File

@ -46,7 +46,7 @@ public class Config
private static boolean DEBUG = false;
private static double knockBack = 3.0;
private static int timerTicks = 4;
private static boolean whooshEffect = true;
private static boolean whooshEffect = false;
// for monitoring plugin efficiency
// public static long timeUsed = 0;
@ -334,7 +334,7 @@ public class Config
message = cfg.getString("message");
shapeRound = cfg.getBoolean("round-border", false);
DEBUG = cfg.getBoolean("debug-mode", false);
whooshEffect = cfg.getBoolean("whoosh-effect", true);
whooshEffect = cfg.getBoolean("whoosh-effect", false);
knockBack = cfg.getDouble("knock-back-dist", 3.0);
timerTicks = cfg.getInt("timer-delay-ticks", 5);
LogConfig("Using " + (shapeRound ? "round" : "square") + " border, knockback of " + knockBack + " blocks, and timer delay of " + timerTicks + ".");

View File

@ -1,6 +1,8 @@
package com.wimbli.WorldBorder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.bukkit.ChatColor;
@ -34,6 +36,39 @@ public class WBCommand implements CommandExecutor
String cmd = clrCmd + ((player == null) ? "wb" : "/wb");
String cmdW = clrCmd + ((player == null) ? "wb " + clrReq + "<world>" : "/wb " + clrOpt + "[world]") + clrCmd;
// if world name is passed inside quotation marks, handle that
if (split.length > 2 && split[0].startsWith("\""))
{
if (split[0].endsWith("\""))
{
split[0] = split[0].substring(1, split[0].length() - 1);
}
else
{
List<String> args = new ArrayList<String>();
String quote = split[0];
int loop;
for (loop = 1; loop < split.length; loop++)
{
quote += " " + split[loop];
if (split[loop].endsWith("\""))
break;
}
if (loop < split.length || !split[loop].endsWith("\""))
{
args.add(quote.substring(1, quote.length() - 1));
loop++;
while (loop < split.length)
{
args.add(split[loop]);
loop++;
}
split = args.toArray(new String[0]);
}
}
}
// "set" command from player or console, world specified
if (split.length == 5 && split[1].equalsIgnoreCase("set"))
{