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


Java PlayerToggleFlightEvent.isCancelled方法代码示例

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


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

示例1: processPlayerAbilities

import org.bukkit.event.player.PlayerToggleFlightEvent; //导入方法依赖的package包/类
public void processPlayerAbilities(C13PacketPlayerAbilities p_147348_1_)
{
    // CraftBukkit start - d() should be isFlying()
    if (this.playerEntity.capabilities.allowFlying && this.playerEntity.capabilities.isFlying != p_147348_1_.func_149488_d())
    {
        PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.playerEntity), p_147348_1_.func_149488_d());
        this.server.getPluginManager().callEvent(event);

        if (!event.isCancelled())
        {
            this.playerEntity.capabilities.isFlying = p_147348_1_.func_149488_d(); // Actually set the player's flying status
        }
        else
        {
            this.playerEntity.sendPlayerAbilities(); // Tell the player their ability was reverted
        }
    }

    // CraftBukkit end
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:21,代码来源:NetHandlerPlayServer.java

示例2: a

import org.bukkit.event.player.PlayerToggleFlightEvent; //导入方法依赖的package包/类
public void a(PacketPlayInAbilities packetplayinabilities) {
    // CraftBukkit start
    if (this.player.abilities.canFly && this.player.abilities.isFlying != packetplayinabilities.isFlying()) {
        PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packetplayinabilities.isFlying());
        this.server.getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            this.player.abilities.isFlying = packetplayinabilities.isFlying(); // Actually set the player's flying status
        } else {
            this.player.updateAbilities(); // Tell the player their ability was reverted
        }
    }
    // CraftBukkit end
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:14,代码来源:PlayerConnection.java

示例3: a

import org.bukkit.event.player.PlayerToggleFlightEvent; //导入方法依赖的package包/类
public void a(Packet202Abilities packet202abilities) {
    // CraftBukkit start
    if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.f()) {
        PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.f());
        this.server.getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            this.player.abilities.isFlying = packet202abilities.f(); // Actually set the player's flying status
        }
        else {
            this.player.updateAbilities(); // Tell the player their ability was reverted
        }
    }
    // CraftBukkit end
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:15,代码来源:PlayerConnection.java

示例4: onFlightToggle

import org.bukkit.event.player.PlayerToggleFlightEvent; //导入方法依赖的package包/类
@EventHandler
public void onFlightToggle(final PlayerToggleFlightEvent event) {
	if (!this.frozenPlayers.isEmpty() && !event.isCancelled() && this.frozenPlayers.containsKey(event.getPlayer().getUniqueId())) {
		if (!event.isFlying()) {
			event.setCancelled(true);
			final Location3w location = this.frozenPlayers.get(event.getPlayer().getUniqueId());
			location.setYaw(event.getPlayer().getLocation().getYaw());
			location.setPitch(event.getPlayer().getLocation().getPitch());
			event.getPlayer().teleport(location);
		}
	}
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:13,代码来源:FreezeComponent.java

示例5: a

import org.bukkit.event.player.PlayerToggleFlightEvent; //导入方法依赖的package包/类
public void a(PacketPlayInAbilities packetplayinabilities) {
    PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x());
    // CraftBukkit start
    if (this.player.abilities.canFly && this.player.abilities.isFlying != packetplayinabilities.isFlying()) {
        PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packetplayinabilities.isFlying());
        this.server.getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            this.player.abilities.isFlying = packetplayinabilities.isFlying(); // Actually set the player's flying status
        } else {
            this.player.updateAbilities(); // Tell the player their ability was reverted
        }
    }
    // CraftBukkit end
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:15,代码来源:PlayerConnection.java


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