-
Notifications
You must be signed in to change notification settings - Fork 59
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
3458d13
commit 5d5566c
Showing
97 changed files
with
844 additions
and
355 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
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
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
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ biomes: | |
|
||
claim-on-create: | ||
(type): int | ||
(min): -1 | ||
(max): 100 | ||
starter-free: int | ||
confirmation: str | ||
|
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
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
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,6 +1,4 @@ | ||
plugins { | ||
java | ||
kotlin | ||
commons | ||
spigot | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
platform/bukkit/src/main/java/org/kingdoms/platform/bukkit/core/BukkitServer.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,18 @@ | ||
package org.kingdoms.platform.bukkit.core; | ||
|
||
import org.kingdoms.platform.bukkit.events.BukkitEventHandler; | ||
import org.kingdoms.server.core.Server; | ||
import org.kingdoms.server.events.EventHandler; | ||
|
||
public class BukkitServer implements Server { | ||
private final EventHandler eventHandler; | ||
|
||
public BukkitServer() { | ||
this.eventHandler = new BukkitEventHandler(); | ||
} | ||
|
||
@Override | ||
public EventHandler getEventHandler() { | ||
return eventHandler; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
platform/bukkit/src/main/java/org/kingdoms/platform/bukkit/events/BukkitEventHandler.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,12 @@ | ||
package org.kingdoms.platform.bukkit.events; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.event.Event; | ||
import org.kingdoms.server.events.EventHandler; | ||
|
||
public final class BukkitEventHandler implements EventHandler { | ||
@Override | ||
public void callEvent(Object event) { | ||
Bukkit.getPluginManager().callEvent((Event) event); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,7 +3,6 @@ import org.kingdoms.main.KingdomsGradleCommons.relocateLibs | |
|
||
plugins { | ||
commons | ||
kotlin | ||
shadowed | ||
} | ||
|
||
|
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,25 @@ | ||
plugins { | ||
commons | ||
sublibs | ||
} | ||
|
||
group = "org.kingdoms.platform.geyser" | ||
version = "unspecified" | ||
|
||
repositories { | ||
// https://github.com/GeyserMC/Cumulus | ||
// https://wiki.geysermc.org/geyser/using-geyser-or-floodgate-as-a-dependency/ | ||
maven { | ||
name = "opencollab-snapshot" | ||
url = uri("https://repo.opencollab.dev/maven-snapshots/") | ||
} | ||
} | ||
|
||
dependencies { | ||
compileOnly(project(":shared")) | ||
|
||
// Idk this gives an error | ||
// compileOnly("org.geysermc.geyser:api:2.1.0-SNAPSHOT") | ||
// https://wiki.geysermc.org/floodgate/api/ | ||
compileOnly("org.geysermc.floodgate:api:2.2.0-SNAPSHOT") | ||
} |
11 changes: 11 additions & 0 deletions
11
platform/geyser/src/main/java/org/kingdoms/platform/geyser/core/FloodgateHandler.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,11 @@ | ||
package org.kingdoms.platform.geyser.core; | ||
|
||
import org.geysermc.floodgate.api.FloodgateApi; | ||
|
||
import java.util.UUID; | ||
|
||
public final class FloodgateHandler { | ||
public static boolean isFloodgatePlayer(UUID player) { | ||
return FloodgateApi.getInstance().isFloodgatePlayer(player); | ||
} | ||
} |
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,33 @@ | ||
plugins { | ||
java | ||
kotlin | ||
sublibs | ||
} | ||
|
||
group = "org.kingdoms.utils.paper" | ||
description = "Used for defining unique optimization techniques from Paper." | ||
version = "1.0.0" | ||
|
||
repositories { | ||
maven { | ||
url = uri("https://repo.papermc.io/repository/maven-public/") | ||
} | ||
} | ||
|
||
dependencies { | ||
// https://papermc.io/using-the-api#gradle | ||
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT") | ||
} | ||
|
||
// Paper is compiled with the latest LTS, so we "trick" gradle into using the latest Java version, | ||
// but we compile with Java 8 | ||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(17)) | ||
} | ||
disableAutoTargetJvm() | ||
} | ||
tasks.compileJava { | ||
options.encoding = Charsets.UTF_8.name() | ||
options.release.set(8) | ||
} |
17 changes: 17 additions & 0 deletions
17
platform/paper/src/main/java/org/kingdoms/utils/paper/PaperLib.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,17 @@ | ||
package org.kingdoms.utils.paper; | ||
|
||
import org.kingdoms.utils.paper.asyncchunks.AsyncChunks; | ||
|
||
import java.util.function.Function; | ||
|
||
public final class PaperLib { | ||
private static AsyncChunks asyncChunks; | ||
|
||
public static void init(Function<Integer, Boolean> versionChecker) { | ||
asyncChunks = AsyncChunks.generateInstance(versionChecker); | ||
} | ||
|
||
public static AsyncChunks getAsyncChunks() { | ||
return asyncChunks; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
platform/paper/src/main/java/org/kingdoms/utils/paper/asyncchunks/AsyncChunks.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 org.kingdoms.utils.paper.asyncchunks; | ||
|
||
import org.bukkit.Chunk; | ||
import org.bukkit.World; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.Function; | ||
|
||
public abstract class AsyncChunks { | ||
public static AsyncChunks generateInstance(Function<Integer, Boolean> versionChecker) { | ||
if (versionChecker.apply(15)) { | ||
return new AsyncChunksPaper_15(); | ||
} else if (versionChecker.apply(13)) { | ||
return new AsyncChunksPaper_13(); | ||
} else if (versionChecker.apply(9) && !versionChecker.apply(13)) { | ||
return new AsyncChunksPaper_9_12(); | ||
} else { | ||
//noinspection StaticInitializerReferencesSubClass | ||
return new AsyncChunksSync(); | ||
} | ||
} | ||
|
||
public final CompletableFuture<Chunk> getChunkAtAsync(World world, int x, int z) { | ||
return getChunkAtAsync(world, x, z, true, false); | ||
} | ||
|
||
public final CompletableFuture<Chunk> getChunkAtAsync(World world, int x, int z, boolean generate) { | ||
return getChunkAtAsync(world, x, z, generate, false); | ||
} | ||
|
||
public abstract CompletableFuture<Chunk> getChunkAtAsync(World world, int x, int z, boolean generate, boolean isUrgent); | ||
} |
13 changes: 13 additions & 0 deletions
13
platform/paper/src/main/java/org/kingdoms/utils/paper/asyncchunks/AsyncChunksPaper_13.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,13 @@ | ||
package org.kingdoms.utils.paper.asyncchunks; | ||
|
||
import org.bukkit.Chunk; | ||
import org.bukkit.World; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
final class AsyncChunksPaper_13 extends AsyncChunks { | ||
@Override | ||
public CompletableFuture<Chunk> getChunkAtAsync(World world, int x, int z, boolean gen, boolean isUrgent) { | ||
return world.getChunkAtAsync(x, z, gen); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
platform/paper/src/main/java/org/kingdoms/utils/paper/asyncchunks/AsyncChunksPaper_15.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,13 @@ | ||
package org.kingdoms.utils.paper.asyncchunks; | ||
|
||
import org.bukkit.Chunk; | ||
import org.bukkit.World; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
final class AsyncChunksPaper_15 extends AsyncChunks { | ||
@Override | ||
public CompletableFuture<Chunk> getChunkAtAsync(World world, int x, int z, boolean gen, boolean isUrgent) { | ||
return world.getChunkAtAsync(x, z, gen, isUrgent); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
platform/paper/src/main/java/org/kingdoms/utils/paper/asyncchunks/AsyncChunksPaper_9_12.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,38 @@ | ||
package org.kingdoms.utils.paper.asyncchunks; | ||
|
||
import org.bukkit.Chunk; | ||
import org.bukkit.World; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
/** | ||
* Async Chunk Loading for Paper version 1.9 to 1.12 | ||
*/ | ||
final class AsyncChunksPaper_9_12 extends AsyncChunks { | ||
private static final boolean SUPPORTS_IS_CHUNK_GENERATED; | ||
|
||
static { | ||
boolean isChunkGenerated = false; | ||
|
||
try { | ||
World.class.getMethod("isChunkGenerated", int.class, int.class); | ||
isChunkGenerated = true; | ||
} catch (NoSuchMethodException ignored) { | ||
} | ||
|
||
SUPPORTS_IS_CHUNK_GENERATED = isChunkGenerated; | ||
} | ||
|
||
@SuppressWarnings("deprecation") | ||
@Override | ||
public CompletableFuture<Chunk> getChunkAtAsync(World world, int x, int z, boolean gen, boolean isUrgent) { | ||
CompletableFuture<Chunk> future = new CompletableFuture<>(); | ||
if (!gen && SUPPORTS_IS_CHUNK_GENERATED && !world.isChunkGenerated(x, z)) { | ||
future.complete(null); | ||
} else { | ||
World.ChunkLoadCallback chunkLoadCallback = future::complete; | ||
world.getChunkAtAsync(x, z, chunkLoadCallback); | ||
} | ||
return future; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
platform/paper/src/main/java/org/kingdoms/utils/paper/asyncchunks/AsyncChunksSync.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,13 @@ | ||
package org.kingdoms.utils.paper.asyncchunks; | ||
|
||
import org.bukkit.Chunk; | ||
import org.bukkit.World; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
final class AsyncChunksSync extends AsyncChunks { | ||
@Override | ||
public CompletableFuture<Chunk> getChunkAtAsync(World world, int x, int z, boolean gen, boolean isUrgent) { | ||
return CompletableFuture.completedFuture(world.getChunkAt(x, z)); | ||
} | ||
} |
Oops, something went wrong.