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


Java PlayerMoveEvent.setCancelled方法代码示例

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


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

示例1: onMove

import org.bukkit.event.player.PlayerMoveEvent; //导入方法依赖的package包/类
@EventHandler
public void onMove(PlayerMoveEvent event) {
    for (Region region : regions) {
        if (region.contains(event.getTo())) {
            for (MatchTeam matchTeam : teams) {
                if (matchTeam.containsPlayer(event.getPlayer())) {
                    FilterResult filterResult = evaluator.evaluate(event.getPlayer());
                    if (filterResult == FilterResult.DENY) {
                        event.setCancelled(true);
                        event.getPlayer().sendMessage(message);
                    } else if (filterResult == FilterResult.ALLOW) {
                        event.setCancelled(false);
                    }
                }
            }
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:19,代码来源:EnterFilterType.java

示例2: resetPosition

import org.bukkit.event.player.PlayerMoveEvent; //导入方法依赖的package包/类
/**
 * Modify the to location of the given event to prevent the movement and
 * move the player so they are standing on the center of the block at the
 * from location.
 */
private static void resetPosition(final PlayerMoveEvent event) {
    Location newLoc;
    double yValue = event.getFrom().getY();

    if(yValue <= 0 || event instanceof PlayerTeleportEvent) {
        newLoc = event.getFrom();
    } else {
        newLoc = BlockUtils.center(event.getFrom()).subtract(new Vector(0, 0.5, 0));
        if(newLoc.getBlock() != null) {
            switch(newLoc.getBlock().getType()) {
            case STEP:
            case WOOD_STEP:
                newLoc.add(new Vector(0, 0.5, 0));
                break;
            default: break;
            }
        }
    }

    newLoc.setPitch(event.getTo().getPitch());
    newLoc.setYaw(event.getTo().getYaw());
    event.setCancelled(false);
    event.setTo(newLoc);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:30,代码来源:PlayerMovementListener.java

示例3: onPlayerMoveWhenNotLoaded

import org.bukkit.event.player.PlayerMoveEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerMoveWhenNotLoaded(PlayerMoveEvent event) {
    Player player = event.getPlayer();

    if (!InventoryManager.isAllowedWorld(player.getWorld()) || InventoryManager.playerIsLoaded(player)) {
        return;
    }

    if (PlayerLoader.isPreparedPlayer(player)) {
        PlayerLoader.removePlayer(player);
        player.kickPlayer(RPGInventory.getLanguage().getMessage("error.rp.denied"));
        event.setCancelled(true);
    } else {
        Location toLocation = event.getTo();
        Location newLocation = event.getFrom().clone();
        //noinspection deprecation
        if (!player.isOnGround()) {
            newLocation.setY(toLocation.getY());
        }

        newLocation.setPitch(toLocation.getPitch());
        newLocation.setYaw(toLocation.getYaw());
        event.setTo(newLocation);
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:26,代码来源:PlayerListener.java

示例4: onMove

import org.bukkit.event.player.PlayerMoveEvent; //导入方法依赖的package包/类
@EventHandler
public void onMove(PlayerMoveEvent event) {
	/*if (event.getPlayer().isInsideVehicle() || event.getPlayer().isDead() || (event.getFrom().getX() == event.getTo().getX() && event.getFrom().getY() == event.getTo().getY() && event.getFrom().getZ() == event.getTo().getZ())) return;
	
	double vd = event.getTo().getY() - event.getFrom().getY();
	//double yd = Math.abs(event.getFrom().getY() - event.getTo().getY());
	
	boolean up = (vd > -0.9);
	
	
	if (!event.getPlayer().isOnGround() && vd < -0.1 && vd < 0.1)
		event.getPlayer().sendMessage(String.valueOf(vd));*/
	
	/*if (event.getFrom().distance(event.getTo()) > 0.75 && !event.getPlayer().hasPotionEffect(PotionEffectType.SPEED) && !event.getPlayer().isFlying() && !event.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
		ActionFactory.log(Cheats.SPEED_HACKING, event.getPlayer());
	}*/
	
	if (McLinkCommand.FREEZED.contains(event.getPlayer())) {
		event.setCancelled(true);
	}
}
 
开发者ID:GigaGamma,项目名称:McLink,代码行数:22,代码来源:ActionFactory.java

示例5: onPlayerMove

import org.bukkit.event.player.PlayerMoveEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    if (p.isInsideVehicle() && p.getVehicle() instanceof ArmorStand){

        e.setCancelled(true);
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:9,代码来源:Sit.java

示例6: onMove

import org.bukkit.event.player.PlayerMoveEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onMove(PlayerMoveEvent event) {
    Location from = event.getFrom();
    Location to = event.getTo();
    if (from.toVector().equals(to.toVector()))
        return;

    PlayerWalkEvent custom = new PlayerWalkEvent(event);
    Bukkit.getPluginManager().callEvent(custom);
    if (event.isCancelled() != custom.isCancelled()) {
        event.setCancelled(custom.isCancelled());
    }
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:14,代码来源:EventCaller.java


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