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


Java PlayerGameModeChangeEvent.getPlayer方法代码示例

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


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

示例1: onPlayerGameModeChangeEvent

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerGameModeChangeEvent(PlayerGameModeChangeEvent event)
{
	Player player = event.getPlayer();
	
	if (!WorldGuardUtils.hasBypass(player))
	{
		new BukkitRunnable()
		{
			@Override
			public void run()
			{
				try
				{
					event.getPlayer().setAllowFlight(WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getSessionManager().get(player).getHandler(FlyFlag.class).getCurrentValue());
				}
				catch(Exception ignored)
				{
					
				}
			}
		}.runTask(WorldGuardExtraFlagsPlugin.getPlugin());
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:25,代码来源:PlayerListener.java

示例2: onPlayerGameModeChange

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
    Player player = event.getPlayer();
    GameMode oldGameMode = player.getGameMode();
    GameMode newGameMode = event.getNewGameMode();
    Group group = plugin.getGroupManager().getGroupFromWorld(player.getWorld().getName());
    if (group == null) {
        group = new Group(player.getWorld().getName(), null, null);
    }

    plugin.getSerializer().writePlayerDataToFile(player,
            PlayerSerialization.serializePlayer(player, plugin),
            group,
            oldGameMode);

    plugin.getSerializer().getPlayerDataFromFile(
            player,
            group,
            newGameMode);
}
 
开发者ID:ThisIzEthan,项目名称:NexusInventory,代码行数:21,代码来源:PlayerGameModeChangeListener.java

示例3: onPlayerQuitCreative

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerQuitCreative(final PlayerGameModeChangeEvent event) {
    if (event.getPlayer().getGameMode() == GameMode.CREATIVE) {
        final boolean wasFlying = event.getPlayer().isFlying();
        final Player player = event.getPlayer();
        if (Perms.hasFly(event.getPlayer()) && this.feature.hasFlyMode(event.getPlayer())) {
            Bukkit.getScheduler().runTaskLater(this.feature.getPlugin(), new BukkitRunnable() {

                @Override
                public void run() {
                    if (player.isOnline()) {
                        player.setAllowFlight(true);
                        player.setFlying(wasFlying);
                    }
                }
            }, 1L);
        }
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:20,代码来源:FlyModeListener.java

示例4: onChangeGM

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler
public void onChangeGM(PlayerGameModeChangeEvent e) {
	Player p = e.getPlayer();
       UUID pU = e.getPlayer().getUniqueId();
       
	int GamemodeTemp1 = 0; 
       if (e.getNewGameMode() == GameMode.SURVIVAL) {
       	GamemodeTemp1 = 0;
       } else if (e.getNewGameMode() == GameMode.CREATIVE) {
       	GamemodeTemp1 = 1;
       } else if (e.getNewGameMode() == GameMode.ADVENTURE) {
       	GamemodeTemp1 = 2;
       } else if (e.getNewGameMode() == GameMode.SPECTATOR) {
       	GamemodeTemp1 = 3;
       }
       int GamemodeTemp2 = Integer.valueOf(GamemodeTemp1);
       
       if (!ConfigTemp.getConfig().contains(String.valueOf(pU))) {
       	ConfigTemp.getConfig().set(pU+".Player", String.valueOf(p));
       	ConfigTemp.getConfig().set(pU+".Options.Gamemode", Integer.valueOf(GamemodeTemp2));
       	
       	ConfigTemp.saveConfigFile();
       } else if (ConfigTemp.getConfig().contains(String.valueOf(pU))) {
       	ConfigTemp.getConfig().set(pU+".Player", String.valueOf(p));
       	ConfigTemp.getConfig().set(pU+".Options.Gamemode", Integer.valueOf(GamemodeTemp2));
       	
       	ConfigTemp.saveConfigFile();
       }
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:30,代码来源:LittlesEvent.java

示例5: onGameModeSwitch

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler
public void onGameModeSwitch(PlayerGameModeChangeEvent event) {
    Player player = event.getPlayer();

    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    if (event.getNewGameMode() == GameMode.CREATIVE) {
        InventoryLocker.unlockSlots(player);
    } else if (event.getPlayer().getGameMode() == GameMode.CREATIVE) {
        InventoryLocker.lockSlots(player, true);
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:15,代码来源:LockerListener.java

示例6: onGamemodeChange

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler
public void onGamemodeChange(PlayerGameModeChangeEvent event)
{
	Player player = event.getPlayer();

	if (event.getNewGameMode() != GameMode.CREATIVE || Thirst.getInstance().getYAMLConfig().ignoreCreative)
	{
		ThirstManager.getThirst().displayThirst(player);
		return;
	}
	else if (event.getNewGameMode() == GameMode.CREATIVE && !Thirst.getInstance().getYAMLConfig().ignoreCreative)
	{
		for (PotionEffect effect : player.getActivePotionEffects())
		{
			player.removePotionEffect(effect.getType());
		}
	}

	if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("scoreboard"))
	{
		if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("SCOREBOARD"))
			player.setScoreboard(Bukkit.getServer().getScoreboardManager().getNewScoreboard());
	}
	else if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("action"))
	{
		UtilActionBar.getInstance().sendActionBar(player, "");
	}
	else if (Thirst.getInstance().getYAMLConfig().displayType.equalsIgnoreCase("bossbar"))
	{
		ThirstData data = ThirstManager.getThirst().getThirstData(player);

		if (data.getBar() != null)
		{
			data.getBar().removePlayer(player);
		}
	}
}
 
开发者ID:GamerKing195,项目名称:Thirst,代码行数:38,代码来源:PlayerGamemodeChangeListener.java

示例7: 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

示例8: 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

示例9: onPlayerGameModeChange

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

			if(!player.hasPermission("googleanalyticsplugin.ignore")) {
				plugin.getTracker().TrackAction(getClientName(plugin, player), getClientId(player), getClientIP(player.getAddress().getAddress()), player.getName(), "Game Mode Change", "Game Mode " + getGamemode(event.getNewGameMode()));
			}
		}
		catch(Exception e) {
			plugin.getLogger().warning("Event Listener Error: " + e.getMessage());
		}
	}
}
 
开发者ID:Fox32,项目名称:GoogleAnalyticsPlugin,代码行数:16,代码来源:GoogleAnalyticsEventListener.java

示例10: gamemodeChange

import org.bukkit.event.player.PlayerGameModeChangeEvent; //导入方法依赖的package包/类
@EventHandler
public void gamemodeChange(PlayerGameModeChangeEvent event) {

    RocketFunctions rocketFunctions = new RocketFunctions();
    CommonString commonString = new CommonString();
    GamemodeCheck gamemodeCheck = new GamemodeCheck();
    TitleSubtitle titleSubtitle = new TitleSubtitle();

    Player player = event.getPlayer();

    if (!RocketInit.rocketUsage.isEmpty())
        if (RocketInit.rocketUsage.contains(player.getUniqueId()))
            if (gamemodeCheck.check(player, GameMode.CREATIVE, GameMode.SPECTATOR)) {

                commonString.messageSend(RocketInit.getPlugin(), player, true, RocketLanguage.RB_GAMEMODE_ERROR);
                titleSubtitle.subtitle(player, 1, RocketLanguage.RB_GAMEMODE_ERROR);

                rocketFunctions.disableRocketBoots(player, false, false, false, false, false);

            }

}
 
开发者ID:Ullarah,项目名称:MinecraftPlugins,代码行数:23,代码来源:PlayerGamemodeChange.java


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