use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class BroadcastAction method execute.
private void execute(MinigamePlayer player, ScriptObject base) {
MinigameMessageType type = MinigameMessageType.INFO;
if (redText.getFlag())
type = MinigameMessageType.ERROR;
MinigamePlayer exclude = null;
if (excludeExecutor.getFlag())
exclude = player;
// Old replacement
String message = this.message.getFlag();
if (player != null) {
message = message.replace("%player%", player.getDisplayName(player.getMinigame().usePlayerDisplayNames()));
}
// New expression system
message = ExpressionParser.stringResolve(message, base, true, true);
if (player != null)
Minigames.getPlugin().getMinigameManager().sendMinigameMessage(player.getMinigame(), message, type, exclude);
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class RegionEvents method itemPickupEvent.
@EventHandler(ignoreCancelled = true)
private void itemPickupEvent(PlayerDropItemEvent event) {
final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
if (ply.isInMinigame()) {
final Trigger trig = Triggers.getTrigger("ITEM_DROP");
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, executeScriptObjects(ply, trig));
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class RegionEvents method playerXpChange.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void playerXpChange(PlayerExpChangeEvent event) {
final MinigamePlayer player = pdata.getMinigamePlayer(event.getPlayer());
if (player == null || !player.isInMinigame()) {
return;
}
executeTrigger(Triggers.getTrigger("XP_CHANGE"), player);
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class RegionEvents method playerMove.
@EventHandler(ignoreCancelled = true)
private void playerMove(PlayerMoveEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
if (ply == null)
return;
if (ply.isInMinigame()) {
Minigame mg = ply.getMinigame();
executeRegionChanges(mg, ply);
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class RegionEvents method playerJoin.
@EventHandler(ignoreCancelled = true)
private void playerJoin(JoinMinigameEvent event) {
final MinigamePlayer ply = event.getMinigamePlayer();
if (ply == null)
return;
final Minigame mg = event.getMinigame();
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
executeRegionChanges(mg, ply);
for (Node node : RegionModule.getMinigameModule(mg).getNodes()) {
node.execute(Triggers.getTrigger("GAME_JOIN"), ply);
}
for (Region region : RegionModule.getMinigameModule(mg).getRegions()) {
if (region.hasPlayer(ply))
region.execute(Triggers.getTrigger("GAME_JOIN"), ply);
}
});
if (event.getMinigame().getPlayers().size() == 0) {
for (Region region : RegionModule.getMinigameModule(event.getMinigame()).getRegions()) {
for (RegionExecutor ex : region.getExecutors()) {
if (ex.getTrigger().getName().equalsIgnoreCase("TICK")) {
region.startTickTask();
break;
}
}
}
}
}
Aggregations