use of com.massivecraft.massivecore.event.EventMassiveCoreDestination in project MassiveCore by MassiveCraft.
the class EngineMassiveCoreDestination method destinationArg.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void destinationArg(EventMassiveCoreDestination event) {
final String arg = event.getArg().toLowerCase();
final CommandSender sender = event.getSender();
try {
Destination destination = destinationArg(arg, sender);
if (destination == null)
return;
event.setDestination(destination);
} catch (MassiveException e) {
event.setException(e);
} catch (Exception e) {
event.setException(new MassiveException().addMsg("<b>%s", e.getMessage()));
}
event.setCancelled(true);
}
use of com.massivecraft.massivecore.event.EventMassiveCoreDestination in project MassiveCore by MassiveCraft.
the class TypeDestination method read.
@Override
public Destination read(String arg, CommandSender sender) throws MassiveException {
EventMassiveCoreDestination event = new EventMassiveCoreDestination(arg, sender, null);
event.run();
MassiveException exception = event.getException();
if (exception != null)
throw exception;
Destination ret = event.getDestination();
if (ret == null)
throw new MassiveException().addMsg("<b>Unknown destination \"<h>%s<b>\".", arg);
// Throw exeption if ps is null.
ret.getPs(sender);
return ret;
}
use of com.massivecraft.massivecore.event.EventMassiveCoreDestination in project MassiveCore by MassiveCraft.
the class EngineMassiveCoreDestination method destinationPs.
// -------------------------------------------- //
// DESTINATION ARG
// -------------------------------------------- //
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void destinationPs(EventMassiveCoreDestination event) {
try {
PS ps = TypePS.get().read(event.getArg(), event.getSender());
Destination destination = new DestinationSimple(ps);
event.setDestination(destination);
} catch (MassiveException exception) {
event.setException(exception);
event.setCancelled(true);
}
}
Aggregations