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


Java Player.setResourcePack方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.setResourcePack方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setResourcePack方法的具体用法?Java Player.setResourcePack怎么用?Java Player.setResourcePack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.setResourcePack方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removePlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void removePlayer(Player player)
{
    super.removePlayer(player);

    this.expected.remove(player.getUniqueId());
    player.setResourcePack("http://resources.samagames.net/samareset.zip");
    player.playEffect(player.getLocation(), Effect.RECORD_PLAY, 0);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:10,代码来源:DeveloperRoomParkour.java

示例2: refreshPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void refreshPlayer(final Player player) {
    if(!enabled) return;
    if(!player.isOnline()) return;

    String url = getUrl();
    String sha1 = getSha1();
    if(url == null || sha1 == null) return;

    if(!Objects.equals(lastSentSha1.get(player), sha1)) {
        Instant joined = joinTime.get(player);
        if(joined == null) return;
        long delayMillis = Duration.between(Instant.now(), joined.plus(JOIN_DELAY)).toMillis();

        if(delayMillis <= 0) {
            logger.fine("Sending resource pack " + url + " with SHA1 " + sha1 + " to player " + player.getName());
            lastSentSha1.put(player, sha1);
            player.setResourcePack(url, sha1);
        } else {
            plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
                @Override
                public void run() {
                    refreshPlayer(player);
                }
            }, delayMillis / 50 + 1);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:29,代码来源:ResourcePackListener.java

示例3: addPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void addPlayer(Player player)
{
    super.addPlayer(player);

    this.expected.add(player.getUniqueId());
    player.setResourcePack("http://resources.samagames.net/" + this.resourcePack + ".zip");
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:9,代码来源:DeveloperRoomParkour.java

示例4: initPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void initPlayer(Player p) {
	if (Bukkit.getPluginManager().isPluginEnabled("AuthMe") && !fr.xephi.authme.api.v3.AuthMeApi.getInstance().isAuthenticated(p)) {
		return;
	}
	if (!loadedResourcePackPlayers.contains(p) && TransportPipes.instance.generalConf.getResourcepack() != null) {
		p.closeInventory();
		p.setResourcePack(TransportPipes.instance.generalConf.getResourcepack(), TransportPipes.resourcepackHash);
	}
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:10,代码来源:RenderSystem.java

示例5: setResourcePack

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void setResourcePack(Player player, String string){
    if(string == null){
        plugin.getLogger().info("Did you set a default resource pack? ");
        return;
    }
    player.setResourcePack(string);
}
 
开发者ID:spammy23,项目名称:per-version-resource-packs,代码行数:8,代码来源:PVSListener.java

示例6: onJoin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onJoin(PlayerJoinEvent event)
{
    final Player player = event.getPlayer();

    if (forceUrl != null)
    {
        currentlyDownloading.add(player.getUniqueId());
        sendPack(player, forceUrl);

        //Kick if still downloading after 1 minute
        Bukkit.getScheduler().runTaskLater(SamaGamesAPI.get().getPlugin(),
                () -> {
                    if(currentlyDownloading.contains(player.getUniqueId()) && player.isOnline())
                    {
                        if (callback == null || callback.automaticKick(player))
                        {
                            player.kickPlayer(rejectMessage);
                        }
                        currentlyDownloading.remove(player.getUniqueId());
                        APIPlugin.getInstance().getLogger().info("Player " + player.getName() + " timed out resource pack");
                    }
                }, 1200L);//20*60
    } else
    {
        Jedis jedis = api.getBungeeResource();
        Long l = jedis.srem("playersWithPack", player.getUniqueId().toString());
        jedis.close();

        if (l > 0)
        {
            //Better to check than force resourcepack
            player.setResourcePack(resetUrl);
            APIPlugin.getInstance().getLogger().info("Sending pack to " + player.getName() + " : " + resetUrl);
        }
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:38,代码来源:ResourcePacksManagerImpl.java


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