-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3777e5
commit 9b2f574
Showing
32 changed files
with
694 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>xyz.ng7</groupId> | ||
<artifactId>rSpawn</artifactId> | ||
<version>1.0</version> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>8</source> | ||
<target>8</target> | ||
</configuration> | ||
<version>3.8.1</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spigotmc-repo</id> | ||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> | ||
</repository> | ||
<repository> | ||
<id>Multiverse Snapshots</id> | ||
<url>http://repo.onarandombox.com/content/repositories/multiverse-snapshots/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot-api</artifactId> | ||
<version>1.14.4-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.onarandombox.multiversecore</groupId> | ||
<artifactId>Multiverse-Core</artifactId> | ||
<version>4.1.0-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.onarandombox.multiverseinventories</groupId> | ||
<artifactId>Multiverse-Inventories</artifactId> | ||
<version>3.0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package xyz.ng7.rSpawn.Listeners; | ||
|
||
import com.onarandombox.multiverseinventories.MultiverseInventories; | ||
import com.onarandombox.multiverseinventories.WorldGroup; | ||
import java.util.List; | ||
import org.bukkit.Location; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerChangedWorldEvent; | ||
import xyz.ng7.rSpawn.MultiverseInventories.SpawnPointSharable; | ||
import xyz.ng7.rSpawn.rSpawn; | ||
import xyz.ng7.rSpawn.Utils.SpawnLocation; | ||
|
||
public class OnJoin implements Listener { | ||
private FileConfiguration c; | ||
private MultiverseInventories i; | ||
private String g; | ||
|
||
public OnJoin(rSpawn rS) { | ||
c = rS.getConfigFile(); | ||
i = rS.getInventories(); | ||
} | ||
|
||
@EventHandler | ||
public void onJoin(PlayerChangedWorldEvent e) { | ||
Player p = e.getPlayer(); | ||
List<WorldGroup> lwg = i.getGroupManager().getGroupsForWorld(p.getWorld().getName()); | ||
|
||
for (WorldGroup fg: lwg) if (fg.isSharing(SpawnPointSharable.SPAWN_POINT)) { | ||
g = fg.getName(); | ||
break; | ||
} | ||
|
||
if (g != null) { | ||
Location sp = SpawnPointSharable.getPlayerSpawnPoint(p); | ||
|
||
if (sp == null) { | ||
SpawnPointSharable.setPlayerSpawnPoint(p, new SpawnLocation(c, p.getWorld()).gen()); | ||
p.teleport(SpawnPointSharable.getPlayerSpawnPoint(p)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package xyz.ng7.rSpawn.Listeners; | ||
|
||
import com.onarandombox.multiverseinventories.MultiverseInventories; | ||
import com.onarandombox.multiverseinventories.WorldGroup; | ||
import java.util.List; | ||
import org.bukkit.Location; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerRespawnEvent; | ||
import xyz.ng7.rSpawn.MultiverseInventories.SpawnPointSharable; | ||
import xyz.ng7.rSpawn.rSpawn; | ||
import xyz.ng7.rSpawn.Utils.SpawnLocation; | ||
|
||
public class OnRespawn implements Listener { | ||
private FileConfiguration c; | ||
private MultiverseInventories i; | ||
private String g; | ||
|
||
public OnRespawn(rSpawn rS) { | ||
c = rS.getConfigFile(); | ||
i = rS.getInventories(); | ||
} | ||
|
||
@EventHandler | ||
public void onJoin(PlayerRespawnEvent e) { | ||
Player p = e.getPlayer(); | ||
List<WorldGroup> lwg = i.getGroupManager().getGroupsForWorld(p.getWorld().getName()); | ||
|
||
for (WorldGroup fg: lwg) if (fg.isSharing(SpawnPointSharable.SPAWN_POINT)) { | ||
g = fg.getName(); | ||
break; | ||
} | ||
|
||
if (g != null) { | ||
Location sp = SpawnPointSharable.getPlayerSpawnPoint(p); | ||
|
||
if (e.isBedSpawn()) return; | ||
else if (sp != null) e.setRespawnLocation(sp); | ||
else { | ||
SpawnPointSharable.setPlayerSpawnPoint(p, new SpawnLocation(c, p.getWorld()).gen()); | ||
e.setRespawnLocation(SpawnPointSharable.getPlayerSpawnPoint(p)); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.