-
Notifications
You must be signed in to change notification settings - Fork 6
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
5a02f30
commit 0f5dbac
Showing
7 changed files
with
102 additions
and
45 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pluginGroup=io.github.m0pt0pmatt.survivalgames | ||
pluginId=survivalgames | ||
pluginVersion=1.1.3 | ||
pluginVersion=1.1.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
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
32 changes: 32 additions & 0 deletions
32
src/main/java/io/github/m0pt0pmatt/survivalgames/task/ClearEntitiesTask.java
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,32 @@ | ||
package io.github.m0pt0pmatt.survivalgames.task; | ||
|
||
import io.github.m0pt0pmatt.survivalgames.command.CommandKeys; | ||
import io.github.m0pt0pmatt.survivalgames.game.SurvivalGame; | ||
import org.spongepowered.api.Sponge; | ||
import org.spongepowered.api.entity.Entity; | ||
import org.spongepowered.api.util.TextMessageException; | ||
import org.spongepowered.api.world.World; | ||
|
||
import static io.github.m0pt0pmatt.survivalgames.Util.getOrThrow; | ||
|
||
public class ClearEntitiesTask implements Task { | ||
|
||
private static ClearEntitiesTask INSTANCE = new ClearEntitiesTask(); | ||
|
||
private ClearEntitiesTask() { | ||
|
||
} | ||
|
||
@Override | ||
public void execute(SurvivalGame survivalGame) throws TextMessageException { | ||
String worldName = | ||
getOrThrow(survivalGame.getConfig().getWorldName(), CommandKeys.WORLD_NAME); | ||
World world = getOrThrow(Sponge.getServer().getWorld(worldName), CommandKeys.WORLD_NAME); | ||
|
||
world.getEntities().forEach(Entity::remove); | ||
} | ||
|
||
public static ClearEntitiesTask getInstance() { | ||
return INSTANCE; | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
src/main/java/io/github/m0pt0pmatt/survivalgames/task/LoadChunksTask.java
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,41 @@ | ||
package io.github.m0pt0pmatt.survivalgames.task; | ||
|
||
import io.github.m0pt0pmatt.survivalgames.command.CommandKeys; | ||
import io.github.m0pt0pmatt.survivalgames.game.SurvivalGame; | ||
import org.spongepowered.api.Sponge; | ||
import org.spongepowered.api.util.TextMessageException; | ||
import org.spongepowered.api.world.World; | ||
|
||
import static io.github.m0pt0pmatt.survivalgames.Util.getOrThrow; | ||
|
||
public class LoadChunksTask implements Task { | ||
|
||
private static LoadChunksTask INSTANCE = new LoadChunksTask(); | ||
|
||
private LoadChunksTask() { | ||
|
||
} | ||
|
||
@Override | ||
public void execute(SurvivalGame survivalGame) throws TextMessageException { | ||
|
||
String worldName = | ||
getOrThrow(survivalGame.getConfig().getWorldName(), CommandKeys.WORLD_NAME); | ||
World world = getOrThrow(Sponge.getServer().getWorld(worldName), CommandKeys.WORLD_NAME); | ||
|
||
// Force chunks to be loaded | ||
int minX = world.getLocation(survivalGame.getConfig().getBlockArea().getLesserBoundary().get()).getChunkPosition().getX(); | ||
int maxX = world.getLocation(survivalGame.getConfig().getBlockArea().getGreaterBoundary().get()).getChunkPosition().getX(); | ||
int minZ = world.getLocation(survivalGame.getConfig().getBlockArea().getLesserBoundary().get()).getChunkPosition().getZ(); | ||
int maxZ = world.getLocation(survivalGame.getConfig().getBlockArea().getGreaterBoundary().get()).getChunkPosition().getZ(); | ||
for (; minX <= maxX; minX++) { | ||
for (int z = minZ; z <= maxZ; z++) { | ||
world.loadChunk(minX, 0, z, false); | ||
} | ||
} | ||
} | ||
|
||
public static LoadChunksTask getInstance() { | ||
return INSTANCE; | ||
} | ||
} |
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