use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.
the class PlayerKillsMechanic method playerSuicide.
@EventHandler
private void playerSuicide(PlayerDeathEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer(event.getEntity());
if (ply == null)
return;
if (ply.isInMinigame() && (ply.getPlayer().getKiller() == null || ply.getPlayer().getKiller() == ply.getPlayer()) && ply.getMinigame().hasStarted()) {
Minigame mgm = ply.getMinigame();
if (mgm.getMechanicName().equals("kills")) {
ply.takeScore();
mgm.setScore(ply, ply.getScore());
if (mgm.isTeamGame())
ply.getTeam().setScore(ply.getTeam().getScore() - 1);
}
}
}
use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.
the class Main method onDisable.
@Override
public void onDisable() {
if (plugin == null) {
return;
}
for (Minigame mg : minigames.mdata.getAllMinigames().values()) {
mg.saveMinigame();
}
minigames.mdata.removeModule("Regions", RegionModule.class);
ToolModes.removeToolMode("REGION");
ToolModes.removeToolMode("NODE");
ToolModes.removeToolMode("REGION_AND_NODE_EDITOR");
display.shutdown();
getLogger().info("Minigames Regions disabled");
}
use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.
the class RegionEvents method playerSpawn.
@EventHandler
private void playerSpawn(PlayerRespawnEvent event) {
final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
if (ply == null)
return;
if (ply.isInMinigame()) {
final Minigame mg = ply.getMinigame();
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
if (!ply.isInMinigame()) {
return;
}
executeRegionChanges(mg, ply);
for (Node node : RegionModule.getMinigameModule(ply.getMinigame()).getNodes()) {
node.execute(Triggers.getTrigger("RESPAWN"), ply);
}
for (Region region : RegionModule.getMinigameModule(ply.getMinigame()).getRegions()) {
if (region.hasPlayer(ply))
region.execute(Triggers.getTrigger("RESPAWN"), ply);
}
}
});
}
}
use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.
the class ScoreboardSign method signUse.
@Override
public boolean signUse(Sign sign, MinigamePlayer player) {
Minigame minigame = plugin.mdata.getMinigame(sign.getLine(2));
if (minigame == null) {
return false;
}
ScoreboardDisplay display = minigame.getScoreboardData().getDisplay(sign.getBlock());
if (display == null) {
return false;
}
display.displayMenu(player);
return false;
}
Aggregations