Java Code Examples for org.bukkit.entity.Player#hasPlayedBefore()
The following examples show how to use
org.bukkit.entity.Player#hasPlayedBefore() .
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: TeleportationService.java From AuthMeReloaded with GNU General Public License v3.0 | 6 votes |
/** * Teleports the player to the first spawn if he is new and the first spawn is configured. * * @param player the player to process */ public void teleportNewPlayerToFirstSpawn(final Player player) { if (settings.getProperty(RestrictionSettings.NO_TELEPORT)) { return; } Location firstSpawn = spawnLoader.getFirstSpawn(); if (firstSpawn == null) { return; } if (!player.hasPlayedBefore() || !dataSource.isAuthAvailable(player.getName())) { logger.debug("Attempting to teleport player `{0}` to first spawn", player.getName()); performTeleportation(player, new FirstSpawnTeleportEvent(player, firstSpawn)); } }
Example 2
Source File: PlayerListener.java From GlobalWarming with GNU Lesser General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onPlayerJoin(PlayerJoinEvent event) { //Player lookup: PlayerTable table = gw.getTableManager().getPlayerTable(); Player player = event.getPlayer(); GPlayer gPlayer = table.getOrCreatePlayer(player.getUniqueId()); //First-time players will receive an instructional booklet: // - Note: adding it even if the climate-engine is disabled (in case it is enabled later) if (!player.hasPlayedBefore()) { GeneralCommands.getBooklet(gPlayer); } //Add the scoreboard if the climate engine for the player's associated-world is enabled // - Note: scores are not tied to the player's current-world WorldClimateEngine engine = ClimateEngine.getInstance().getClimateEngine(gPlayer.getAssociatedWorldId()); if (engine != null && engine.isEnabled()) { if (gw.getConf().isWelcomingOnJoin()) { //Show players their current carbon score in chat: GeneralCommands.showCarbonScore(gPlayer); } if (gw.getConf().isScoreboardEnabled()) { //Add the player to the scoreboard: gw.getScoreboard().connect(gPlayer); } } }
Example 3
Source File: CrazyCrates.java From Crazy-Crates with MIT License | 5 votes |
/** * Set a new player's default amount of keys. * @param player The player that has just joined. */ public void setNewPlayerKeys(Player player) { if (giveNewPlayersKeys) {// Checks if any crate gives new players keys and if not then no need to do all this stuff. String uuid = player.getUniqueId().toString(); if (player.hasPlayedBefore()) { for (Crate crate : getCrates()) { if (crate.doNewPlayersGetKeys()) { Files.DATA.getFile().set("Players." + uuid + "." + crate, crate.getNewPlayerKeys()); } } Files.DATA.saveFile(); } } }
Example 4
Source File: TutorialListener.java From ServerTutorial with MIT License | 5 votes |
@EventHandler public void onJoin(PlayerJoinEvent event) { final Player player = event.getPlayer(); final String playerName = player.getName(); if (TutorialManager.getManager().getConfigs().getCheckGameMode()) { event.getPlayer().setGameMode(GameMode.SURVIVAL); } if (plugin.getTempPlayers().containsKey(player.getUniqueId())) { plugin.getTempPlayers().get(player.getUniqueId()).restorePlayer(); plugin.getTempPlayers().remove(player.getUniqueId()); DataLoading.getDataLoading().getTempData().set("players." + player.getUniqueId(), null); DataLoading.getDataLoading().saveTempData(); } if (!plugin.getServer().getOnlineMode()) { plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { try { Caching.getCaching().getResponse().put(playerName, UUIDFetcher.getUUIDOf(playerName)); } catch (Exception ignored) { } } }); } for (String name : TutorialManager.getManager().getAllInTutorial()) { Player tut = plugin.getServer().getPlayerExact(name); if (tut != null) { player.hidePlayer(tut); } } if (!player.hasPlayedBefore()) { if (TutorialManager.getManager().getConfigs().firstJoin()) { plugin.startTutorial(TutorialManager.getManager().getConfigs().firstJoinTutorial(), player); } } }