Skip to content

Commit

Permalink
Teleport player to lobby spawn on join
Browse files Browse the repository at this point in the history
  • Loading branch information
teraprath committed Oct 14, 2024
1 parent be584eb commit 9743753
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 2 additions & 25 deletions Lobby.iml
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.0.1-jre" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.12.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
</component>
</module>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.spigotcloud</groupId>
<artifactId>lobby</artifactId>
<version>1.4.2-STABLE</version>
<version>1.5.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lobby</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/spigotcloud/lobby/Lobby.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9743753

Please sign in to comment.