Fixed pattern "X%Y" with no Y defined throwing an exception.

Fixes WORLDEDIT-2897.
Dieser Commit ist enthalten in:
sk89q 2014-02-28 16:20:54 -08:00
Ursprung 513940a80b
Commit 7cf093ad40

Datei anzeigen

@ -713,8 +713,12 @@ public class WorldEdit {
// Parse special percentage syntax
if (s.matches("[0-9]+(\\.[0-9]*)?%.*")) {
String[] p = s.split("%");
if (p.length < 2) {
throw new UnknownItemException(s);
} else {
chance = Double.parseDouble(p[0]);
block = getBlock(player, p[1]);
}
} else {
chance = 1;
block = getBlock(player, s);