Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
6dbd755055 | |||
9bbbdd42f7 |
4
pom.xml
4
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>eu.cloudapio.deathswap</groupId>
|
||||
<artifactId>deathswap</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<name>deathswap</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<properties>
|
||||
@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -20,10 +20,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class DeathSwapGame {
|
||||
ArrayList<Player> players;
|
||||
WorldCreator wc;
|
||||
World world;
|
||||
World world_nether;
|
||||
Random randomizer;
|
||||
String worldName;
|
||||
|
||||
boolean isPlayingGame = false;
|
||||
|
||||
@ -34,12 +33,34 @@ public class DeathSwapGame {
|
||||
|
||||
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()
|
||||
{
|
||||
randomizer = new Random(System.currentTimeMillis());
|
||||
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);
|
||||
}
|
||||
@ -132,26 +153,12 @@ public class DeathSwapGame {
|
||||
|
||||
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());
|
||||
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++)
|
||||
|
Loading…
Reference in New Issue
Block a user