當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。