Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
6dbd755055 | |||
9bbbdd42f7 | |||
91e3a43dc4 |
@ -1,6 +1,6 @@
|
|||||||
# death-swap
|
# death-swap
|
||||||
|
|
||||||
DeathSwap plugin for 1.19 Minecraft Java servers (Spigot/Paper)
|
DeathSwap plugin for 1.20 Minecraft Java servers (Spigot/Paper)
|
||||||
|
|
||||||
## WARNING
|
## WARNING
|
||||||
|
|
||||||
@ -20,4 +20,4 @@ Whenever a player dies/leaves the game, they will be transported back to the lob
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Free and open-source software under the [BSD-2-Clause](LICENSE) license.
|
Free and open-source software under the [BSD-2-Clause](LICENSE) license.
|
||||||
|
4
pom.xml
4
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<groupId>eu.cloudapio.deathswap</groupId>
|
<groupId>eu.cloudapio.deathswap</groupId>
|
||||||
<artifactId>deathswap</artifactId>
|
<artifactId>deathswap</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.2-SNAPSHOT</version>
|
||||||
<name>deathswap</name>
|
<name>deathswap</name>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
<properties>
|
<properties>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
<version>1.20.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -20,10 +20,9 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class DeathSwapGame {
|
public class DeathSwapGame {
|
||||||
ArrayList<Player> players;
|
ArrayList<Player> players;
|
||||||
WorldCreator wc;
|
|
||||||
World world;
|
World world;
|
||||||
|
World world_nether;
|
||||||
Random randomizer;
|
Random randomizer;
|
||||||
String worldName;
|
|
||||||
|
|
||||||
boolean isPlayingGame = false;
|
boolean isPlayingGame = false;
|
||||||
|
|
||||||
@ -34,12 +33,34 @@ public class DeathSwapGame {
|
|||||||
|
|
||||||
long lastSwapTime;
|
long lastSwapTime;
|
||||||
|
|
||||||
|
private World createWorld(String name, boolean isNether)
|
||||||
|
{
|
||||||
|
World world = Bukkit.getWorld(name);
|
||||||
|
Bukkit.getServer().unloadWorld(world, false);
|
||||||
|
|
||||||
|
deleteWorld(name);
|
||||||
|
|
||||||
|
WorldCreator wc = new WorldCreator(name);
|
||||||
|
|
||||||
|
wc.copy(Bukkit.getServer().getWorlds().get(0));
|
||||||
|
wc.seed(randomizer.nextLong());
|
||||||
|
if(isNether) wc.environment(Environment.NETHER);
|
||||||
|
world = wc.createWorld();
|
||||||
|
world.setKeepSpawnInMemory(false);
|
||||||
|
world.setDifficulty(Difficulty.NORMAL);
|
||||||
|
world.setPVP(false);
|
||||||
|
world.setGameRule(GameRule.DO_IMMEDIATE_RESPAWN, true);
|
||||||
|
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
public DeathSwapGame()
|
public DeathSwapGame()
|
||||||
{
|
{
|
||||||
randomizer = new Random(System.currentTimeMillis());
|
randomizer = new Random(System.currentTimeMillis());
|
||||||
players = new ArrayList<Player>();
|
players = new ArrayList<Player>();
|
||||||
worldName = "death-swap";
|
|
||||||
wc = new WorldCreator(worldName);
|
world = createWorld("death-swap", false);
|
||||||
|
world_nether = createWorld("death-swap-nether", true);
|
||||||
|
|
||||||
getMainWorld().setPVP(false);
|
getMainWorld().setPVP(false);
|
||||||
}
|
}
|
||||||
@ -132,26 +153,12 @@ public class DeathSwapGame {
|
|||||||
|
|
||||||
isPlayingGame = true;
|
isPlayingGame = true;
|
||||||
|
|
||||||
Bukkit.getServer().unloadWorld(world, false);
|
|
||||||
|
|
||||||
deleteWorld(worldName);
|
|
||||||
|
|
||||||
wc.copy(Bukkit.getServer().getWorlds().get(0));
|
|
||||||
wc.seed(randomizer.nextLong());
|
|
||||||
if(isNether)
|
|
||||||
{
|
|
||||||
wc.environment(Environment.NETHER);
|
|
||||||
}
|
|
||||||
world = wc.createWorld();
|
|
||||||
world.setKeepSpawnInMemory(false);
|
|
||||||
world.setDifficulty(Difficulty.NORMAL);
|
|
||||||
world.setPVP(false);
|
|
||||||
world.setGameRule(GameRule.DO_IMMEDIATE_RESPAWN, true);
|
|
||||||
|
|
||||||
ArrayList<Location> spawnLocations = new ArrayList<Location>(players.size());
|
ArrayList<Location> spawnLocations = new ArrayList<Location>(players.size());
|
||||||
for(int i = 0; i < players.size(); i++)
|
for(int i = 0; i < players.size(); i++)
|
||||||
{
|
{
|
||||||
spawnLocations.add(randomSpawnLocation(world, isNether));
|
if(isNether)
|
||||||
|
spawnLocations.add(randomSpawnLocation(world_nether, true));
|
||||||
|
else spawnLocations.add(randomSpawnLocation(world, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < players.size(); i++)
|
for(int i = 0; i < players.size(); i++)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
main: eu.cloudapio.deathswap.DeathSwap
|
main: eu.cloudapio.deathswap.DeathSwap
|
||||||
name: death-swap
|
name: death-swap
|
||||||
version: 0.1
|
version: 0.1
|
||||||
api-version: 1.19
|
api-version: 1.20
|
||||||
commands:
|
commands:
|
||||||
dswap:
|
dswap:
|
||||||
description: Death Swap
|
description: Death Swap
|
||||||
usage: /<command> [overworld|nether]
|
usage: /<command> [overworld|nether]
|
||||||
permission: deathswap.dswap
|
permission: deathswap.dswap
|
||||||
|
Loading…
Reference in New Issue
Block a user