Search in sources :

Example 1 with QueueTag

use of com.denizenscript.denizencore.objects.core.QueueTag in project Denizen-For-Bukkit by DenizenScript.

the class PlayerPreLoginScriptEvent method applyDetermination.

@Override
public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
    String determination = determinationObj.toString();
    if (determinationObj instanceof ElementTag) {
        if (CoreUtilities.toLowerCase(determination).startsWith("kicked")) {
            String message = determination.length() > 7 ? determination.substring(7) : determination;
            event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, message);
            return true;
        }
    }
    if (QueueTag.matches(determination)) {
        QueueTag newQueue = QueueTag.valueOf(determination, getTagContext(path));
        if (newQueue != null && newQueue.getQueue() != null) {
            waitForQueues.add(newQueue);
        }
        return true;
    }
    return super.applyDetermination(path, determinationObj);
}
Also used : QueueTag(com.denizenscript.denizencore.objects.core.QueueTag) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag)

Aggregations

ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)1 QueueTag (com.denizenscript.denizencore.objects.core.QueueTag)1