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


Java PlayerTeleportEvent.setTo方法代码示例

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


在下文中一共展示了PlayerTeleportEvent.setTo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:PearlGlitchListener.java

示例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);

	}
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:19,代码来源:EnderpearlListener.java

示例3: on

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler (priority = EventPriority.MONITOR)
public void on(PlayerTeleportEvent event) {
    if (!config.isPatchesForceAllowTeleportation()) {
        return;
    }

    Storage storage = Storage.get(event.getPlayer());
    Object value = storage.get("teleportedTo");

    if (value == null) {
        return;
    }

    storage.remove("teleportedTo");
    event.setTo((Location) value);
    event.setCancelled(false);
}
 
开发者ID:RealizedMC,项目名称:Duels,代码行数:18,代码来源:Teleport.java

示例4: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
	final IUser user = ess.getUserMap().getUser(event.getPlayer());
	if (!user.getData().isJailed() || user.getData().getJail() == null || user.getData().getJail().isEmpty())
	{
		return;
	}

	try
	{
		event.setTo(getJail(user.getData().getJail()));
	}
	catch (Exception ex)
	{
		if (ess.getSettings().isDebug())
		{
			LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()), ex);
		}
		else
		{
			LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()));
		}
	}
	user.sendMessage(_("§4You do the crime, you do the time."));
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:27,代码来源:Jails.java

示例5: onTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
public void onTeleport(PlayerTeleportEvent event) {
    if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
        Location to = event.getTo();

        if (this.blockedTypes.contains(to.getBlock().getType())) {
            event.setCancelled(true);
            return;
        }

        to.setX(to.getBlockX() + 0.5D);
        to.setZ(to.getBlockZ() + 0.5D);
        event.setTo(to);
    }
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:16,代码来源:PearlFix.java

示例6: onTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onTeleport(PlayerTeleportEvent event) {
    final Player player = event.getPlayer();
    HeightMapMCAGenerator gen = getGenerator(player);
    if (gen != null) {
        Location from = event.getFrom();
        Location to = event.getTo();
        if (to.getWorld().equals(from.getWorld()) && to.distanceSquared(from) < 8) {
            event.setTo(player.getLocation());
            event.setCancelled(true);
            player.setVelocity(player.getVelocity());
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:15,代码来源:CFIPacketListener.java

示例7: onTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onTeleport(final PlayerTeleportEvent e) {
    //
    // plugin.getLogger().info("DEBUG: Teleport called");
    Player player = e.getPlayer();
    if (SafeBoat.ignoreList.contains(player.getUniqueId())) {
        return;
    }
    // If the player is not teleporting due to boat exit, return
    if (!exitedBoat.containsKey(player.getUniqueId())) {
        return;
    }
    // Entity boat = exitedBoat.get(player.getUniqueId());
    // Reset the flag
    exitedBoat.remove(player.getUniqueId());
    // Okay, so a player is getting out of a boat in the the right world.
    // Now...
    //plugin.getLogger().info("DEBUG: Player just exited a boat");
    // Find a safe place for the player to land
    int radius = 0;
    while (radius++ < 2) {
        for (int x = player.getLocation().getBlockX() - radius; x < player.getLocation().getBlockX() + radius; x++) {
            for (int z = player.getLocation().getBlockZ() - radius; z < player.getLocation().getBlockZ() + radius; z++) {
                for (int y = player.getLocation().getBlockY(); y < player.getLocation().getBlockY() + 2; y++) {
                    // The safe location to tp to is actually +0.5 to x and
                    // z.
                    final Location loc = new Location(player.getWorld(), (double) (x + 0.5), (double) y, (double) (z + 0.5));
                    // plugin.getLogger().info("XYZ is " + x + " " + y + " "
                    // + z);
                    // Make sure the location is safe
                    if (GridManager.isSafeLocation(loc)) {
                        // plugin.getLogger().info("Safe!");
                        e.setTo(loc);
                        return;
                    }
                }
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:41,代码来源:SafeBoat.java

示例8: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
    if (testObserver(event.getPlayer())) {
        if (event.getTo().getY() <= -64) {
            TeamModule teamModule = Teams.getTeamById("observers").get();
            ModuleCollection<SpawnModule> modules = new ModuleCollection<>();
            for (SpawnModule spawnModule : match.getModules().getModules(SpawnModule.class)) {
                if (spawnModule.getTeam() == teamModule) modules.add(spawnModule);
            }
            event.setTo(modules.getRandom().getLocation());
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:14,代码来源:ObserverModule.java


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