本文整理匯總了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);
}