Added test

This commit is contained in:
Butzlabben 2019-06-14 12:33:44 +02:00
parent 41b5ed6bc2
commit e117fda5e8
3 changed files with 47 additions and 20 deletions

15
pom.xml
View File

@ -40,6 +40,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
@ -48,6 +49,7 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
@ -61,6 +63,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>3.0.0-M3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

View File

@ -18,27 +18,24 @@ public class AsyncCreatorAdapter implements CreatorAdapter {
// Create worlds async to close #16
@Override
public void create(WorldCreator creator, SystemWorld sw, Runnable r) {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
AsyncWorld world;
if (Bukkit.getWorld(creator.name()) == null)
world = AsyncWorld.create(creator);
else
world = AsyncWorld.wrap(Objects.requireNonNull(Bukkit.getWorld(creator.name())));
TaskManager.IMP.async(() -> {
AsyncWorld world;
if (Bukkit.getWorld(creator.name()) == null)
world = AsyncWorld.create(creator);
else
world = AsyncWorld.wrap(Objects.requireNonNull(Bukkit.getWorld(creator.name())));
Block block = world.getBlockAt(0, 0, 0);
block.setType(Material.BEDROCK);
// When you are done
world.commit();
Bukkit.getWorlds().add(world);
if (sw != null)
sw.setCreating(false);
// Send the message
r.run();
}
Block block = world.getBlockAt(0, 0, 0);
block.setType(Material.BEDROCK);
// When you are done
world.commit();
Bukkit.getWorlds().add(world);
if (sw != null)
sw.setCreating(false);
// Send the message
r.run();
});
}

View File

@ -0,0 +1,15 @@
package de.butzlabben.world.wrapper;
import org.bukkit.WorldCreator;
import org.junit.Test;
import static org.junit.Assert.*;
public class GeneratorSettingsTest {
@Test
public void asWorldCreator() {
GeneratorSettings settings = new GeneratorSettings();
WorldCreator creator = settings.asWorldCreator("test");
}
}