Java Code Examples for org.bukkit.entity.Player#getGameMode()

The following examples show how to use org.bukkit.entity.Player#getGameMode() . 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: SilentOpenChest.java    From SuperVanish with Mozilla Public License 2.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onChestInteract(PlayerInteractEvent e) {
    Player p = e.getPlayer();
    if (!plugin.getVanishStateMgr().isVanished(p.getUniqueId())) return;
    if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
    if (p.getGameMode() == GameMode.SPECTATOR) return;
    //noinspection deprecation
    if (p.isSneaking() && p.getItemInHand() != null
            && (p.getItemInHand().getType().isBlock() || p.getItemInHand().getType() == ITEM_FRAME)
            && p.getItemInHand().getType() != Material.AIR)
        return;
    Block block = e.getClickedBlock();
    if (block == null) return;
    if (block.getType() == ENDER_CHEST) {
        e.setCancelled(true);
        p.openInventory(p.getEnderChest());
        return;
    }
    if (!(block.getType() == CHEST || block.getType() == TRAPPED_CHEST
            || plugin.getVersionUtil().isOneDotXOrHigher(11) && shulkerBoxes.contains(block.getType())))
        return;
    StateInfo stateInfo = StateInfo.extract(p);
    playerStateInfoMap.put(p, stateInfo);
    p.setGameMode(GameMode.SPECTATOR);
}
 
Example 2
Source File: Vitamins.java    From Slimefun4 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public ItemUseHandler getItemHandler() {
    return e -> {
        Player p = e.getPlayer();

        if (p.getGameMode() != GameMode.CREATIVE) {
            ItemUtils.consumeItem(e.getItem(), false);
        }

        p.getWorld().playSound(p.getLocation(), Sound.ENTITY_GENERIC_EAT, 1, 1);

        if (p.hasPotionEffect(PotionEffectType.POISON)) p.removePotionEffect(PotionEffectType.POISON);
        if (p.hasPotionEffect(PotionEffectType.WITHER)) p.removePotionEffect(PotionEffectType.WITHER);
        if (p.hasPotionEffect(PotionEffectType.SLOW)) p.removePotionEffect(PotionEffectType.SLOW);
        if (p.hasPotionEffect(PotionEffectType.SLOW_DIGGING)) p.removePotionEffect(PotionEffectType.SLOW_DIGGING);
        if (p.hasPotionEffect(PotionEffectType.WEAKNESS)) p.removePotionEffect(PotionEffectType.WEAKNESS);
        if (p.hasPotionEffect(PotionEffectType.CONFUSION)) p.removePotionEffect(PotionEffectType.CONFUSION);
        if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) p.removePotionEffect(PotionEffectType.BLINDNESS);

        p.setFireTicks(0);
        p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 2));

        e.cancel();
    };
}
 
Example 3
Source File: Acrobat.java    From AnnihilationPro with MIT License 6 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void AcrobatDoubleJump(PlayerToggleFlightEvent event) 
{  
	Player player = event.getPlayer();
	if(player.getGameMode() != GameMode.CREATIVE) 
	{
		AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
		if(Game.isGameRunning() && p != null && p.getKit().equals(this))
		{
			Delays.getInstance().addDelay(player, System.currentTimeMillis()+10000, this.getInternalName());
		    event.setCancelled(true);
		    player.setAllowFlight(false);
		    player.setFlying(false);		    
		    player.setVelocity(player.getLocation().getDirection().setY(1).multiply(1));
		    player.playSound(player.getLocation(), Sound.ZOMBIE_INFECT, 1.0F, 2.0F);
		}
		else
		{
			player.setAllowFlight(false);
			player.setFlying(false);
		}
	}
}
 
