-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from TheNextLvl-net/2.0.0
2.0.0
- Loading branch information
Showing
98 changed files
with
2,591 additions
and
1,842 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
13 changes: 13 additions & 0 deletions
13
api/src/main/java/net/thenextlvl/worlds/api/WorldsProvider.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 net.thenextlvl.worlds.api; | ||
|
||
import net.thenextlvl.worlds.api.link.LinkController; | ||
import net.thenextlvl.worlds.api.view.GeneratorView; | ||
import net.thenextlvl.worlds.api.view.LevelView; | ||
|
||
public interface WorldsProvider { | ||
GeneratorView generatorView(); | ||
|
||
LevelView levelView(); | ||
|
||
LinkController linkController(); | ||
} |
19 changes: 19 additions & 0 deletions
19
api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.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,19 @@ | ||
package net.thenextlvl.worlds.api.event; | ||
|
||
import lombok.Getter; | ||
import org.bukkit.World; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.event.world.WorldEvent; | ||
|
||
public class WorldDeleteEvent extends WorldEvent { | ||
private static final @Getter HandlerList handlerList = new HandlerList(); | ||
|
||
public WorldDeleteEvent(World world) { | ||
super(world, false); | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
api/src/main/java/net/thenextlvl/worlds/api/event/WorldRegenerateEvent.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,9 @@ | ||
package net.thenextlvl.worlds.api.event; | ||
|
||
import org.bukkit.World; | ||
|
||
public class WorldRegenerateEvent extends WorldDeleteEvent { | ||
public WorldRegenerateEvent(World world) { | ||
super(world); | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
api/src/main/java/net/thenextlvl/worlds/api/link/LinkController.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,21 @@ | ||
package net.thenextlvl.worlds.api.link; | ||
|
||
import org.bukkit.NamespacedKey; | ||
import org.bukkit.PortalType; | ||
import org.bukkit.World; | ||
|
||
import java.util.Optional; | ||
|
||
public interface LinkController { | ||
Optional<NamespacedKey> getTarget(World world, PortalType type); | ||
|
||
Optional<NamespacedKey> getTarget(World world, Relative relative); | ||
|
||
Optional<NamespacedKey> getTarget(World world, World.Environment type); | ||
|
||
boolean canLink(World source, World destination); | ||
|
||
boolean link(World source, World destination); | ||
|
||
boolean unlink(World source, Relative relative); | ||
} |
38 changes: 38 additions & 0 deletions
38
api/src/main/java/net/thenextlvl/worlds/api/link/Relative.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 net.thenextlvl.worlds.api.link; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.experimental.Accessors; | ||
import net.kyori.adventure.key.Key; | ||
import net.kyori.adventure.key.Keyed; | ||
import org.bukkit.NamespacedKey; | ||
import org.bukkit.World; | ||
|
||
import java.util.Arrays; | ||
import java.util.Optional; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
@Accessors(fluent = true) | ||
public enum Relative implements Keyed { | ||
OVERWORLD(new NamespacedKey("relative", "overworld")), | ||
NETHER(new NamespacedKey("relative", "nether")), | ||
THE_END(new NamespacedKey("relative", "the_end")); | ||
|
||
private final NamespacedKey key; | ||
|
||
public static Optional<Relative> valueOf(Key key) { | ||
return Arrays.stream(values()) | ||
.filter(value -> value.key().equals(key)) | ||
.findAny(); | ||
} | ||
|
||
public static Optional<Relative> valueOf(World.Environment environment) { | ||
return Optional.ofNullable(switch (environment) { | ||
case NORMAL -> Relative.OVERWORLD; | ||
case NETHER -> Relative.NETHER; | ||
case THE_END -> Relative.THE_END; | ||
default -> null; | ||
}); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
api/src/main/java/net/thenextlvl/worlds/api/model/LevelExtras.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,10 @@ | ||
package net.thenextlvl.worlds.api.model; | ||
|
||
import org.bukkit.NamespacedKey; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public record LevelExtras( | ||
@Nullable NamespacedKey key, | ||
boolean enabled | ||
) { | ||
} |
14 changes: 14 additions & 0 deletions
14
api/src/main/java/net/thenextlvl/worlds/api/model/WorldPreset.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,14 @@ | ||
package net.thenextlvl.worlds.api.model; | ||
|
||
import net.kyori.adventure.key.Key; | ||
import net.kyori.adventure.key.Keyed; | ||
|
||
public record WorldPreset(Key key) implements Keyed { | ||
public static final WorldPreset AMPLIFIED = new WorldPreset(Key.key("minecraft", "amplified")); | ||
public static final WorldPreset CHECKERBOARD = new WorldPreset(Key.key("minecraft", "checkerboard")); | ||
public static final WorldPreset DEBUG = new WorldPreset(Key.key("minecraft", "debug")); | ||
public static final WorldPreset FLAT = new WorldPreset(Key.key("minecraft", "flat")); | ||
public static final WorldPreset LARGE_BIOMES = new WorldPreset(Key.key("minecraft", "large_biomes")); | ||
public static final WorldPreset NORMAL = new WorldPreset(Key.key("minecraft", "noise")); | ||
public static final WorldPreset SINGLE_BIOME = new WorldPreset(Key.key("minecraft", "fixed")); | ||
} |
10 changes: 10 additions & 0 deletions
10
api/src/main/java/net/thenextlvl/worlds/api/model/package-info.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,10 @@ | ||
@TypesAreNotNullByDefault | ||
@FieldsAreNotNullByDefault | ||
@ParametersAreNotNullByDefault | ||
@MethodsReturnNotNullByDefault | ||
package net.thenextlvl.worlds.api.model; | ||
|
||
import core.annotation.FieldsAreNotNullByDefault; | ||
import core.annotation.MethodsReturnNotNullByDefault; | ||
import core.annotation.ParametersAreNotNullByDefault; | ||
import core.annotation.TypesAreNotNullByDefault; |
9 changes: 4 additions & 5 deletions
9
...a/net/thenextlvl/worlds/preset/Biome.java → ...t/thenextlvl/worlds/api/preset/Biome.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
14 changes: 14 additions & 0 deletions
14
api/src/main/java/net/thenextlvl/worlds/api/preset/Layer.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,14 @@ | ||
package net.thenextlvl.worlds.api.preset; | ||
|
||
import org.bukkit.Material; | ||
|
||
public record Layer(String block, int height) { | ||
Layer(Material material, int height) { | ||
this(material.key().asString(), height); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return height() != 1 ? height() + "*" + block() : block(); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
.../thenextlvl/worlds/preset/PresetFile.java → ...nextlvl/worlds/api/preset/PresetFile.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
2 changes: 1 addition & 1 deletion
2
...net/thenextlvl/worlds/preset/Presets.java → ...thenextlvl/worlds/api/preset/Presets.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package net.thenextlvl.worlds.preset; | ||
package net.thenextlvl.worlds.api.preset; | ||
|
||
import org.bukkit.Material; | ||
|
||
|
16 changes: 16 additions & 0 deletions
16
api/src/main/java/net/thenextlvl/worlds/api/preset/Structure.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,16 @@ | ||
package net.thenextlvl.worlds.api.preset; | ||
|
||
public record Structure(String structure) { | ||
Structure(org.bukkit.generator.structure.Structure structure) { | ||
this(structure.key().asString()); | ||
} | ||
|
||
public static Structure minecraft(String structure) { | ||
return new Structure("minecraft:" + structure); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return structure(); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...rlds/preset/adapter/BiomeTypeAdapter.java → .../api/preset/adapter/BiomeTypeAdapter.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
6 changes: 3 additions & 3 deletions
6
.../preset/adapter/StructureTypeAdapter.java → .../preset/adapter/StructureTypeAdapter.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
10 changes: 10 additions & 0 deletions
10
api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/package-info.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,10 @@ | ||
@TypesAreNotNullByDefault | ||
@FieldsAreNotNullByDefault | ||
@ParametersAreNotNullByDefault | ||
@MethodsReturnNotNullByDefault | ||
package net.thenextlvl.worlds.api.preset.adapter; | ||
|
||
import core.annotation.FieldsAreNotNullByDefault; | ||
import core.annotation.MethodsReturnNotNullByDefault; | ||
import core.annotation.ParametersAreNotNullByDefault; | ||
import core.annotation.TypesAreNotNullByDefault; |
10 changes: 10 additions & 0 deletions
10
api/src/main/java/net/thenextlvl/worlds/api/preset/package-info.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,10 @@ | ||
@TypesAreNotNullByDefault | ||
@FieldsAreNotNullByDefault | ||
@ParametersAreNotNullByDefault | ||
@MethodsReturnNotNullByDefault | ||
package net.thenextlvl.worlds.api.preset; | ||
|
||
import core.annotation.FieldsAreNotNullByDefault; | ||
import core.annotation.MethodsReturnNotNullByDefault; | ||
import core.annotation.ParametersAreNotNullByDefault; | ||
import core.annotation.TypesAreNotNullByDefault; |
11 changes: 11 additions & 0 deletions
11
api/src/main/java/net/thenextlvl/worlds/api/view/GeneratorView.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 net.thenextlvl.worlds.api.view; | ||
|
||
import org.bukkit.plugin.Plugin; | ||
|
||
public interface GeneratorView { | ||
boolean hasGenerator(Plugin plugin); | ||
|
||
boolean hasChunkGenerator(Class<? extends Plugin> clazz); | ||
|
||
boolean hasBiomeProvider(Class<? extends Plugin> clazz); | ||
} |
Oops, something went wrong.