本文整理汇总了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()));
}
}
示例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()));
}
}
示例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()));
}
}
示例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()));
}
}
示例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()));
}
}
示例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);
}
}
示例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);
}