Example 4
Source File: PlayerUtils.java    From Skript with GNU General Public License v3.0 6 votes vote down vote up
public static boolean canEat(Player p, Material food) {
	GameMode gm = p.getGameMode();
	if (gm == GameMode.CREATIVE || gm == GameMode.SPECTATOR)
		return false; // Can't eat anything in those gamemodes
	
	boolean edible = food.isEdible();
	if (!edible)
		return false;
	boolean special;
	switch (food) {
		case GOLDEN_APPLE:
		case CHORUS_FRUIT:
			special = true;
			break;
			//$CASES-OMITTED$
		default:
			special = false;
	}
	if (p.getFoodLevel() < 20 || special)
		return true;
	
	return false;
}
 
Example 5
Source File: Grenade.java    From QualityArmory with GNU General Public License v3.0 6 votes vote down vote up
public void removeGrenade(Player player) {
	if (player.getGameMode() != GameMode.CREATIVE) {
		int slot = -56;
		ItemStack stack = null;
		for (int i = 0; i < player.getInventory().getContents().length; i++) {
			if ((stack = player.getInventory().getItem(i)) != null && MaterialStorage.getMS(stack) == getItemData()) {
				slot = i;
				break;
			}
		}
		if (slot >= -1) {
			if (stack.getAmount() > 1) {
				stack.setAmount(stack.getAmount() - 1);
			} else {
				stack = null;
			}
			player.getInventory().setItem(slot, stack);
		}
	}
}
 
Example 6
Source File: SilentOpenChest.java    From SuperVanish with Mozilla Public License 2.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onSpectatorClick(InventoryClickEvent e) {
    if (!(e.getWhoClicked() instanceof Player))
        return;
    Player p = (Player) e.getWhoClicked();
    if (!plugin.getVanishStateMgr().isVanished(p.getUniqueId())) return;
    if (!playerStateInfoMap.containsKey(p)) return;
    if (p.getGameMode() != GameMode.SURVIVAL && p.getGameMode() != GameMode.ADVENTURE
            && p.getGameMode() != GameMode.CREATIVE) {
        e.setCancelled(false);
    }
}
 
Example 7
Source File: DoubleJumpFeature.java    From VoxelGamesLibv2 with MIT License 5 votes vote down vote up
@GameEvent
public void e(@Nonnull PlayerToggleFlightEvent event) {
    final Player player = event.getPlayer();
    if (player.getGameMode() != GameMode.CREATIVE) {
        if (!disabled.contains(player.getUniqueId())) {
            event.setCancelled(true);
            player.setAllowFlight(false);
            player.setFlying(false);
            player.setVelocity(player.getLocation().getDirection().multiply(1.6).setY(1));
            player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_FLAP, 4, 1);
        }
    }
}
 
Example 8
Source File: ExhibitionCommands.java    From NyaaUtils with MIT License 5 votes vote down vote up
@SubCommand(value = "unset", permission = "nu.exhibition.unset")
public void commandUnset(CommandSender sender, Arguments args) {
    Player p = asPlayer(sender);
    ExhibitionFrame f = ExhibitionFrame.fromPlayerEye(p);
    if (f == null) {
        msg(sender, "user.exhibition.no_item_frame");
        return;
    }
    if (!f.hasItem()) {
        msg(sender, "user.exhibition.no_item");
        return;
    }
    if (!f.isSet()) {
        msg(sender, "user.exhibition.have_not_set");
        return;
    }
    if (f.ownerMatch(p)) {
        f.unset();
        if (p.getGameMode() == GameMode.SURVIVAL) {
            f.getItemFrame().setItem(new ItemStack(Material.AIR));
        }
    } else if (p.hasPermission("nu.exhibition.forceUnset")) {
        f.unset();
    } else {
        msg(sender, "user.exhibition.unset_protected");
    }
}
 
Example 9
Source File: InventoryUtils.java    From NovaGuilds with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Removes a list of items from player's inventory
 *
 * @param player the player
 * @param items  list of items
 */
