From dd9785ef7ccfdbaac511aaf710a64e43e3a8cc0c Mon Sep 17 00:00:00 2001 From: DiddiZ Date: Wed, 11 Jan 2012 19:59:16 +0100 Subject: [PATCH] Added loc param --- MANIFEST.MF | 2 +- src/de/diddiz/LogBlock/QueryParams.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/MANIFEST.MF b/MANIFEST.MF index ffae369..cc2e933 100644 --- a/MANIFEST.MF +++ b/MANIFEST.MF @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Class-Path: ../lib/mysql-connector-java-bin.jar ../lib/WorldEdit.jar ../WorldEdit.jar +Class-Path: ../lib/WorldEdit.jar ../WorldEdit.jar diff --git a/src/de/diddiz/LogBlock/QueryParams.java b/src/de/diddiz/LogBlock/QueryParams.java index ba10799..3735706 100644 --- a/src/de/diddiz/LogBlock/QueryParams.java +++ b/src/de/diddiz/LogBlock/QueryParams.java @@ -25,7 +25,7 @@ import com.sk89q.worldedit.bukkit.selections.Selection; public class QueryParams implements Cloneable { - private static final Set keywords = new HashSet(Arrays.asList("player".hashCode(), "area".hashCode(), "selection".hashCode(), "sel".hashCode(), "block".hashCode(), "type".hashCode(), "sum".hashCode(), "destroyed".hashCode(), "created".hashCode(), "chestaccess".hashCode(), "all".hashCode(), "time".hashCode(), "since".hashCode(), "before".hashCode(), "limit".hashCode(), "world".hashCode(), "asc".hashCode(), "desc".hashCode(), "last".hashCode(), "coords".hashCode(), "silent".hashCode(), "chat".hashCode(), "search".hashCode(), "match".hashCode())); + private static final Set keywords = new HashSet(Arrays.asList("player".hashCode(), "area".hashCode(), "selection".hashCode(), "sel".hashCode(), "block".hashCode(), "type".hashCode(), "sum".hashCode(), "destroyed".hashCode(), "created".hashCode(), "chestaccess".hashCode(), "all".hashCode(), "time".hashCode(), "since".hashCode(), "before".hashCode(), "limit".hashCode(), "world".hashCode(), "asc".hashCode(), "desc".hashCode(), "last".hashCode(), "coords".hashCode(), "silent".hashCode(), "chat".hashCode(), "search".hashCode(), "match".hashCode(), "loc".hashCode(), "location".hashCode())); public BlockChangeType bct = BlockChangeType.BOTH; public int limit = -1, before = 0, since = 0, radius = -1; public Location loc = null; @@ -396,6 +396,15 @@ public class QueryParams implements Cloneable if (values.length == 0) throw new IllegalArgumentException("No arguments for '" + param + "'"); match = join(values, " ").replace("\\", "\\\\").replace("'", "\\'"); + } else if (param.equals("loc") || param.equals("location")) { + final String[] vectors = values.length == 1 ? values[0].split(":") : values; + if (vectors.length != 3) + throw new IllegalArgumentException("Wrong count arguments for '" + param + "'"); + for (final String vec : vectors) + if (!isInt(vec)) + throw new IllegalArgumentException("Not a number: '" + vec + "'"); + loc = new Location(null, Integer.valueOf(vectors[0]), Integer.valueOf(vectors[1]), Integer.valueOf(vectors[2])); + radius = 0; } else throw new IllegalArgumentException("Not a valid argument: '" + param + "'"); i += values.length;