Java Code Examples for org.bukkit.event.player.PlayerJoinEvent#getPlayer()
The following examples show how to use
org.bukkit.event.player.PlayerJoinEvent#getPlayer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerListener.java From BedWars with GNU Lesser General Public License v3.0 | 6 votes |
@EventHandler public void onJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); final Game game = Main.getApi().getFirstWaitingGame(); if (game != null) { game.joinToGame(event.getPlayer()); } else if (!player.hasPermission("misat11.bw.admin")) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(Main.getApi().getHubServerName()); player.sendPluginMessage(Main.getInstance(), "BungeeCord", out.toByteArray()); } }
Example 2
Source File: HoloListener.java From HoloAPI with GNU General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); for (final Hologram h : HoloAPI.getManager().getAllHolograms().keySet()) { if (player.getLocation().getWorld().getName().equals(h.getWorldName()) && h.getVisibility().isVisibleTo(player, h.getSaveId())) { new BukkitRunnable() { @Override public void run() { if (h instanceof AnimatedHologram && !((AnimatedHologram) h).isAnimating()) { ((AnimatedHologram) h).animate(); } h.show(player, true); } }.runTaskLater(HoloAPI.getCore(), 40L); } } }
Example 3
Source File: PlayerEventHandler.java From GriefDefender with MIT License | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJoin(PlayerJoinEvent event) { GDTimings.PLAYER_JOIN_EVENT.startTiming(); Player player = event.getPlayer(); if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(player.getWorld().getUID())) { GDTimings.PLAYER_JOIN_EVENT.stopTiming(); return; } UUID playerID = player.getUniqueId(); final GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), playerID); final GDClaim claim = this.dataStore.getClaimAtPlayer(playerData, player.getLocation()); if (claim.isInTown()) { playerData.inTown = true; } GDTimings.PLAYER_JOIN_EVENT.stopTiming(); }
Example 4
Source File: Database.java From MarriageMaster with GNU General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.LOWEST) // We want to start the loading of the player as soon as he connects, so he probably is ready as soon as someone requests the player. public void onPlayerLoginEvent(PlayerJoinEvent event) // This will load the player if he isn't loaded yet { MarriagePlayerData player = cache.getPlayer(event.getPlayer().getUniqueId()); if(player == null) { player = new MarriagePlayerData(event.getPlayer()); cache.cache(player); } if(bungee) { if(player.getDatabaseKey() == null) { final MarriagePlayerData fPlayer = player; plugin.getServer().getScheduler().runTaskLater(plugin, () -> load(fPlayer), 10); } else if(!player.getName().equals(event.getPlayer().getName())) { player.setName(event.getPlayer().getName()); } } else load(player); }
Example 5
Source File: PlayerListener.java From WorldGuardExtraFlagsPlugin with MIT License | 5 votes |
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoinEvent(PlayerJoinEvent event) { Player player = event.getPlayer(); Boolean value = this.plugin.getWorldGuardCommunicator().getSessionManager().get(player).getHandler(FlyFlagHandler.class).getCurrentValue(); if (value != null) { player.setAllowFlight(value); } }
Example 6
Source File: SlimefunGuideListener.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onJoin(PlayerJoinEvent e) { if (giveOnFirstJoin && !e.getPlayer().hasPlayedBefore()) { Player p = e.getPlayer(); if (!SlimefunPlugin.getWorldSettingsService().isWorldEnabled(p.getWorld())) { return; } SlimefunGuideLayout type = SlimefunPlugin.getCfg().getBoolean("guide.default-view-book") ? SlimefunGuideLayout.BOOK : SlimefunGuideLayout.CHEST; p.getInventory().addItem(SlimefunGuide.getItem(type)); } }
Example 7
Source File: PlayerListener.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void join(final PlayerJoinEvent event) { Player player = event.getPlayer(); resetPlayer(player); event.getPlayer().addAttachment(lobby, Permissions.OBSERVER, true); if (player.hasPermission("lobby.overhead-news")) { final String datacenter = minecraftService.getLocalServer().datacenter(); final Component news = new Component(ChatColor.GREEN) .extra(new TranslatableComponent( "lobby.news", new Component(ChatColor.GOLD, ChatColor.BOLD).extra(generalFormatter.publicHostname()) )); final BossBar bar = bossBarFactory.createBossBar(renderer.render(news, player), BarColor.BLUE, BarStyle.SOLID); bar.setProgress(1); bar.addPlayer(player); bar.show(); } if(!player.hasPermission("lobby.disabled-permissions-exempt")) { for(PermissionAttachmentInfo attachment : player.getEffectivePermissions()) { if(config.getDisabledPermissions().contains(attachment.getPermission())) { attachment.getAttachment().setPermission(attachment.getPermission(), false); } } } int count = lobby.getServer().getOnlinePlayers().size(); if(!lobby.getServer().getOnlinePlayers().contains(event.getPlayer())) count++; minecraftService.updateLocalServer(new SignUpdate(count)); }
Example 8
Source File: AnniPlayer.java From AnnihilationPro with MIT License | 5 votes |
@EventHandler(priority = EventPriority.LOWEST) public void playerCheck(PlayerJoinEvent event) { final Player p = event.getPlayer(); if(!exists(p)) loadPlayer(p); }
Example 9
Source File: HealthListeners.java From ActionHealth with MIT License | 5 votes |
@EventHandler(priority = EventPriority.MONITOR) public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); if (plugin.configStore.rememberToggle) { FileHandler fileHandler = new FileHandler("plugins/ActionHealth/players/" + player.getUniqueId() + ".yml"); if (fileHandler.getBoolean("toggle")) { plugin.toggle.add(player.getUniqueId()); } } }
Example 10
Source File: NametagHandler.java From NametagEdit with GNU General Public License v3.0 | 5 votes |
/** * Applies tags to a player */ @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); nametagManager.sendTeams(player); new BukkitRunnable() { @Override public void run() { abstractConfig.load(player, true); } }.runTaskLaterAsynchronously(plugin, 1); }
Example 11
Source File: StatsListener.java From ScoreboardStats with MIT License | 5 votes |
/** * Add the player account from the database in the cache. * * @param joinEvent the join event * @see Database */ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) public void onJoin(PlayerJoinEvent joinEvent) { Player player = joinEvent.getPlayer(); //removing old metadata which wasn't removed (which can lead to memory leaks) player.removeMetadata("player_stats", plugin); //load the pvpstats if activated database.loadAccountAsync(player); }
Example 12
Source File: DefaultUpdateCallback.java From Thermos with GNU General Public License v3.0 | 5 votes |
public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); if (hasPermission(player)) { if (mHasUpdate) { sendUpdate(player); } } }
Example 13
Source File: BossBars.java From CardinalPGM with MIT License | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onJoinEvent(PlayerJoinEvent event) { final Player player = event.getPlayer(); for (LocalizedBossBar bossBar : broadcastedBossBars.values()) { bossBar.addPlayer(player); } }
Example 14
Source File: BukkitEventListener.java From LunaChat with GNU Lesser General Public License v3.0 | 5 votes |
/** * プレイヤーのサーバー参加ごとに呼び出されるメソッド * @param event プレイヤー参加イベント */ @EventHandler public void onJoin(PlayerJoinEvent event) { LunaChatConfig config = LunaChat.getConfig(); Player player = event.getPlayer(); // UUIDをキャッシュ LunaChat.getUUIDCacheData().put(player.getUniqueId().toString(), player.getName()); LunaChat.getUUIDCacheData().save(); // 強制参加チャンネル設定を確認し、参加させる forceJoinToForceJoinChannels(player); // グローバルチャンネル設定がある場合 if ( !config.getGlobalChannel().equals("") ) { tryJoinToGlobalChannel(player); } // チャンネルチャット情報を表示する if ( config.isShowListOnJoin() ) { ArrayList<String> list = getListForMotd(player); for ( String msg : list ) { player.sendMessage(msg); } } }
Example 15
Source File: PingManager.java From LagMonitor with MIT License | 5 votes |
@EventHandler public void onPlayerJoin(PlayerJoinEvent joinEvent) { Player player = joinEvent.getPlayer(); Bukkit.getScheduler().runTaskLater(plugin, () -> { if (player.isOnline()) { addPlayer(player); } }, PING_INTERVAL); }
Example 16
Source File: DynmapHook.java From SuperVanish with Mozilla Public License 2.0 | 5 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onJoin(PlayerJoinEvent e) { Player p = e.getPlayer(); DynmapPlugin dynmap = (DynmapPlugin) plugin; if (superVanish.getVanishStateMgr().isVanished(p.getUniqueId())) { dynmap.setPlayerVisiblity(p, false); } }
Example 17
Source File: PingManager.java From LagMonitor with MIT License | 5 votes |
@EventHandler public void onPlayerJoin(PlayerJoinEvent joinEvent) { Player player = joinEvent.getPlayer(); Bukkit.getScheduler().runTaskLater(plugin, () -> { if (player.isOnline()) { addPlayer(player); } }, PING_INTERVAL); }
Example 18
Source File: LoginListener.java From NovaGuilds with GNU General Public License v3.0 | 4 votes |
@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); //adding player plugin.getPlayerManager().addIfNotExists(player); final NovaPlayer nPlayer = PlayerManager.getPlayer(player); //Send version message if there's an update if(VersionUtils.isUpdateAvailable() && Permission.NOVAGUILDS_ADMIN_UPDATEAVAILABLE.has(player)) { Message.CHAT_UPDATE.send(player); } //Schedule region check NovaGuilds.runTask(new Runnable() { @Override public void run() { plugin.getRegionManager().checkAtRegionChange(nPlayer); } }); if(nPlayer.hasGuild()) { for(Player onlinePlayer : CompatibilityUtils.getOnlinePlayers()) { NovaPlayer onlineNPlayer = PlayerManager.getPlayer(onlinePlayer); if(onlineNPlayer.equals(nPlayer) || !onlineNPlayer.isAtRegion() || !onlineNPlayer.getAtRegion().getGuild().equals(nPlayer.getGuild())) { continue; } plugin.getRegionManager().checkRaidInit(onlineNPlayer); } //Show bank hologram nPlayer.getGuild().showVaultHologram(player); } //TabAPI if(Config.TAGAPI_ENABLED.getBoolean()) { if(player.getScoreboard() == null || player.getScoreboard() == Bukkit.getScoreboardManager().getMainScoreboard()) { player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); } TagUtils.refresh(); } //PacketExtension if(plugin.getPacketExtension() != null) { plugin.getPacketExtension().registerPlayer(player); } //Tab if(Config.TABLIST_ENABLED.getBoolean()) { nPlayer.setTabList(plugin.createTabList(nPlayer)); TabUtils.refresh(nPlayer); } //Guild inactive time if(nPlayer.hasGuild()) { nPlayer.getGuild().updateInactiveTime(); } BossBarUtils.removeBar(player); }
Example 19
Source File: DurabilityBar.java From AdditionsAPI with MIT License | 4 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); sendDurabilityBossBar(player, player.getInventory().getItemInMainHand(), EquipmentSlot.HAND); sendDurabilityBossBar(player, player.getInventory().getItemInOffHand(), EquipmentSlot.OFF_HAND); }
Example 20
Source File: PlayerJoin.java From FunnyGuilds with Apache License 2.0 | 4 votes |
@EventHandler public void onJoin(PlayerJoinEvent e) { Player player = e.getPlayer(); User user = User.get(player); if (user == null) { user = User.create(player); } user.updateReference(player); PluginConfiguration config = FunnyGuilds.getInstance().getPluginConfiguration(); if (config.playerListEnable && ! AbstractTablist.hasTablist(player)) { AbstractTablist.createTablist(config.playerList, config.playerListHeader, config.playerListFooter, config.playerListPing, player); } UserCache cache = user.getCache(); if (cache.getScoreboard() == null) { cache.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); } if (cache.getIndividualPrefix() == null && config.guildTagEnabled) { IndividualPrefix prefix = new IndividualPrefix(user); prefix.initialize(); cache.setIndividualPrefix(prefix); } ConcurrencyManager concurrencyManager = FunnyGuilds.getInstance().getConcurrencyManager(); concurrencyManager.postRequests( new PrefixGlobalUpdatePlayer(player), new DummyGlobalUpdateUserRequest(user), new RankUpdateUserRequest(user) ); this.plugin.getServer().getScheduler().runTaskLaterAsynchronously(this.plugin, () -> { PacketExtension.registerPlayer(player); FunnyGuildsVersion.isNewAvailable(player, false); Region region = RegionUtils.getAt(player.getLocation()); if (region == null || region.getGuild() == null) { return; } if (config.createEntityType != null) { GuildEntityHelper.spawnGuildHeart(region.getGuild(), player); } }, 30L); }