本文整理汇总了Java中org.bukkit.event.player.PlayerResourcePackStatusEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlayerResourcePackStatusEvent类的具体用法?Java PlayerResourcePackStatusEvent怎么用?Java PlayerResourcePackStatusEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerResourcePackStatusEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerResourcePackStatusEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: confirm
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
@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
);
}
示例2: onPlayerResourcePackStatus
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerResourcePackStatus(PlayerResourcePackStatusEvent event)
{
if (!this.expected.contains(event.getPlayer().getUniqueId()) || event.getStatus() != PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED)
return;
this.playMusic(event.getPlayer());
new BukkitRunnable()
{
@Override
public void run()
{
if (expected.contains(event.getPlayer().getUniqueId()))
playMusic(event.getPlayer());
else
this.cancel();
}
}.runTaskTimer(this.hub, MUSIC_LENGTH, MUSIC_LENGTH);
}
示例3: init
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
/**
* Make sure Nucleus and Bukkit are initialized.
*/
@BeforeClass
public static void init() {
NucleusTest.init();
Plugin plugin = BukkitTester.mockPlugin("dummy");
String yml = FileUtils.scanTextFile(SoundManagerTest.class, "/resource-sounds.yml", StandardCharsets.UTF_8);
YamlDataNode dataNode = new YamlDataNode(plugin, yml);
dataNode.load();
Player player = BukkitTester.login("dummy");
PlayerResourcePackStatusEvent event1 = new PlayerResourcePackStatusEvent(
player, PlayerResourcePackStatusEvent.Status.ACCEPTED);
Bukkit.getPluginManager().callEvent(event1);
BukkitTester.pause(20);
PlayerResourcePackStatusEvent event2 = new PlayerResourcePackStatusEvent(
player, PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED);
Bukkit.getPluginManager().callEvent(event2);
BukkitTester.pause(20);
}
示例4: onPlayerResourcePackStatus
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerResourcePackStatus(PlayerResourcePackStatusEvent event)
{
if (!this.expected.contains(event.getPlayer().getUniqueId()) || event.getStatus() != PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED)
return;
this.expected.remove(event.getPlayer().getUniqueId());
this.hub.getServer().getScheduler().runTaskLater(this.hub, () -> this.tutorial.start(event.getPlayer().getUniqueId()), 20L);
}
示例5: onResourcePackStatus
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
@EventHandler
public void onResourcePackStatus(PlayerResourcePackStatusEvent e) {
if (e.getStatus() == Status.DECLINED || e.getStatus() == Status.FAILED_DOWNLOAD) {
ductManager.changePlayerRenderSystem(e.getPlayer(), 0);
e.getPlayer().sendMessage("§cResourcepack Download failed!");
e.getPlayer().sendMessage("§cDid you enable \"Server Resourcepacks\" in your server list?");
} else {
loadedResourcePackPlayers.add(e.getPlayer());
}
}
示例6: onResourcePlayer
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onResourcePlayer(PlayerResourcePackStatusEvent e) {
Player p = e.getPlayer();
switch (e.getStatus()) {
case DECLINED:
case FAILED_DOWNLOAD:
Title.sendTitle(p, 1, 7, 1, ChatColor.RED + "Debes aceptar el ResourcePack", "");
plugin.getServer().getScheduler().runTaskLater(plugin, () -> PAServer.getUser(p).sendToLobby(), 60L);
break;
}
}
示例7: handle
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
private void handle(Player sender, PacketPlayInResourcePackStatus.EnumResourcePackStatus state)
{
Player player = sender;
if (forceUrl == null)
return;
if (state.equals(PacketPlayInResourcePackStatus.EnumResourcePackStatus.DECLINED) || state.equals(PacketPlayInResourcePackStatus.EnumResourcePackStatus.FAILED_DOWNLOAD))
{
if (callback == null || callback.automaticKick(player))
{
Bukkit.getScheduler().runTask(SamaGamesAPI.get().getPlugin(), () -> player.kickPlayer(rejectMessage));
}
APIPlugin.getInstance().getLogger().info("Player " + player.getName() + " rejected resource pack");
currentlyDownloading.remove(player.getUniqueId());
}
else if(state.equals(PacketPlayInResourcePackStatus.EnumResourcePackStatus.SUCCESSFULLY_LOADED))
{
currentlyDownloading.remove(player.getUniqueId());
APIPlugin.getInstance().getLogger().info("Player " + player.getName() + " successfully downloaded resource pack");
Bukkit.getScheduler().runTaskAsynchronously(APIPlugin.getInstance(), () -> {
Jedis jedis = api.getBungeeResource();
jedis.sadd("playersWithPack", player.getUniqueId().toString());
jedis.close();
});
//Call when it's done
if (callback != null)
callback.callback(player, PlayerResourcePackStatusEvent.Status.valueOf(state.toString()));
}
}
示例8: onResourcePackStatus
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
private void onResourcePackStatus(final PlayerResourcePackStatusEvent event) {
Scheduler.runTaskSync(Nucleus.getPlugin(), new Runnable() {
@Override
public void run() {
handleStatusEvent(event.getPlayer(), event.getStatus());
}
});
}
示例9: handleStatusEvent
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
private void handleStatusEvent(Player player, PlayerResourcePackStatusEvent.Status bukkitStatus) {
PlayerResourcePacks packs = get(player);
if (packs == null)
return;
ResourcePackStatus status = ResourcePackStatus.fromBukkit(bukkitStatus);
packs.setStatus(status);
}
示例10: a
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {
this.server.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), PlayerResourcePackStatusEvent.Status.values()[packetplayinresourcepackstatus.status.ordinal()]));
}
示例11: callback
import org.bukkit.event.player.PlayerResourcePackStatusEvent; //导入依赖的package包/类
/**
* Called when the download status is changed
* WARNING DON'T KICK THE PLAYER HERE
*
* @param player The player downloading the pack
* @param status The download status
*/
void callback(Player player, PlayerResourcePackStatusEvent.Status status);