Search in sources :

Example 6 with ScriptObject

use of au.com.mineauz.minigames.script.ScriptObject in project Minigames by AddstarMC.

the class BroadcastAction method executeNodeAction.

@Override
public void executeNodeAction(final MinigamePlayer player, final Node node) {
    ScriptObject base = new ScriptObject() {

        @Override
        public Set<String> getKeys() {
            return ImmutableSet.of("player", "area", "minigame", "team");
        }

        @Override
        public String getAsString() {
            return "";
        }

        @Override
        public ScriptReference get(String name) {
            if (name.equalsIgnoreCase("player")) {
                return player;
            } else if (name.equalsIgnoreCase("area")) {
                return node;
            } else if (name.equalsIgnoreCase("minigame")) {
                return player.getMinigame();
            } else if (name.equalsIgnoreCase("team")) {
                return player.getTeam();
            }
            return null;
        }
    };
    execute(player, base);
}
Also used : ScriptObject(au.com.mineauz.minigames.script.ScriptObject)

Aggregations

ScriptObject (au.com.mineauz.minigames.script.ScriptObject)6 MenuItemString (au.com.mineauz.minigames.menu.MenuItemString)2