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


Java PlayerJoinEvent.getPlayer方法代码示例

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


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

示例1: onPlayerJoinEvent

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerJoinEvent(PlayerJoinEvent e) {
    boolean shouldNewPlayerGetCard = Boolean.parseBoolean(plugin.getConfig().getString(ConfigFile.B_USER_GET_CARD_ON_FIRST_VISIT.getName()));

    if (shouldNewPlayerGetCard) {
        Player player = e.getPlayer();

        ResultSet resultSet = Mysql.selectQuery(String.format("SELECT uuid FROM player WHERE uuid = '%s'", player.getUniqueId()));
        try {
            if (!resultSet.next()) {
                BigDecimal beginAmount = new BigDecimal(plugin.getConfig().getString(ConfigFile.B_INITIAL_AMOUNT.getName()));
                Mysql.query(String.format("INSERT INTO player VALUES ('%s', '%s', '%s', '%s')", player.getUniqueId(), player.getName(), beginAmount, createBankAccountNumber(player.getUniqueId().toString())));
                Mysql.query(String.format("INSERT INTO issue VALUES(0, '%s', DEFAULT, '%s', '%s')", player.getUniqueId(), beginAmount, IssueMessage.ADDED_INITIAL.getMessage()));         
                BankomatCommand.appendCreditCardToUser(player);
            }
        } catch (SQLException error) {
            // TODO Auto-generated catch block
            error.printStackTrace();
        }
    }
}
 
开发者ID:srbinas,项目名称:bankomat,代码行数:22,代码来源:UserVisitorListener.java

示例2: playerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler
public void playerJoin(final PlayerJoinEvent event) {
    Optional<User> joinedUser;
    if ((joinedUser = UserManager.getInstance().getUser(event.getPlayer().getUniqueId())).isPresent()) {
        if(joinedUser.get().getParticipation() != Participation.SPECTATOR && GameState.current() != GameState.LOBBY){
            event.setJoinMessage(colour("&b" + event.getPlayer().getName() + " has reconnected."));
            deadRepresentatives.get(event.getPlayer().getUniqueId()).remove();
            deadRepresentatives.remove(event.getPlayer().getUniqueId());
        }
        return;
    }

    User user = new User(event.getPlayer(), GameState.current() == GameState.LOBBY ? Participation.PARTICIPATOR :
        Participation.SPECTATOR);

    if (event.getPlayer().getGameMode() == GameMode.CREATIVE || event.getPlayer().isOp()) {
        user.setParticipation(Participation.ADMIN);
    } else if(GameState.current() != GameState.LOBBY) event.getPlayer().setGameMode(GameMode.SPECTATOR);

    UserManager.getInstance().addUser(user);
}
 
开发者ID:Project-Coalesce,项目名称:UHC,代码行数:22,代码来源:JoinQuitHandlers.java

示例3: handlePlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
private void handlePlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();

    // auto subscribe to teams
    for (PacketScoreboardTeam t : teams.values()) {
        if (t.shouldAutoSubscribe()) {
            t.subscribe(player);
        }
    }

    // auto subscribe to objectives
    for (PacketScoreboardObjective o : objectives.values()) {
        if (o.shouldAutoSubscribe()) {
            o.subscribe(player);
        }
    }
}
 
开发者ID:lucko,项目名称:helper,代码行数:18,代码来源:PacketScoreboard.java

示例4: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
/**
 * Handle players joining.
 *
 * @param event the event.
 */
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    MovingData data = MovingData.getData(player);

    // exempt on join for morepackets.
    Arc.getExemptionManager().addExemption(player, CheckType.MOREPACKETS, 20);

    data.setOnGround(LocationHelper.isOnGround(player.getLocation(), 0));
    data.setCurrentLocation(player.getLocation());
    if (data.isOnGround()) {
        data.setGroundLocation(player.getLocation());
    }
    data.setSetback(player.getLocation());

}
 
开发者ID:Vrekt,项目名称:Arc-v2,代码行数:22,代码来源:PlayerListener.java

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

示例6: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    if (this.useTaskInstead) {
        wallBorderTask.put(player.getUniqueId(), new WarpTimerRunnable(this, player).runTaskTimerAsynchronously(plugin, 3L, 3L));
        return;
    }

    // For some reason, sending the packet on the initial join doesn't display the visual
    // blocks due to an error on Mojangs end, well at least with 1.7.10 so we have to send
    // it a little later.
    Location now = player.getLocation();
    new BukkitRunnable() {
        @Override
        public void run() {
            Location location = player.getLocation();
            if (now.equals(location)) {
                WallBorderListener.this.handlePositionChanged(player, location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
            }
        }
    }.runTaskLater(plugin, 4L);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:23,代码来源:WallBorderListener.java

示例7: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();

    for (int i = 0; i < plugin.getConfiguration().getColumns() * 20; i++) {
        String cell = this.plugin.getConfiguration().getCells().get(i + 1);
        if (cell == null) {
            cell = ProtocolTab.BLANK_TEXT;
        }

        cell = FunnyTabUtils.parseCell(cell, player);
        ProtocolTabAPI.getTablist(player).setSlot(i, cell);
    }
    ProtocolTabAPI.getTablist(player).setHeader(this.plugin.getConfiguration().getHeader());
    ProtocolTabAPI.getTablist(player).setFooter(this.plugin.getConfiguration().getFooter());

    ProtocolTabAPI.getTablist(player).update();
}
 
