use of au.com.mineauz.minigames.minigame.modules.ResourcePackModule 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);
}
}
}
}
Aggregations