public static void removeItems(Player player, List<ItemStack> items) {
	for(ItemStack item : items) {
		if(player.getGameMode() != GameMode.CREATIVE || item.hasItemMeta()) {
			player.getInventory().removeItem(item);
		}
	}
}
 
Example 10
Source File: DoubleJump.java    From HubBasics with GNU Lesser General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onMove(PlayerMoveEvent event) {
    Player player = event.getPlayer();
    if (player.getGameMode() == GameMode.CREATIVE) return;
    if (player.isFlying()) return;
    if (!isEnabledInWorld(player.getWorld())) return;
    if (player.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() != Material.AIR)
        player.setAllowFlight(true);
}
 
Example 11
Source File: KnowledgeTome.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemUseHandler getItemHandler() {
    return e -> {
        Player p = e.getPlayer();
        ItemStack item = e.getItem();

        e.setUseBlock(Result.DENY);

        ItemMeta im = item.getItemMeta();
        List<String> lore = im.getLore();

        if (lore.get(1).isEmpty()) {
            lore.set(0, ChatColors.color("&7Owner: &b" + p.getName()));
            lore.set(1, ChatColor.BLACK + "" + p.getUniqueId());
            im.setLore(lore);
            item.setItemMeta(im);
            p.getWorld().playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 1F);
        }
        else {
            UUID uuid = UUID.fromString(ChatColor.stripColor(item.getItemMeta().getLore().get(1)));

            if (p.getUniqueId().equals(uuid)) {
                SlimefunPlugin.getLocalization().sendMessage(p, "messages.no-tome-yourself");
                return;
            }

            PlayerProfile.get(p, profile -> PlayerProfile.fromUUID(uuid, owner -> {
                for (Research research : owner.getResearches()) {
                    research.unlock(p, true);
                }
            }));

            if (p.getGameMode() != GameMode.CREATIVE) {
                ItemUtils.consumeItem(item, false);
            }
        }
    };
}
 
Example 12
Source File: BlockListener.java    From Carbon with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void setDoubleSlab(Player player, Block block) {
	block.setType(Carbon.injector().redSandstoneDoubleSlabMat);
	block.setData((byte) 0);
	block.getWorld().playSound(block.getLocation(), Sound.DIG_STONE, 1, 1);
	if (player.getGameMode() != GameMode.CREATIVE) {
		if (player.getItemInHand().getAmount() > 1)
			player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1);
		else
			player.setItemInHand(null);
	}
}
 
Example 13
Source File: PWIPlayer.java    From PerWorldInventory with GNU General Public License v3.0 5 votes vote down vote up
PWIPlayer(Player player, Group group, double bankBalance, double balance, boolean useAttributes) {
    this.uuid = player.getUniqueId();
    this.name = player.getName();
    this.location = player.getLocation();

    this.group = group;
    this.saved = false;

    this.armor = player.getInventory().getArmorContents();
    this.enderChest = player.getEnderChest().getContents();
    this.inventory = player.getInventory().getContents();

    this.canFly = player.getAllowFlight();
    this.displayName = player.getDisplayName();
    this.exhaustion = player.getExhaustion();
    this.experience = player.getExp();
    this.isFlying = player.isFlying();
    this.foodLevel = player.getFoodLevel();
    if (useAttributes) {
        this.maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
    } else {
        this.maxHealth = player.getMaxHealth();
    }
    this.health = player.getHealth();
    this.gamemode = player.getGameMode();
    this.level = player.getLevel();
    this.saturationLevel = player.getSaturation();
    this.potionEffects = player.getActivePotionEffects();
    this.fallDistance = player.getFallDistance();
    this.fireTicks = player.getFireTicks();
    this.maxAir = player.getMaximumAir();
    this.remainingAir = player.getRemainingAir();

    this.bankBalance = bankBalance;
    this.balance = balance;
}
 
