本文整理汇总了Java中org.bukkit.event.player.PlayerTeleportEvent.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerTeleportEvent.getCause方法的具体用法?Java PlayerTeleportEvent.getCause怎么用?Java PlayerTeleportEvent.getCause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerTeleportEvent
的用法示例。
在下文中一共展示了PlayerTeleportEvent.getCause方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPearlClip
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
Location to = event.getTo();
if (blockedPearlTypes.contains(to.getBlock().getType())) {
Player player = event.getPlayer();
player.sendMessage(ChatColor.YELLOW + "You have been detected trying to pearl glitch, your pearl has been refunded and cooldown wiped.");
plugin.getTimerManager().getEnderPearlTimer().refund(player);
event.setCancelled(true);
return;
}
to.setX(to.getBlockX() + 0.5);
to.setZ(to.getBlockZ() + 0.5);
event.setTo(to);
}
}
示例2: onPearlClip
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
Location to = event.getTo();
if (blockedPearlTypes.contains(to.getBlock().getType())) {
Player player = event.getPlayer();
player.sendMessage(ChatColor.RED + "You cannot pearl there.");
removeCooldown(player);
event.setCancelled(true);
return;
}
to.setX(to.getBlockX() + 0.5D);
to.setZ(to.getBlockZ() + 0.5D);
event.setTo(to);
}
}
示例3: onPlayerSwitch
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerSwitch(final PlayerTeleportEvent e) {
if(RandomCoords.getPlugin().config.getStringList("OnJoinWorlds") == null ) { return; }
if(e.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || e.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL) {
return;
}
final List<String> list = RandomCoords.getPlugin().config.getStringList("OnJoinWorlds");
if(list.isEmpty()) { return; }
if(e.getTo().getWorld() == e.getFrom().getWorld()) { return; }
if(list.contains(e.getTo().getWorld().getName())) {
if(e.getTo().getWorld().getPlayers().contains(e.getPlayer())) { return; }
final Player p = e.getPlayer();
//coordinates.finalCoordinates(p, 574272099, 574272099, e.getTo().getWorld(), CoordType.JOINWORLD, 0);
coordinatesManager.randomlyTeleportPlayer(p, e.getTo().getWorld(), coordinatesManager.key, coordinatesManager.key, CoordType.JOINWORLD, 0);
}
}
示例4: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
if(event.getCause() != TeleportCause.ENDER_PEARL) return;
Flag flag = this.GetFlagInstanceAtLocation(event.getFrom(), event.getPlayer());
if(flag != null)
{
event.setCancelled(true);
}
flag = this.GetFlagInstanceAtLocation(event.getTo(), event.getPlayer());
if(flag != null)
{
event.setCancelled(true);
}
}
示例5: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
if(event.getCause() != TeleportCause.CHORUS_FRUIT) return;
Flag flag = this.GetFlagInstanceAtLocation(event.getFrom(), event.getPlayer());
if(flag != null)
{
event.setCancelled(true);
}
flag = this.GetFlagInstanceAtLocation(event.getTo(), event.getPlayer());
if(flag != null)
{
event.setCancelled(true);
}
}
示例6: playerTeleportEvent
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void playerTeleportEvent(PlayerTeleportEvent event)
{
Player player = event.getPlayer();
PlayerGUIPage playerGUIContainer = PlayerData.getPlayerData(player).getPlayerGUIPage();
if(playerGUIContainer != null)
{
if(event.getCause() != PlayerTeleportEvent.TeleportCause.UNKNOWN)
{
playerGUIContainer.destroy();
PlayerData.getPlayerData(player).setPlayerGUIPage(null);
PlayerData.getPlayerData(player).setPlayerPreviousGUIPage(null);
}
}
}
示例7: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@Override
public void onPlayerTeleport(PlayerTeleportEvent event, BPPlayer bpPlayer)
{
TeleportCause cause = event.getCause();
if(cause == TeleportCause.ENDER_PEARL)
{
CTFGame game = getGame();
FlagManager flm = game.getFlagManager();
if(flm.isHoldingFlag(bpPlayer))
{
Player player = bpPlayer.getPlayer();
event.setCancelled(true);
player.sendMessage(MessageType.OTHER_WARNPEARL.getTranslation().getValue());
}
}
}
示例8: on
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void on(PlayerTeleportEvent event) {
if (!isCurrentlyFrozen(event.getPlayer().getUniqueId())) return;
Player player = event.getPlayer();
switch (event.getCause()) {
case PLUGIN:
// skip if it was to the same location as currently set, stops
// resetting particles/metadata on border knockback
if (event.getTo().equals(getFreezeLocation(player).get())) return;
case COMMAND:
case UNKNOWN:
// set new location and reset particles
setFreezeLocation(player, event.getTo());
startParticleSpawning(player, event.getTo());
potionApplier.addPotions(player);
}
}
示例9: 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);
}
}
}
}
示例10: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true)
private void onPlayerTeleport(PlayerTeleportEvent event) {
if (event.getFrom() == null || event.getTo() == null)
return;
// player teleporting to a different world
if (!event.getFrom().getWorld().equals(event.getTo().getWorld())) {
PlayList.clearQueue(event.getPlayer());
}
if (event.getCause() != TeleportCause.UNKNOWN) {
_regionManager.getPlayerWatcher()
.updatePlayerLocation(event.getPlayer(), event.getTo(), RegionEventReason.TELEPORT);
}
}
示例11: PlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void PlayerTeleport(final PlayerTeleportEvent event)
{
final Player player = event.getPlayer();
if (plugin.isLoggedIn(player))
{
final LoginPlayerData playerdata = plugin.getPlayerData(player);
if (playerdata != null)
playerdata.notifyAction();
return;
}
if (playerListener.getMovementBlocker(player) == null)
return;
switch (event.getCause())
{
case PLUGIN:
playerListener.setMovementBlocker(player, event.getTo());
case UNKNOWN:
return;
default:
event.setCancelled(true);
plugin.sendAuthReminderMessage(event.getPlayer());
}
}
示例12: onStaffTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onStaffTeleport(PlayerTeleportEvent e) {
if(e.getCause() == TeleportCause.PLUGIN) {
XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
if(xp.isStaff()) {
if(xp.isVanished()) {
return;
} else if(xp.getBukkitPlayer().getGameMode() == GameMode.CREATIVE) {
return;
} else {
if(staff.containsKey(e.getPlayer().getName())) {
Bukkit.getScheduler().cancelTask(staff.get(e.getPlayer().getName()));
staff.remove(e.getPlayer().getName());
staff.put(e.getPlayer().getName(), staffScheduler(e.getPlayer()));
sendMessage(e.getPlayer(), ChatColor.GRAY + "teleportation safety against damage has been " + ChatColor.GREEN + "enabled!");
} else {
staff.put(e.getPlayer().getName(), staffScheduler(e.getPlayer()));
sendMessage(e.getPlayer(), ChatColor.GRAY + "teleportation safety against damage has been " + ChatColor.GREEN + "enabled!");
}
}
}
}
}
示例13: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event) {
if (OrebfuscatorConfig.UseProximityHider) {
if(event.getCause() != TeleportCause.END_PORTAL
&& event.getCause() != TeleportCause.NETHER_PORTAL
)
{
ProximityHider.addPlayerToCheck(event.getPlayer(), null);
}
}
}
示例14: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
/**
* Prevent teleporting outside the map
*/
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
if(event.getCause() == PlayerTeleportEvent.TeleportCause.PLUGIN) {
double fromY = event.getFrom().getY();
double toY = event.getTo().getY();
if((fromY >= 0.0D && fromY < 255.0D) && (toY < 0.0D || toY >= 255.0D)) {
event.setCancelled(true);
}
}
}
示例15: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
/**
* Prevent teleporting outside the border
*/
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
if(event.getCause() == PlayerTeleportEvent.TeleportCause.PLUGIN) {
if(WorldBorderUtils.isInsideBorder(event.getFrom()) &&
!WorldBorderUtils.isInsideBorder(event.getTo())) {
event.setCancelled(true);
}
}
}