当前位置: 首页>>代码示例>>Java>>正文


Java PlayerResourcePackStatusEvent类代码示例

本文整理汇总了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
    );
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:17,代码来源:ResourcePackListener.java

示例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);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:21,代码来源:DeveloperRoomParkour.java

示例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);
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:28,代码来源:SimplePlayListTest.java

示例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);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:10,代码来源:WelcomeTutorialNPCAction.java

示例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());
	}
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:11,代码来源:RenderSystem.java

示例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;
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:13,代码来源:ResourcePackListener.java

示例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()));
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:31,代码来源:ResourcePacksManagerImpl.java

示例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());
        }
    });
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:10,代码来源:InternalResourcePackManager.java

示例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);
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:9,代码来源:InternalResourcePackManager.java

示例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()]));
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:4,代码来源:PlayerConnection.java

示例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);
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:9,代码来源:IResourceCallback.java


注:本文中的org.bukkit.event.player.PlayerResourcePackStatusEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。