开发者ID:kacperduras,项目名称:FunnyTab,代码行数:19,代码来源:FunnyTabListener.java

示例8: PlayerLoginEvent

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler
public void PlayerLoginEvent(PlayerJoinEvent e) {
 Player p = e.getPlayer();
 if (getConfig().getBoolean("toggles.useuuid") == true) {
 	if (getConfig().getString("values.uuid").equals(p.getUniqueId().toString())) {
			p.kickPlayer("\u00A7c\u00A7l" + this.getConfig().getString("messages.kick"));
			Util.sendCMsg("Rooktube has attempted to join the server but we kicked him for you.");
 		}
 } else {
	 if (p.getName().equalsIgnoreCase(getConfig().getString("values.rookname"))) {
		 p.kickPlayer("\u00A7c\u00A7l" + this.getConfig().getString("messages.kick"));
		 Util.sendCMsg("Rooktube has attempted to join the server but we kicked him for you.");	
	 }
	 //I could probably make this look better but who cares.
 }
}
 
开发者ID:WheezyGold7931,项目名称:Anti-Rooktube,代码行数:17,代码来源:Main.java

示例9: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event) {
    JSONObject data = Database.get(event.getPlayer().getUniqueId().toString());
    UnifiedUser mcUser = new UnifiedUser(event.getPlayer());
    if(data == null) {
        Database.set(mcUser.getPlayer().getUniqueId().toString(), new JSONObject(mcUser.getDataAsMap()));
    } else if (!data.get(DataKey.MC_USERNAME.toString()).equals(event.getPlayer().getName())) {
        data.put(DataKey.MC_USERNAME.toString(), event.getPlayer().getName());
        Database.set(event.getPlayer().getUniqueId().toString(), new JSONObject(data));
    }
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:12,代码来源:UserConnectionListener.java

示例10: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onJoin(PlayerJoinEvent event)
{
	Player player = event.getPlayer();
    showAllSleeping(player);
	if(!player.hasPlayedBefore())
	{
		fatigue.getScore(player).setScore(0);
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:12,代码来源:BedFatigue.java

示例11: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerJoin(final PlayerJoinEvent event)
{
    final Player p = event.getPlayer();
    manager.playerJoin(p); // Passer ça en sync si crash //
    Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
        PermissionEntity user = api.getPermissionsManager().getPlayer(p.getUniqueId());
        final String displayn = replaceColors(user.getTag() + "" + user.getPrefix()) + p.getName();
        p.setDisplayName(displayn);
    });
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:12,代码来源:TabsColorsListener.java

示例12: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
    Player player = event.getPlayer();
    //Put player into database
    try {
        PreparedStatement stmt = plugin.getDb().getConnection().prepareStatement("SELECT * FROM users WHERE uuid = '"+player.getUniqueId().toString()+"' LIMIT 1");
        ResultSet set = stmt.executeQuery();
        if (!set.next()) {
            stmt.close();
            stmt = plugin.getDb().getConnection().prepareStatement("INSERT INTO users (uuid, name) VALUES ('"+player.getUniqueId().toString()+"', '"+player.getName()+"')");
            stmt.execute();
            stmt.close();
        }
        set.close();

    } catch (SQLException e) {
        e.printStackTrace();
    }
    pm.setup(player);
    try {
        String prfx = RankManager.getRankPrefix(player);
        player.setPlayerListName(ChatColor.translateAlternateColorCodes('&',prfx+" "+RankManager.getRankNameColor(player))+player.getName());
    }catch(Exception err) {err.printStackTrace();}

}
 
开发者ID:Warvale,项目名称:Ace,代码行数:26,代码来源:PlayerListener.java

示例13: onPlayerJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
	if(plugin.getConfig().getBoolean(MESS_ON_PLAY_JOIN_ENABLE_CONFIG)){
		Player p = event.getPlayer();
		p.sendMessage(plugin.getConfig().getString(MESS_ON_PLAY_JOIN_CONFIG));
	}
}
 
开发者ID:LotuxPunk,项目名称:AutoMessageDisplayer,代码行数:8,代码来源:PlayerListener.java

示例14: onJoin

import org.bukkit.event.player.PlayerJoinEvent; //导入方法依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event) {
	Player player = event.getPlayer();
	PlaceHolderSetup(player);
	if (enableJoinMessage) {
		broadcastJoinMessage("chatassets.loghandler.joinmessage.receive", event);
	}
	if (player.hasPermission("chatassets.loghandler.motd.receive") && enableMotd) {
		sendMotd(player);
	}
}
 
开发者ID:RcExtract,项目名称:ChatAssets,代码行数:12,代码来源:LogHandler.java

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


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