use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class Events method onPlayerResourcePack.
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerResourcePack(PlayerResourcePackStatusEvent event) {
final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
List<MinigamePlayer> required = plugin.getPlayerManager().getApplyingPack();
if (ply.isInMinigame()) {
if (required.contains(ply)) {
ResourcePackModule module = ResourcePackModule.getMinigameModule(ply.getMinigame());
if (!module.isEnabled())
return;
if (!module.isForced())
return;
switch(event.getStatus()) {
case ACCEPTED:
required.remove(ply);
return;
case DECLINED:
Minigames.getPlugin().getPlayerManager().quitMinigame(ply, true);
MessageManager.sendMessage(ply, MinigameMessageType.ERROR, null, "minigames.resource.declined");
required.remove(ply);
return;
case FAILED_DOWNLOAD:
Minigames.getPlugin().getPlayerManager().quitMinigame(ply, true);
MessageManager.sendMessage(ply, MinigameMessageType.ERROR, null, "minigames.resource.failed");
required.remove(ply);
return;
case SUCCESSFULLY_LOADED:
required.remove(ply);
}
}
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class RegionDisplayManager method update.
public void update(Region region) {
Set<MinigamePlayer> watchers = Sets.newHashSet(activeWatchers.get(region));
ArmorStand stand = nameDisplay.remove(region);
if (stand != null)
stand.remove();
for (MinigamePlayer player : watchers) {
hide(region, player);
show(region, player);
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class RegionDisplayManager method update.
public void update(Node node) {
Set<MinigamePlayer> watchers = Sets.newHashSet(activeWatchers.get(node));
ArmorStand stand = nameDisplay.remove(node);
if (stand != null)
stand.remove();
for (MinigamePlayer player : watchers) {
hide(node, player);
show(node, player);
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class RegionDisplayManager method hideAll.
public void hideAll(Player player) {
MinigamePlayer mplayer = Minigames.getPlugin().getPlayerManager().getMinigamePlayer(player);
Map<Region, IDisplayObject> regions = regionDisplays.remove(player);
if (regions != null) {
for (IDisplayObject display : regions.values()) {
display.remove();
}
for (Region region : regions.keySet()) {
hideInfo(region, mplayer);
}
}
Map<Node, IDisplayObject> nodes = nodeDisplays.remove(player);
if (nodes != null) {
for (IDisplayObject display : nodes.values()) {
display.remove();
}
for (Node node : nodes.keySet()) {
hideInfo(node, mplayer);
}
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class AbstractAction method setWinnersLosers.
/**
* Set winners losers.
*
* @param winner the winner
*/
void setWinnersLosers(final MinigamePlayer winner) {
if (winner.getMinigame().getType() != MinigameType.SINGLEPLAYER) {
final List<MinigamePlayer> w;
final List<MinigamePlayer> l;
if (winner.getMinigame().isTeamGame()) {
w = new ArrayList<>(winner.getTeam().getPlayers());
l = new ArrayList<>(winner.getMinigame().getPlayers().size() - winner.getTeam().getPlayers().size());
for (final Team t : TeamsModule.getMinigameModule(winner.getMinigame()).getTeams()) {
if (t != winner.getTeam()) {
l.addAll(t.getPlayers());
}
}
} else {
w = new ArrayList<>(1);
l = new ArrayList<>(winner.getMinigame().getPlayers().size());
w.add(winner);
l.addAll(winner.getMinigame().getPlayers());
l.remove(winner);
}
Minigames.getPlugin().getPlayerManager().endMinigame(winner.getMinigame(), w, l);
} else {
Minigames.getPlugin().getPlayerManager().endMinigame(winner);
}
}
Aggregations