use of io.github.wysohn.triggerreactor.core.manager.location.SimpleLocation in project TriggerReactor by wysohn.
the class LocationBasedTriggerManager method showTriggerInfo.
@Override
protected void showTriggerInfo(ICommandSender sender, SimpleLocation sloc) {
Trigger trigger = getTriggerForLocation(sloc);
if (trigger == null) {
return;
}
Location loc = LocationUtil.convertToBukkitLocation(sloc);
Block clicked = loc.getBlock();
sender.sendMessage("- - - - - - - - - - - - - -");
sender.sendMessage("Trigger: " + getTriggerTypeName());
sender.sendMessage("Block Type: " + clicked.getType().name());
sender.sendMessage("Location: " + clicked.getWorld().getName() + "@" + clicked.getLocation().getBlockX() + "," + clicked.getLocation().getBlockY() + "," + clicked.getLocation().getBlockZ());
sender.sendMessage("");
sender.sendMessage("Script:");
sender.sendMessage(trigger.getScript());
sender.sendMessage("- - - - - - - - - - - - - -");
}
use of io.github.wysohn.triggerreactor.core.manager.location.SimpleLocation in project TriggerReactor by wysohn.
the class WalkTriggerManager method handleWalk.
private void handleWalk(PlayerBlockLocationEvent e, SimpleLocation to) {
Player player = e.getPlayer();
SimpleLocation bottomLoc = to.clone();
bottomLoc.add(0, -1, 0);
WalkTrigger trigger = getTriggerForLocation(bottomLoc);
if (trigger == null)
return;
Map<String, Object> varMap = new HashMap<>();
varMap.put("player", player);
varMap.put("from", e.getFrom());
varMap.put("to", e.getTo());
trigger.activate(e, varMap);
return;
}
use of io.github.wysohn.triggerreactor.core.manager.location.SimpleLocation in project TriggerReactor by wysohn.
the class PlayerLocationManager method onTeleport.
@EventHandler
public void onTeleport(PlayerChangedWorldEvent e) {
Player player = e.getPlayer();
Location loc = player.getLocation();
SimpleLocation sloc = LocationUtil.convertToSimpleLocation(loc);
setCurrentBlockLocation(player.getUniqueId(), sloc);
}
use of io.github.wysohn.triggerreactor.core.manager.location.SimpleLocation in project TriggerReactor by wysohn.
the class PlayerLocationManager method onMove.
@EventHandler(priority = EventPriority.HIGHEST)
public void onMove(PlayerMoveEvent e) {
if (e.getTo() == e.getFrom())
return;
Player player = e.getPlayer();
SimpleLocation from = getCurrentBlockLocation(player.getUniqueId());
SimpleLocation to = LocationUtil.convertToSimpleLocation(e.getTo());
PlayerBlockLocationEvent pble = new PlayerBlockLocationEvent(player, from, to);
onMove(new BukkitPlayerBlockLocationEvent(pble));
if (pble.isCancelled()) {
Location loc = LocationUtil.convertToBukkitLocation(from);
loc.setPitch(e.getPlayer().getLocation().getPitch());
loc.setYaw(e.getPlayer().getLocation().getPitch());
e.setFrom(loc);
e.setTo(loc);
}
}
use of io.github.wysohn.triggerreactor.core.manager.location.SimpleLocation in project TriggerReactor by wysohn.
the class PlayerLocationManager method onJoin.
@EventHandler(priority = EventPriority.LOW)
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
Location loc = player.getLocation();
SimpleLocation sloc = LocationUtil.convertToSimpleLocation(loc);
setCurrentBlockLocation(player.getUniqueId(), sloc);
}
Aggregations