From 9743753c1bbd27ec55b3af5c988596d4c631098b Mon Sep 17 00:00:00 2001 From: Terry <68700354+teraprath@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:36:56 +0200 Subject: [PATCH] Teleport player to lobby spawn on join --- .idea/.gitignore | 3 ++ .idea/compiler.xml | 13 ++++++++ .idea/encodings.xml | 7 +++++ .idea/jarRepositories.xml | 30 +++++++++++++++++++ .idea/misc.xml | 12 ++++++++ .idea/modules.xml | 8 +++++ .idea/vcs.xml | 6 ++++ Lobby.iml | 27 ++--------------- pom.xml | 2 +- .../java/net/spigotcloud/lobby/Lobby.java | 2 +- .../lobby/listener/JoinQuitListener.java | 8 +++++ src/main/resources/plugin.yml | 2 +- 12 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..2c72534 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..861936a --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9dc782b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d950da9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Lobby.iml b/Lobby.iml index 4365954..f553dad 100644 --- a/Lobby.iml +++ b/Lobby.iml @@ -1,36 +1,13 @@ - + SPIGOT + 1 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6736417..2157154 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.spigotcloud lobby - 1.4.2-STABLE + 1.5.0-SNAPSHOT jar Lobby diff --git a/src/main/java/net/spigotcloud/lobby/Lobby.java b/src/main/java/net/spigotcloud/lobby/Lobby.java index ce31cf0..9c3d9e1 100644 --- a/src/main/java/net/spigotcloud/lobby/Lobby.java +++ b/src/main/java/net/spigotcloud/lobby/Lobby.java @@ -68,7 +68,7 @@ private void registerCommands() { private void registerEvents() { final PluginManager pm = getServer().getPluginManager(); pm.registerEvents(new ItemListener(), this); - pm.registerEvents(new JoinQuitListener(), this); + pm.registerEvents(new JoinQuitListener(this.locationManager), this); pm.registerEvents(new ProtectListener(), this); } diff --git a/src/main/java/net/spigotcloud/lobby/listener/JoinQuitListener.java b/src/main/java/net/spigotcloud/lobby/listener/JoinQuitListener.java index 57d6425..e5be78f 100644 --- a/src/main/java/net/spigotcloud/lobby/listener/JoinQuitListener.java +++ b/src/main/java/net/spigotcloud/lobby/listener/JoinQuitListener.java @@ -2,6 +2,7 @@ import net.spigotcloud.lobby.Lobby; import net.spigotcloud.lobby.handler.PlayerHandler; +import net.spigotcloud.lobby.manager.LocationManager; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -10,10 +11,17 @@ public class JoinQuitListener implements Listener { + private final LocationManager locationManager; + + public JoinQuitListener(LocationManager locationManager) { + this.locationManager = locationManager; + } + @EventHandler public void onPlayerJoin(PlayerJoinEvent e) { final Player player = e.getPlayer(); e.setJoinMessage(null); + player.teleport(locationManager.getSpawn()); PlayerHandler.reset(player); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6d699a8..667cc4b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,7 +3,7 @@ version: '${project.version}' main: net.spigotcloud.lobby.Lobby api-version: 1.19 softdepend: [ PointsAPI ] -authors: [ TerryGHG ] +authors: [ MrMending ] description: Modular Lobby Plugin for Spigot 1.19+ website: https://github.com/teraprath commands: