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


Java PlayerJoinEvent类代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerJoinEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerJoinEvent类的具体用法?Java PlayerJoinEvent怎么用?Java PlayerJoinEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onJoin

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

    event.setJoinMessage(null);

    if (!Skywars.getInstance().isSingleServerMode()) {
        player.setGameMode(GameMode.ADVENTURE);
        player.getInventory().clear();
        player.setMaxHealth(20);
        player.setHealth(player.getMaxHealth());
        player.setFoodLevel(25);

        player.teleport(Skywars.getInstance().getLobbyPoint());
    }
}
 
开发者ID:JordanOsterberg,项目名称:SkywarsSeries,代码行数:17,代码来源:PlayerJoin.java

示例2: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
public void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    if (hasPermission(player)) {
        /*
        if (Uranium.isLegacy()) {
            player.sendMessage(ChatColor.YELLOW + "We're running on legacy version on Uranium, please update your version");
        }            
        if (!Uranium.isOfficial()) {
            player.sendMessage(ChatColor.YELLOW + "We're running on non-official version on Uranium, please update your version");
        }            
        if (mHasUpdate) {
            sendUpdate(player);
        }
        */
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:DefaultUpdateCallback.java

示例3: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
public void onPlayerJoin(PlayerJoinEvent event) {
    // When a player joins, add their correct values to the `playerVals` hashmap
    plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { // Run the database functions async
        public void run() {
            Player p = event.getPlayer();
            UUID id = p.getUniqueId();
            String uuid = id.toString();
            PreparedStatement stmt = null;
            try {
                stmt = plugin.getDb().getConnection().prepareStatement("SELECT tse FROM life_system WHERE uuid = " + uuid + " LIMIT 1");
                ResultSet set = stmt.executeQuery(); // Get the player with the UUID `uuid`'s life levels from the database
                set.next(); // Get the first matching row
                playerVals.put(id, set.getString("tse")); // Add the player's values to `playerVals`
            } catch (SQLException e) {
                e.printStackTrace();
            }

        }

        ;
    });
}
 
开发者ID:Warvale,项目名称:Locked,代码行数:23,代码来源:LifeSystem.java

示例4: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    if (onJoinActions.containsKey(event.getPlayer().getUniqueId())) {
        ProxyBlacklist blacklist = finders.get(event.getPlayer().getUniqueId());
        plugin.getLogger().info("Player " + event.getPlayer().getName() + " connected with an open proxy at " + event.getPlayer().getAddress().getAddress().getHostAddress() + " as detected by " + blacklist.getName());
        if (event.getPlayer().hasPermission("mopm.bypass")) {
            plugin.getLogger().info("Player " + event.getPlayer().getName() + " bypassed open proxy detection by permission");
        }
        for (Predicate<Player> p : onJoinActions.get(event.getPlayer().getUniqueId())) {
            if (p.test(event.getPlayer())) {
                return;
            }
        }
        plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), blacklist.getDefaultCommand()
                .replace("%player%", event.getPlayer().getName())
                .replace("%bl%", blacklist.getName()));
    }
}
 
开发者ID:0x277F,项目名称:mopm,代码行数:19,代码来源:ConnectionListener.java

