use of au.com.mineauz.minigames.script.ScriptObject in project Minigames by AddstarMC.
the class BroadcastAction method executeRegionAction.
@Override
public void executeRegionAction(final MinigamePlayer player, final Region region) {
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 region;
} else if (name.equalsIgnoreCase("minigame")) {
return player.getMinigame();
} else if (name.equalsIgnoreCase("team")) {
return player.getTeam();
}
return null;
}
};
execute(player, base);
}
use of au.com.mineauz.minigames.script.ScriptObject in project Minigames by AddstarMC.
the class ExecuteCommandAction method executeRegionAction.
@Override
public void executeRegionAction(final MinigamePlayer player, final Region region) {
String command = replacePlayerTags(player, comd.getFlag());
command = command.replace("{region}", region.getName());
// New expression system
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 region;
} else if (name.equalsIgnoreCase("minigame")) {
return player.getMinigame();
} else if (name.equalsIgnoreCase("team")) {
return player.getTeam();
}
return null;
}
};
command = ExpressionParser.stringResolve(command, base, true, true);
dispatch(command);
}
use of au.com.mineauz.minigames.script.ScriptObject in project Minigames by AddstarMC.
the class ExecuteCommandAction method executeNodeAction.
@Override
public void executeNodeAction(final MinigamePlayer player, final Node node) {
String command = replacePlayerTags(player, comd.getFlag());
command = command.replace("{x}", String.valueOf(node.getLocation().getBlockX())).replace("{y}", String.valueOf(node.getLocation().getBlockY())).replace("{z}", String.valueOf(node.getLocation().getBlockZ())).replace("{node}", node.getName());
// New expression system
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;
}
};
command = ExpressionParser.stringResolve(command, base, true, true);
dispatch(command);
}
use of au.com.mineauz.minigames.script.ScriptObject in project Minigames by AddstarMC.
the class MessageAction method executeRegionAction.
@Override
public void executeRegionAction(final MinigamePlayer player, final Region region) {
if (player == null || !player.isInMinigame())
return;
player.sendMessage(msg.getFlag(), null);
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 region;
} else if (name.equalsIgnoreCase("minigame")) {
return player.getMinigame();
} else if (name.equalsIgnoreCase("team")) {
return player.getTeam();
}
return null;
}
};
execute(player, base);
}
use of au.com.mineauz.minigames.script.ScriptObject in project Minigames by AddstarMC.
the class MessageAction method executeNodeAction.
@Override
public void executeNodeAction(final MinigamePlayer player, final Node node) {
if (player == null || !player.isInMinigame())
return;
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);
}
Aggregations