use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class ObserverListeners method onMatchWindowOpen.
//
// Miscellaneous
//
@EventHandler(priority = EventPriority.MONITOR)
public void onMatchWindowOpen(PlayerInteractEvent event) {
Action action = event.getAction();
if (!(action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK))) {
// Deny all actions which are not right clicks.
return;
}
ItemStack item = event.getItem();
if (item != null && item.isSimilar(ObserversKit.PLAY_ITEM.getResult())) {
GamePlayer player = this.game.getGame().getPlayer(event.getPlayer());
if (player == null) {
return;
}
PlayMatchWindow window = this.game.getMatch().getPlayWindow();
if (window != null && window.open(player)) {
return;
}
// The PlayerMatchWindow is not set. As we cannot handle the window
// join the given player to match with the '/join' command instead.
Commands commands = this.game.getPlugin().getCommands();
Command command = commands.getCommand(PLAY_COMMAND);
if (command != null) {
commands.handleCommand(player, command, command.getCommand(), null);
return;
}
player.sendError("Could not join the match right now. Did you defined format module?");
}
}
use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class ObserverListeners method onPlayerJoinedObservers.
//
// Kit and Visibility Filtering
//
@Handler(priority = Priority.NORMAL)
public void onPlayerJoinedObservers(ObserversJoinEvent event) {
GamePlayer player = event.getGamePlayer();
if (player.isOnline()) {
this.game.getMatch().getObserversKit().apply(player);
// ^ apply kits
player.refreshVisibilityArcadePlayer(this.game.getPlugin().getPlayers());
}
}
use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class ObserverListeners method onPlayerRespawn.
@Handler(priority = Priority.NORMAL)
public void onPlayerRespawn(PlayerRespawnEvent event) {
GamePlayer player = event.getGamePlayer();
if (player.isOnline() && !player.isParticipating()) {
player.getPlayer().clearInventory(true);
this.game.getMatch().getObserversKit().apply(player);
player.getBukkit().updateInventory();
// ^ apply kits
}
}
use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class PortalParser method parseDestination.
protected SpawnApply parseDestination(Node node, String name, String value) throws ParserException {
Spawn destination = (Spawn) this.destinationParser.parse(node.property("destination")).orFail().get();
boolean smooth = this.smoothParser.parse(node.property("smooth")).orDefault(false);
Direction yaw = this.yawDirectionParser.parse(node.property("yaw")).orDefault(Direction.ENTITY);
Direction pitch = this.pitchDirectionParser.parse(node.property("pitch")).orDefault(Direction.ENTITY);
return new SpawnApply(destination, new SpawnApply.AgentFactory() {
@Override
public SpawnAgent createAgent(Spawn spawn, GamePlayer player, Player bukkit) {
if (smooth) {
return SmoothSpawnAgent.create(spawn, player.getBukkit(), yaw, pitch);
} else {
return SpawnAgent.create(spawn, player.getBukkit(), yaw, pitch);
}
}
});
}
use of pl.themolka.arcade.game.GamePlayer in project Arcade2 by ShootGame.
the class PortalsGame method detectPortal.
// See pl.themolka.arcade.capture.point.PointCapture#onPlayerInitialSpawn
@Handler(priority = Priority.LOW)
public void detectPortal(PlayerJoinEvent event) {
GamePlayer player = event.getGamePlayer();
this.detectPortal(player, player.getBukkit().getLocation().toVector());
}
Aggregations