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


Java PlayerTeleportEvent.TeleportCause方法代码示例

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


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

示例1: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
/**
 * Teleports a {@link Player} to a {@link Location} with a delay.
 *
 * @param player
 *            the {@link Player} to teleport
 * @param location
 *            the {@link Location} to teleport to
 * @param millis
 *            the time in milliseconds until teleport
 * @param warmupMessage
 *            the message to send whilst waiting
 * @param cause
 *            the cause for teleporting
 * @return true if {@link Player} was successfully teleported
 */
public boolean teleport(Player player, Location location, long millis, String warmupMessage, PlayerTeleportEvent.TeleportCause cause) {
    cancelTeleport(player, null); // cancels any previous teleport for the player.

    boolean result;
    if (millis <= 0) { // if there is no delay, just instantly teleport.
        result = player.teleport(location, cause);
        clearCooldown(player.getUniqueId());
    } else {
        UUID uuid = player.getUniqueId();
        player.sendMessage(warmupMessage);
        destinationMap.put(uuid, location.clone());
        setCooldown(player, uuid, millis, true, null);
        result = true;
    }

    return result;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:33,代码来源:TeleportTimer.java

示例2: onTp

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onTp(PlayerTeleportEvent event) {

    Player player = event.getPlayer();
    PlayerTeleportEvent.TeleportCause cause = event.getCause();

    if (cause.toString().equals("SPECTATE")) {
        if (!player.hasPermission("spectatetp.tp")) {
            event.setCancelled(true);
            if (!deny_message.equals("")) {
                player.sendMessage(deny_message);
            }
        }
    }

}
 
开发者ID:jonthesquirrel,项目名称:SpectateTP,代码行数:17,代码来源:SpectateTP.java

示例3: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    if (getHealth() == 0) {
        return false;
    }

    return super.teleport(location, cause);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:9,代码来源:CraftLivingEntity.java

示例4: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
public void teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    unstack();
    for (EEntity entity : entities) {
        entity.bukkit().teleport(location, cause);
    }
    stack();
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:8,代码来源:EntityStack.java

示例5: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent e) { PlayerTeleportEvent.TeleportCause cause = e.getCause();
  Player player = e.getPlayer();
  if (((redTeam.contains(player)) || (blueTeam.contains(player))) && 
    (cause == PlayerTeleportEvent.TeleportCause.ENDER_PEARL))
    e.setCancelled(true);
}
 
开发者ID:Dragonzslayer,项目名称:TeamTag-plugin,代码行数:8,代码来源:main.java

示例6: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    if (this.getPassenger() != null || this.isDead()) {
        return false;
    }
    if (this.eject()) {
        getHandle().setTransform(LocationConverter.toTransform(location));
        // CraftBukkit apparently does not throw an event when this method is called
        return true;
    }
    return false;
}
 
开发者ID:LapisBlue,项目名称:Pore,代码行数:13,代码来源:PoreEntity.java

示例7: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    net.minecraft.entity.player.EntityPlayerMP entity = getHandle();

    if (getHealth() == 0 || entity.isDead) {
        return false;
    }

    if (entity.playerNetServerHandler == null || entity.playerNetServerHandler.isDisconnected()) {
        return false;
    }

    // Spigot Start
    // if (entity.vehicle != null || entity.passenger != null) {
    // return false;
    // }
    // Spigot End

    // From = Players current Location
    Location from = this.getLocation();
    // To = Players new Location if Teleport is Successful
    Location to = location;
    // Create & Call the Teleport Event.
    PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause);
    server.getPluginManager().callEvent(event);

    // Return False to inform the Plugin that the Teleport was unsuccessful/cancelled.
    if (event.isCancelled()) {
        return false;
    }
    
    // Spigot Start
    eject();
    leaveVehicle();
    // Spigot End

    // Update the From Location
    from = event.getFrom();
    // Grab the new To Location dependent on whether the event was cancelled.
    to = event.getTo();
    // Grab the To and From World Handles.
    net.minecraft.world.WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle();
    net.minecraft.world.WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle();

    // Close any foreign inventory
    if (getHandle().openContainer != getHandle().inventoryContainer) {
        getHandle().closeScreen();
    }

    // Check if the fromWorld and toWorld are the same.
    if (fromWorld == toWorld) {
        entity.playerNetServerHandler.teleport(to);
    } else {
        server.getHandle().respawnPlayer(entity, toWorld.dimension, cause, to); // Cauldron
    }
    return true;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:58,代码来源:CraftPlayer.java

示例8: DelayedPlayerTeleportEvent

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
public DelayedPlayerTeleportEvent(Player player, Location from, Location to, PlayerTeleportEvent.TeleportCause cause) {
    this.player = PlayerModule.getInstance().getPlayer(player);
    this.from = from;
    this.to = to;
    this.cause = cause;
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:7,代码来源:DelayedPlayerTeleportEvent.java

示例9: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause teleportCause) {
    return implementation.teleport(location, teleportCause);
}
 
开发者ID:shawlaf,项目名称:Banmanager,代码行数:5,代码来源:CraftBanmanagerUser.java

示例10: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport( Location location, PlayerTeleportEvent.TeleportCause teleportCause ) {
    return this.teleport( location );
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:5,代码来源:FlexEntity.java

示例11: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport( Location location, PlayerTeleportEvent.TeleportCause teleportCause ) {
    return false;
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:5,代码来源:TempPlayer.java

示例12: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    return player.teleport(location, cause);
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:5,代码来源:DiscordPlayerCommandSender.java

示例13: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    if (!Sponge.isServerAvailable()) return false;
    return getSpongeEntity().setLocation(convertToSpongeLocation(location));
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:6,代码来源:LinkedEntity.java

示例14: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    return false;
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:5,代码来源:LinkedPlayer.java

示例15: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
    net.minecraft.entity.player.EntityPlayerMP entity = getHandle();

    if (getHealth() == 0 || entity.isDead) {
        return false;
    }

    if (entity.playerNetServerHandler == null || entity.playerNetServerHandler.isDisconnected()) {
        return false;
    }

    // Spigot Start
    // if (entity.vehicle != null || entity.passenger != null) {
    // return false;
    // }
    // Spigot End

    // From = Players current Location
    Location from = this.getLocation();
    // To = Players new Location if Teleport is Successful
    Location to = location;
    // Create & Call the Teleport Event.
    PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause);
    server.getPluginManager().callEvent(event);

    // Return False to inform the Plugin that the Teleport was unsuccessful/cancelled.
    if (event.isCancelled()) {
        return false;
    }
    
    // Spigot Start
    eject();
    leaveVehicle();
    // Spigot End

    // Update the From Location
    from = event.getFrom();
    // Grab the new To Location dependent on whether the event was cancelled.
    to = event.getTo();
    // Grab the To and From World Handles.
    net.minecraft.world.WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle();
    net.minecraft.world.WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle();

    // Close any foreign inventory
    if (getHandle().openContainer != getHandle().inventoryContainer) {
        getHandle().closeScreen();
    }

    // Check if the fromWorld and toWorld are the same.
    if (fromWorld == toWorld) {
        entity.playerNetServerHandler.teleport(to);
    } else {
        server.getHandle().respawnPlayer(entity, toWorld.dimension, false, to); // Cauldron
    }
    return true;
}
 
开发者ID:CyberdyneCC,项目名称:ThermosRebased,代码行数:58,代码来源:CraftPlayer.java


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