defaults = Arrays.asList(
60 | "yes", "true", "generate_structures", "Structures",
61 | "no", "false", "no_structures"
62 | );
63 | if (input.isBlank()) {
64 | return defaults;
65 | }
66 | return defaults.stream()
67 | .filter(x -> x.startsWith(input))
68 | .sorted(Comparator.reverseOrder())
69 | .toList();
70 | }
71 |
72 | @Override
73 | public boolean isContextFree() {
74 | return true;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/configuration/FileConfigurationObject.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.configuration;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.spongepowered.configurate.objectmapping.ConfigSerializable;
22 | import org.spongepowered.configurate.objectmapping.meta.Comment;
23 | import org.spongepowered.configurate.objectmapping.meta.Setting;
24 |
25 | /**
26 | * Data holder class that is instantiated in
27 | * {@link FileHyperConfiguration}
28 | */
29 | @ConfigSerializable
30 | public final class FileConfigurationObject {
31 |
32 | @Setting(value = "import-automatically")
33 | @Comment(value = "Whether or not worlds should be automatically imported into Hyperverse on load")
34 | private boolean importAutomatically = true;
35 | @Setting(value = "persist-locations")
36 | @Comment(value = "Whether or not player locations should be saved to the database,"
37 | + " and be used when a player teleports between worlds")
38 | private boolean persistLocations = true;
39 | @Setting(value = "keep-loaded")
40 | @Comment(value = "Whether or not world spawn chunks should be kept in memory")
41 | private boolean keepSpawnLoaded = true;
42 | @Setting(value = "grouped-inventories")
43 | @Comment(value = "Whether or player profile groups are enabled")
44 | private boolean groupedProfiles = false;
45 | @Setting(value = "language-code")
46 | @Comment(value = "Language code used to resolve translations. Currently supported: en, sv, de, cn")
47 | private String languageCode = "en";
48 | @Setting(value = "safe-teleport")
49 | @Comment(value = "Whether or not safe teleportation should be enforced")
50 | private boolean safeTeleport = true;
51 | @Setting(value = "hook-essentials")
52 | @Comment(value = "Whether or not Hyperverse should attempt to utilize Essentials' specific features.")
53 | private boolean hookEssentials = true;
54 | @Setting(value = "debug")
55 | @Comment(value = "Whether or not Hyperverse should print verbose debugging messages")
56 | private boolean debug = false;
57 |
58 | boolean isImportAutomatically() {
59 | return this.importAutomatically;
60 | }
61 |
62 | boolean isPersistLocations() {
63 | return this.persistLocations;
64 | }
65 |
66 | boolean isKeepSpawnLoaded() {
67 | return this.keepSpawnLoaded;
68 | }
69 |
70 | boolean useGroupedProfiles() {
71 | return this.groupedProfiles;
72 | }
73 |
74 | @NonNull String getLanguageCode() {
75 | return this.languageCode;
76 | }
77 |
78 | boolean shouldSafeTeleport() {
79 | return this.safeTeleport;
80 | }
81 |
82 | boolean shouldHookEssentials() {
83 | return this.hookEssentials;
84 | }
85 |
86 | boolean shouldPrintDebug() {
87 | return this.debug;
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/configuration/HyperConfiguration.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.configuration;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 |
22 | /**
23 | * Hyperverse configuration options
24 | */
25 | public interface HyperConfiguration {
26 |
27 | /**
28 | * Whether or not Hyperverse should
29 | * import detected worlds automatically
30 | *
31 | * @return True if worlds should be imported
32 | * automatically
33 | */
34 | boolean shouldImportAutomatically();
35 |
36 | /**
37 | * Whether or not Hyperverse's location
38 | * persistence system should be enabled
39 | *
40 | * @return True if locations should persist
41 | */
42 | boolean shouldPersistLocations();
43 |
44 | /**
45 | * Whether or not Hyperverse should keep
46 | * spawn chunks loaded
47 | *
48 | * @return True if spawn chunks should be kept
49 | * loaded
50 | */
51 | boolean shouldKeepSpawnLoaded();
52 |
53 | /**
54 | * Whether or not Hyperverse should load
55 | * and store player profiles for specific
56 | * world groups
57 | *
58 | * @return True if the player profile group
59 | * system should be enabled
60 | */
61 | boolean shouldGroupProfiles();
62 |
63 | /**
64 | * Get the language code that will be used
65 | * to resolve translations
66 | *
67 | * @return Language code
68 | */
69 | @NonNull String getLanguageCode();
70 |
71 | /**
72 | * Whether or not Hyperverse should enforce
73 | * safe teleportation
74 | *
75 | * @return True if Hyperverse should enforce
76 | * safe teleportation
77 | */
78 | boolean shouldSafeTeleport();
79 |
80 | /**
81 | * Whether or not Hyperverse should hook into
82 | * and attempt to utilize features present in Essentials.
83 | *
84 | * @return True if Hyperverse should hook into Essentials.
85 | */
86 | boolean shouldHookEssentials();
87 |
88 | /**
89 | * Whether or not Hyperverse should print
90 | * verbose debugging messages
91 | *
92 | * @return True if Hyperverse should print verbose debugging messages
93 | */
94 | boolean shouldPrintDebug();
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/configuration/Message.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.configuration;
19 |
20 | import co.aikar.locales.MessageKey;
21 | import co.aikar.locales.MessageKeyProvider;
22 | import org.checkerframework.checker.nullness.qual.NonNull;
23 |
24 | import java.util.Objects;
25 |
26 | /**
27 | * Configurable messages
28 | */
29 | public final class Message implements MessageKeyProvider {
30 |
31 | private final MessageKey messageKey;
32 | private final String key;
33 | private final String defaultValue;
34 |
35 | /**
36 | * Construct a new message
37 | *
38 | * @param key The message key, used as a path in the configuration file
39 | * @param defaultValue The default message
40 | */
41 | public Message(
42 | final @NonNull String key,
43 | final @NonNull String defaultValue
44 | ) {
45 | this.key = Objects.requireNonNull(key);
46 | this.defaultValue = Objects.requireNonNull(defaultValue);
47 | this.messageKey = MessageKey.of(key);
48 | }
49 |
50 | /**
51 | * Get the configuration key
52 | *
53 | * @return Configuration key
54 | */
55 | public @NonNull String getKey() {
56 | return this.key;
57 | }
58 |
59 | /**
60 | * Get the default message
61 | *
62 | * @return Default message
63 | */
64 | public @NonNull String getDefaultValue() {
65 | return this.defaultValue;
66 | }
67 |
68 | @Override
69 | public @NonNull String toString() {
70 | return Messages.getConfigured(this);
71 | }
72 |
73 | public @NonNull String withoutColorCodes() {
74 | return this.toString().replaceAll("&[A-Za-z0-9]", "");
75 | }
76 |
77 | @Override
78 | public @NonNull MessageKey getMessageKey() {
79 | return this.messageKey;
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/configuration/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Configuration utilities and types
20 | */
21 | package org.incendo.hyperverse.configuration;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/database/LocationType.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.database;
19 |
20 | public enum LocationType {
21 | PLAYER_LOCATION,
22 | BED_SPAWN
23 | }
24 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/database/PersistentLocation.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.database;
19 |
20 | import org.bukkit.Location;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 |
23 | import java.util.Objects;
24 | import java.util.UUID;
25 |
26 | public final class PersistentLocation {
27 |
28 | private final String uuid;
29 | private final String world;
30 | private final double x;
31 | private final double y;
32 | private final double z;
33 | private final LocationType locationType;
34 |
35 | public PersistentLocation(
36 | final @NonNull String uuid,
37 | final @NonNull String world,
38 | final double x,
39 | final double y,
40 | final double z,
41 | final @NonNull LocationType locationType
42 | ) {
43 | this.uuid = Objects.requireNonNull(uuid);
44 | this.world = Objects.requireNonNull(world);
45 | this.locationType = Objects.requireNonNull(locationType);
46 | this.x = x;
47 | this.y = y;
48 | this.z = z;
49 | }
50 |
51 | public static @NonNull PersistentLocation fromLocation(
52 | final @NonNull UUID owner,
53 | final @NonNull Location location,
54 | final @NonNull LocationType locationType
55 | ) {
56 | return new PersistentLocation(owner.toString(), Objects.requireNonNull(location.getWorld()).getName(),
57 | location.getX(), location.getY(), location.getZ(), locationType
58 | );
59 | }
60 |
61 | public @NonNull String getUuid() {
62 | return this.uuid;
63 | }
64 |
65 | public @NonNull String getWorld() {
66 | return this.world;
67 | }
68 |
69 | public double getX() {
70 | return this.x;
71 | }
72 |
73 | public double getY() {
74 | return this.y;
75 | }
76 |
77 | public double getZ() {
78 | return this.z;
79 | }
80 |
81 | public @NonNull LocationType getLocationType() {
82 | return this.locationType;
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/database/SimpleLocationTransformer.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.database;
19 |
20 | import com.google.inject.Inject;
21 | import com.google.inject.Singleton;
22 | import org.bukkit.Location;
23 | import org.bukkit.Server;
24 | import org.checkerframework.checker.nullness.qual.NonNull;
25 | import org.incendo.hyperverse.modules.PersistentLocationTransformer;
26 |
27 | @Singleton
28 | public final class SimpleLocationTransformer implements PersistentLocationTransformer {
29 |
30 | private final Server server;
31 |
32 | @Inject
33 | SimpleLocationTransformer(final @NonNull Server server) {
34 | this.server = server;
35 | }
36 |
37 | @Override
38 | public @NonNull Location transform(final @NonNull PersistentLocation persistent) {
39 | return new Location(this.server.getWorld(persistent.getWorld()), persistent.getX(), persistent.getY(), persistent.getZ());
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/HyperPlayerEvent.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import org.bukkit.entity.Player;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 | import org.incendo.hyperverse.world.HyperWorld;
23 |
24 | import java.util.Objects;
25 |
26 | /**
27 | * Events involving {@link org.bukkit.entity.Player} inside of a
28 | * {@link org.incendo.hyperverse.world.HyperWorld}
29 | * {@inheritDoc}
30 | */
31 | public abstract class HyperPlayerEvent extends HyperWorldEvent {
32 |
33 | private final Player player;
34 |
35 | public HyperPlayerEvent(
36 | final @NonNull Player player,
37 | final @NonNull HyperWorld hyperWorld
38 | ) {
39 | super(hyperWorld);
40 | this.player = Objects.requireNonNull(player, "player");
41 | }
42 |
43 | /**
44 | * Get the player involved in the event
45 | *
46 | * @return Player involved in the event
47 | */
48 | public final @NonNull Player getPlayer() {
49 | return this.player;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/HyperWorldCreateEvent.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import com.google.inject.assistedinject.Assisted;
21 | import org.bukkit.event.HandlerList;
22 | import org.checkerframework.checker.nullness.qual.NonNull;
23 | import org.incendo.hyperverse.world.HyperWorld;
24 |
25 | /**
26 | * Called when a new {@link org.incendo.hyperverse.world.HyperWorld} has been created
27 | * {@inheritDoc}
28 | */
29 | public final class HyperWorldCreateEvent extends HyperWorldEvent {
30 |
31 | private static final HandlerList handlers = new HandlerList();
32 |
33 | HyperWorldCreateEvent(final @Assisted @NonNull HyperWorld world) {
34 | super(world);
35 | }
36 |
37 | @SuppressWarnings("unused")
38 | public static HandlerList getHandlerList() {
39 | return handlers;
40 | }
41 |
42 | @Override
43 | public @NonNull HandlerList getHandlers() {
44 | return handlers;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/HyperWorldDeleteEvent.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import org.bukkit.event.HandlerList;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 | import org.incendo.hyperverse.world.HyperWorld;
23 |
24 | /**
25 | * Called when a {@link org.incendo.hyperverse.world.HyperWorld} has been deleted
26 | * {@inheritDoc}
27 | */
28 | public final class HyperWorldDeleteEvent extends HyperWorldEvent {
29 |
30 | private static final HandlerList handlers = new HandlerList();
31 |
32 | HyperWorldDeleteEvent(final @NonNull HyperWorld world) {
33 | super(world);
34 | }
35 |
36 | @SuppressWarnings("unused")
37 | public static HandlerList getHandlerList() {
38 | return handlers;
39 | }
40 |
41 | @Override
42 | public @NonNull HandlerList getHandlers() {
43 | return handlers;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/HyperWorldEvent.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.world.HyperWorld;
22 |
23 | import java.util.Objects;
24 |
25 | /**
26 | * Events involving {@link org.incendo.hyperverse.world.HyperWorld hyper worlds}
27 | */
28 | public abstract class HyperWorldEvent extends HyperverseEvent {
29 |
30 | private final HyperWorld world;
31 |
32 | public HyperWorldEvent(final @NonNull HyperWorld world) {
33 | this.world = Objects.requireNonNull(world, "world");
34 | }
35 |
36 | /**
37 | * Get the world involved in this event
38 | *
39 | * @return Event world
40 | */
41 | public final @NonNull HyperWorld getWorld() {
42 | return this.world;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/HyperverseEvent.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import org.bukkit.event.Event;
21 |
22 | /**
23 | * Just a generic Hyperverse event class
24 | */
25 | public abstract class HyperverseEvent extends Event {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/PlayerSeekSpawnEvent.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import org.bukkit.Location;
21 | import org.bukkit.entity.Player;
22 | import org.bukkit.event.Cancellable;
23 | import org.bukkit.event.HandlerList;
24 | import org.checkerframework.checker.nullness.qual.NonNull;
25 | import org.incendo.hyperverse.world.HyperWorld;
26 |
27 | import java.util.Objects;
28 |
29 | /**
30 | * Called when a {@link org.bukkit.entity.Player} is supposed to re-spawn in a
31 | * {@link org.incendo.hyperverse.world.HyperWorld}, this is used to determine
32 | * their re-spawn location.
33 | *
34 | * Cancelling this event means that Hyperverse ignores the event entirely,
35 | * and lets vanilla/other Bukkit plugins handle it
36 | * {@inheritDoc}
37 | */
38 | public final class PlayerSeekSpawnEvent extends HyperPlayerEvent implements Cancellable {
39 |
40 | private static final HandlerList handlers = new HandlerList();
41 |
42 | private boolean cancelled;
43 | private Location respawnLocation;
44 |
45 | PlayerSeekSpawnEvent(
46 | final @NonNull Player player,
47 | final @NonNull HyperWorld world,
48 | final @NonNull Location respawnLocation
49 | ) {
50 | super(player, world);
51 | this.cancelled = false;
52 | this.respawnLocation = Objects.requireNonNull(respawnLocation, "respawn location");
53 | }
54 |
55 | @SuppressWarnings("unused")
56 | public static HandlerList getHandlerList() {
57 | return handlers;
58 | }
59 |
60 | @Override
61 | public @NonNull HandlerList getHandlers() {
62 | return handlers;
63 | }
64 |
65 | @Override
66 | public boolean isCancelled() {
67 | return this.cancelled;
68 | }
69 |
70 | @Override
71 | public void setCancelled(final boolean cancelled) {
72 | this.cancelled = cancelled;
73 | }
74 |
75 | /**
76 | * Get the location where the player is supposed to re-spawn
77 | *
78 | * @return Re-spawn location
79 | */
80 | public @NonNull Location getRespawnLocation() {
81 | return this.respawnLocation;
82 | }
83 |
84 | /**
85 | * Set the location where the player is supposed to respawn
86 | *
87 | * @param respawnLocation Re-spawn location
88 | */
89 | public void setRespawnLocation(final @NonNull Location respawnLocation) {
90 | this.respawnLocation = Objects.requireNonNull(respawnLocation);
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/PlayerSetSpawnEvent.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import org.bukkit.entity.Player;
21 | import org.bukkit.event.Cancellable;
22 | import org.bukkit.event.HandlerList;
23 | import org.checkerframework.checker.nullness.qual.NonNull;
24 | import org.incendo.hyperverse.world.HyperWorld;
25 |
26 | /**
27 | * Called when a {@link org.bukkit.entity.Player} attempts to set their
28 | * spawn point using a bed in a {@link org.incendo.hyperverse.world.HyperWorld}.
29 | *
30 | * Cancelling this event will prevent Hyperverse from updating the spawn point.
31 | * This will not affect the vanilla spawn point, however. To do that, one would
32 | * need to interact with {@link org.bukkit.event.player.PlayerBedEnterEvent}
33 | */
34 | public final class PlayerSetSpawnEvent extends HyperPlayerEvent implements Cancellable {
35 |
36 | private static final HandlerList handlers = new HandlerList();
37 |
38 | private boolean cancelled;
39 |
40 | PlayerSetSpawnEvent(
41 | final @NonNull Player player,
42 | final @NonNull HyperWorld world
43 | ) {
44 | super(player, world);
45 | this.cancelled = false;
46 | }
47 |
48 | @SuppressWarnings("unused")
49 | public static HandlerList getHandlerList() {
50 | return handlers;
51 | }
52 |
53 | @Override
54 | public @NonNull HandlerList getHandlers() {
55 | return handlers;
56 | }
57 |
58 | @Override
59 | public boolean isCancelled() {
60 | return this.cancelled;
61 | }
62 |
63 | @Override
64 | public void setCancelled(final boolean cancelled) {
65 | this.cancelled = cancelled;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/events/SimpleHyperEventFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.events;
19 |
20 | import com.google.inject.Inject;
21 | import com.google.inject.Singleton;
22 | import org.bukkit.Location;
23 | import org.bukkit.entity.Player;
24 | import org.bukkit.event.Event;
25 | import org.bukkit.plugin.PluginManager;
26 | import org.checkerframework.checker.nullness.qual.NonNull;
27 | import org.incendo.hyperverse.modules.HyperEventFactory;
28 | import org.incendo.hyperverse.world.HyperWorld;
29 |
30 | @Singleton
31 | public final class SimpleHyperEventFactory implements HyperEventFactory {
32 |
33 | private final PluginManager pluginManager;
34 |
35 | @Inject
36 | SimpleHyperEventFactory(final @NonNull PluginManager pluginManager) {
37 | this.pluginManager = pluginManager;
38 | }
39 |
40 | @Override
41 | public void callWorldCreation(final @NonNull HyperWorld hyperWorld) {
42 | final Event event = new HyperWorldCreateEvent(hyperWorld);
43 | this.pluginManager.callEvent(event);
44 | }
45 |
46 | @Override
47 | public void callWorldDeletion(final @NonNull HyperWorld hyperWorld) {
48 | final Event event = new HyperWorldDeleteEvent(hyperWorld);
49 | this.pluginManager.callEvent(event);
50 | }
51 |
52 | @Override
53 | public @NonNull PlayerSeekSpawnEvent callPlayerSeekSpawn(
54 | final @NonNull Player player,
55 | final @NonNull HyperWorld world,
56 | final @NonNull Location respawnLocation
57 | ) {
58 | final PlayerSeekSpawnEvent playerSetSpawnEvent = new PlayerSeekSpawnEvent(player, world, respawnLocation);
59 | this.pluginManager.callEvent(playerSetSpawnEvent);
60 | return playerSetSpawnEvent;
61 | }
62 |
63 | @Override
64 | public @NonNull PlayerSetSpawnEvent callPlayerSetSpawn(final @NonNull Player player, final @NonNull HyperWorld world) {
65 | final PlayerSetSpawnEvent playerSetSpawnEvent = new PlayerSetSpawnEvent(player, world);
66 | this.pluginManager.callEvent(playerSetSpawnEvent);
67 | return playerSetSpawnEvent;
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/exception/HyperException.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.exception;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.world.HyperWorld;
22 |
23 | import java.util.Objects;
24 |
25 | /**
26 | * Exception related to a {@link HyperWorld}
27 | */
28 | public class HyperException extends Exception {
29 |
30 | private static final long serialVersionUID = 4059156250285134733L;
31 |
32 | private final HyperWorld world;
33 |
34 | public HyperException(
35 | final @NonNull HyperWorld world,
36 | final @NonNull String message
37 | ) {
38 | super(Objects.requireNonNull(message));
39 | this.world = Objects.requireNonNull(world);
40 | }
41 |
42 | /**
43 | * Get the world involved in the exception
44 | *
45 | * @return World
46 | */
47 | public final @NonNull HyperWorld getWorld() {
48 | return this.world;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/exception/HyperWorldCreationException.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.exception;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.world.HyperWorld;
22 | import org.incendo.hyperverse.world.HyperWorldCreator;
23 | import org.incendo.hyperverse.world.WorldConfiguration;
24 |
25 | /**
26 | * Exception thrown during the creation of a {@link HyperWorld},
27 | * if it for some reason cannot be created
28 | * {@inheritDoc}
29 | */
30 | public final class HyperWorldCreationException extends Exception {
31 |
32 | private static final long serialVersionUID = 7739603214208515388L;
33 |
34 | private final HyperWorldCreator.ValidationResult validationResult;
35 | private final WorldConfiguration configuration;
36 |
37 | public HyperWorldCreationException(
38 | final HyperWorldCreator.@NonNull ValidationResult validationResult,
39 | final @NonNull WorldConfiguration configuration
40 | ) {
41 | super(String.format("Failed to create world '%s' from configuration. Result: %s",
42 | configuration.getName(), validationResult.name()
43 | ));
44 | this.validationResult = validationResult;
45 | this.configuration = configuration;
46 | }
47 |
48 | public HyperWorldCreationException(
49 | final @NonNull Throwable cause,
50 | final @NonNull WorldConfiguration configuration
51 | ) {
52 | super(String.format(
53 | "Failed to create world '%s' from configuration for an unknown reason.",
54 | configuration.getName()
55 | ), cause);
56 | this.validationResult = HyperWorldCreator.ValidationResult.UNKNOWN_ERROR;
57 | this.configuration = configuration;
58 | }
59 |
60 | public HyperWorldCreator.@NonNull ValidationResult getValidationResult() {
61 | return this.validationResult;
62 | }
63 |
64 | public @NonNull WorldConfiguration getConfiguration() {
65 | return this.configuration;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/exception/HyperWorldValidationException.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.exception;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.world.HyperWorld;
22 | import org.incendo.hyperverse.world.HyperWorldCreator;
23 |
24 | /**
25 | * Exception thrown when the validation of a {@link HyperWorld} fails
26 | */
27 | public final class HyperWorldValidationException extends HyperException {
28 |
29 | private static final long serialVersionUID = 2460058219525178442L;
30 |
31 | private final HyperWorldCreator.ValidationResult validationResult;
32 |
33 | public HyperWorldValidationException(
34 | final HyperWorldCreator.@NonNull ValidationResult validationResult,
35 | final @NonNull HyperWorld world
36 | ) {
37 | super(world, String
38 | .format("Failed to validate world configuration for world %s. Result: %s",
39 | world.getConfiguration().getName(), validationResult.name()
40 | ));
41 | this.validationResult = validationResult;
42 | }
43 |
44 | public HyperWorldCreator.@NonNull ValidationResult getValidationResult() {
45 | return this.validationResult;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/exception/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Custom exceptions, mostly related to worlds
20 | */
21 | package org.incendo.hyperverse.exception;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/features/PluginFeature.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.features;
19 |
20 | /**
21 | * A third party plugin feature
22 | */
23 | public abstract class PluginFeature {
24 |
25 | /**
26 | * Initialize the feature
27 | */
28 | public abstract void initializeFeature();
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/features/external/EssentialsFeature.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.features.external;
19 |
20 | import com.earth2me.essentials.Essentials;
21 | import com.earth2me.essentials.IEssentials;
22 | import com.earth2me.essentials.utils.LocationUtil;
23 | import org.bukkit.Location;
24 | import org.bukkit.plugin.java.JavaPlugin;
25 | import org.checkerframework.checker.nullness.qual.NonNull;
26 | import org.checkerframework.checker.nullness.qual.Nullable;
27 | import org.incendo.hyperverse.Hyperverse;
28 | import org.incendo.hyperverse.features.PluginFeature;
29 | import org.incendo.hyperverse.service.internal.SafeTeleportService;
30 |
31 | import java.util.Collections;
32 |
33 | /**
34 | * Feature hooking into Essentials
35 | */
36 | public final class EssentialsFeature extends PluginFeature {
37 |
38 | @Override
39 | public void initializeFeature() {
40 | final Hyperverse hyperverse = JavaPlugin.getPlugin(Hyperverse.class);
41 | hyperverse.getLogger().info("Using Essentials to provide safe-teleportation lookup.");
42 | hyperverse.getServicePipeline().registerServiceImplementation(SafeTeleportService.class,
43 | new EssentialsSafeTeleportService(JavaPlugin.getPlugin(Essentials.class)), Collections.emptyList()
44 | );
45 | }
46 |
47 | private static class EssentialsSafeTeleportService implements SafeTeleportService {
48 |
49 | private final IEssentials essentials;
50 |
51 | public EssentialsSafeTeleportService(final @NonNull IEssentials essentials) {
52 | this.essentials = essentials;
53 | }
54 |
55 | @Override
56 | public @Nullable Location handle(final @NonNull Location location) {
57 | try {
58 | return LocationUtil.getSafeDestination(this.essentials, location);
59 | } catch (final Exception ignored) {
60 | }
61 | return null;
62 | }
63 |
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/features/external/HyperverseExpansion.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.features.external;
19 |
20 | import me.clip.placeholderapi.expansion.PlaceholderExpansion;
21 | import net.kyori.adventure.text.minimessage.MiniMessage;
22 | import org.bukkit.entity.Player;
23 | import org.bukkit.plugin.PluginDescriptionFile;
24 | import org.bukkit.plugin.java.JavaPlugin;
25 | import org.checkerframework.checker.nullness.qual.NonNull;
26 | import org.checkerframework.checker.nullness.qual.Nullable;
27 | import org.incendo.hyperverse.Hyperverse;
28 | import org.incendo.hyperverse.flags.implementation.DifficultyFlag;
29 | import org.incendo.hyperverse.flags.implementation.PveFlag;
30 | import org.incendo.hyperverse.flags.implementation.PvpFlag;
31 | import org.incendo.hyperverse.world.HyperWorld;
32 | import org.incendo.hyperverse.world.WorldConfiguration;
33 | import org.incendo.hyperverse.world.WorldManager;
34 |
35 | /**
36 | * PlaceholderAPI expansion
37 | */
38 | final class HyperverseExpansion extends PlaceholderExpansion {
39 |
40 | private final Hyperverse plugin;
41 |
42 | private final String author;
43 | private final String version;
44 |
45 | public HyperverseExpansion() {
46 | this.plugin = JavaPlugin.getPlugin(Hyperverse.class);
47 | final PluginDescriptionFile descriptionFile = this.plugin.getDescription();
48 | this.author = descriptionFile.getAuthors().toString();
49 | this.version = descriptionFile.getVersion();
50 | }
51 |
52 | @Override
53 | public @NonNull String getIdentifier() {
54 | return "hyperverse";
55 | }
56 |
57 | @Override
58 | public @NonNull String getAuthor() {
59 | return this.author;
60 | }
61 |
62 | @Override
63 | public @NonNull String getVersion() {
64 | return this.version;
65 | }
66 |
67 | @Override
68 | public boolean persist() {
69 | return true;
70 | }
71 |
72 | @Override
73 | public boolean canRegister() {
74 | return true;
75 | }
76 |
77 | @Override
78 | public @Nullable String onPlaceholderRequest(
79 | final @Nullable Player player,
80 | final @NonNull String identifier
81 | ) {
82 | if (player == null) {
83 | return "";
84 | }
85 |
86 | final WorldManager worldManager = this.plugin.getWorldManager();
87 |
88 | final HyperWorld hyperWorld = worldManager.getWorld(player.getWorld());
89 | if (hyperWorld == null) {
90 | return "";
91 | }
92 |
93 | final WorldConfiguration worldConfiguration = hyperWorld.getConfiguration();
94 |
95 | switch (identifier.toLowerCase()) {
96 | case "world_display_name":
97 | return MiniMessage.miniMessage().escapeTags(hyperWorld.getDisplayName());
98 | case "world_name":
99 | return worldConfiguration.getName();
100 | case "world_generator":
101 | return worldConfiguration.getGenerator();
102 | case "world_difficulty":
103 | return hyperWorld.getFlag(DifficultyFlag.class).name();
104 | case "world_pvp":
105 | return hyperWorld.getFlag(PvpFlag.class).toString();
106 | case "world_pve":
107 | return hyperWorld.getFlag(PveFlag.class).toString();
108 | default:
109 | return null;
110 | }
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/features/external/PlaceholderAPIFeature.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.features.external;
19 |
20 | import org.incendo.hyperverse.features.PluginFeature;
21 |
22 | /**
23 | * {@link PluginFeature} adding PlaceholderAPI support
24 | */
25 | public final class PlaceholderAPIFeature extends PluginFeature {
26 |
27 | @Override
28 | public void initializeFeature() {
29 | final HyperverseExpansion hyperverseExpansion = new HyperverseExpansion();
30 | hyperverseExpansion.register();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/FlagParseException.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags;
19 |
20 | import org.incendo.hyperverse.util.MessageUtil;
21 |
22 | public class FlagParseException extends Exception {
23 |
24 | private static final long serialVersionUID = 3442434713845764748L;
25 |
26 | private final WorldFlag, ?> flag;
27 | private final String value;
28 | private final String errorMessage;
29 |
30 | /**
31 | * Construct a new flag parse exception to indicate that an attempt to parse a world
32 | * flag was unsuccessful.
33 | *
34 | * @param flag Flag instance
35 | * @param value Value that failed ot parse
36 | * @param errorMessage An error message explaining the failure
37 | * @param args Arguments used to format the error message
38 | */
39 | public FlagParseException(
40 | final WorldFlag, ?> flag, final String value,
41 | final String errorMessage, final String... args
42 | ) {
43 | super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
44 | flag.getName(), value
45 | ));
46 | this.flag = flag;
47 | this.value = value;
48 | this.errorMessage = MessageUtil.format(errorMessage, args);
49 | }
50 |
51 | /**
52 | * Returns the value that caused the parse exception
53 | *
54 | * @return Value that failed to parse
55 | */
56 | public String getValue() {
57 | return this.value;
58 | }
59 |
60 | /**
61 | * Returns the class that threw the exception
62 | *
63 | * @return Flag that threw the exception
64 | */
65 | public WorldFlag, ?> getFlag() {
66 | return this.flag;
67 | }
68 |
69 | /**
70 | * Get the error message that was supplied by the flag instance.
71 | *
72 | * @return Error message.
73 | */
74 | public String getErrorMessage() {
75 | return this.errorMessage;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/AdvancementFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class AdvancementFlag extends BooleanFlag {
24 |
25 | public static final AdvancementFlag ADVANCEMENTS_ALLOWED = new AdvancementFlag(true);
26 | public static final AdvancementFlag ADVANCEMENTS_FORBIDDEN = new AdvancementFlag(false);
27 |
28 | private AdvancementFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionAdvancements);
30 | }
31 |
32 | @Override
33 | protected AdvancementFlag flagOf(final @NonNull Boolean value) {
34 | return value ? ADVANCEMENTS_ALLOWED : ADVANCEMENTS_FORBIDDEN;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/AliasFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 | import org.incendo.hyperverse.flags.WorldFlag;
23 |
24 | public final class AliasFlag extends WorldFlag {
25 |
26 | public static final AliasFlag ALIAS_NONE = new AliasFlag("");
27 |
28 | private AliasFlag(final @NonNull String alias) {
29 | super(alias, Messages.flagDescriptionAlias);
30 | }
31 |
32 | @Override
33 | public AliasFlag parse(final @NonNull String input) {
34 | return this.flagOf(input.replaceAll("&[A-Za-z0-9]", ""));
35 | }
36 |
37 | @Override
38 | public AliasFlag merge(final @NonNull String newValue) {
39 | return this.flagOf(newValue);
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return this.getValue();
45 | }
46 |
47 | @Override
48 | public String getExample() {
49 | return "&cFancy World Name";
50 | }
51 |
52 | @Override
53 | protected AliasFlag flagOf(final @NonNull String value) {
54 | return new AliasFlag(value);
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/BooleanFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Message;
22 | import org.incendo.hyperverse.flags.FlagParseException;
23 | import org.incendo.hyperverse.flags.WorldFlag;
24 |
25 | import java.util.Arrays;
26 | import java.util.Collection;
27 | import java.util.Locale;
28 |
29 | public abstract class BooleanFlag> extends WorldFlag {
30 |
31 | private static final Collection POSITIVE_VALUES =
32 | Arrays.asList("1", "yes", "allow", "true");
33 | private static final Collection NEGATIVE_VALUES =
34 | Arrays.asList("0", "no", "deny", "disallow", "false");
35 |
36 | /**
37 | * Construct a new flag instance.
38 | *
39 | * @param value Flag value
40 | * @param description Flag description
41 | */
42 | protected BooleanFlag(final boolean value, final Message description) {
43 | super(value, description);
44 | }
45 |
46 | /**
47 | * Construct a new boolean flag, with
48 | * {@code false} as the default value.
49 | *
50 | * @param description Flag description
51 | */
52 | protected BooleanFlag(final Message description) {
53 | this(false, description);
54 | }
55 |
56 | @Override
57 | public final F parse(final @NonNull String input) throws FlagParseException {
58 | if (POSITIVE_VALUES.contains(input.toLowerCase(Locale.ENGLISH))) {
59 | return this.flagOf(true);
60 | } else if (NEGATIVE_VALUES.contains(input.toLowerCase(Locale.ENGLISH))) {
61 | return this.flagOf(false);
62 | } else {
63 | throw new FlagParseException(this, input, "The value must be a boolean value (true/false)");
64 | }
65 | }
66 |
67 | @Override
68 | public final F merge(final @NonNull Boolean newValue) {
69 | return this.flagOf(getValue() || newValue);
70 | }
71 |
72 | @Override
73 | public final String getExample() {
74 | return "true";
75 | }
76 |
77 | @Override
78 | public final String toString() {
79 | return this.getValue().toString();
80 | }
81 |
82 | @Override
83 | public final Collection getTabCompletions() {
84 | return Arrays.asList("true", "false");
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/CreatureSpawnFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class CreatureSpawnFlag extends BooleanFlag {
24 |
25 | public static final CreatureSpawnFlag CREATURE_SPAWN_ALLOWED = new CreatureSpawnFlag(true);
26 | public static final CreatureSpawnFlag CREATURE_SPAWN_FORBIDDEN = new CreatureSpawnFlag(false);
27 |
28 | private CreatureSpawnFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionCreatureSpawn);
30 | }
31 |
32 | @Override
33 | protected CreatureSpawnFlag flagOf(final @NonNull Boolean value) {
34 | return value ? CREATURE_SPAWN_ALLOWED : CREATURE_SPAWN_FORBIDDEN;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/DifficultyFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.bukkit.Difficulty;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 | import org.incendo.hyperverse.configuration.Messages;
23 | import org.incendo.hyperverse.flags.FlagParseException;
24 | import org.incendo.hyperverse.flags.WorldFlag;
25 |
26 | import java.util.Arrays;
27 | import java.util.Collection;
28 |
29 | public final class DifficultyFlag extends WorldFlag {
30 |
31 | public static final DifficultyFlag DIFFICULTY_FLAG_PEACEFUL = new DifficultyFlag(Difficulty.PEACEFUL);
32 | public static final DifficultyFlag DIFFICULTY_FLAG_EASY = new DifficultyFlag(Difficulty.EASY);
33 | public static final DifficultyFlag DIFFICULTY_FLAG_NORMAL = new DifficultyFlag(Difficulty.NORMAL);
34 | public static final DifficultyFlag DIFFICULTY_FLAG_HARD = new DifficultyFlag(Difficulty.HARD);
35 |
36 | private DifficultyFlag(final @NonNull Difficulty difficulty) {
37 | super(difficulty, Messages.flagDescriptionDifficulty);
38 | }
39 |
40 | @Override
41 | public DifficultyFlag parse(final @NonNull String input) throws FlagParseException {
42 | switch (input.toLowerCase()) {
43 | case "peaceful":
44 | return this.flagOf(Difficulty.PEACEFUL);
45 | case "easy":
46 | return this.flagOf(Difficulty.EASY);
47 | case "normal":
48 | return this.flagOf(Difficulty.NORMAL);
49 | case "hard":
50 | return this.flagOf(Difficulty.HARD);
51 | default:
52 | throw new FlagParseException(this, input,
53 | "Invalid difficulty. Available values are: peaceful, easy, normal and hard"
54 | );
55 | }
56 | }
57 |
58 | @Override
59 | public DifficultyFlag merge(final @NonNull Difficulty newValue) {
60 | return this.flagOf(newValue);
61 | }
62 |
63 | @Override
64 | public String toString() {
65 | return this.getValue().name().toLowerCase();
66 | }
67 |
68 | @Override
69 | public String getExample() {
70 | return "peaceful";
71 | }
72 |
73 | @Override
74 | protected DifficultyFlag flagOf(final @NonNull Difficulty value) {
75 | switch (value) {
76 | case PEACEFUL:
77 | return DIFFICULTY_FLAG_PEACEFUL;
78 | case EASY:
79 | return DIFFICULTY_FLAG_EASY;
80 | case HARD:
81 | return DIFFICULTY_FLAG_HARD;
82 | default:
83 | return DIFFICULTY_FLAG_NORMAL;
84 | }
85 | }
86 |
87 | @Override
88 | public Collection getTabCompletions() {
89 | return Arrays.asList("peaceful", "easy", "normal", "hard");
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/EndFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.Hyperverse;
22 | import org.incendo.hyperverse.configuration.Messages;
23 | import org.incendo.hyperverse.flags.FlagParseException;
24 | import org.incendo.hyperverse.flags.WorldFlag;
25 | import org.incendo.hyperverse.util.WorldUtil;
26 | import org.incendo.hyperverse.world.HyperWorld;
27 |
28 | import java.util.ArrayList;
29 | import java.util.Collection;
30 |
31 | public final class EndFlag extends WorldFlag {
32 |
33 | public static final EndFlag END_FLAG_DEFAULT = new EndFlag("");
34 |
35 | private EndFlag(final @NonNull String value) {
36 | super(value, Messages.flagDescriptionEnd);
37 | }
38 |
39 | @Override
40 | public EndFlag parse(final @NonNull String input) throws FlagParseException {
41 | if (WorldUtil.validateName(input)) {
42 | return this.flagOf(input);
43 | }
44 | throw new FlagParseException(this, input, "A world name may only contain (up to) 16 alphanumerical characters, - and _");
45 | }
46 |
47 | @Override
48 | public EndFlag merge(final @NonNull String newValue) {
49 | return this.flagOf(newValue);
50 | }
51 |
52 | @Override
53 | public String toString() {
54 | return this.getValue();
55 | }
56 |
57 | @Override
58 | public String getExample() {
59 | return "end_world";
60 | }
61 |
62 | @Override
63 | protected EndFlag flagOf(final @NonNull String value) {
64 | return new EndFlag(value);
65 | }
66 |
67 | @Override
68 | public Collection getTabCompletions() {
69 | final Collection configurations = Hyperverse.getApi().getWorldManager().getWorlds();
70 | final Collection worldNames = new ArrayList<>(configurations.size());
71 | for (final HyperWorld world : configurations) {
72 | worldNames.add(world.getDisplayName());
73 | }
74 | return worldNames;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/ForceSpawn.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class ForceSpawn extends BooleanFlag {
24 |
25 | public static final ForceSpawn FORCE_SPAWN_TRUE = new ForceSpawn(true);
26 | public static final ForceSpawn FORCE_SPAWN_FALSE = new ForceSpawn(false);
27 |
28 | private ForceSpawn(final boolean value) {
29 | super(value, Messages.flagDescriptionForceSpawn);
30 | }
31 |
32 | @Override
33 | protected ForceSpawn flagOf(final @NonNull Boolean value) {
34 | return value ? FORCE_SPAWN_TRUE : FORCE_SPAWN_FALSE;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/GamemodeFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.bukkit.GameMode;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 | import org.incendo.hyperverse.configuration.Messages;
23 | import org.incendo.hyperverse.flags.FlagParseException;
24 | import org.incendo.hyperverse.flags.WorldFlag;
25 |
26 | import java.util.Arrays;
27 | import java.util.Collection;
28 |
29 | public final class GamemodeFlag extends WorldFlag {
30 |
31 | public static final GamemodeFlag GAMEMODE_SURVIVAL = new GamemodeFlag(GameMode.SURVIVAL);
32 | public static final GamemodeFlag GAMEMODE_CREATIVE = new GamemodeFlag(GameMode.CREATIVE);
33 | public static final GamemodeFlag GAMEMODE_ADVENTURE = new GamemodeFlag(GameMode.ADVENTURE);
34 | public static final GamemodeFlag GAMEMODE_SPECTATOR = new GamemodeFlag(GameMode.SPECTATOR);
35 |
36 | private GamemodeFlag(final @NonNull GameMode value) {
37 | super(value, Messages.flagDescriptionGamemode);
38 | }
39 |
40 | @Override
41 | public GamemodeFlag parse(final @NonNull String input) throws FlagParseException {
42 | switch (input.toLowerCase()) {
43 | case "survival":
44 | case "0":
45 | case "s":
46 | return GAMEMODE_SURVIVAL;
47 | case "creative":
48 | case "1":
49 | case "c":
50 | return GAMEMODE_CREATIVE;
51 | case "adventure":
52 | case "2":
53 | case "a":
54 | return GAMEMODE_ADVENTURE;
55 | case "spectator":
56 | case "3":
57 | return GAMEMODE_SPECTATOR;
58 | default:
59 | throw new FlagParseException(this, input, "There is no such game mode");
60 | }
61 | }
62 |
63 | @Override
64 | public GamemodeFlag merge(final @NonNull GameMode newValue) {
65 | return this.flagOf(newValue);
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | return this.getValue().name();
71 | }
72 |
73 | @Override
74 | public String getExample() {
75 | return "survival";
76 | }
77 |
78 | @Override
79 | protected GamemodeFlag flagOf(final @NonNull GameMode value) {
80 | switch (value) {
81 | case SURVIVAL:
82 | return GAMEMODE_SURVIVAL;
83 | case CREATIVE:
84 | return GAMEMODE_CREATIVE;
85 | case ADVENTURE:
86 | return GAMEMODE_ADVENTURE;
87 | case SPECTATOR:
88 | return GAMEMODE_SPECTATOR;
89 | default:
90 | throw new IllegalArgumentException("Unknown gamemode: " + value.name());
91 | }
92 | }
93 |
94 | @Override
95 | public Collection getTabCompletions() {
96 | return Arrays.asList("survival", "creative", "adventure", "spectator");
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/IgnoreBedsFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class IgnoreBedsFlag extends BooleanFlag {
24 |
25 | public static final IgnoreBedsFlag IGNORE_BEDS_TRUE = new IgnoreBedsFlag(true);
26 | public static final IgnoreBedsFlag IGNORE_BEDS_FALSE = new IgnoreBedsFlag(false);
27 |
28 | private IgnoreBedsFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionIgnoreBeds);
30 | }
31 |
32 | @Override
33 | protected IgnoreBedsFlag flagOf(final @NonNull Boolean value) {
34 | return value ? IGNORE_BEDS_TRUE : IGNORE_BEDS_FALSE;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/LocalRespawnFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class LocalRespawnFlag extends BooleanFlag {
24 |
25 | public static final LocalRespawnFlag RESPAWN_TRUE = new LocalRespawnFlag(true);
26 | public static final LocalRespawnFlag RESPAWN_FALSE = new LocalRespawnFlag(false);
27 |
28 | private LocalRespawnFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionLocalRespawn);
30 | }
31 |
32 | @Override
33 | protected LocalRespawnFlag flagOf(final @NonNull Boolean value) {
34 | return value ? RESPAWN_TRUE : RESPAWN_FALSE;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/MobSpawnFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class MobSpawnFlag extends BooleanFlag {
24 |
25 | public static final MobSpawnFlag MOB_SPAWN_ALLOWED = new MobSpawnFlag(true);
26 | public static final MobSpawnFlag MOB_SPAWN_FORBIDDEN = new MobSpawnFlag(false);
27 |
28 | private MobSpawnFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionMobSpawn);
30 | }
31 |
32 | @Override
33 | protected MobSpawnFlag flagOf(final @NonNull Boolean value) {
34 | return value ? MOB_SPAWN_ALLOWED : MOB_SPAWN_FORBIDDEN;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/NetherFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.Hyperverse;
22 | import org.incendo.hyperverse.configuration.Messages;
23 | import org.incendo.hyperverse.flags.FlagParseException;
24 | import org.incendo.hyperverse.flags.WorldFlag;
25 | import org.incendo.hyperverse.util.WorldUtil;
26 | import org.incendo.hyperverse.world.HyperWorld;
27 |
28 | import java.util.ArrayList;
29 | import java.util.Collection;
30 |
31 | public final class NetherFlag extends WorldFlag {
32 |
33 | public static final NetherFlag NETHER_FLAG_DEFAULT = new NetherFlag("");
34 |
35 | private NetherFlag(final @NonNull String value) {
36 | super(value, Messages.flagDescriptionNether);
37 | }
38 |
39 | @Override
40 | public NetherFlag parse(final @NonNull String input) throws FlagParseException {
41 | if (WorldUtil.validateName(input)) {
42 | return this.flagOf(input);
43 | }
44 | throw new FlagParseException(this, input, "A world name may only contain (up to) 16 alphanumerical characters, - and _");
45 | }
46 |
47 | @Override
48 | public NetherFlag merge(final @NonNull String newValue) {
49 | return this.flagOf(newValue);
50 | }
51 |
52 | @Override
53 | public String toString() {
54 | return this.getValue();
55 | }
56 |
57 | @Override
58 | public String getExample() {
59 | return "nether_world";
60 | }
61 |
62 | @Override
63 | protected NetherFlag flagOf(final @NonNull String value) {
64 | return new NetherFlag(value);
65 | }
66 |
67 | @Override
68 | public Collection getTabCompletions() {
69 | final Collection configurations = Hyperverse.getApi().getWorldManager().getWorlds();
70 | final Collection worldNames = new ArrayList<>(configurations.size());
71 | for (final HyperWorld world : configurations) {
72 | worldNames.add(world.getDisplayName());
73 | }
74 | return worldNames;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/ProfileGroupFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 | import org.incendo.hyperverse.flags.FlagParseException;
23 | import org.incendo.hyperverse.flags.WorldFlag;
24 | import org.incendo.hyperverse.util.WorldUtil;
25 |
26 | public final class ProfileGroupFlag extends WorldFlag {
27 |
28 | public static final ProfileGroupFlag PROFILE_GROUP_FLAG_EMPTY = new ProfileGroupFlag("default");
29 |
30 | private ProfileGroupFlag(final @NonNull String group) {
31 | super(group, Messages.flagDescriptionProfileGroup);
32 | }
33 |
34 | @Override
35 | public ProfileGroupFlag parse(final @NonNull String input) throws FlagParseException {
36 | if (WorldUtil.validateName(input)) {
37 | return this.flagOf(input);
38 | }
39 | throw new FlagParseException(this, input, "A world name may only contain (up to) 16 alphanumerical characters, - and _");
40 | }
41 |
42 | @Override
43 | public ProfileGroupFlag merge(final @NonNull String newValue) {
44 | return this.flagOf(newValue);
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return this.getValue();
50 | }
51 |
52 | @Override
53 | public String getExample() {
54 | return "survival_worlds";
55 | }
56 |
57 | @Override
58 | protected ProfileGroupFlag flagOf(final @NonNull String value) {
59 | return new ProfileGroupFlag(value);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/PveFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class PveFlag extends BooleanFlag {
24 |
25 | public static final PveFlag PVE_FLAG_TRUE = new PveFlag(true);
26 | public static final PveFlag PVE_FLAG_FALSE = new PveFlag(false);
27 |
28 | private PveFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionPve);
30 | }
31 |
32 | @Override
33 | protected PveFlag flagOf(final @NonNull Boolean value) {
34 | return value ? PVE_FLAG_TRUE : PVE_FLAG_FALSE;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/PvpFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class PvpFlag extends BooleanFlag {
24 |
25 | public static final PvpFlag PVP_FLAG_TRUE = new PvpFlag(true);
26 | public static final PvpFlag PVP_FLAG_FALSE = new PvpFlag(false);
27 |
28 | private PvpFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionPvp);
30 | }
31 |
32 | @Override
33 | protected PvpFlag flagOf(final @NonNull Boolean value) {
34 | return value ? PVP_FLAG_TRUE : PVP_FLAG_FALSE;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/RespawnWorldFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 | import org.incendo.hyperverse.flags.FlagParseException;
23 | import org.incendo.hyperverse.flags.WorldFlag;
24 | import org.incendo.hyperverse.util.WorldUtil;
25 |
26 | public final class RespawnWorldFlag extends WorldFlag {
27 |
28 | public static final RespawnWorldFlag RESPAWN_WORLD_FLAG_EMPTY = new RespawnWorldFlag("");
29 |
30 | private RespawnWorldFlag(final @NonNull String world) {
31 | super(world, Messages.flagDescriptionRespawnWorld);
32 | }
33 |
34 | @Override
35 | public RespawnWorldFlag parse(final @NonNull String input) throws FlagParseException {
36 | if (WorldUtil.validateName(input)) {
37 | return this.flagOf(input);
38 | }
39 | throw new FlagParseException(this, input, "A world name may only contain (up to) 16 alphanumerical characters, - and _");
40 | }
41 |
42 | @Override
43 | public RespawnWorldFlag merge(final @NonNull String newValue) {
44 | return this.flagOf(newValue);
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return this.getValue();
50 | }
51 |
52 | @Override
53 | public String getExample() {
54 | return "world";
55 | }
56 |
57 | @Override
58 | protected RespawnWorldFlag flagOf(final @NonNull String value) {
59 | return new RespawnWorldFlag(value);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/SaveWorldFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class SaveWorldFlag extends BooleanFlag {
24 |
25 | public static final SaveWorldFlag SAVE_WORLD_TRUE = new SaveWorldFlag(true);
26 | public static final SaveWorldFlag SAVE_WORLD_FALSE = new SaveWorldFlag(false);
27 |
28 | private SaveWorldFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionIgnoreBeds);
30 | }
31 |
32 | @Override
33 | protected SaveWorldFlag flagOf(final @NonNull Boolean value) {
34 | return value ? SAVE_WORLD_TRUE : SAVE_WORLD_FALSE;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/UnloadSpawnFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 |
23 | public final class UnloadSpawnFlag extends BooleanFlag {
24 |
25 | public static final UnloadSpawnFlag UNLOAD_SPAWN_FALSE = new UnloadSpawnFlag(false);
26 | public static final UnloadSpawnFlag UNLOAD_SPAWN_TRUE = new UnloadSpawnFlag(true);
27 |
28 | public UnloadSpawnFlag(final boolean value) {
29 | super(value, Messages.flagDescriptionUnloadSpawn);
30 | }
31 |
32 | @Override
33 | protected UnloadSpawnFlag flagOf(final @NonNull Boolean value) {
34 | return value ? UNLOAD_SPAWN_TRUE : UNLOAD_SPAWN_FALSE;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/flags/implementation/WorldPermissionFlag.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.flags.implementation;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.configuration.Messages;
22 | import org.incendo.hyperverse.flags.FlagParseException;
23 | import org.incendo.hyperverse.flags.WorldFlag;
24 |
25 | import java.util.regex.Pattern;
26 |
27 | public final class WorldPermissionFlag extends WorldFlag {
28 |
29 | public static final WorldPermissionFlag WORLD_PERMISSION_FLAG_DEFAULT = new WorldPermissionFlag("");
30 | private static final Pattern PERMISSION_PATTERN = Pattern.compile("[A-Za-z0-9\\-_.]+");
31 |
32 | public WorldPermissionFlag(final @NonNull String value) {
33 | super(value, Messages.flagDescriptionWorldPermission);
34 | }
35 |
36 | @Override
37 | public WorldPermissionFlag parse(final @NonNull String input) throws
38 | FlagParseException {
39 | if (input.isEmpty()) {
40 | return WORLD_PERMISSION_FLAG_DEFAULT;
41 | }
42 | if (PERMISSION_PATTERN.matcher(input).matches()) {
43 | return this.flagOf(input);
44 | }
45 | throw new FlagParseException(this, input, "A permission node may only contain alphanumerical characters,"
46 | + " -, . and _");
47 | }
48 |
49 | @Override
50 | public WorldPermissionFlag merge(final @NonNull String newValue) {
51 | return this.flagOf(newValue);
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | return getValue();
57 | }
58 |
59 | @Override
60 | public String getExample() {
61 | return "your.permission.node";
62 | }
63 |
64 | @Override
65 | protected WorldPermissionFlag flagOf(final @NonNull String value) {
66 | return new WorldPermissionFlag(value);
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/listeners/PaperListener.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.listeners;
19 |
20 | import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent;
21 | import com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent;
22 | import com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent;
23 | import org.bukkit.event.EventHandler;
24 | import org.bukkit.event.Listener;
25 | import org.bukkit.event.entity.CreatureSpawnEvent;
26 | import org.checkerframework.checker.nullness.qual.NonNull;
27 | import org.incendo.hyperverse.flags.implementation.AdvancementFlag;
28 | import org.incendo.hyperverse.flags.implementation.CreatureSpawnFlag;
29 | import org.incendo.hyperverse.flags.implementation.MobSpawnFlag;
30 | import org.incendo.hyperverse.world.HyperWorld;
31 | import org.incendo.hyperverse.world.WorldManager;
32 |
33 | public final class PaperListener implements Listener {
34 |
35 | private final WorldManager worldManager;
36 |
37 | PaperListener(final @NonNull WorldManager worldManager) {
38 | this.worldManager = worldManager;
39 | }
40 |
41 | @EventHandler
42 | public void onEntityPreSpawn(final @NonNull PreCreatureSpawnEvent event) {
43 | final HyperWorld hyperWorld = this.worldManager.getWorld(event.getSpawnLocation().getWorld());
44 | if (hyperWorld == null) {
45 | return;
46 | }
47 | if (hyperWorld.getFlag(CreatureSpawnFlag.class)) {
48 | return;
49 | }
50 | if (event.getReason() != CreatureSpawnEvent.SpawnReason.NATURAL) {
51 | return;
52 | }
53 | event.setCancelled(true);
54 | event.setShouldAbortSpawn(true);
55 | }
56 |
57 | @EventHandler
58 | public void onMobPreSpawn(final @NonNull PlayerNaturallySpawnCreaturesEvent event) {
59 | final HyperWorld hyperWorld = this.worldManager.getWorld(event.getPlayer().getWorld());
60 | if (hyperWorld == null) {
61 | return;
62 | }
63 | if (hyperWorld.getFlag(MobSpawnFlag.class)) {
64 | return;
65 | }
66 | event.setCancelled(true);
67 | }
68 |
69 | @EventHandler
70 | public void onAdvancementGrant(final @NonNull PlayerAdvancementCriterionGrantEvent event) {
71 | final HyperWorld hyperWorld = this.worldManager.getWorld(event.getPlayer().getWorld());
72 | if (hyperWorld == null) {
73 | return;
74 | }
75 | if (hyperWorld.getFlag(AdvancementFlag.class)) {
76 | return;
77 | }
78 | event.setCancelled(true);
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/listeners/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Event listeners
20 | */
21 | package org.incendo.hyperverse.listeners;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/BukkitModule.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import com.google.inject.AbstractModule;
21 | import com.google.inject.Singleton;
22 | import org.bukkit.Server;
23 | import org.bukkit.inventory.ItemFactory;
24 | import org.bukkit.plugin.PluginManager;
25 | import org.bukkit.plugin.ServicesManager;
26 | import org.bukkit.scheduler.BukkitScheduler;
27 | import org.bukkit.scoreboard.ScoreboardManager;
28 | import org.checkerframework.checker.nullness.qual.NonNull;
29 |
30 | /**
31 | * Utility module binding commonly used bukkit interfaces to bukkit
32 | */
33 | public final class BukkitModule extends AbstractModule {
34 |
35 | private final Server server;
36 |
37 | public BukkitModule(final @NonNull Server server) {
38 | this.server = server;
39 | }
40 |
41 | @Override
42 | protected void configure() {
43 | bind(Server.class).toInstance(this.server);
44 | bind(PluginManager.class).toProvider(this.server::getPluginManager).in(Singleton.class);
45 | bind(BukkitScheduler.class).toProvider(this.server::getScheduler).in(Singleton.class);
46 | bind(ItemFactory.class).toProvider(this.server::getItemFactory).in(Singleton.class);
47 | bind(ServicesManager.class).toProvider(this.server::getServicesManager).in(Singleton.class);
48 | bind(ScoreboardManager.class).toProvider(this.server::getScoreboardManager).in(Singleton.class);
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/FlagContainerFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.flags.FlagContainer;
22 |
23 | public interface FlagContainerFactory {
24 |
25 | FlagContainer create(final FlagContainer.@NonNull WorldFlagUpdateHandler flagUpdateHandler);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/HyperEventFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.bukkit.Location;
21 | import org.bukkit.entity.Player;
22 | import org.checkerframework.checker.nullness.qual.NonNull;
23 | import org.incendo.hyperverse.events.PlayerSeekSpawnEvent;
24 | import org.incendo.hyperverse.events.PlayerSetSpawnEvent;
25 | import org.incendo.hyperverse.world.HyperWorld;
26 |
27 | public interface HyperEventFactory {
28 |
29 | void callWorldCreation(@NonNull HyperWorld hyperWorld);
30 |
31 | void callWorldDeletion(@NonNull HyperWorld hyperWorld);
32 |
33 | @NonNull PlayerSeekSpawnEvent callPlayerSeekSpawn(
34 | @NonNull Player player,
35 | @NonNull HyperWorld world,
36 | @NonNull Location respawnLocation
37 | );
38 |
39 |
40 | @NonNull PlayerSetSpawnEvent callPlayerSetSpawn(
41 | final @NonNull Player player,
42 | final @NonNull HyperWorld world
43 | );
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/HyperWorldCreatorFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.world.HyperWorld;
22 | import org.incendo.hyperverse.world.HyperWorldCreator;
23 |
24 | public interface HyperWorldCreatorFactory {
25 |
26 | @NonNull HyperWorldCreator create(final @NonNull HyperWorld hyperWorld);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/HyperWorldFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.world.HyperWorld;
22 | import org.incendo.hyperverse.world.WorldConfiguration;
23 |
24 | import java.util.UUID;
25 |
26 | public interface HyperWorldFactory {
27 |
28 | @NonNull HyperWorld create(@NonNull UUID uuid, @NonNull WorldConfiguration worldConfiguration);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/PersistentLocationTransformer.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.bukkit.Location;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 | import org.incendo.hyperverse.database.PersistentLocation;
23 |
24 | /**
25 | * Transforms a {@link PersistentLocation} to a Bukkit {@link Location}.
26 | * This class exists so that the {@link org.bukkit.Bukkit} static server singleton
27 | * isn't used to lookup worlds.
28 | */
29 | @FunctionalInterface
30 | public interface PersistentLocationTransformer {
31 |
32 | @NonNull Location transform(@NonNull PersistentLocation persistentLocation);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/TaskFactoryModule.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import co.aikar.taskchain.BukkitTaskChainFactory;
21 | import co.aikar.taskchain.TaskChainFactory;
22 | import com.google.inject.AbstractModule;
23 | import com.google.inject.Provides;
24 | import com.google.inject.Singleton;
25 | import org.bukkit.plugin.Plugin;
26 | import org.checkerframework.checker.nullness.qual.NonNull;
27 |
28 | public final class TaskFactoryModule extends AbstractModule {
29 |
30 | @Override
31 | protected void configure() {
32 | }
33 |
34 | @Provides
35 | @Singleton
36 | public @NonNull TaskChainFactory provideTaskChainFactory(final @NonNull Plugin plugin) {
37 | return BukkitTaskChainFactory.create(plugin);
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/TeleportationManagerFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.teleportation.TeleportationManager;
22 | import org.incendo.hyperverse.world.HyperWorld;
23 |
24 | public interface TeleportationManagerFactory {
25 |
26 | @NonNull TeleportationManager create(@NonNull HyperWorld hyperWorld);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/WorldConfigurationFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.bukkit.World;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 | import org.checkerframework.checker.nullness.qual.Nullable;
23 | import org.incendo.hyperverse.world.WorldConfiguration;
24 | import org.incendo.hyperverse.world.WorldConfigurationBuilder;
25 |
26 | import java.nio.file.Path;
27 |
28 | public interface WorldConfigurationFactory {
29 |
30 | default WorldConfigurationBuilder builder() {
31 | return new WorldConfigurationBuilder();
32 | }
33 | @NonNull WorldConfiguration fromWorld(@NonNull World world);
34 |
35 | @Nullable WorldConfiguration fromFile(@NonNull Path file);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/WorldImporterFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.modules;
19 |
20 | import org.checkerframework.checker.nullness.qual.NonNull;
21 | import org.incendo.hyperverse.util.MultiverseImporter;
22 | import org.incendo.hyperverse.util.MyWorldsImporter;
23 |
24 | public interface WorldImporterFactory {
25 |
26 | @NonNull MultiverseImporter createMultiverseImporter(@NonNull HyperWorldFactory hyperWorldFactory);
27 |
28 | @NonNull MyWorldsImporter createMyWorldsImporter(@NonNull HyperWorldFactory hyperWorldFactory);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/modules/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Guice modules and factory types
20 | */
21 | package org.incendo.hyperverse.modules;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/platform/PlatformProvider.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.platform;
19 |
20 | import org.incendo.hyperverse.util.NMS;
21 | import org.jetbrains.annotations.NotNull;
22 |
23 | @FunctionalInterface
24 | public interface PlatformProvider {
25 |
26 | @NotNull Class extends NMS> providePlatform() throws PlatformProvisionException;
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/platform/PlatformProvisionException.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.platform;
19 |
20 | public class PlatformProvisionException extends Exception {
21 |
22 | public PlatformProvisionException() {
23 | }
24 |
25 | public PlatformProvisionException(final String message) {
26 | super(message);
27 | }
28 |
29 | public PlatformProvisionException(final String message, final Throwable cause) {
30 | super(message, cause);
31 | }
32 |
33 | public PlatformProvisionException(final Throwable cause) {
34 | super(cause);
35 | }
36 |
37 | public PlatformProvisionException(
38 | final String message,
39 | final Throwable cause,
40 | final boolean enableSuppression,
41 | final boolean writableStackTrace
42 | ) {
43 | super(message, cause, enableSuppression, writableStackTrace);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/platform/ReflectionPlatformProvider.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.platform;
19 |
20 | import org.incendo.hyperverse.util.NMS;
21 | import org.incendo.hyperverse.util.versioning.Version;
22 | import org.jetbrains.annotations.NotNull;
23 |
24 | import java.util.Locale;
25 |
26 | public final class ReflectionPlatformProvider implements PlatformProvider {
27 |
28 | private final Version minecraftVersion;
29 | public ReflectionPlatformProvider(@NotNull final Version version) {
30 | this.minecraftVersion = version;
31 | }
32 |
33 | @Override
34 | public @NotNull Class extends NMS> providePlatform() throws PlatformProvisionException {
35 | String expectedPackage = this.minecraftVersion.original().toLowerCase(Locale.ENGLISH).replace('.', '_');
36 | String packageName = "org.incendo.hyperverse.platform.v" + expectedPackage;
37 | try {
38 | Class> clazz = Class.forName(packageName + ".NMSImpl");
39 | return clazz.asSubclass(NMS.class);
40 | } catch (ReflectiveOperationException ex) {
41 | throw new PlatformProvisionException("Could not provide platform for version: " + this.minecraftVersion + "!", ex);
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/service/internal/SafeTeleportService.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.service.internal;
19 |
20 | import cloud.commandframework.services.types.Service;
21 | import org.bukkit.Location;
22 | import org.bukkit.Material;
23 | import org.bukkit.block.Block;
24 | import org.bukkit.block.BlockFace;
25 | import org.checkerframework.checker.nullness.qual.NonNull;
26 |
27 | /**
28 | * A {@link Service} used to find safe teleportation locations
29 | */
30 | public interface SafeTeleportService extends Service {
31 |
32 | /**
33 | * Get the default service implementation
34 | *
35 | * @return Default implementation
36 | */
37 | static @NonNull SafeTeleportService defaultService() {
38 | return new DefaultSafeTeleportService();
39 | }
40 |
41 | /**
42 | * Default {@link SafeTeleportService} implementation that just scans
43 | * for safe locations in a vertical column
44 | */
45 | final class DefaultSafeTeleportService implements SafeTeleportService {
46 |
47 | @Override
48 | public @NonNull Location handle(final @NonNull Location location) {
49 | Block locationBlock = location.getBlock();
50 | do {
51 | if (locationBlock.getRelative(BlockFace.DOWN).getType().isSolid()) {
52 | return locationBlock.getLocation();
53 | }
54 | } while (locationBlock.getY() > 0
55 | && (locationBlock = locationBlock.getRelative(BlockFace.DOWN)).getType() != Material.VOID_AIR);
56 | return location;
57 | }
58 |
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/service/internal/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Internal service types.
20 | */
21 | package org.incendo.hyperverse.service.internal;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/service/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Services used by Hyperverse internally.
20 | */
21 | package org.incendo.hyperverse.service;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/teleportation/TeleportationManager.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.teleportation;
19 |
20 | import org.bukkit.Location;
21 | import org.bukkit.entity.Entity;
22 | import org.bukkit.entity.Player;
23 | import org.checkerframework.checker.nullness.qual.NonNull;
24 | import org.checkerframework.checker.nullness.qual.Nullable;
25 | import org.incendo.hyperverse.world.HyperWorld;
26 |
27 | import java.util.concurrent.CompletableFuture;
28 |
29 | /**
30 | * Manager responsible for teleportation related actions
31 | */
32 | public interface TeleportationManager {
33 |
34 | /**
35 | * Get the spawn location for a player in a particular world. This can be a bed
36 | * spawn location, the world spawn location, or some other location
37 | *
38 | * @param player Player to check the location for
39 | * @param hyperWorld The world in which the location exists
40 | * @return The spawn location
41 | */
42 | @NonNull Location getSpawnLocation(
43 | @NonNull Player player,
44 | @NonNull HyperWorld hyperWorld
45 | );
46 |
47 | /**
48 | * Check whether or not the player is allowed
49 | * to teleport to the specified location
50 | *
51 | * @param player Player that is about to teleport
52 | * @param location Location the player is teleporting to
53 | * @return True if the player is allowed to teleport to the location
54 | */
55 | @NonNull CompletableFuture allowedTeleport(
56 | @NonNull Player player,
57 | @NonNull Location location
58 | );
59 |
60 | /**
61 | * Check whether or not the player can safely teleport
62 | * to the specified location
63 | *
64 | * @param player Player that is about to teleport
65 | * @param location Location the player is teleporting to
66 | * @return True if the player is able to teleport to the location
67 | */
68 | @NonNull CompletableFuture canTeleport(
69 | @NonNull Player player,
70 | @NonNull Location location
71 | );
72 |
73 | /**
74 | * Find a safe teleportation location near the specified
75 | * location
76 | *
77 | * @param location Search origin
78 | * @return Safe location
79 | */
80 | @NonNull CompletableFuture findSafe(@NonNull Location location);
81 |
82 | /**
83 | * Teleport the player to a given location
84 | *
85 | * @param player Player to teleport
86 | * @param location Location to teleport the player to
87 | */
88 | void teleportPlayer(
89 | @NonNull Player player,
90 | @NonNull Location location
91 | );
92 |
93 | /**
94 | * Handle nether portal teleportation
95 | *
96 | * @param entity Entity to teleport
97 | * @param location Portal location
98 | * @return The destination location
99 | */
100 | @Nullable Location netherDestination(
101 | @NonNull Entity entity,
102 | @NonNull Location location
103 | );
104 |
105 | /**
106 | * Handle end portal teleportation
107 | *
108 | * @param entity Entity to teleport
109 | * @return The destination location
110 | */
111 | @Nullable Location endDestination(@NonNull Entity entity);
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/teleportation/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Teleportation related classes
20 | */
21 | package org.incendo.hyperverse.teleportation;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/GeneratorUtil.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util;
19 |
20 | import org.bukkit.Bukkit;
21 | import org.bukkit.Server;
22 | import org.bukkit.generator.ChunkGenerator;
23 | import org.bukkit.plugin.java.JavaPlugin;
24 | import org.checkerframework.checker.nullness.qual.NonNull;
25 | import org.checkerframework.checker.nullness.qual.Nullable;
26 |
27 | import java.lang.reflect.Field;
28 | import java.lang.reflect.InvocationTargetException;
29 | import java.lang.reflect.Method;
30 | import java.util.Objects;
31 | import java.util.regex.Pattern;
32 |
33 | /**
34 | * Generator utility methods
35 | */
36 | public final class GeneratorUtil {
37 |
38 | private static Method generatorGetter;
39 | private static Class> pluginClassLoaderClass;
40 | private static Field pluginGetter;
41 |
42 | private GeneratorUtil() {
43 | }
44 |
45 | /**
46 | * Attempt to find the generator for a given world name
47 | *
48 | * @param world world name
49 | * @return Generator, if found
50 | */
51 | public static @Nullable ChunkGenerator getGenerator(final @NonNull String world)
52 | throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
53 | if (generatorGetter == null) {
54 | final Class extends Server> serverClass = Bukkit.getServer().getClass();
55 | generatorGetter = serverClass.getDeclaredMethod("getGenerator", String.class);
56 | generatorGetter.setAccessible(true);
57 | }
58 | return (ChunkGenerator) generatorGetter
59 | .invoke(Bukkit.getServer(), Objects.requireNonNull(world));
60 | }
61 |
62 | /**
63 | * Attempt to find the generator plugin from a chunk generator instance
64 | *
65 | * @param generator Generator instance
66 | * @return Plugin, if found
67 | */
68 | public static @Nullable JavaPlugin matchGenerator(final @NonNull ChunkGenerator generator)
69 | throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
70 | Objects.requireNonNull(generator);
71 | final ClassLoader classLoader = generator.getClass().getClassLoader();
72 | if (pluginClassLoaderClass == null) {
73 | pluginClassLoaderClass = Class.forName("org.bukkit.plugin.java.PluginClassLoader");
74 | pluginGetter = pluginClassLoaderClass.getDeclaredField("plugin");
75 | pluginGetter.setAccessible(true);
76 | }
77 | if (pluginClassLoaderClass.isInstance(classLoader)) {
78 | return (JavaPlugin) pluginGetter.get(classLoader);
79 | }
80 | return null;
81 | }
82 |
83 | /**
84 | * Check if there is an available generator with the given name
85 | *
86 | * @param generatorName Generator name
87 | * @return True if the generator is available, false if not
88 | */
89 | public static boolean isGeneratorAvailable(final @Nullable String generatorName) {
90 | if (generatorName == null
91 | || generatorName.isEmpty()
92 | || generatorName.equalsIgnoreCase("vanilla")) {
93 | return true;
94 | }
95 | final String pluginName;
96 | if (generatorName.contains(":")) {
97 | pluginName = generatorName.split(Pattern.quote(":"))[0];
98 | } else {
99 | pluginName = generatorName;
100 | }
101 | return Bukkit.getPluginManager().isPluginEnabled(pluginName);
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/SeedUtil.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util;
19 |
20 | import java.util.concurrent.ThreadLocalRandom;
21 |
22 | /**
23 | * Seed utility methods
24 | */
25 | public final class SeedUtil {
26 |
27 | private SeedUtil() {
28 | }
29 |
30 | /**
31 | * Generate a random seed
32 | *
33 | * @return Randomly generated seed
34 | */
35 | public static long randomSeed() {
36 | return ThreadLocalRandom.current().nextLong();
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/WorldUtil.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util;
19 |
20 | import org.bukkit.Bukkit;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 | import org.incendo.hyperverse.world.WorldManager;
23 |
24 | import java.io.File;
25 | import java.io.IOException;
26 | import java.nio.file.Files;
27 | import java.nio.file.Path;
28 | import java.util.regex.Pattern;
29 | import java.util.stream.Stream;
30 |
31 | /**
32 | * World utility methods
33 | */
34 | public final class WorldUtil {
35 |
36 | private static final Pattern WORLD_NAME_PATTERN = Pattern.compile("[A-Za-z\\-_0-9]{1,16}");
37 |
38 | private WorldUtil() {
39 | }
40 |
41 | /**
42 | * Check whether or not a world name is valid
43 | *
44 | * @param worldName World name
45 | * @return True if the world name is valid, false if not
46 | */
47 | public static boolean validateName(final @NonNull String worldName) {
48 | return WORLD_NAME_PATTERN.matcher(worldName).matches();
49 | }
50 |
51 | /**
52 | * Check whether or not a world is suitable to be imported
53 | *
54 | * @param worldName World name
55 | * @param manager World manager
56 | * @return True of directory containing a level.dat file with the same name is found
57 | */
58 | public static boolean isSuitableImportCandidate(
59 | final @NonNull String worldName,
60 | final @NonNull WorldManager manager
61 | ) {
62 | if (manager.getWorld(worldName) != null) {
63 | return false;
64 | }
65 | try (final Stream files = Files.list(Bukkit.getWorldContainer().toPath())) {
66 | return files.anyMatch(path -> {
67 | final File file = path.toFile();
68 | return file.getName().equals(worldName) && file.isDirectory() && new File(
69 | file,
70 | "level.dat"
71 | ).isFile();
72 | });
73 | } catch (IOException e) {
74 | return false;
75 | }
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Utility classes
20 | */
21 | package org.incendo.hyperverse.util;
22 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/versioning/PreReleaseType.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util.versioning;
19 |
20 | import org.jetbrains.annotations.NotNull;
21 |
22 | import javax.annotation.Nullable;
23 | import java.util.Locale;
24 |
25 | public enum PreReleaseType {
26 |
27 | UNKNOWN("unknown"),
28 |
29 | ALPHA("alpha"),
30 | BETA("beta"),
31 | SNAPSHOT("snapshot"),
32 | RELEASE_CANDIDATE("rc");
33 |
34 | private static final PreReleaseType[] VALUES = values();
35 |
36 | private final String asString;
37 |
38 | PreReleaseType(@NotNull final String asString) {
39 | this.asString = asString;
40 | }
41 |
42 | @Nullable
43 | public static PreReleaseType parse(@NotNull final String release) {
44 | if (release.isEmpty()) {
45 | return null;
46 | }
47 | String sanitized = release.toLowerCase(Locale.ENGLISH);
48 | for (PreReleaseType preReleaseType : VALUES) {
49 | if (preReleaseType.asString.equals(sanitized)) {
50 | return preReleaseType;
51 | }
52 | }
53 | return UNKNOWN;
54 | }
55 |
56 | public @NotNull String asString() {
57 | return this.asString;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/versioning/Version.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util.versioning;
19 |
20 | import org.jetbrains.annotations.NotNull;
21 |
22 | import java.util.StringJoiner;
23 | import java.util.regex.Matcher;
24 | import java.util.regex.Pattern;
25 |
26 | public record Version(@NotNull String original, @NotNull VersionData versionData) {
27 |
28 | /**
29 | * Semver pattern, cg1 = major, cg2 = minor, cg3 = patch, cg4 = prerelease and cg5 = buildmetadata
30 | * Taken from https://semver.org/ and https://regex101.com/r/vkijKf/1/
31 | */
32 | public static final Pattern SEMVER_PATTERN = Pattern.compile(
33 | "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$");
34 |
35 | public static @NotNull Version parseMinecraft(@NotNull final String version) throws IllegalArgumentException {
36 | String[] split = version.split("\\.");
37 | if (split.length < 2) {
38 | throw new IllegalArgumentException("Invalid minecraft version: " + version);
39 | }
40 | if (split.length == 2) {
41 | StringJoiner joiner = new StringJoiner(".");
42 | // insert a .0 to make it correctly formatted
43 | joiner.add(split[0]);
44 | joiner.add("0");
45 | joiner.add(split[1]);
46 | Version formatted = parseSemVer(joiner.toString());
47 | return new Version(version, formatted.versionData());
48 | }
49 | return parseSemVer(version);
50 | }
51 |
52 | public static @NotNull Version parseSemVer(@NotNull final String version) throws IllegalArgumentException {
53 | Matcher matcher = SEMVER_PATTERN.matcher(version);
54 | if (!matcher.find()) {
55 | throw new IllegalArgumentException("Invalid version: " + version);
56 | }
57 | String majorRaw = matcher.group(1);
58 | String minorRaw = matcher.group(2);
59 | String patchRaw = matcher.group(3);
60 | String preReleaseRaw = matcher.group(4);
61 | int major;
62 | int minor;
63 | try {
64 | major = Integer.parseInt(majorRaw);
65 | minor = Integer.parseInt(minorRaw);
66 | } catch (NumberFormatException ex) {
67 | throw new IllegalArgumentException("Invalid version: " + version);
68 | }
69 | if (patchRaw == null || patchRaw.isEmpty()) {
70 | return new Version(version, new VersionData(major, minor, 0, null));
71 | }
72 | int patch;
73 | try {
74 | patch = Integer.parseInt(patchRaw);
75 | } catch (NumberFormatException ex) {
76 | throw new IllegalArgumentException("Invalid version: " + version);
77 | }
78 | if (preReleaseRaw == null || preReleaseRaw.isEmpty()) {
79 | return new Version(version, new VersionData(major, minor, patch, null));
80 | }
81 | PreReleaseType releaseType = PreReleaseType.parse(preReleaseRaw);
82 | return new Version(version, new VersionData(major, minor, patch, releaseType));
83 | }
84 |
85 | @Override
86 | public @NotNull String toString() {
87 | return this.original;
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/versioning/VersionData.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util.versioning;
19 |
20 | import org.jetbrains.annotations.NotNull;
21 |
22 | public record VersionData(int major, int minor, Integer patch, PreReleaseType preReleaseType)
23 | implements Comparable {
24 |
25 | public VersionData(final int major, final int minor, final int patch) {
26 | this(major, minor, patch, null);
27 | }
28 |
29 | public VersionData(final int major, final int minor) {
30 | this(major, minor, 0);
31 | }
32 |
33 | @Override
34 | public @NotNull String toString() {
35 | return String.format("%d.%d.%d", this.major, this.minor, this.patch);
36 | }
37 |
38 | public boolean isNewerThan(@NotNull final VersionData other) {
39 | return this.compareTo(other) > 0;
40 | }
41 |
42 | public boolean isOlderThan(@NotNull final VersionData other) {
43 | return this.compareTo(other) < 0;
44 | }
45 |
46 |
47 | @Override
48 | public int compareTo(@NotNull final VersionData o) {
49 | int majorComp = Integer.compare(this.major, o.major);
50 | if (majorComp != 0) {
51 | return majorComp;
52 | }
53 | int minorComp = Integer.compare(this.minor, o.minor);
54 | if (minorComp != 0) {
55 | return minorComp;
56 | }
57 | int patchComp = Integer.compare(this.patch, o.patch);
58 | if (patchComp != 0) {
59 | return patchComp;
60 | }
61 | if (this.preReleaseType == null && o.preReleaseType == null) {
62 | return 0;
63 | }
64 | if (this.preReleaseType == null) {
65 | return 1;
66 | }
67 | return this.preReleaseType.compareTo(o.preReleaseType);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/util/versioning/VersionUtil.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util.versioning;
19 |
20 | import org.jetbrains.annotations.NotNull;
21 |
22 | public final class VersionUtil {
23 |
24 | private VersionUtil() {
25 | throw new IllegalStateException("Cannot instantiate static utility class");
26 | }
27 |
28 | public static @NotNull Version parseMinecraftVersion(@NotNull final String minecraftVersion) throws IllegalArgumentException {
29 | // Expecting 1.X.X-R0.1-SNAPSHOT
30 | int stripLength = "-R0.1-SNAPSHOT".length();
31 | int length = minecraftVersion.length();
32 | if (length <= stripLength) {
33 | throw new IllegalArgumentException("Invalid minecraft version: " + minecraftVersion);
34 | }
35 | String strippedVersion = minecraftVersion.substring(0, length - stripLength);
36 | try {
37 | return Version.parseMinecraft(strippedVersion);
38 | } catch (IllegalArgumentException ex) {
39 | throw new IllegalArgumentException("Invalid minecraft version: " + minecraftVersion, ex);
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/world/HyperWorldCreator.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.world;
19 |
20 | import com.google.inject.Inject;
21 | import com.google.inject.assistedinject.Assisted;
22 | import org.bukkit.WorldCreator;
23 | import org.bukkit.WorldType;
24 | import org.bukkit.generator.ChunkGenerator;
25 | import org.checkerframework.checker.nullness.qual.NonNull;
26 | import org.incendo.hyperverse.util.NullRouteCommandSender;
27 |
28 | import java.util.Objects;
29 |
30 | /**
31 | * World creator instance used to create a {@link HyperWorld}
32 | */
33 | public final class HyperWorldCreator extends WorldCreator {
34 |
35 | private final HyperWorld hyperWorld;
36 |
37 | @Inject
38 | public HyperWorldCreator(@Assisted final @NonNull HyperWorld hyperWorld) {
39 | super(Objects.requireNonNull(hyperWorld).getConfiguration().getName());
40 | this.hyperWorld = hyperWorld;
41 | }
42 |
43 | /**
44 | * Validate the world configuration
45 | *
46 | * @return Result of the validation
47 | */
48 | public @NonNull ValidationResult validate() {
49 | final WorldConfiguration worldConfiguration = this.hyperWorld.getConfiguration();
50 | if (!worldConfiguration.getGenerator().isEmpty()
51 | && !worldConfiguration.getGenerator().equalsIgnoreCase("vanilla")) {
52 | final ChunkGenerator chunkGenerator =
53 | getGeneratorForName(worldConfiguration.getName(), this.getJoinedName(),
54 | NullRouteCommandSender.getInstance()
55 | );
56 | if (chunkGenerator == null) {
57 | return ValidationResult.UNKNOWN_GENERATOR;
58 | }
59 | }
60 | return ValidationResult.SUCCESS;
61 | }
62 |
63 | /**
64 | * Configure the world creator
65 | */
66 | public void configure() {
67 | final WorldConfiguration worldConfiguration = this.hyperWorld.getConfiguration();
68 | if (worldConfiguration.getWorldFeatures() != null) {
69 | this.type(worldConfiguration.getWorldFeatures().getBukkitType());
70 | } else {
71 | this.type(WorldType.NORMAL);
72 | }
73 | this.environment(worldConfiguration.getType().getBukkitType());
74 | this.generatorSettings(worldConfiguration.getSettings());
75 | this.seed(worldConfiguration.getSeed());
76 | this.generateStructures(worldConfiguration.isGenerateStructures());
77 | this.generator(this.getJoinedName(), NullRouteCommandSender.getInstance());
78 | }
79 |
80 | private @NonNull String getJoinedName() {
81 | if (this.hyperWorld.getConfiguration().getGeneratorArg().isEmpty()) {
82 | return this.hyperWorld.getConfiguration().getGenerator();
83 | }
84 | return String.format("%s:%s", this.hyperWorld.getConfiguration().getGenerator(),
85 | this.hyperWorld.getConfiguration().getGeneratorArg()
86 | );
87 | }
88 |
89 | /**
90 | * Result of configuration validation
91 | */
92 | public enum ValidationResult {
93 | SUCCESS,
94 | UNKNOWN_GENERATOR,
95 | NAME_TAKEN,
96 | UNKNOWN_ERROR
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/world/WorldStructureSetting.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.world;
19 |
20 | /**
21 | * Setting that indicates whether or not
22 | * worlds should generate structures
23 | */
24 | public enum WorldStructureSetting {
25 | NO_STRUCTURES,
26 | GENERATE_STRUCTURES
27 | }
28 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/world/WorldType.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.world;
19 |
20 | import org.bukkit.World;
21 | import org.checkerframework.checker.nullness.qual.NonNull;
22 |
23 | import java.util.Arrays;
24 | import java.util.Collection;
25 | import java.util.Objects;
26 | import java.util.Optional;
27 |
28 | /**
29 | * World type, mirroring Bukkit's {@link World.Environment}
30 | */
31 | public enum WorldType {
32 | OVER_WORLD(World.Environment.NORMAL, Arrays.asList("overworld", "over_world", "normal")),
33 | NETHER(World.Environment.NETHER, Arrays.asList("the_nether", "nether", "hell")),
34 | END(World.Environment.THE_END, Arrays.asList("end", "the_end"));
35 |
36 | private final World.Environment bukkitType;
37 | private final Collection aliases;
38 |
39 | WorldType(
40 | final World.@NonNull Environment bukkitType,
41 | final @NonNull Collection<@NonNull String> aliases
42 | ) {
43 | this.bukkitType = bukkitType;
44 | this.aliases = aliases;
45 | }
46 |
47 | /**
48 | * Attempt to map a string to a world type
49 | *
50 | * @param string String to match
51 | * @return Optional containing the type, if found
52 | */
53 | public static @NonNull Optional<@NonNull WorldType> fromString(final @NonNull String string) {
54 | final String normalized = Objects.requireNonNull(string.toLowerCase());
55 | for (final WorldType worldType : values()) {
56 | if (worldType.getAliases().contains(normalized)) {
57 | return Optional.of(worldType);
58 | }
59 | }
60 | return Optional.empty();
61 | }
62 |
63 | /**
64 | * Get the world type from a bukkit environment
65 | *
66 | * @param environment Bukkit environment
67 | * @return Equivalent Hyperverse world type
68 | */
69 | public static @NonNull WorldType fromBukkit(final World.@NonNull Environment environment) {
70 | for (final WorldType worldType : values()) {
71 | if (worldType.getBukkitType() == environment) {
72 | return worldType;
73 | }
74 | }
75 | return WorldType.OVER_WORLD;
76 | }
77 |
78 | /**
79 | * Get the bukkit equivalent
80 | *
81 | * @return Bukkit equivalent
82 | */
83 | public World.@NonNull Environment getBukkitType() {
84 | return this.bukkitType;
85 | }
86 |
87 | /**
88 | * Get all aliases of the type name
89 | *
90 | * @return Name aliases
91 | */
92 | public @NonNull Collection<@NonNull String> getAliases() {
93 | return this.aliases;
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/hyperverse-core/src/main/java/org/incendo/hyperverse/world/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | /**
19 | * Classes related to worlds, world creation, world properties, etc
20 | */
21 | package org.incendo.hyperverse.world;
22 |
--------------------------------------------------------------------------------
/hyperverse-nms-1-20-6/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("hyperverse.base-conventions")
3 | alias(libs.plugins.paperweight.userdev)
4 | }
5 |
6 | indra {
7 | javaVersions {
8 | minimumToolchain(21)
9 | target(21)
10 | }
11 | }
12 |
13 | dependencies {
14 | paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT")
15 | compileOnly(projects.hyperverseNmsCommon)
16 | }
17 |
18 | tasks {
19 | assemble {
20 | dependsOn(reobfJar)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/hyperverse-nms-1-21-3/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("hyperverse.base-conventions")
3 | alias(libs.plugins.paperweight.userdev)
4 | }
5 |
6 | indra {
7 | javaVersions {
8 | minimumToolchain(21)
9 | target(21)
10 | }
11 | }
12 |
13 | dependencies {
14 | paperweight.paperDevBundle("1.21.3-R0.1-SNAPSHOT")
15 | compileOnly(projects.hyperverseNmsCommon)
16 | }
17 |
18 | tasks {
19 | assemble {
20 | dependsOn(reobfJar)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/hyperverse-nms-1-21-4/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("hyperverse.base-conventions")
3 | alias(libs.plugins.paperweight.userdev)
4 | }
5 |
6 | indra {
7 | javaVersions {
8 | minimumToolchain(21)
9 | target(21)
10 | }
11 | }
12 |
13 | dependencies {
14 | paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")
15 | compileOnly(projects.hyperverseNmsCommon)
16 | }
17 |
18 | tasks {
19 | assemble {
20 | dependsOn(reobfJar)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/hyperverse-nms-1-21/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("hyperverse.base-conventions")
3 | alias(libs.plugins.paperweight.userdev)
4 | }
5 |
6 | indra {
7 | javaVersions {
8 | minimumToolchain(21)
9 | target(21)
10 | }
11 | }
12 |
13 | dependencies {
14 | paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
15 | compileOnly(projects.hyperverseNmsCommon)
16 | }
17 |
18 | tasks {
19 | assemble {
20 | dependsOn(reobfJar)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/hyperverse-nms-common/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("hyperverse.base-conventions")
3 | }
4 |
5 | dependencies {
6 | compileOnly(libs.paper)
7 | compileOnlyApi(libs.paperlib)
8 | compileOnlyApi(libs.guice)
9 | compileOnlyApi(libs.taskchain)
10 | }
11 |
--------------------------------------------------------------------------------
/hyperverse-nms-common/src/main/java/org/incendo/hyperverse/util/HyperConfigShouldGroupProfiles.java:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | // Hyperverse - A minecraft world management plugin
4 | //
5 | // This program is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program. If not, see .
17 | //
18 |
19 | package org.incendo.hyperverse.util;
20 |
21 | import java.lang.annotation.ElementType;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.RetentionPolicy;
24 | import java.lang.annotation.Target;
25 |
26 | // This is a slight hack around the fact we can't have circular dependencies.
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Target({ElementType.PARAMETER, ElementType.METHOD})
29 | public @interface HyperConfigShouldGroupProfiles {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/hyperverse-nms-common/src/main/java/org/incendo/hyperverse/util/NMS.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.util;
19 |
20 | import org.bukkit.Location;
21 | import org.bukkit.entity.Entity;
22 | import org.bukkit.entity.Player;
23 | import org.checkerframework.checker.nullness.qual.NonNull;
24 | import org.checkerframework.checker.nullness.qual.Nullable;
25 |
26 | import java.nio.file.Path;
27 |
28 | /**
29 | * Version specific NMS utility methods
30 | */
31 | public interface NMS {
32 |
33 | /**
34 | * Get the nether portal at the given location or create a new one
35 | *
36 | * @param entity Entity that is searching for the portal
37 | * @param origin Origin location
38 | * @return Portal location
39 | */
40 | @Nullable
41 | Location getOrCreateNetherPortal(
42 | @NonNull Entity entity,
43 | @NonNull Location origin
44 | );
45 |
46 | /**
47 | * Get the spawn for the dimension containing the given location
48 | *
49 | * @param origin Origin location
50 | * @return Dimension spawn
51 | */
52 | @Nullable Location getDimensionSpawn(@NonNull Location origin);
53 |
54 | /**
55 | * Find the respawn location for a location that contains a bed
56 | *
57 | * @param spawnLocation Location to search from
58 | * @return The bed respawn location, if found
59 | */
60 | @Nullable Location findBedRespawn(@NonNull Location spawnLocation);
61 |
62 | /**
63 | * Save {@link Player player} data to a {@link Path file}
64 | *
65 | * @param player Player that owns the data.
66 | * @param file File to save the data to.
67 | */
68 | void writePlayerData(@NonNull Player player, @NonNull Path file);
69 |
70 | /**
71 | * Read the {@link Player player} data from a {@link Path file} into the given {@link Player} object
72 | *
73 | * @param player Player to read data into.
74 | * @param file File to read data from.
75 | * @param whenDone Runnable that runs when the reading is complete.
76 | */
77 | void readPlayerData(
78 | @NonNull Player player,
79 | @NonNull Path file,
80 | @NonNull Runnable whenDone
81 | );
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/hyperverse-nms-common/src/main/java/org/incendo/hyperverse/util/package-info.java:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | // Hyperverse - A minecraft world management plugin
4 | //
5 | // This program is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program. If not, see .
17 | //
18 |
19 | /**
20 | * Utility classes.
21 | */
22 | package org.incendo.hyperverse.util;
23 |
--------------------------------------------------------------------------------
/hyperverse-nms-unsupported/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("hyperverse.base-conventions")
3 | }
4 |
5 | dependencies {
6 | compileOnly(projects.hyperverseNmsCommon)
7 | compileOnly(libs.paper)
8 | }
9 |
--------------------------------------------------------------------------------
/hyperverse-nms-unsupported/src/main/java/org/incendo/hyperverse/platform/unsupported/NMSImpl.java:
--------------------------------------------------------------------------------
1 | //
2 | // Hyperverse - A minecraft world management plugin
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 | //
17 |
18 | package org.incendo.hyperverse.platform.unsupported;
19 |
20 | import org.bukkit.Location;
21 | import org.bukkit.World;
22 | import org.bukkit.entity.Entity;
23 | import org.bukkit.entity.Player;
24 | import org.checkerframework.checker.nullness.qual.NonNull;
25 | import org.checkerframework.checker.nullness.qual.Nullable;
26 | import org.incendo.hyperverse.util.NMS;
27 |
28 | import java.nio.file.Path;
29 | import java.util.Objects;
30 |
31 | @SuppressWarnings("unused")
32 | public class NMSImpl implements NMS {
33 |
34 | @Override
35 | public @Nullable Location getOrCreateNetherPortal(
36 | final @NonNull Entity entity,
37 | final @NonNull Location origin
38 | ) {
39 | throw new UnsupportedOperationException("Not supported.");
40 | }
41 |
42 | @Override
43 | public @Nullable Location getDimensionSpawn(final @NonNull Location origin) {
44 | if (Objects.requireNonNull(origin.getWorld()).getEnvironment()
45 | == World.Environment.THE_END) {
46 | return new Location(origin.getWorld(), 100, 50, 0);
47 | }
48 | return origin.getWorld().getSpawnLocation();
49 | }
50 |
51 | @Override
52 | public void writePlayerData(final @NonNull Player player, final @NonNull Path file) {
53 | throw new UnsupportedOperationException("Not supported.");
54 | }
55 |
56 | @Override
57 | public void readPlayerData(final @NonNull Player player, final @NonNull Path file, final @NonNull Runnable whenDone) {
58 | throw new UnsupportedOperationException("Not supported.");
59 | }
60 |
61 | @Override
62 | public @Nullable Location findBedRespawn(final @NonNull Location spawnLocation) {
63 | throw new UnsupportedOperationException("Not supported.");
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
2 |
3 | pluginManagement {
4 | repositories {
5 | gradlePluginPortal()
6 | }
7 | includeBuild("gradle/build-logic")
8 | }
9 |
10 | rootProject.name = "Hyperverse"
11 |
12 | include(":hyperverse-nms-common")
13 | include(":hyperverse-core")
14 |
15 | include(":hyperverse-nms-unsupported")
16 | include(":hyperverse-nms-1-20-6")
17 | include(":hyperverse-nms-1-21")
18 | include(":hyperverse-nms-1-21-3")
19 | include(":hyperverse-nms-1-21-4")
20 |
--------------------------------------------------------------------------------