本文整理汇总了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);
}
示例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);
}
}
}
示例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");
}
示例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);
}
}
示例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);
}
示例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);
}
}
}