本文整理汇总了Java中org.bukkit.entity.Player.teleport方法的典型用法代码示例。如果您正苦于以下问题:Java Player.teleport方法的具体用法?Java Player.teleport怎么用?Java Player.teleport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.teleport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInventoryClick2
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onInventoryClick2(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
ItemStack is = event.getCurrentItem();
if ((event.getCurrentItem() != null) && (event.getCurrentItem().getType() != Material.AIR)) {
if (event.getInventory().getName().equals(ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1")) {
event.setCancelled(true);
for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
Location location = player.getLocation();
if ((event.getCurrentItem().getType() == Material.SKULL_ITEM) && (is.hasItemMeta()) && (is.getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you."))) {
player.closeInventory();
targetPlayer.teleport(player);
player.sendMessage(ChatColor.YELLOW + "You've teleported " + ChatColor.GREEN + targetPlayer.getDisplayName() + ChatColor.YELLOW + " to you!");
player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
player.playEffect(location, Effect.ENDER_SIGNAL, 1);
targetPlayer.playEffect(location, Effect.ENDER_SIGNAL, 1);
}
}
}
}
}
示例2: run
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void run(WCUser user, String label, String[] args) {
Player p = user.getPlayer();
economy = new Economy(p);
if (args.length >= 0) {
if (economy.isInTeam()) {
Teams.TeamsInfo team = WCTWD.getInstance().getTeams().getTeam(WCTWD.getPlayer(user.getPlayer()));
user.sendMessagePrefix("&cYa estás en el equipo " + team.getColor() + team.toString());
return;
}
fileManager.getPlayer().set(p.getName() + ".team", "prision");
p.teleport(Parsers.stringToLocation(fileManager.getConfig().getString("prision")));
fileManager.saveFiles();
addItems(p);
WCTWD.getInstance().getFileManager().saveFiles();
WCTWD.getInstance().getTeams().addTeam(WCTWD.getPlayer(p), Teams.TeamsInfo.PRISION);
p.sendMessage(Messages.teamJoin("prision"));
}
}
示例3: onDamage
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onDamage(EntityDamageEvent e){
if(!(e.getEntity() instanceof Player)) return;
Player p = (Player) e.getEntity();
if (plugin.getGm().isInLobby()) e.setCancelled(true);
switch (e.getCause()) {
case LAVA:
e.setCancelled(true);
p.teleport(plugin.getAm().getRandomSpawn());
//RageGames.getPlayer(p).resetPlayer();
p.setHealth(20d);
p.setFireTicks(0);
break;
case FALL:
e.setCancelled(true);
break;
}
}
示例4: JoinTeam
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void JoinTeam(Player player,String area){
String worldconfig = plugin.getConfig().getString("area."+area+".world");
World world = Bukkit.getServer().getWorld(worldconfig);
String Location = plugin.getConfig().getString("area."+area+".Location");
String[] location = Location.split(",");
int x = Integer.parseInt(location[0]);
int y = Integer.parseInt(location[1]);
int z = Integer.parseInt(location[2]);
Location location2 = new Location(world, x, y, z);
player.teleport(location2);
player.setGameMode(GameMode.SURVIVAL);
Team team = board.getTeam(area);
PlayerInWhereArea.put(player, team);
team.addPlayer(player);
player.playSound(player.getLocation(), Sound.CLICK, 2F, 15F);
player.sendMessage(ChatColor.BLUE + "�A�[�J�F�C��");
}
示例5: onPreStart
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void onPreStart() {
Location spawnLocation = Utils.parseLocation((String) this.getGameMap().fetchSetting("startPosition"));
for(Player player : Bukkit.getOnlinePlayers()) {
if(!this.getAPI().getGameManager().isAlive(player)) continue;
player.teleport(spawnLocation);
player.setGameMode(GameMode.ADVENTURE);
player.setFoodLevel(1);
}
this.potionDropLocation = Utils.parseLocation((String) this.getGameMap().fetchSetting("potionDropPosition"));
this.potionVelocityMultiplier = Double.parseDouble((String) this.getGameMap().fetchSetting("potionVelocityMultiplier"));
this.healthDropPerTwoSeconds = Double.parseDouble((String) this.getGameMap().fetchSetting("healthDropPerTwoSeconds"));
this.potionDropPerSecond = Integer.parseInt((String) this.getGameMap().fetchSetting("potionDropPerSecond"));
this.poisonEffectDelayInSeconds = Integer.parseInt((String) this.getGameMap().fetchSetting("poisonEffectDelayInSeconds"))+1;
this.witherEffectDelayInSeconds = Integer.parseInt((String) this.getGameMap().fetchSetting("witherEffectDelayInSeconds"))+1;
this.slownessEffectDelayInSeconds = Integer.parseInt((String) this.getGameMap().fetchSetting("slownessEffectDelayInSeconds"))+1;
}
示例6: downElevator
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void downElevator(PlayerToggleSneakEvent e) {
Player p = e.getPlayer();
Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (!p.isSneaking() && b.getType() == elevatorMaterial) {
b = b.getRelative(BlockFace.DOWN, minElevation);
int i = maxElevation; //16
while (i > 0 && !(b.getType() == elevatorMaterial && b.getRelative(BlockFace.UP).getType().isTransparent() && b.getRelative(BlockFace.UP, 2).getType().isTransparent())) {
i--;
b = b.getRelative(BlockFace.DOWN);
}
if (i > 0) {
Location l = p.getLocation();
l.setY(l.getY() - maxElevation - 2 + i);
p.teleport(l);
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_IRONGOLEM_ATTACK, 1, 1);
}
}
}
示例7: onJoin
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(null);
if (!Skywars.getInstance().isSingleServerMode()) {
player.setGameMode(GameMode.ADVENTURE);
player.getInventory().clear();
player.setMaxHealth(20);
player.setHealth(player.getMaxHealth());
player.setFoodLevel(25);
player.teleport(Skywars.getInstance().getLobbyPoint());
}
}
示例8: onEntityDamage
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
if (!(event.getEntity() instanceof Player))
return;
if (event.getCause() != DamageCause.VOID)
return;
Player p = (Player) event.getEntity();
Gamer g = Gamer.get(p);
if (g.getVariable("parkour") != null) {
p.teleport(((Course) g.getVariable("parkour")).getStart());
}
}
示例9: join
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public synchronized boolean join(Player player, Team team) {
if (team == Team.RED) {
this.redTeam.add(player);
if (this.arena.getTeamMeta().getRedSpawnPoint() != null)
player.teleport(this.arena.getTeamMeta().getRedSpawnPoint());
else
player.teleport(this.arena.getBallSpawnLocation());
if (this.getHologram() != null) {
this.getHologram().show(player);
}
Bukkit.getPluginManager().callEvent(new GameJoinEvent(this, player));
return true;
} else if (team == Team.BLUE) {
this.blueTeam.add(player);
if (this.arena.getTeamMeta().getBlueSpawnPoint() != null)
player.teleport(this.arena.getTeamMeta().getBlueSpawnPoint());
else
player.teleport(this.arena.getBallSpawnLocation());
if (this.getHologram() != null) {
this.getHologram().show(player);
}
Bukkit.getPluginManager().callEvent(new GameJoinEvent(this, player));
return true;
}
return false;
}
示例10: cast
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean cast(final Player p, final PlayerDataRPG pd, final int level) {
final Location start = p.getLocation().add(0, p.getEyeHeight() * 0.1, 0);
Location permStart = p.getLocation().add(0, p.getEyeHeight() * 0.1, 0).clone();
Location loc = start;
Vector direction = p.getLocation().getDirection().normalize();
direction.setY(0);
int length = 5;
Location prev = null;
for (int k = 0; k < length; k++) {
Location temp = loc.clone();
loc = loc.add(direction);
if (loc.getBlock().getType().isSolid())
break;
prev = temp.clone();
}
if (prev != null) {
RParticles.show(ParticleEffect.EXPLOSION_NORMAL, permStart, 10);
RParticles.show(ParticleEffect.EXPLOSION_NORMAL, prev, 10);
p.teleport(prev);
} else {
p.sendMessage(ChatColor.RED + "You can't flash through walls!");
return false;
}
Spell.notify(p, "You instantly teleport a short distance.");
return true;
}
示例11: onPlayerJoin
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
joinTimes.put(event.getPlayer().getName(), new Date());
event.setJoinMessage(null);
p.setHealth(20);
p.setFoodLevel(20);
p.getInventory().clear();
Location l = event.getPlayer().getWorld().getSpawnLocation();
l.setX(14.5);
l.setY(10.5);
l.setZ(-795.5);
l.setPitch(0.5F);
l.setYaw(90 * RandomUtil.between(1, 4));
p.teleport(l);
p.setGameMode(GameMode.SURVIVAL);
p.getInventory().addItem(Lobby.book);
p.getInventory().addItem(Lobby.compass);
Lobby.addPotionEffect(event.getPlayer(), new PotionEffect(PotionEffectType.SPEED, 2147483647, 2));
if (Gamer.get(p.getName()).getRank().getLevel() >= RankType.ADMIN.getLevel())
event.getPlayer().addAttachment(Lobby.getInstance(), "bukkit.command.gamemode", true);
}
示例12: playerJoinJail
import org.bukkit.entity.Player; //导入方法依赖的package包/类
static public void playerJoinJail(Player player,Location location){
double jailX = Integer.valueOf(Config.getConfig("jail.location.X"))+0.5;
double jailY = Integer.valueOf(Config.getConfig("jail.location.Y"));
double jailZ = Integer.valueOf(Config.getConfig("jail.location.Z"))+0.5;
World jailWorld = Bukkit.getWorld(Config.getConfig("jail.location.World"));
Location jail = new Location(jailWorld,jailX,jailY,jailZ);
player.teleport(jail);
}
示例13: onExpire
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void onExpire(UUID userUUID) {
Player player = Bukkit.getPlayer(userUUID);
if (player == null)
return;
Location destination = this.destinationMap.remove(userUUID);
if (destination != null) {
destination.getChunk(); // pre-load the chunk before teleport.
player.teleport(destination, PlayerTeleportEvent.TeleportCause.COMMAND);
}
}
示例14: teleportToSpawnStats
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void teleportToSpawnStats(Player player) {
try {
org.bukkit.World w = org.bukkit.Bukkit.getServer().getWorld(ConfigPlayerStats.getConfig().getString(player.getUniqueId()+".Position.Last_logout.World"));
double x = ConfigPlayerStats.getConfig().getDouble(player.getUniqueId()+".Position.Last_logout.x");
double y = ConfigPlayerStats.getConfig().getDouble(player.getUniqueId()+".Position.Last_logout.y");
double z = ConfigPlayerStats.getConfig().getDouble(player.getUniqueId()+".Position.Last_logout.z");
float yaw = ConfigPlayerStats.getConfig().getInt(player.getUniqueId()+".Position.Last_logout.yaw");
float pitch = ConfigPlayerStats.getConfig().getInt(player.getUniqueId()+".Position.Last_logout.pitch");
player.teleport(new org.bukkit.Location(w, x, y, z, yaw, pitch));
} catch (Exception e) {
org.bukkit.Bukkit.getLogger().warning("UltimateSpawn : Error either in the plugin or in your configuration");
}
}
示例15: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage(Lang.HEADERS_CHALLENGES.toString() + Lang.COMMANDS_ONLY_PLAYER.toString());
return true;
}
Player player = (Player) sender;
if(args.length == 1) {
if(args[0].equalsIgnoreCase("location")) {
if(!sender.hasPermission("asgardascension.admin")){
sender.sendMessage(Lang.HEADERS_MAIN.toString() + Lang.COMMANDS_NO_PERMISSION.toString());
return true;
}
ConfigFile.setPrestigeLocation(Convert.locationToString(player.getLocation(), true));
player.sendMessage(Lang.HEADERS_MAIN.toString() + Lang.PRESTIGE_SET_LOCATION.toString());
return true;
}
}
if(plugin.getPlayerManager().getPrestige(player) >= ConfigFile.getMaxPrestige()){
player.sendMessage(Lang.HEADERS_CHALLENGES.toString()
+ Lang.PRESTIGE_REACHED_MAX.toString());
return true;
}
if(plugin.getPlayerManager().getRank(player) != plugin.getChallengesFile().getChallengesAmount()) {
player.sendMessage(Lang.HEADERS_CHALLENGES.toString()
+ Lang.PRESTIGE_RANK_INSUFFICIENT.toString()
.replaceAll("%s", plugin.getChallengesFile().getTitle(plugin.getChallengesFile().getChallengesAmount())));
return true;
}
if(args.length == 0){
player.sendMessage(Lang.HEADERS_CHALLENGES.toString()
+ Lang.PRESTIGE_READY.toString());
return true;
}
if(args.length == 1){
if(!args[0].equalsIgnoreCase("confirm")){
player.sendMessage(Lang.HEADERS_CHALLENGES.toString()
+ Lang.PRESTIGE_READY.toString());
return true;
}
else {
plugin.getPlayerManager().setPrestige(player, plugin.getPlayerManager().getPrestige(player) + 1, PrestigeType.SELF);
plugin.getPlayerManager().setRank(player, 0);
plugin.getPlayerManager().setTokens(player, plugin.getPlayerManager().getTokens(player) + ConfigFile.getTokensReward());
player.teleport(ConfigFile.getPrestigeLocation());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pex user " + player.getName() + " group remove Odin");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pex user " + player.getName() + " group add A");
String comm = ConfigFile.getPrestigeCommand();
comm = comm.replaceAll("%player", player.getName());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), comm);
player.sendMessage(Lang.HEADERS_CHALLENGES.toString()
+ Lang.PRESTIGE_ASCENDED.toString()
.replaceAll("%d", String.valueOf(plugin.getPlayerManager().getPrestige(player))));
if(ConfigFile.getTokensReward() > 0) {
player.sendMessage(Lang.HEADERS_CHALLENGES.toString()
+ Lang.PRESTIGE_TOKEN_REWARD.toString()
.replaceAll("%d", String.valueOf(ConfigFile.getTokensReward())));
}
}
return true;
}
return true;
}