Example 14
Source File: BlockListener.java    From MineTinker with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onShovelUse(PlayerInteractEvent event) {
	Player player = event.getPlayer();

	if (Lists.WORLDS.contains(player.getWorld().getName())) {
		return;
	}

	if (!(player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)) {
		return;
	}

	ItemStack tool = player.getInventory().getItemInMainHand();

	if (!ToolType.SHOVEL.contains(tool.getType())) {
		return;
	}

	if (!modManager.isToolViable(tool)) {
		return;
	}

	boolean apply = false;

	if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null) {
		if (event.getClickedBlock().getType() == Material.GRASS_BLOCK)
			apply = true;

		Block b = player.getWorld().getBlockAt(event.getClickedBlock().getLocation().add(0, 1, 0));
		if (b.getType() != Material.AIR && b.getType() != Material.CAVE_AIR)
			//Case Block is on top of clicked Block -> No Path created -> no Exp
			apply = false;
	}

	if (!apply) {
		return;
	}

	if (!modManager.durabilityCheck(event, player, tool)) {
		return;
	}

	modManager.addExp(player, tool, MineTinker.getPlugin().getConfig().getInt("ExpPerBlockBreak"));

	MTPlayerInteractEvent interactEvent = new MTPlayerInteractEvent(tool, event);
	Bukkit.getPluginManager().callEvent(interactEvent);
}
 
Example 15
Source File: BlockBreakDirection.java    From Hawk with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void check(BlockDigEvent e) {
    Player p = e.getPlayer();
    HawkPlayer pp = e.getHawkPlayer();
    Location bLoc = e.getBlock().getLocation();
    Vector pos;
    if(pp.isInVehicle()) {
        pos = hawk.getLagCompensator().getHistoryLocation(ServerUtils.getPing(p), p).toVector();
        pos.setY(pos.getY() + p.getEyeHeight());
    }
    else {
        pos = pp.getHeadPosition();
    }
    Vector dir = MathPlus.getDirection(pp.getYaw(), pp.getPitch());
    Vector extraDir = MathPlus.getDirection(pp.getYaw() + pp.getDeltaYaw(), pp.getPitch() + pp.getDeltaPitch());

    switch (e.getDigAction()) {
        case START:
            if(CHECK_DIG_START || (p.getGameMode() == GameMode.CREATIVE && CHECK_DIG_COMPLETE))
                break;
            return;
        case CANCEL:
            if(CHECK_DIG_CANCEL)
                break;
            return;
        case COMPLETE:
            if(CHECK_DIG_COMPLETE)
                break;
            return;
    }

    Vector min = bLoc.toVector();
    Vector max = bLoc.toVector().add(new Vector(1, 1, 1));
    AABB targetAABB = new AABB(min, max);

    if (DEBUG_HITBOX)
        targetAABB.highlight(hawk, p.getWorld(), 0.25);
    if (DEBUG_RAY)
        new Ray(pos, extraDir).highlight(hawk, p.getWorld(), 6F, 0.3);

    if(targetAABB.betweenRays(pos, dir, extraDir)) {
        reward(pp);
    }
    else {
        punish(pp, true, e);
    }
}
 
