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


Java PlayerGameModeChangeEvent.isCancelled方法代码示例

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


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

示例1: setGameMode

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@Override
public void setGameMode(GameMode mode) {
    if (getHandle().playerNetServerHandler == null) return;

    if (mode == null) {
        throw new IllegalArgumentException("Mode cannot be null");
    }

    if (mode != getGameMode()) {
        PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
        server.getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return;
        }

        getHandle().theItemInWorldManager.setGameType(net.minecraft.world.WorldSettings.GameType.getByID(mode.getValue()));
        getHandle().fallDistance = 0;
        getHandle().playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S2BPacketChangeGameState(3, mode.getValue()));
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:21,代码来源:CraftPlayer.java

示例2: setGameMode

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@Override
public void setGameMode(GameMode mode) {
    if (getHandle().playerConnection == null) return;

    if (mode == null) {
        throw new IllegalArgumentException("Mode cannot be null");
    }

    if (mode != getGameMode()) {
        PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
        server.getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return;
        }

        getHandle().playerInteractManager.setGameMode(EnumGamemode.getById(mode.getValue()));
        getHandle().fallDistance = 0;
        getHandle().playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, mode.getValue()));
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:21,代码来源:CraftPlayer.java

示例3: setGameMode

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@Override
public void setGameMode(GameMode mode) {
    if (getHandle().playerConnection == null) return;

    if (mode == null) {
        throw new IllegalArgumentException("Mode cannot be null");
    }

    if (mode != getGameMode()) {
        PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
        server.getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return;
        }
        
        getHandle().setSpectatorTarget(getHandle());
        getHandle().playerInteractManager.setGameMode(WorldSettings.EnumGamemode.getById(mode.getValue()));
        getHandle().fallDistance = 0;
        getHandle().playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, mode.getValue()));
    }
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:22,代码来源:CraftPlayer.java

示例4: setGameMode

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@Override
public void setGameMode(GameMode mode) {
    if (getHandle().playerConnection == null) return;

    if (mode == null) {
        throw new IllegalArgumentException("Mode cannot be null");
    }

    if (mode != getGameMode()) {
        PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
        server.getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return;
        }

        getHandle().playerInteractManager.setGameMode(EnumGamemode.a(mode.getValue()));
        getHandle().playerConnection.sendPacket(new Packet70Bed(3, mode.getValue()));
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:20,代码来源:CraftPlayer.java

示例5: setGameMode

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@Override
public void setGameMode(GameMode mode) {
    if (getHandle().field_71135_a == null) return;

    if (mode == null) {
        throw new IllegalArgumentException("Mode cannot be null");
    }

    if (mode != getGameMode()) {
        PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
        server.getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return;
        }

        getHandle().field_71134_c.func_73076_a(net.minecraft.world.EnumGameType.func_77146_a(mode.getValue()));
        getHandle().field_71135_a.func_72567_b(new net.minecraft.network.packet.Packet70GameEvent(3, mode.getValue()));
    }
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:20,代码来源:CraftPlayer.java

示例6: onGameModeChange

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onGameModeChange(PlayerGameModeChangeEvent e) {
    Player p = e.getPlayer();
    if (playerStateInfoMap.containsKey(p) && e.getNewGameMode() != GameMode.SPECTATOR) {
        // Don't let low-priority event listeners cancel the gamemode change
        if (e.isCancelled()) e.setCancelled(false);
    }
}
 
开发者ID:MyzelYam,项目名称:SuperVanish,代码行数:9,代码来源:SilentOpenChest.java

示例7: onPlayerGameModeChange

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

    Player player = event.getPlayer();
    Group group = groupManager.getGroupFromWorld(player.getWorld().getName());

    ConsoleLogger.debug("[GM PROCESS] Player '" + player.getName() + "' changed to GameMode '" +
            event.getNewGameMode().name() + "' in group '" + group.getName() + "'");

    playerManager.addPlayer(player, group);
    bukkitService.runTaskLater(() -> process.processGameModeChange(player, event.getNewGameMode(), group), 1L);
}
 
开发者ID:Gnat008,项目名称:PerWorldInventory,代码行数:16,代码来源:PlayerGameModeChangeListener.java


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