use of org.bukkit.event.block.BlockEvent in project CommandHelper by EngineHub.
the class BukkitAbstractEventMixin method evaluate_helper.
@Override
public Map<String, Construct> evaluate_helper(BindableEvent event) throws EventException {
Map<String, Construct> map = new HashMap<>();
map.put("event_type", new CString(mySuper.getName(), Target.UNKNOWN));
String macro;
Object e = event._GetObject();
if (e instanceof BlockEvent) {
macro = "block";
} else if (e instanceof EntityEvent) {
macro = "entity";
if (((EntityEvent) e).getEntity() instanceof Player) {
Entity entity = ((EntityEvent) e).getEntity();
map.put("player", new CString(entity.getName(), Target.UNKNOWN));
}
} else if (e instanceof HangingEvent) {
macro = "entity";
} else if (e instanceof InventoryEvent) {
macro = "inventory";
} else if (e instanceof PlayerEvent) {
map.put("player", new CString(((PlayerEvent) e).getPlayer().getName(), Target.UNKNOWN));
macro = "player";
} else if (e instanceof ServerEvent) {
macro = "server";
} else if (e instanceof VehicleEvent) {
macro = "vehicle";
} else if (e instanceof WeatherEvent) {
macro = "weather";
} else if (e instanceof WorldEvent) {
macro = "world";
} else {
macro = "custom";
}
map.put("macrotype", new CString(macro, Target.UNKNOWN));
return map;
}
Aggregations