本文整理汇总了Java中org.bukkit.event.player.PlayerTeleportEvent.getTo方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerTeleportEvent.getTo方法的具体用法?Java PlayerTeleportEvent.getTo怎么用?Java PlayerTeleportEvent.getTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerTeleportEvent
的用法示例。
在下文中一共展示了PlayerTeleportEvent.getTo方法的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: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerTeleport(PlayerTeleportEvent event) {
if (event.isCancelled()) {
return;
}
Location from = event.getFrom();
Location to = event.getTo();
if (from.getWorld().equals(to.getWorld())) {
return;
}
ConsoleLogger.debug("[EVENTS] Player '" + event.getPlayer().getName() + "' going from world '" + from + "' to world '" + to + "'");
Group groupFrom = groupManager.getGroupFromWorld(from.getWorld().getName());
Group groupTo = groupManager.getGroupFromWorld(to.getWorld().getName());
if (groupFrom.equals(groupTo)) {
return;
}
playerManager.addPlayer(event.getPlayer(), groupFrom);
event.getPlayer().closeInventory();
}
示例4: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent e){
if (e.isCancelled()) {
return;
}
final Player p = e.getPlayer();
Location lfrom = e.getFrom();
Location lto = e.getTo();
if (e.getCause().equals(PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT)){
final Region rfrom = RedProtect.get().rm.getTopRegion(lfrom);
final Region rto = RedProtect.get().rm.getTopRegion(lto);
if (rfrom != null && !rfrom.canTeleport(p)){
RPLang.sendMessage(p, "playerlistener.region.cantuse");
e.setCancelled(true);
}
if (rto != null && !rto.canTeleport(p)){
RPLang.sendMessage(p, "playerlistener.region.cantuse");
e.setCancelled(true);
}
}
}
示例5: onTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent event) {
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld().equals(event.getTo().getWorld())) {
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
org.bukkit.Location to = event.getTo();
if (to != null) {
Player player = event.getPlayer();
PlotPlayer pp = PlotPlayer.wrap(player);
Location loc = BukkitUtil.getLocation(to);
PlotArea area = PS.get().getPlotAreaAbs(loc);
if (area == null) {
return;
}
Plot plot = area.getPlot(loc);
if (plot != null) {
plotEntry(pp, plot);
}
}
return;
}
playerMove(event);
}
示例6: onTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent event)
{
Location from = event.getFrom();
Location to = event.getTo();
PlayerTeleport action = this.newAction(PlayerTeleport.class, from.getWorld());
if (action != null)
{
action.setLocation(from);
action.setOtherLocation(to, true);
action.setPlayer(event.getPlayer());
this.logAction(action);
}
PlayerTeleport action2 = this.newAction(PlayerTeleport.class, to.getWorld());
if (action2 != null)
{
action2.setLocation(to);
action2.setOtherLocation(from, false);
action2.setPlayer(event.getPlayer());
this.logAction(action2);
}
}
示例7: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(PlayerTeleportEvent event) {
// Strangely, sometimes these worlds can be null
if (event.getFrom() == null || event.getTo() == null) {
return;
}
// Check if they changed worlds
UUID uuid = event.getPlayer().getUniqueId();
if (plugin.getPlayerGHouse(uuid) == null || plugin.getPlayerGHouse(uuid).isEmpty()) {
return;
}
World fromWorld = event.getFrom().getWorld();
World toWorld = event.getTo().getWorld();
// Check we are in the right world
if (!Settings.worldName.contains(fromWorld.getName()) && !Settings.worldName.contains(toWorld.getName())) {
return;
}
// Did we move a block?
checkMove(event.getPlayer(), event.getFrom(), event.getTo(), uuid);
}
示例8: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onPlayerTeleport(PlayerTeleportEvent event) {
if (event.getTo() == null) {
NucMsg.warning("Teleport using a null destination location detected.");
return;
}
if (event.getTo().getWorld() == null) {
NucMsg.warning("Teleport using a null world in destination location detected.");
return;
}
if (event.getFrom() != null && event.getTo().getWorld().equals(event.getFrom().getWorld()))
return;
synchronized (_sync) {
_lastWorldChange.put(event.getPlayer(), new Date());
}
}
示例9: 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);
}
}
示例10: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=true)
public void onPlayerTeleport(PlayerTeleportEvent event) {
if(event.isCancelled()) return;
if (pl.getHandCuffManager().isHandCuffed(event.getPlayer().getUniqueId()) && event.getTo() != tos.get(event.getPlayer().getName())) {
Location to = pl.getHandCuffManager().getLocation(event.getPlayer().getUniqueId());
to.setPitch(event.getTo().getPitch());
to.setYaw(event.getTo().getYaw());
tos.put(event.getPlayer().getName(), to);
event.getPlayer().teleport(to);
if(System.currentTimeMillis() >= pl.getHandCuffManager().getNextMessageTime(event.getPlayer().getUniqueId())) {
event.getPlayer().sendMessage(ChatColor.RED + "You are handcuffed and cant move!");
pl.getHandCuffManager().updateNextTime(event.getPlayer().getUniqueId());
}
}
}
示例11: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public final void onPlayerTeleport(final PlayerTeleportEvent event) {
final Location to = event.getTo();
final double origX = to.getX();
final double origZ = to.getZ();
this.adjustToPos(to, wbHandler.getBorder(to.getWorld()));
if (Double.compare(origX, to.getX()) != 0
|| Double.compare(origZ, to.getZ()) != 0) {
event.getPlayer().sendMessage(DENY_TELEPORT);
}
}
示例12: 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);
}
}
示例13: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
if(event.getTo() != null && event.getPlayer() != null)
{
handleTeleport(event.getPlayer(), event.getTo().clone());
}
}
示例14: onPlayerTeleport
import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
Location from = event.getFrom();
Location to = event.getTo();
if (from != null && to != null && !this.canTeleport(player, from.getWorld(), to.getWorld())) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + "You cannot leave the world until the bloodmoon has ended.");
}
}
示例15: 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());
}
}
}