Example 16
Source File: Modifier.java    From MineTinker with GNU General Public License v3.0 4 votes vote down vote up
public void enchantItem(Player player) {
	if (!player.hasPermission("minetinker.modifiers." + getKey().replace("-", "").toLowerCase() + ".craft")) {
		return;
	}

	if (getConfig().getBoolean("Recipe.Enabled")) {
		return;
	}

	Location location = player.getLocation();
	World world = location.getWorld();
	PlayerInventory inventory = player.getInventory();

	if (world == null) {
		return;
	}

	if (player.getGameMode() == GameMode.CREATIVE) {
		if (inventory.addItem(getModItem()).size() != 0) { //adds items to (full) inventory
			world.dropItem(location, getModItem());
		} // no else as it gets added in if

		if (MineTinker.getPlugin().getConfig().getBoolean("Sound.OnEnchanting")) {
			player.playSound(location, Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1.0F, 0.5F);
		}

		ChatWriter.log(false, player.getDisplayName() + " created a " + getName() + "-Modifiers in Creative!");
	} else if (player.getLevel() >= getEnchantCost()) {
		int amount = inventory.getItemInMainHand().getAmount();
		int newLevel = player.getLevel() - getEnchantCost();

		player.setLevel(newLevel);
		inventory.getItemInMainHand().setAmount(amount - 1);

		if (inventory.addItem(getModItem()).size() != 0) { //adds items to (full) inventory
			world.dropItem(location, getModItem());
		} // no else as it gets added in if

		if (MineTinker.getPlugin().getConfig().getBoolean("Sound.OnEnchanting")) {
			player.playSound(location, Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1.0F, 0.5F);
		}

		ChatWriter.log(false, player.getDisplayName() + " created a " + getName() + "-Modifiers!");
	} else {
		ChatWriter.sendActionBar(player, ChatColor.RED
				+ LanguageManager.getString("Modifier.Enchantable.LevelsRequired", player)
				.replace("%amount", String.valueOf(getEnchantCost())));
		ChatWriter.log(false, player.getDisplayName() + " tried to create a "
				+ getName() + "-Modifiers but had not enough levels!");
	}
}
 
Example 17
Source File: CommonEntityEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
private void checkPlayerFlight(GDPermissionUser user, GDClaim fromClaim, GDClaim toClaim) {
    if (user == null) {
        return;
    }
    final Player player = user.getOnlinePlayer();
    if (player == null || !player.isFlying()) {
        // Most likely Citizens NPC
        return;
    }
    if (!GDOptions.isOptionEnabled(Options.PLAYER_DENY_FLIGHT)) {
        return;
    }

    final GDPlayerData playerData = user.getInternalPlayerData();
    final GameMode gameMode = player.getGameMode();
    if (gameMode == GameMode.SPECTATOR) {
        return;
    }
    if (gameMode == GameMode.CREATIVE) {
        if (playerData.inPvpCombat() && !GriefDefenderPlugin.getActiveConfig(player.getWorld().getUID()).getConfig().pvp.allowFly) {
            player.setAllowFlight(false);
            player.setFlying(false);
            playerData.ignoreFallDamage = true;
            GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().OPTION_APPLY_PLAYER_DENY_FLIGHT);
            return;
        }
        return;
    }

    final Boolean noFly = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), playerData.getSubject(), Options.PLAYER_DENY_FLIGHT, toClaim);
    final boolean adminFly = playerData.userOptionBypassPlayerDenyFlight;
    boolean trustFly = false;
    if (toClaim.isBasicClaim() || (toClaim.parent != null && toClaim.parent.isBasicClaim()) || toClaim.isInTown()) {
        // check owner
        if (playerData.userOptionPerkFlyOwner && toClaim.allowEdit(player) == null) {
            trustFly = true;
        } else {
            if (playerData.userOptionPerkFlyAccessor && toClaim.isUserTrusted(player, TrustTypes.ACCESSOR)) {
                trustFly = true;
            } else if (playerData.userOptionPerkFlyBuilder && toClaim.isUserTrusted(player, TrustTypes.BUILDER)) {
                trustFly = true;
            } else if (playerData.userOptionPerkFlyContainer && toClaim.isUserTrusted(player, TrustTypes.CONTAINER)) {
                trustFly = true;
            } else if (playerData.userOptionPerkFlyManager && toClaim.isUserTrusted(player, TrustTypes.MANAGER)) {
                trustFly = true;
            }
         }
    }

    if (trustFly) {
        return;
    }
    if (!adminFly && noFly) {
        player.setAllowFlight(false);
        player.setFlying(false);
        playerData.ignoreFallDamage = true;
        GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().OPTION_APPLY_PLAYER_DENY_FLIGHT);
    }
}
 
