use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class RedstoneScriptEvent method onBlockRedstone.
@EventHandler
public void onBlockRedstone(BlockRedstoneEvent event) {
location = new dLocation(event.getBlock().getLocation());
old_current = new Element(event.getOldCurrent());
new_current = new Element(event.getNewCurrent());
this.event = event;
fire();
event.setNewCurrent(new_current.asInt());
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class StructureGrowsScriptEvent method onStructureGrow.
@EventHandler
public void onStructureGrow(StructureGrowEvent event) {
world = new dWorld(event.getWorld());
location = new dLocation(event.getLocation());
structure = new Element(event.getSpecies().name());
blocks = new dList();
new_materials = new dList();
for (BlockState block : event.getBlocks()) {
blocks.add(new dLocation(block.getLocation()).identify());
new_materials.add(dMaterial.getMaterialFrom(block.getType(), block.getRawData()).identify());
}
this.event = event;
cancelled = event.isCancelled();
fire();
event.setCancelled(cancelled);
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class WeatherChangesScriptEvent method onWeatherChanges.
@EventHandler
public void onWeatherChanges(WeatherChangeEvent event) {
world = new dWorld(event.getWorld());
weather = new Element(event.toWeatherState() ? "rains" : "clears");
this.event = event;
cancelled = event.isCancelled();
fire();
event.setCancelled(cancelled);
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class ChatScriptEvent method applyDetermination.
@Override
public boolean applyDetermination(ScriptContainer container, String determination) {
String lower = CoreUtilities.toLowerCase(determination);
if (lower.startsWith("format:")) {
String name = determination.substring(7);
FormatScriptContainer formatscr = ScriptRegistry.getScriptContainer(name);
if (formatscr == null) {
dB.echoError("Could not find format script matching '" + name + '\'');
} else {
String formatstr = formatscr.getFormatText(null, player);
if (net.aufdemrand.denizencore.utilities.debugging.dB.verbose) {
dB.log("Setting format to " + formatstr);
}
format = new Element(formatstr);
}
} else if (lower.startsWith("recipients:")) {
String rec_new = determination.substring(11);
dList recs = dList.valueOf(rec_new);
List<dPlayer> players = recs.filter(dPlayer.class);
recipients.clear();
for (dPlayer player : players) {
recipients.add(player.getPlayerEntity());
}
} else if (!lower.startsWith("cancelled")) {
message = new Element(determination);
} else {
return super.applyDetermination(container, determination);
}
return true;
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class ListPingScriptEvent method onListPing.
@EventHandler
public void onListPing(ServerListPingEvent event) {
motd = new Element(event.getMotd());
max_players = new Element(event.getMaxPlayers());
num_players = new Element(event.getNumPlayers());
address = new Element(event.getAddress().toString());
this.event = event;
fire();
event.setMaxPlayers(max_players.asInt());
event.setMotd(motd.asString());
}
Aggregations