slayer plugin: validate !task name and location
This commit is contained in:
@@ -770,7 +770,8 @@ public class SlayerPlugin extends Plugin
|
||||
}
|
||||
|
||||
if (TASK_STRING_VALIDATION.matcher(task.getTask()).find() || task.getTask().length() > TASK_STRING_MAX_LENGTH ||
|
||||
TASK_STRING_VALIDATION.matcher(task.getLocation()).find() || task.getLocation().length() > TASK_STRING_MAX_LENGTH)
|
||||
TASK_STRING_VALIDATION.matcher(task.getLocation()).find() || task.getLocation().length() > TASK_STRING_MAX_LENGTH ||
|
||||
Task.getTask(task.getTask()) == null || !Task.LOCATIONS.contains(task.getLocation()))
|
||||
{
|
||||
log.debug("Validation failed for task name or location: {}", task);
|
||||
return;
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
package net.runelite.client.plugins.slayer;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
@@ -176,6 +178,48 @@ enum Task
|
||||
//</editor-fold>
|
||||
|
||||
private static final Map<String, Task> tasks;
|
||||
static final List<String> LOCATIONS = ImmutableList.of(
|
||||
"", // no location is a valid location
|
||||
"Abyss",
|
||||
"Ancient Cavern",
|
||||
"Asgarnian Ice Dungeon",
|
||||
"Brimhaven Dungeon",
|
||||
"Brine Rat Cavern",
|
||||
"Catacombs of Kourend",
|
||||
"Chasm of Fire",
|
||||
"Clan Wars",
|
||||
"Death Plateau",
|
||||
"Evil Chicken's Lair",
|
||||
"Fossil Island",
|
||||
"Fremennik Slayer Dungeon",
|
||||
"God Wars Dungeon",
|
||||
"Iorwerth Dungeon",
|
||||
"Kalphite Lair",
|
||||
"Karuulm Slayer Dungeon",
|
||||
"Keldagrim",
|
||||
"Kraken Cove",
|
||||
"Lighthouse",
|
||||
"Lithkren Vault",
|
||||
"Lizardman Canyon",
|
||||
"Lizardman Settlement",
|
||||
"Molch",
|
||||
"Mount Quidamortem",
|
||||
"Mourner Tunnels",
|
||||
"Ogre Enclave",
|
||||
"Slayer Tower",
|
||||
"Smoke Devil Dungeon",
|
||||
"Smoke Dungeon",
|
||||
"Stronghold of Security",
|
||||
"Stronghold Slayer Dungeon",
|
||||
"task-only Kalphite Cave",
|
||||
"Taverley Dungeon",
|
||||
"Troll Stronghold",
|
||||
"Waterbirth Island",
|
||||
"Waterfall Dungeon",
|
||||
"Wilderness",
|
||||
"Witchaven Dungeon",
|
||||
"Zanaris"
|
||||
);
|
||||
|
||||
private final String name;
|
||||
private final int itemSpriteId;
|
||||
|
||||
Reference in New Issue
Block a user