Example 18
Source File: Acrobat.java    From AnnihilationPro with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
	public void AcrobatJumpMonitor(PlayerMoveEvent event) 
	{ 
		Player player = event.getPlayer();
		if(player.getGameMode() != GameMode.CREATIVE)
		{
			if(player.isFlying())
			{
				player.setAllowFlight(false);
				player.setFlying(false);
				return;
			}
			
			if(Game.isGameRunning())
			{
				if(!player.getAllowFlight())
				{
					AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
					if(p != null && p.getKit().equals(this))
					{
						if(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.AIR && !Delays.getInstance().hasActiveDelay(player, this.getInternalName()))
						{
							//Bukkit.getLogger().info("Thing 2");
							player.setAllowFlight(true);
							return;
						}
					}
				}
			}
//			else
//			{
//				player.setAllowFlight(false);
//				player.setFlying(false);
//			}
		}
			
			
//		if(player.getGameMode() != GameMode.CREATIVE && player.isFlying())
//		{
//			player.setAllowFlight(false);
//			player.setFlying(false);
//		}
//		
//		if(Game.isGameRunning() && player.getGameMode() != GameMode.CREATIVE && !player.getAllowFlight())
//		{
//			AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
//			if(p != null && p.getKit().equals(this))
//			{
//				//This is possibly also where we would make them able to permanently sprint
//				if(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.AIR && !Delays.getInstance().hasActiveDelay(player, this.getInternalName()))
//				{
//					//Bukkit.getLogger().info("Thing 2");
//					player.setAllowFlight(true);
//					return;
//				}
//			}
//			player.setAllowFlight(false);
//			player.setFlying(false);
//		}
	}
 
Example 19
Source File: AsynchronousJoin.java    From AuthMeReloaded with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Processes the given player that has just joined.
 *
 * @param player the player to process
 */
public void processJoin(final Player player) {
    final String name = player.getName().toLowerCase();
    final String ip = PlayerUtils.getPlayerIp(player);

    if (service.getProperty(RestrictionSettings.UNRESTRICTED_NAMES).contains(name)) {
        return;
    }

    if (service.getProperty(RestrictionSettings.FORCE_SURVIVAL_MODE)
        && player.getGameMode() != GameMode.SURVIVAL
        && !service.hasPermission(player, PlayerStatePermission.BYPASS_FORCE_SURVIVAL)) {
        bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> player.setGameMode(GameMode.SURVIVAL));
    }

    if (service.getProperty(HooksSettings.DISABLE_SOCIAL_SPY)) {
        pluginHookService.setEssentialsSocialSpyStatus(player, false);
    }

    if (!validationService.fulfillsNameRestrictions(player)) {
        handlePlayerWithUnmetNameRestriction(player, ip);
        return;
    }

    if (!validatePlayerCountForIp(player, ip)) {
        return;
    }

    final boolean isAuthAvailable = database.isAuthAvailable(name);

    if (isAuthAvailable) {
        // Protect inventory
        if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
            ProtectInventoryEvent ev = bukkitService.createAndCallEvent(
                isAsync -> new ProtectInventoryEvent(player, isAsync));
            if (ev.isCancelled()) {
                player.updateInventory();
                logger.fine("ProtectInventoryEvent has been cancelled for " + player.getName() + "...");
            }
        }

        // Session logic
        if (sessionService.canResumeSession(player)) {
            service.send(player, MessageKey.SESSION_RECONNECTION);
            // Run commands
            bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
                () -> commandManager.runCommandsOnSessionLogin(player));
            bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player));
            return;
        }
    } else if (!service.getProperty(RegistrationSettings.FORCE)) {
        bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
            welcomeMessageConfiguration.sendWelcomeMessage(player);
        });

        // Skip if registration is optional
        return;
    }

    processJoinSync(player, isAuthAvailable);
}