Search in sources :

Example 1 with RenderType

use of org.bukkit.scoreboard.RenderType in project Denizen-For-Bukkit by DenizenScript.

the class ScoreboardCommand method parseArgs.

@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
    for (Argument arg : scriptEntry) {
        if (!scriptEntry.hasObject("action") && arg.matchesEnum(Action.class)) {
            scriptEntry.addObject("action", arg.asElement());
        } else if (!scriptEntry.hasObject("lines") && arg.matchesPrefix("lines", "l")) {
            scriptEntry.addObject("lines", arg.asElement());
        } else if (!scriptEntry.hasObject("id") && arg.matchesPrefix("id")) {
            scriptEntry.addObject("id", arg.asElement());
        } else if (!scriptEntry.hasObject("objective") && arg.matchesPrefix("objective", "obj", "o")) {
            scriptEntry.addObject("objective", arg.asElement());
        } else if (!scriptEntry.hasObject("criteria") && arg.matchesPrefix("criteria", "c")) {
            scriptEntry.addObject("criteria", arg.asElement());
        } else if (!scriptEntry.hasObject("score") && arg.matchesInteger()) {
            scriptEntry.addObject("score", arg.asElement());
        } else if (!scriptEntry.hasObject("displayslot") && (arg.matchesEnum(DisplaySlot.class) || arg.matches("none"))) {
            scriptEntry.addObject("displayslot", arg.asElement());
        } else if (!scriptEntry.hasObject("displayslot") && arg.matchesPrefix("displayname")) {
            scriptEntry.addObject("displayname", arg.asElement());
        } else if (!scriptEntry.hasObject("rendertype") && arg.matchesPrefix("rendertype") && arg.matchesEnum(RenderType.class)) {
            scriptEntry.addObject("rendertype", arg.asElement());
        } else if (!scriptEntry.hasObject("viewers") && arg.matchesArgumentList(PlayerTag.class)) {
            scriptEntry.addObject("viewers", arg.asType(ListTag.class).filter(PlayerTag.class, scriptEntry));
        } else {
            arg.reportUnhandled();
        }
    }
    scriptEntry.defaultObject("action", new ElementTag("add"));
    scriptEntry.defaultObject("id", new ElementTag("main"));
}
Also used : Argument(com.denizenscript.denizencore.objects.Argument) DisplaySlot(org.bukkit.scoreboard.DisplaySlot) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) ListTag(com.denizenscript.denizencore.objects.core.ListTag) RenderType(org.bukkit.scoreboard.RenderType)

Aggregations

Argument (com.denizenscript.denizencore.objects.Argument)1 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)1 ListTag (com.denizenscript.denizencore.objects.core.ListTag)1 DisplaySlot (org.bukkit.scoreboard.DisplaySlot)1 RenderType (org.bukkit.scoreboard.RenderType)1