示例5: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event) {
	plugin.getPlayerManager().loadData(event.getPlayer());
	if(event.getPlayer().hasPermission("asgardascension.staff")) {
		event.getPlayer().setPlayerListName(ChatColor.YELLOW + event.getPlayer().getDisplayName());
	}
	// Restoring location, level and experience in case server crashed
	plugin.getPlayerFile().createConfig(event.getPlayer());
	if(plugin.getPlayerFile().isInChallenge()) {
		Player player = event.getPlayer();
		player.teleport(plugin.getPlayerFile().getChallengeLocation());
		player.setLevel(plugin.getPlayerFile().getChallengeLevel());
		player.setExp(plugin.getPlayerFile().getChallengeExperience());
		plugin.getEconomy().depositPlayer(player, plugin.getPlayerFile().getChallengePrice());
		plugin.getPlayerFile().removeChallenge();
		plugin.getPlayerFile().saveConfig();
	}
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:19,代码来源:PlayerListener.java

示例6: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerJoin(PlayerJoinEvent event) {
	Player player = event.getPlayer();

	if (Craft.reboardNames.containsKey(player.getName())) {
		if ((Craft.reboardNames.get(player.getName()) != null)
				&& Craft.reboardNames.get(player.getName()).crewNames.contains(player.getName())) {
			Craft c = Craft.reboardNames.get(player.getName());
			Location loc = new Location(c.world, c.minX + (c.sizeX / 2), c.maxY, c.minZ + (c.sizeZ / 2));
			player.teleport(loc);

		}
		Craft.reboardNames.remove(player.getName());

	}
	
	syp = (Shipyard)plugin.getServer().getPluginManager().getPlugin("NavyCraft-Shipyard");
	if( syp != null )
	{
		syp.playerJoin(player);
	}

}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:24,代码来源:MoveCraft_PlayerListener.java

示例7: handlePlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
public void handlePlayerJoin( FlexPlayer player ) {
    this.players.put( player.getUuid(), player );
    List<MessageS2EPlayerList.PlayerItem> items = new ArrayList<>();
    for ( FlexPlayer target : this.getOnlinePlayers() ) {
        if( !target.equals( player ) ) {
            target.getConnectionHandler().sendMessage( new MessageS2EPlayerList( MessageS2EPlayerList.Action.ADD_PLAYER,
                    Collections.singletonList( new MessageS2EPlayerList.PlayerItem().setUuid( player.getUuid() ).setName( player.getName() ).setGameMode( player.getGameMode() ).setPing( player.getLatency() ) ) ) );
        }
        items.add( new MessageS2EPlayerList.PlayerItem().setName( target.getName() ).setUuid( target.getUuid() ).setGameMode( target.getGameMode() ).setPing( target.getLatency() ) );
    }
    player.getConnectionHandler().sendMessage( new MessageS2EPlayerList( MessageS2EPlayerList.Action.ADD_PLAYER, items ) );
    System.out.println( player.getName() + " (" + player.getUuid().toString() + ") logged in from " + player.getIpAddress() );
    player.spawnPlayer();
    player.getWorld().addEntity( player, true );

    String joinMessage = EventFactory.call( new PlayerJoinEvent( player, "§e" + player.getName() + " joined the game." ) ).getJoinMessage();
    if( joinMessage != null && !joinMessage.isEmpty() ) {
        Bukkit.broadcastMessage( joinMessage );
    }

}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:22,代码来源:PlayerManager.java

示例8: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent e) {
    RagePlayer u = RageGames.getPlayer(e.getPlayer());
    e.setJoinMessage(null);

    u.getPlayer().setFlySpeed(0.2f);
    u.getPlayer().setWalkSpeed(0.2f);

    if (plugin.getGm().isInLobby()) {
        u.getPlayer().getInventory().clear();
        plugin.getGm().addPlayerToGame(u);
        plugin.getServer().getOnlinePlayers().forEach(p -> u.getPlayer().showPlayer(p));
        plugin.getServer().getOnlinePlayers().forEach(p -> p.showPlayer(u.getPlayer()));
        u.setLobby();
        Utils.broadcastMsg("&7Ha entrado al juego &e" + u.getName() + " &3(&b" + plugin.getGm().getPlaying().size() + "&d/&b" + plugin.getAm().getMaxPlayers() + "&3)");
        plugin.getGm().checkStart();

        plugin.getServer().getScheduler().runTaskLater(plugin, () -> u.sendToLobby(), 20);
    } else {
        new SpectatorTask(plugin, u).runTaskTimer(plugin, 0, 20);
    }
}
 
开发者ID:cadox8,项目名称:PA,代码行数:23,代码来源:PlayerEvents.java

示例9: registerPlayer

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
private Player registerPlayer() {
    Player player = mock(Player.class);
    when(player.getUniqueId()).thenReturn(UUID.randomUUID());

    PlayerJoinEvent event = mock(PlayerJoinEvent.class);
    when(event.getPlayer()).thenReturn(player);

    this.manager.registerPlayer(event);

    return player;
}
 
开发者ID:Dragovorn,项目名称:gamecraft,代码行数:12,代码来源:TestPlayerManager.java

示例10: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event)
{
    Player player = event.getPlayer();

    if (api.getGameManager().isLegacyPvP())
    {
        AttributeInstance genericAttackSpeedAttribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);

        if (genericAttackSpeedAttribute != null)
            genericAttackSpeedAttribute.setBaseValue(1024.0D);
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:14,代码来源:CooldownModule.java

示例11: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent e){
    if (!e.getPlayer().hasPlayedBefore()){
        karmaUserManager.addNewKarmaUser(e.getPlayer());
    } else {
        karmaUserManager.addKarmaUser(e.getPlayer());
    }
}
 
开发者ID:AsunaY,项目名称:Karma,代码行数:9,代码来源:JoinLeaveListeners.java

示例12: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled=true, priority=EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event)
{
  Player player = event.getPlayer();
  UUID uuid = player.getUniqueId();
  for (PlayerBoard board : this.playerBoards.values()) {
    board.addUpdate(player);
  }
  PlayerBoard board2 = new PlayerBoard(this.plugin, player);
  Object c = Arrays.asList(Bukkit.getOnlinePlayers());
  board2.addUpdates((Collection)c);
  setPlayerBoard(uuid, board2);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:14,代码来源:ScoreboardHandler.java

示例13: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
   //Join
   public void onJoin(PlayerJoinEvent e) {
	Player player = e.getPlayer();
	if(Teams.getPlayerInWhereArea().containsKey(player)){
		Teams.QuitTeam(player);
	}
}
 
开发者ID:cocomine,项目名称:FastSpawn,代码行数:9,代码来源:JoinQuitServer.java

示例14:

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled=true, priority= EventPriority.MONITOR)
/*    */   public void onPlayerJoin(PlayerJoinEvent event)
/*    */   {
/* 77 */     EntityPlayer entityPlayer = ((CraftPlayer)event.getPlayer()).getHandle();
/* 78 */     entityPlayer.knockbackReductionX = 0.6F;
/* 79 */     entityPlayer.knockbackReductionY = 0.55F;
/* 80 */     entityPlayer.knockbackReductionZ = 0.6F;
/*    */   }
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:HungerFixListener.java

示例15: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent e){
    /*
    CAVECLOUD API
     */
    CaveCloud.gameAPI
            .setPlayers(Bukkit.getOnlinePlayers().size())
            .update();
}
 
开发者ID:TheCaveFire,项目名称:CaveCloudAddon,代码行数:10,代码来源:PlayerJoinListener.java


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