org.bukkit.event.player.PlayerResourcePackStatusEvent Java Examples
The following examples show how to use
org.bukkit.event.player.PlayerResourcePackStatusEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourcePackListener.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
@EventHandler public void confirm(final PlayerResourcePackStatusEvent event) { logger.fine("Player " + event.getPlayer().getName() + " sent res pack status " + event.getStatus()); final UserDoc.ResourcePackStatus status; switch(event.getStatus()) { case ACCEPTED: status = UserDoc.ResourcePackStatus.ACCEPTED; break; case DECLINED: status = UserDoc.ResourcePackStatus.DECLINED; break; case SUCCESSFULLY_LOADED: status = UserDoc.ResourcePackStatus.LOADED; break; case FAILED_DOWNLOAD: status = UserDoc.ResourcePackStatus.FAILED; break; default: throw new IllegalStateException("Unknown status " + event.getStatus()); } userService.update( Users.playerId(event.getPlayer()), (UserDoc.ResourcePackResponse) () -> status ); }
Example #2
Source File: ResourcePackListener.java From AdditionsAPI with MIT License | 6 votes |
@EventHandler public void onResourcestatusChange(PlayerResourcePackStatusEvent event) { if (ResourcePackManager.getForceResourcePack()) { Status status = event.getStatus(); switch (status) { case DECLINED: case FAILED_DOWNLOAD: final Player player = event.getPlayer(); if (!player.hasPermission(new Permission("additionsapi.resourcepack.bypass", PermissionDefault.FALSE))) Bukkit.getServer().getScheduler().runTask(AdditionsAPI.getInstance(), () -> player.kickPlayer(LangFileUtils.get("resource_pack_kick"))); break; case ACCEPTED: case SUCCESSFULLY_LOADED: default: break; } } }
Example #3
Source File: Update19resourcepackhandler.java From QualityArmory with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onResourcepackStatusEvent(PlayerResourcePackStatusEvent event) { QAMain.sentResourcepack.remove(event.getPlayer().getUniqueId()); if (event.getStatus() == PlayerResourcePackStatusEvent.Status.ACCEPTED || event.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) { QAMain.resourcepackReq.add(event.getPlayer().getUniqueId()); }else if (QAMain.kickIfDeniedRequest) { event.getPlayer().kickPlayer(QAMain.S_KICKED_FOR_RESOURCEPACK); } }
Example #4
Source File: ResourcepackService.java From Transport-Pipes with MIT License | 5 votes |
@EventHandler public void onResourcepackStatus(PlayerResourcePackStatusEvent e) { if (getResourcepackMode() != ResourcepackMode.DEFAULT) { return; } if (e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED || e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) { LangConf.Key.RESOURCEPACK_FAIL.sendMessage(e.getPlayer()); loadingResourcepackPlayers.remove(e.getPlayer()); } else if (e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) { resourcepackPlayers.add(e.getPlayer()); if (loadingResourcepackPlayers.remove(e.getPlayer())) { transportPipes.changeRenderSystem(e.getPlayer(), ModelledRenderSystem.getDisplayName()); } } }
Example #5
Source File: CondResourcePack.java From Skript with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings({"unchecked", "null"}) @Override public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) { if (!ScriptLoader.isCurrentEvent(PlayerResourcePackStatusEvent.class)) { Skript.error("The resource pack condition can't be used outside of a resource pack response event"); return false; } states = (Expression<Status>) exprs[0]; setNegated(matchedPattern == 1); return true; }
Example #6
Source File: EvtResourcePackResponse.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public boolean check(final Event e) { if (states != null) { Status state = ((PlayerResourcePackStatusEvent) e).getStatus(); return states.check(e, state::equals); } return true; }
Example #7
Source File: CondResourcePack.java From Skript with GNU General Public License v3.0 | 4 votes |
@Override public boolean check(Event e) { Status state = ((PlayerResourcePackStatusEvent) e).getStatus(); return states.check(e, state::equals, isNegated()); }