xavier.6996

Plugin Name: LastLocation Minecraft Versions: 1.21+ (tested on 1.21.1) Java Version: 21

Description: Automatically teleport players to their last world when they join a server (directly or via Velocity).

  • Slobby world has a special spawn.
  • Other worlds (Overworld, Nether, End, or custom worlds) are restored using Multiverse /mvtp as the player.
  • No custom player data — uses server/player data only.

Behavior:

  1. 1.

On Player Join (Direct / Velocity):

- If last world = slobby:

- Teleport to slobby spawn if set.

- If slobby spawn not set → do nothing.

- If last world = any other world (survival, slobby_nether, slobby_end, etc.):

- Execute /mvtp ll:<world_name> as the player (force teleport).

- Do not teleport players in slobby using /mvtp.

  1. 2.

Slobby Spawn Management:

- Command: /setslobby → sets the spawn for slobby.

  1. 3.

Safety:

- Never disconnect or crash players if slobby spawn is missing.

- Teleport failures are ignored safely.

  1. 4.

Integration:

- Works for players joining via Velocity, direct join, or NPC server switching.

- Uses only server/player existing data (no external storage).

Example:

Last World

Action

slobby

Teleport to slobby spawn (if set)

survival

/mvtp ll:survival (as player)

slobby_nether

/mvtp ll:slobby_nether (as player)

slobby_end

/mvtp ll:slobby_end (as player)

Goal: Seamlessly return players to their last world on join while handling slobby as a special spawn, without storing custom player data, and with full Velocity compatibility.

Kodari AI
KodariApr 5 at 5:20 pm 7,732 (v2)

I’ll create a plugin that teleports players to their last world location on join, with special handling for the “slobby” world.

LastLocation
Automatically teleports players to their last world when joining the server (direct or via Velocity). The "slobby" world uses a custom spawn point, while other worlds use Multiverse's last location system. Includes `/setslobby` command for spawn management and seamless integration with Velocity proxy joins.

Plugin created! All files are ready for compilation.

Key Features Implemented:

  • Players joining “slobby” world → teleported to custom spawn (if set via /setslobby)

  • Players in any other world → Multiverse /mvtp ll:<world> executed as player

  • 1-tick delay ensures players are fully loaded before teleportation

  • Safe error handling: missing spawn or teleport failures won’t crash the server

  • Works with Velocity, direct join, and NPC server switching (all trigger PlayerJoinEvent)

xavier.6996

There is a big issue. When i upload boath lastlocation and multiverse core together. We get disconnect instantly from the server. When i delete on of them the server starts working. Fix it.

Kodari AI
KodariApr 5 at 5:40 pm 3,702 (v2)

I need to examine the plugin files to identify the conflict with Multiverse-Core. Let me read the relevant files.

I found the critical issues causing the disconnect conflict with Multiverse-Core:

  1. Wrong event priority - Using HIGHEST makes your plugin run BEFORE Multiverse, creating teleport conflicts

  2. Invalid Multiverse command - mvtp ll:worldname doesn’t exist and executing it as the player causes errors

  3. Missing dependency declaration - No soft-depend on Multiverse-Core means load order is random

  4. Teleport timing conflict - Both plugins trying to teleport simultaneously on join

Fixes:

  • Change priority to MONITOR (run AFTER Multiverse)

  • Add Multiverse-Core soft-depend

  • Increase delay to avoid race conditions

  • Store and manage last locations properly instead of relying on non-existent Multiverse commands

Fixed:

  • Added softdepend: [Multiverse-Core] to ensure proper load order

  • Changed event priority from HIGHEST to MONITOR so Multiverse processes first

  • Increased delay from 1 tick to 20 ticks (1 second) to let Multiverse complete initialization

  • Removed broken mvtp ll:worldname command that doesn’t exist

  • Added proper last location tracking with PlayerQuitEvent

  • Added ignoreCancelled = true to prevent processing cancelled joins

This will now work alongside Multiverse-Core without conflicts.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 275
src/main/java/com/lastlocation/plugin/LastLocation.java
package com.lastlocation.plugin;

import com.lastlocation.plugin.command.SetSlobbyCommand;
import com.lastlocation.plugin.listener.PlayerJoinListener;
import com.lastlocation.plugin.manager.SpawnManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class LastLocation extends JavaPlugin {
    
    private SpawnManager spawnManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.spawnManager = new SpawnManager(this);
        this.spawnManager.loadSpawn();
        
        Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(this), this);
        
        SetSlobbyCommand setSlobbyCommand = new SetSlobbyCommand(this);
        getCommand("setslobby").setExecutor(setSlobbyCommand);
        
        getLogger().info("LastLocation has been enabled!");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("LastLocation has been disabled!");
    }
}