本文整理匯總了Java中org.bukkit.entity.Player.hidePlayer方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.hidePlayer方法的具體用法?Java Player.hidePlayer怎麽用?Java Player.hidePlayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.hidePlayer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import org.bukkit.entity.Player; //導入方法依賴的package包/類
/**
* Starts the tutorial for the given player.
*
* @param id The UUID of the player.
*/
public void start(UUID id)
{
if (isWatchingTutorial(id))
{
p.getLogger().info(p.getServer().getPlayer(id).getName() + "(" + id + ") is trying to see the tutorial whilst watching it.");
return;
}
Player player = p.getServer().getPlayer(id);
// The player cannot move anymore (except with our teleportations)
player.setFlySpeed(0f);
player.setAllowFlight(true);
player.setFlying(true);
// All other players are hidden
for (Player other : p.getServer().getOnlinePlayers())
{
player.hidePlayer(other);
other.hidePlayer(player);
}
// The player's hour is updated, if needed
if(tutorialHour != null)
{
player.setPlayerTime(tutorialHour, false);
}
// The tutorial is started
viewers.put(
id, p.getServer().getScheduler().runTaskTimer(p, new TutorialRunner(this, id), 10L, 10L)
);
}
示例2: handleModeratorLogin
import org.bukkit.entity.Player; //導入方法依賴的package包/類
/**
* Override this to execute something when a moderator joins the game.
*
* You need to call the {@code super} method at the beginning of your own one.
*
* @param player The player who logged in.
*/
public void handleModeratorLogin(Player player)
{
for (GamePlayer gamePlayer : this.gamePlayers.values())
{
Player p = gamePlayer.getPlayerIfOnline();
if (p != null)
p.hidePlayer(player);
}
this.gameModerators.add(player.getUniqueId());
player.setGameMode(GameMode.SPECTATOR);
player.sendMessage(ChatColor.GREEN + "Vous êtes invisibles aux yeux de tous, attention à vos actions !");
}
示例3: refreshVisibility
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public void refreshVisibility() {
final Player bukkit = getBukkit();
bukkit.showInvisibles(isObserving());
for(MatchPlayer other : match.getPlayers()) {
if(canSee(other)) {
bukkit.showPlayer(other.getBukkit());
} else {
bukkit.hidePlayer(other.getBukkit());
}
if(other.canSee(this)) {
other.getBukkit().showPlayer(bukkit);
} else {
other.getBukkit().hidePlayer(bukkit);
}
}
}
示例4: sendAllToPlayer
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public void sendAllToPlayer(Player current)
{
if (current == null)
return;
//final EntityPlayer currentNMS = ((CraftPlayer) current).getHandle();
// Bukkit.getScheduler().runTaskAsynchronously(pluginAPI, () -> {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player == null || current.getName().equals(player.getName()))
continue;
current.hidePlayer(player);
//TODO show if not moderator
current.showPlayer(player);
/*
EntityPlayer entity = ((CraftPlayer) player).getHandle();
if (entity == null || currentNMS == null || currentNMS.playerConnection == null)
continue;
currentNMS.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entity));*/
}
// });
}
示例5: sendPlayerToAll
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public void sendPlayerToAll(Player current)
{
if (current == null)
return;
// final EntityPlayer currentNMS = ((CraftPlayer) current).getHandle();
// Bukkit.getScheduler().runTaskAsynchronously(pluginAPI, () -> {
//PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, currentNMS);
for (Player p : Bukkit.getOnlinePlayers()) {
if (p == null || current.getName().equals(p.getName()))
continue;
p.hidePlayer(current);
p.showPlayer(current);
/*EntityPlayer entity = ((CraftPlayer) p).getHandle();
if (entity == null|| currentNMS == null || entity.playerConnection == null)
continue;
entity.playerConnection.sendPacket(packet);*/
}
//});
}
示例6: giveStealth
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void giveStealth(Player p, int seconds) {
invis.add(p);
for(Player p2 : plugin.getServer().getOnlinePlayers())
p2.hidePlayer(p);
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, RTicks.seconds(seconds), 1, true, false));
RParticles.showWithOffset(ParticleEffect.SMOKE_LARGE, p.getLocation().add(0, p.getEyeHeight() * 0.7, 0), 1.0, 15);
}
示例7: sendNPC
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public void sendNPC(Player p, CustomNPC npc)
{
Reflection.sendPacket(p, new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
p.hidePlayer(npc.getBukkitEntity());
p.showPlayer(npc.getBukkitEntity());
this.api.getPlugin().getServer().getScheduler().runTaskLater(this.api.getPlugin(), () ->
{
Reflection.sendPacket(p, new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc));
}, 60L);
}
示例8: setCloak
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void setCloak(Player player, boolean state) {
setCloakState(player, state);
for (Player ps : Bukkit.getOnlinePlayers()) {
if (isCloaked(player)) {
ps.hidePlayer(player);
} else {
ps.showPlayer(player);
}
}
}
示例9: onJoin
import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
player.setPlayerListName(ChatColor.LIGHT_PURPLE + getConfig().getString("players." + player.getName() + ".name") + ChatColor.DARK_AQUA + getConfig().getString("players." + player.getName() + ".suffix"));
AntiCheat.data.add(new PlayerData(player));
//player.kickPlayer("Get out of here!");
if (!getConfig().getString("players." + player.getName() + ".cloaked").equals("yes")) {
if (!player.isOp()) {
e.setJoinMessage(ChatColor.LIGHT_PURPLE + player.getName() + ChatColor.GREEN + " has joined the game");
}
else if (player.isOp()) {
e.setJoinMessage(ChatColor.LIGHT_PURPLE + getConfig().getString("players." + e.getPlayer().getName() + ".name") + ChatColor.DARK_AQUA + getConfig().getString("players." + e.getPlayer().getName() + ".suffix") + ChatColor.GREEN + "joined the game");
}
}
else {
e.setJoinMessage(null);
}
for (Player ps : cloaked) {
player.hidePlayer(ps);
}
if (getConfig().getString("players." + player.getName() + ".cloaked").equals("yes")) {
cloaked.add(player);
}
ItemStack gs = new ItemStack(Material.COMPASS, 1);
ItemMeta gsm = gs.getItemMeta();
gsm.setDisplayName("&f&lGame Selector".replace('&', '�'));
gs.setItemMeta(gsm);
e.getPlayer().getInventory().setItem(8, gs);
}
示例10: entityDamage
import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler
public void entityDamage(final EntityDamageEvent event) {
if(!(event instanceof EntityDamageByEntityEvent)) return;
EntityDamageByEntityEvent realEvent = (EntityDamageByEntityEvent) event;
if(!(realEvent.getDamager() instanceof Player) || !(realEvent.getEntity() instanceof Player)) return;
final Player damager = (Player) realEvent.getDamager();
final Player victim = (Player) realEvent.getEntity();
if(victim.hasPermission(GizmoConfig.EXEMPT_PERMISSION)) return;
if(!(Gizmos.gizmoMap.get(damager) instanceof PopperGizmo)) return;
if(damager.getItemInHand().getType() != this.getIcon()) return;
if(!damager.canSee(victim)) return;
damager.hidePlayer(victim);
damager.playSound(damager.getLocation(), Sound.BLOCK_LAVA_POP, 1f, 2f);
Integer count = poppedCount.get(damager);
if(count == null) count = 0;
count++;
poppedCount.put(damager, count);
if(count % 10 == 0) {
RaindropUtil.giveRaindrops(
Users.playerId(damager), 1, null,
new TranslatableComponent("gizmo.popper.raindropsResult", new Component(String.valueOf(count), net.md_5.bungee.api.ChatColor.GOLD))
);
}
event.setCancelled(true);
}
示例11: add
import org.bukkit.entity.Player; //導入方法依賴的package包/類
boolean add(Player viewer) {
if(viewers.add(viewer)) {
viewer.hidePlayer(player);
entity.spawn(viewer, player.getLocation());
viewer.playSound(viewer.getLocation(), Sound.ENTITY_CHICKEN_AMBIENT, 1f, 1f);
viewer.playSound(viewer.getLocation(), Sound.ENTITY_CHICKEN_HURT, 1f, 1f);
return true;
}
return false;
}
示例12: setSpectator
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void setSpectator(Player player, String prefix, Location spawn) {
if (!PREFIXES.containsKey(player.getName()))
PREFIXES.put(player.getName(), prefix);
player.setFoodLevel(20);
player.setLevel(0);
player.setGameMode(GameMode.ADVENTURE);
player.setAllowFlight(true);
player.setPlayerListName(prefix + player.getDisplayName());
player.setDisplayName(prefix + player.getDisplayName());
player.setExp(0);
player.setHealthScale(20);
player.setHealth(20);
player.setTotalExperience(0);
player.setCanPickupItems(false);
player.setCustomName(prefix + player.getDisplayName());
player.setCustomNameVisible(true);
for (PotionEffect eff : player.getActivePotionEffects()) {
player.removePotionEffect(eff.getType());
}
player.teleport(spawn);
for (Player p : Bukkit.getOnlinePlayers()) {
p.hidePlayer(player);
}
PlayerUtil.addDeadPlayer(player);
}
示例13: updateSpectators
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void updateSpectators() {
for (String list : getSpectators()) {
Player t = Bukkit.getPlayerExact(list);
if (t == null || !t.isOnline())
continue;
t.setAllowFlight(true);
for (Player p : Bukkit.getOnlinePlayers()) {
if (getSpectators().contains(p.getName()))
continue;
p.hidePlayer(t);
}
}
}
示例14: hidePlayer
import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void hidePlayer(Player p) {
for (Player player : Bukkit.getOnlinePlayers()) {
p.hidePlayer(player);
}
PVPlayer.remove(p);
}
示例15: handleInvisibility
import org.bukkit.entity.Player; //導入方法依賴的package包/類
private void handleInvisibility(Player player, Rune rune) {
for(Player p : Bukkit.getOnlinePlayers()) {
p.hidePlayer(player);
}
new BukkitRunnable() {
public void run() {
if(player != null && player.isOnline()) {
finish(player, true);
}
}
}.runTaskLater(plugin, 100L);
}