diff --git a/build.gradle.kts b/build.gradle.kts index c44aad78..9197254f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,6 +16,7 @@ repositories { } dependencies { + api(project(":util")) implementation("com.google.code.gson:gson:2.8.5") implementation("org.apache.logging.log4j:log4j-core:2.11.1") implementation("org.apache.logging.log4j:log4j-api:2.11.1") diff --git a/plugins/api/item/LootTableItem.kt b/plugins/api/item/LootTableItem.kt index a9166779..6268da43 100644 --- a/plugins/api/item/LootTableItem.kt +++ b/plugins/api/item/LootTableItem.kt @@ -2,7 +2,7 @@ package api.item import io.luna.game.model.def.ItemDefinition import io.luna.game.model.item.Item -import io.luna.util.Rational +import io.luna.util.common.Rational /** * A model representing an item within a [LootTable]. diff --git a/plugins/api/item/LootTableReceiver.kt b/plugins/api/item/LootTableReceiver.kt index 12a8a133..73b81948 100644 --- a/plugins/api/item/LootTableReceiver.kt +++ b/plugins/api/item/LootTableReceiver.kt @@ -1,7 +1,7 @@ package api.item import api.predef.* -import io.luna.util.Rational +import io.luna.util.common.Rational /** * A model representing the primary [lootTable] receiver. diff --git a/plugins/api/item/RarityReceiver.kt b/plugins/api/item/RarityReceiver.kt index 1c4b1ae6..06dbdd47 100644 --- a/plugins/api/item/RarityReceiver.kt +++ b/plugins/api/item/RarityReceiver.kt @@ -1,6 +1,6 @@ package api.item -import io.luna.util.Rational +import io.luna.util.common.Rational /** * A model representing the [LootTableReceiver.rarity] receiver. diff --git a/plugins/api/predef/FunctionsPredef.kt b/plugins/api/predef/FunctionsPredef.kt index 760260ad..0b38cb8e 100644 --- a/plugins/api/predef/FunctionsPredef.kt +++ b/plugins/api/predef/FunctionsPredef.kt @@ -8,7 +8,7 @@ import io.luna.game.model.def.EquipmentDefinition import io.luna.game.model.def.ItemDefinition import io.luna.game.model.def.NpcDefinition import io.luna.game.model.def.ObjectDefinition -import io.luna.util.StringUtils +import io.luna.util.common.StringUtils import java.time.Duration import java.util.concurrent.ThreadLocalRandom import java.util.concurrent.TimeUnit diff --git a/plugins/api/predef/PropertiesPredef.kt b/plugins/api/predef/PropertiesPredef.kt index 46de0b60..053c7e02 100644 --- a/plugins/api/predef/PropertiesPredef.kt +++ b/plugins/api/predef/PropertiesPredef.kt @@ -9,8 +9,8 @@ import io.luna.game.model.mob.PlayerRights import io.luna.game.model.mob.Skill import io.luna.game.plugin.KotlinBindings import io.luna.game.plugin.PluginBootstrap -import io.luna.util.Rational -import io.luna.util.ReflectionUtils +import io.luna.util.common.Rational +import io.luna.util.common.ReflectionUtils /** * The Kotlin bindings. Not accessible to scripts. diff --git a/settings.gradle.kts b/settings.gradle.kts index ff326966..c0ca49ee 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,3 +3,4 @@ */ rootProject.name = "luna" +include("util") diff --git a/src/main/java/io/luna/LunaServer.java b/src/main/java/io/luna/LunaServer.java index 90363ce0..40bf9b27 100644 --- a/src/main/java/io/luna/LunaServer.java +++ b/src/main/java/io/luna/LunaServer.java @@ -7,9 +7,9 @@ import io.luna.net.LunaChannelFilter; import io.luna.net.LunaChannelInitializer; import io.luna.net.msg.GameMessageRepository; -import io.luna.util.AsyncExecutor; -import io.luna.util.ThreadUtils; -import io.luna.util.Tuple; +import io.luna.util.concurrent.AsyncExecutor; +import io.luna.util.concurrent.ThreadUtils; +import io.luna.util.common.Tuple; import io.luna.util.parser.impl.BlacklistFileParser; import io.luna.util.parser.impl.EquipmentDefinitionFileParser; import io.luna.util.parser.impl.ItemDefinitionFileParser; diff --git a/src/main/java/io/luna/game/event/EventListener.java b/src/main/java/io/luna/game/event/EventListener.java index fa837189..1bb3ad95 100644 --- a/src/main/java/io/luna/game/event/EventListener.java +++ b/src/main/java/io/luna/game/event/EventListener.java @@ -3,7 +3,7 @@ import com.google.common.base.MoreObjects; import io.luna.game.plugin.Script; import io.luna.game.plugin.ScriptExecutionException; -import io.luna.util.ReflectionUtils; +import io.luna.util.common.ReflectionUtils; import java.util.function.Consumer; diff --git a/src/main/java/io/luna/game/event/EventMatcherListener.java b/src/main/java/io/luna/game/event/EventMatcherListener.java index 41843d1d..7520e592 100644 --- a/src/main/java/io/luna/game/event/EventMatcherListener.java +++ b/src/main/java/io/luna/game/event/EventMatcherListener.java @@ -2,7 +2,7 @@ import io.luna.game.plugin.Script; import io.luna.game.plugin.ScriptExecutionException; -import io.luna.util.ReflectionUtils; +import io.luna.util.common.ReflectionUtils; import java.util.function.Consumer; diff --git a/src/main/java/io/luna/game/event/impl/CommandEvent.java b/src/main/java/io/luna/game/event/impl/CommandEvent.java index f298c5b6..0e74b2c8 100644 --- a/src/main/java/io/luna/game/event/impl/CommandEvent.java +++ b/src/main/java/io/luna/game/event/impl/CommandEvent.java @@ -1,7 +1,7 @@ package io.luna.game.event.impl; import io.luna.game.model.mob.Player; -import io.luna.util.StringUtils; +import io.luna.util.common.StringUtils; /** * An event sent when a player activates a command. diff --git a/src/main/java/io/luna/game/model/Area.java b/src/main/java/io/luna/game/model/Area.java index c1609e4a..c4485719 100644 --- a/src/main/java/io/luna/game/model/Area.java +++ b/src/main/java/io/luna/game/model/Area.java @@ -1,7 +1,7 @@ package io.luna.game.model; import io.luna.game.model.mob.Player; -import io.luna.util.RandomUtils; +import io.luna.util.common.RandomUtils; import java.util.Objects; diff --git a/src/main/java/io/luna/game/model/World.java b/src/main/java/io/luna/game/model/World.java index 2927ad5c..2b9ec185 100644 --- a/src/main/java/io/luna/game/model/World.java +++ b/src/main/java/io/luna/game/model/World.java @@ -18,7 +18,7 @@ import io.luna.game.task.TaskManager; import io.luna.net.msg.out.NpcUpdateMessageWriter; import io.luna.net.msg.out.PlayerUpdateMessageWriter; -import io.luna.util.ThreadUtils; +import io.luna.util.concurrent.ThreadUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; diff --git a/src/main/java/io/luna/game/model/chunk/ChunkMobComparator.java b/src/main/java/io/luna/game/model/chunk/ChunkMobComparator.java index fd1de552..5fce910d 100644 --- a/src/main/java/io/luna/game/model/chunk/ChunkMobComparator.java +++ b/src/main/java/io/luna/game/model/chunk/ChunkMobComparator.java @@ -4,7 +4,7 @@ import io.luna.game.model.EntityType; import io.luna.game.model.mob.Mob; import io.luna.game.model.mob.Player; -import io.luna.util.Tuple; +import io.luna.util.common.Tuple; import java.util.Comparator; import java.util.function.BiFunction; diff --git a/src/main/java/io/luna/game/model/def/EquipmentDefinition.java b/src/main/java/io/luna/game/model/def/EquipmentDefinition.java index 010677ce..1cc803e1 100644 --- a/src/main/java/io/luna/game/model/def/EquipmentDefinition.java +++ b/src/main/java/io/luna/game/model/def/EquipmentDefinition.java @@ -11,7 +11,7 @@ import java.util.Arrays; import java.util.Optional; -import static io.luna.util.StringUtils.addArticle; +import static io.luna.util.common.StringUtils.addArticle; /** * A model describing an equipment item definition. diff --git a/src/main/java/io/luna/game/model/item/Equipment.java b/src/main/java/io/luna/game/model/item/Equipment.java index 07af06e8..b8183a05 100644 --- a/src/main/java/io/luna/game/model/item/Equipment.java +++ b/src/main/java/io/luna/game/model/item/Equipment.java @@ -13,9 +13,9 @@ import java.util.OptionalInt; import java.util.function.IntUnaryOperator; -import static io.luna.util.OptionalUtils.ifPresent; -import static io.luna.util.OptionalUtils.mapToInt; -import static io.luna.util.OptionalUtils.matches; +import static io.luna.util.common.OptionalUtils.ifPresent; +import static io.luna.util.common.OptionalUtils.mapToInt; +import static io.luna.util.common.OptionalUtils.matches; /** * An item container model representing a player's equipment. diff --git a/src/main/java/io/luna/game/model/item/ItemContainer.java b/src/main/java/io/luna/game/model/item/ItemContainer.java index d62f2f68..6f76dffc 100644 --- a/src/main/java/io/luna/game/model/item/ItemContainer.java +++ b/src/main/java/io/luna/game/model/item/ItemContainer.java @@ -28,8 +28,8 @@ import static com.google.common.base.Preconditions.checkState; import static io.luna.game.model.item.ItemContainer.StackPolicy.ALWAYS; import static io.luna.game.model.item.ItemContainer.StackPolicy.STANDARD; -import static io.luna.util.OptionalUtils.mapToInt; -import static io.luna.util.OptionalUtils.matches; +import static io.luna.util.common.OptionalUtils.mapToInt; +import static io.luna.util.common.OptionalUtils.matches; import static java.util.Objects.requireNonNull; /** diff --git a/src/main/java/io/luna/game/model/mob/PlayerCredentials.java b/src/main/java/io/luna/game/model/mob/PlayerCredentials.java index 1424ea36..1be81064 100644 --- a/src/main/java/io/luna/game/model/mob/PlayerCredentials.java +++ b/src/main/java/io/luna/game/model/mob/PlayerCredentials.java @@ -1,6 +1,6 @@ package io.luna.game.model.mob; -import io.luna.util.StringUtils; +import io.luna.util.common.StringUtils; /** * A model representing a player's credentials. diff --git a/src/main/java/io/luna/game/model/mob/PlayerRights.java b/src/main/java/io/luna/game/model/mob/PlayerRights.java index 1c21c31f..6da4b161 100644 --- a/src/main/java/io/luna/game/model/mob/PlayerRights.java +++ b/src/main/java/io/luna/game/model/mob/PlayerRights.java @@ -1,6 +1,6 @@ package io.luna.game.model.mob; -import io.luna.util.StringUtils; +import io.luna.util.common.StringUtils; import static com.google.common.base.Preconditions.checkArgument; diff --git a/src/main/java/io/luna/game/model/mob/dialogue/Expression.java b/src/main/java/io/luna/game/model/mob/dialogue/Expression.java index 5cc7423a..bfadfdc3 100644 --- a/src/main/java/io/luna/game/model/mob/dialogue/Expression.java +++ b/src/main/java/io/luna/game/model/mob/dialogue/Expression.java @@ -1,7 +1,7 @@ package io.luna.game.model.mob.dialogue; import io.luna.net.msg.out.WidgetAnimationMessageWriter; -import io.luna.util.RandomUtils; +import io.luna.util.common.RandomUtils; import static com.google.common.base.Preconditions.checkArgument; diff --git a/src/main/java/io/luna/game/model/mob/dialogue/GiveItemDialogueInterface.java b/src/main/java/io/luna/game/model/mob/dialogue/GiveItemDialogueInterface.java index 52ebfa5e..a2ca56cf 100644 --- a/src/main/java/io/luna/game/model/mob/dialogue/GiveItemDialogueInterface.java +++ b/src/main/java/io/luna/game/model/mob/dialogue/GiveItemDialogueInterface.java @@ -4,7 +4,7 @@ import io.luna.game.model.mob.Player; import io.luna.game.model.mob.inter.DialogueInterface; import io.luna.net.msg.out.WidgetItemModelMessageWriter; -import io.luna.util.StringUtils; +import io.luna.util.common.StringUtils; /** * A {@link DialogueInterface} implementation that opens a dialogue which grants the Player an item. diff --git a/src/main/java/io/luna/game/model/mob/persistence/PlayerPersistence.java b/src/main/java/io/luna/game/model/mob/persistence/PlayerPersistence.java index 3753a52f..8bf2a09a 100644 --- a/src/main/java/io/luna/game/model/mob/persistence/PlayerPersistence.java +++ b/src/main/java/io/luna/game/model/mob/persistence/PlayerPersistence.java @@ -2,7 +2,7 @@ import io.luna.Luna; import io.luna.game.model.mob.Player; -import io.luna.util.ReflectionUtils; +import io.luna.util.common.ReflectionUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.mindrot.jbcrypt.BCrypt; diff --git a/src/main/java/io/luna/game/plugin/PluginBootstrap.java b/src/main/java/io/luna/game/plugin/PluginBootstrap.java index ebb8d08c..188cd88c 100644 --- a/src/main/java/io/luna/game/plugin/PluginBootstrap.java +++ b/src/main/java/io/luna/game/plugin/PluginBootstrap.java @@ -7,9 +7,9 @@ import io.luna.game.event.EventListenerPipelineSet; import io.luna.game.event.EventMatcherListener; import io.luna.game.service.GameService; -import io.luna.util.AsyncExecutor; -import io.luna.util.ThreadUtils; -import io.luna.util.Tuple; +import io.luna.util.concurrent.AsyncExecutor; +import io.luna.util.concurrent.ThreadUtils; +import io.luna.util.common.Tuple; import io.luna.util.gui.PluginGui; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -19,7 +19,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashSet; diff --git a/src/main/java/io/luna/game/service/AuthenticationService.java b/src/main/java/io/luna/game/service/AuthenticationService.java index 432cebeb..ce780069 100644 --- a/src/main/java/io/luna/game/service/AuthenticationService.java +++ b/src/main/java/io/luna/game/service/AuthenticationService.java @@ -4,7 +4,7 @@ import com.google.common.util.concurrent.ListeningExecutorService; import io.luna.game.model.World; import io.luna.game.model.mob.persistence.PlayerPersistence; -import io.luna.util.ExecutorUtils; +import io.luna.util.concurrent.ExecutorUtils; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/src/main/java/io/luna/game/service/GameService.java b/src/main/java/io/luna/game/service/GameService.java index 2c6eae92..4647033e 100644 --- a/src/main/java/io/luna/game/service/GameService.java +++ b/src/main/java/io/luna/game/service/GameService.java @@ -12,7 +12,7 @@ import io.luna.game.plugin.PluginManager; import io.luna.game.task.Task; import io.luna.net.msg.out.SystemUpdateMessageWriter; -import io.luna.util.ExecutorUtils; +import io.luna.util.concurrent.ExecutorUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -23,7 +23,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; -import static io.luna.util.ThreadUtils.awaitTerminationUninterruptibly; +import static io.luna.util.concurrent.ThreadUtils.awaitTerminationUninterruptibly; /** * An {@link AbstractScheduledService} implementation that handles the launch, processing, and termination diff --git a/src/main/java/io/luna/game/service/LoginService.java b/src/main/java/io/luna/game/service/LoginService.java index 936dc7c0..f596a424 100644 --- a/src/main/java/io/luna/game/service/LoginService.java +++ b/src/main/java/io/luna/game/service/LoginService.java @@ -13,7 +13,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import static io.luna.util.ThreadUtils.awaitTerminationUninterruptibly; +import static io.luna.util.concurrent.ThreadUtils.awaitTerminationUninterruptibly; import static org.apache.logging.log4j.util.Unbox.box; /** diff --git a/src/main/java/io/luna/game/service/LogoutService.java b/src/main/java/io/luna/game/service/LogoutService.java index 3351fa49..73ec4b2e 100644 --- a/src/main/java/io/luna/game/service/LogoutService.java +++ b/src/main/java/io/luna/game/service/LogoutService.java @@ -10,7 +10,7 @@ import java.util.Set; -import static io.luna.util.ThreadUtils.awaitTerminationUninterruptibly; +import static io.luna.util.concurrent.ThreadUtils.awaitTerminationUninterruptibly; import static org.apache.logging.log4j.util.Unbox.box; /** diff --git a/src/main/java/io/luna/game/service/PersistenceService.java b/src/main/java/io/luna/game/service/PersistenceService.java index 07de71a6..5d360e43 100644 --- a/src/main/java/io/luna/game/service/PersistenceService.java +++ b/src/main/java/io/luna/game/service/PersistenceService.java @@ -9,7 +9,7 @@ import io.luna.game.model.World; import io.luna.game.model.mob.Player; import io.luna.game.model.mob.persistence.PlayerData; -import io.luna.util.ExecutorUtils; +import io.luna.util.concurrent.ExecutorUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; @@ -18,7 +18,7 @@ import java.util.concurrent.Executors; import java.util.function.Consumer; -import static io.luna.util.ThreadUtils.awaitTerminationUninterruptibly; +import static io.luna.util.concurrent.ThreadUtils.awaitTerminationUninterruptibly; import static org.apache.logging.log4j.util.Unbox.box; /** diff --git a/src/main/java/io/luna/net/msg/in/ChatMessageReader.java b/src/main/java/io/luna/net/msg/in/ChatMessageReader.java index 0859fc77..a61d32d6 100644 --- a/src/main/java/io/luna/net/msg/in/ChatMessageReader.java +++ b/src/main/java/io/luna/net/msg/in/ChatMessageReader.java @@ -8,7 +8,7 @@ import io.luna.net.msg.GameMessage; import io.luna.net.msg.GameMessageReader; import io.luna.util.LoggingSettings.FileOutputType; -import io.luna.util.StringUtils; +import io.luna.util.common.StringUtils; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/io/luna/net/msg/in/NameInputMessageReader.java b/src/main/java/io/luna/net/msg/in/NameInputMessageReader.java index 634778bd..c4974d79 100644 --- a/src/main/java/io/luna/net/msg/in/NameInputMessageReader.java +++ b/src/main/java/io/luna/net/msg/in/NameInputMessageReader.java @@ -7,7 +7,7 @@ import io.luna.game.model.mob.inter.NameInputInterface; import io.luna.net.msg.GameMessage; import io.luna.net.msg.GameMessageReader; -import io.luna.util.StringUtils; +import io.luna.util.common.StringUtils; import java.util.Optional; import java.util.OptionalInt; diff --git a/src/main/java/io/luna/net/msg/in/PrivateChatMessageReader.java b/src/main/java/io/luna/net/msg/in/PrivateChatMessageReader.java index 9be79be7..f0cb339a 100644 --- a/src/main/java/io/luna/net/msg/in/PrivateChatMessageReader.java +++ b/src/main/java/io/luna/net/msg/in/PrivateChatMessageReader.java @@ -9,7 +9,7 @@ import io.luna.net.msg.GameMessage; import io.luna.net.msg.GameMessageReader; import io.luna.util.LoggingSettings.FileOutputType; -import io.luna.util.StringUtils; +import io.luna.util.common.StringUtils; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/io/luna/util/gui/PluginTreeItem.java b/src/main/java/io/luna/util/gui/PluginTreeItem.java index c18c8056..1d329161 100644 --- a/src/main/java/io/luna/util/gui/PluginTreeItem.java +++ b/src/main/java/io/luna/util/gui/PluginTreeItem.java @@ -11,7 +11,7 @@ import java.util.function.BiConsumer; import java.util.stream.Collectors; -import static io.luna.util.StringUtils.COMMA_JOINER; +import static io.luna.util.common.StringUtils.COMMA_JOINER; import static io.luna.util.gui.PluginGuiImage.*; /** diff --git a/src/main/java/io/luna/util/parser/impl/EquipmentDefinitionFileParser.java b/src/main/java/io/luna/util/parser/impl/EquipmentDefinitionFileParser.java index 0b588caf..c210f92c 100644 --- a/src/main/java/io/luna/util/parser/impl/EquipmentDefinitionFileParser.java +++ b/src/main/java/io/luna/util/parser/impl/EquipmentDefinitionFileParser.java @@ -4,7 +4,7 @@ import com.google.gson.JsonObject; import io.luna.game.model.def.EquipmentDefinition; import io.luna.game.model.def.EquipmentDefinition.Requirement; -import io.luna.util.GsonUtils; +import io.luna.util.common.GsonUtils; import io.luna.util.parser.AbstractJsonFileParser; /** diff --git a/src/main/java/io/luna/util/parser/impl/ItemDefinitionFileParser.java b/src/main/java/io/luna/util/parser/impl/ItemDefinitionFileParser.java index b797d6ef..f487ce02 100644 --- a/src/main/java/io/luna/util/parser/impl/ItemDefinitionFileParser.java +++ b/src/main/java/io/luna/util/parser/impl/ItemDefinitionFileParser.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.gson.JsonObject; import io.luna.game.model.def.ItemDefinition; -import io.luna.util.GsonUtils; +import io.luna.util.common.GsonUtils; import io.luna.util.parser.AbstractJsonFileParser; /** diff --git a/src/main/java/io/luna/util/parser/impl/NpcCombatDefinitionFileParser.java b/src/main/java/io/luna/util/parser/impl/NpcCombatDefinitionFileParser.java index e88f1a70..d1f89ca4 100644 --- a/src/main/java/io/luna/util/parser/impl/NpcCombatDefinitionFileParser.java +++ b/src/main/java/io/luna/util/parser/impl/NpcCombatDefinitionFileParser.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.gson.JsonObject; import io.luna.game.model.def.NpcCombatDefinition; -import io.luna.util.GsonUtils; +import io.luna.util.common.GsonUtils; import io.luna.util.parser.AbstractJsonFileParser; /** diff --git a/src/main/java/io/luna/util/parser/impl/NpcDefinitionFileParser.java b/src/main/java/io/luna/util/parser/impl/NpcDefinitionFileParser.java index 544c515f..364914c3 100644 --- a/src/main/java/io/luna/util/parser/impl/NpcDefinitionFileParser.java +++ b/src/main/java/io/luna/util/parser/impl/NpcDefinitionFileParser.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.gson.JsonObject; import io.luna.game.model.def.NpcDefinition; -import io.luna.util.GsonUtils; +import io.luna.util.common.GsonUtils; import io.luna.util.parser.AbstractJsonFileParser; /** diff --git a/src/main/java/io/luna/util/parser/impl/ObjectDefinitionFileParser.java b/src/main/java/io/luna/util/parser/impl/ObjectDefinitionFileParser.java index b9c991de..016f9a6e 100644 --- a/src/main/java/io/luna/util/parser/impl/ObjectDefinitionFileParser.java +++ b/src/main/java/io/luna/util/parser/impl/ObjectDefinitionFileParser.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.gson.JsonObject; import io.luna.game.model.def.ObjectDefinition; -import io.luna.util.GsonUtils; +import io.luna.util.common.GsonUtils; import io.luna.util.parser.AbstractJsonFileParser; /** diff --git a/src/test/java/io/luna/game/model/mob/attr/AttributeTest.java b/src/test/java/io/luna/game/model/mob/attr/AttributeTest.java index e45e797b..76c68df4 100644 --- a/src/test/java/io/luna/game/model/mob/attr/AttributeTest.java +++ b/src/test/java/io/luna/game/model/mob/attr/AttributeTest.java @@ -1,6 +1,6 @@ package io.luna.game.model.mob.attr; -import io.luna.util.GsonUtils; +import io.luna.util.common.GsonUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; diff --git a/util/build.gradle.kts b/util/build.gradle.kts new file mode 100644 index 00000000..877a3c04 --- /dev/null +++ b/util/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + `java-library` +} + +group = "luna" +version = "1.0" + +repositories { + mavenCentral() +} + +dependencies { + implementation("com.google.code.gson:gson:2.8.5") + implementation("com.google.guava:guava:27.0.1-jre") + implementation("org.apache.logging.log4j:log4j-core:2.11.1") + implementation("org.apache.logging.log4j:log4j-api:2.11.1") +} + +java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} \ No newline at end of file diff --git a/src/main/java/io/luna/util/GsonUtils.java b/util/src/main/java/io/luna/util/common/GsonUtils.java similarity index 98% rename from src/main/java/io/luna/util/GsonUtils.java rename to util/src/main/java/io/luna/util/common/GsonUtils.java index df32cc4e..ff640912 100644 --- a/src/main/java/io/luna/util/GsonUtils.java +++ b/util/src/main/java/io/luna/util/common/GsonUtils.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; diff --git a/src/main/java/io/luna/util/LazyVal.java b/util/src/main/java/io/luna/util/common/LazyVal.java similarity index 97% rename from src/main/java/io/luna/util/LazyVal.java rename to util/src/main/java/io/luna/util/common/LazyVal.java index 05bcc544..52f58fae 100644 --- a/src/main/java/io/luna/util/LazyVal.java +++ b/util/src/main/java/io/luna/util/common/LazyVal.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import com.google.common.base.Suppliers; diff --git a/src/main/java/io/luna/util/OptionalUtils.java b/util/src/main/java/io/luna/util/common/OptionalUtils.java similarity index 99% rename from src/main/java/io/luna/util/OptionalUtils.java rename to util/src/main/java/io/luna/util/common/OptionalUtils.java index 278eadec..65e92cac 100644 --- a/src/main/java/io/luna/util/OptionalUtils.java +++ b/util/src/main/java/io/luna/util/common/OptionalUtils.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import java.util.Objects; import java.util.Optional; diff --git a/src/main/java/io/luna/util/RandomUtils.java b/util/src/main/java/io/luna/util/common/RandomUtils.java similarity index 99% rename from src/main/java/io/luna/util/RandomUtils.java rename to util/src/main/java/io/luna/util/common/RandomUtils.java index fa04091b..d7e83ac4 100644 --- a/src/main/java/io/luna/util/RandomUtils.java +++ b/util/src/main/java/io/luna/util/common/RandomUtils.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import com.google.common.collect.BoundType; import com.google.common.collect.Range; diff --git a/src/main/java/io/luna/util/RangeIterator.java b/util/src/main/java/io/luna/util/common/RangeIterator.java similarity index 97% rename from src/main/java/io/luna/util/RangeIterator.java rename to util/src/main/java/io/luna/util/common/RangeIterator.java index bb999231..2af10104 100644 --- a/src/main/java/io/luna/util/RangeIterator.java +++ b/util/src/main/java/io/luna/util/common/RangeIterator.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import com.google.common.collect.ContiguousSet; import com.google.common.collect.DiscreteDomain; diff --git a/src/main/java/io/luna/util/Rational.java b/util/src/main/java/io/luna/util/common/Rational.java similarity index 99% rename from src/main/java/io/luna/util/Rational.java rename to util/src/main/java/io/luna/util/common/Rational.java index 72abaafe..f441bbdb 100644 --- a/src/main/java/io/luna/util/Rational.java +++ b/util/src/main/java/io/luna/util/common/Rational.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import java.math.BigInteger; import java.util.Objects; diff --git a/src/main/java/io/luna/util/ReflectionUtils.java b/util/src/main/java/io/luna/util/common/ReflectionUtils.java similarity index 99% rename from src/main/java/io/luna/util/ReflectionUtils.java rename to util/src/main/java/io/luna/util/common/ReflectionUtils.java index 3cd40d21..5e49b48c 100644 --- a/src/main/java/io/luna/util/ReflectionUtils.java +++ b/util/src/main/java/io/luna/util/common/ReflectionUtils.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import java.lang.reflect.Constructor; import java.lang.reflect.Field; diff --git a/src/main/java/io/luna/util/StringUtils.java b/util/src/main/java/io/luna/util/common/StringUtils.java similarity index 99% rename from src/main/java/io/luna/util/StringUtils.java rename to util/src/main/java/io/luna/util/common/StringUtils.java index 5ebb9497..89060f15 100644 --- a/src/main/java/io/luna/util/StringUtils.java +++ b/util/src/main/java/io/luna/util/common/StringUtils.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import com.google.common.base.Joiner; diff --git a/src/main/java/io/luna/util/Tuple.java b/util/src/main/java/io/luna/util/common/Tuple.java similarity index 98% rename from src/main/java/io/luna/util/Tuple.java rename to util/src/main/java/io/luna/util/common/Tuple.java index 709a053f..94788a6f 100644 --- a/src/main/java/io/luna/util/Tuple.java +++ b/util/src/main/java/io/luna/util/common/Tuple.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.common; import com.google.common.base.MoreObjects; diff --git a/src/main/java/io/luna/util/AsyncExecutor.java b/util/src/main/java/io/luna/util/concurrent/AsyncExecutor.java similarity index 99% rename from src/main/java/io/luna/util/AsyncExecutor.java rename to util/src/main/java/io/luna/util/concurrent/AsyncExecutor.java index 22d070e4..9de3eef2 100644 --- a/src/main/java/io/luna/util/AsyncExecutor.java +++ b/util/src/main/java/io/luna/util/concurrent/AsyncExecutor.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.concurrent; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; diff --git a/src/main/java/io/luna/util/ExecutorUtils.java b/util/src/main/java/io/luna/util/concurrent/ExecutorUtils.java similarity index 90% rename from src/main/java/io/luna/util/ExecutorUtils.java rename to util/src/main/java/io/luna/util/concurrent/ExecutorUtils.java index 7b59bf1a..07e750f1 100644 --- a/src/main/java/io/luna/util/ExecutorUtils.java +++ b/util/src/main/java/io/luna/util/concurrent/ExecutorUtils.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.concurrent; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; @@ -6,12 +6,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.concurrent.Executor; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.*; import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy; -import java.util.concurrent.TimeUnit; /** * A static-utility class that contains functions for manipulating {@link Executor}s. diff --git a/src/main/java/io/luna/util/ThreadUtils.java b/util/src/main/java/io/luna/util/concurrent/ThreadUtils.java similarity index 98% rename from src/main/java/io/luna/util/ThreadUtils.java rename to util/src/main/java/io/luna/util/concurrent/ThreadUtils.java index 969f239d..05e1ce45 100644 --- a/src/main/java/io/luna/util/ThreadUtils.java +++ b/util/src/main/java/io/luna/util/concurrent/ThreadUtils.java @@ -1,4 +1,4 @@ -package io.luna.util; +package io.luna.util.concurrent; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/io/luna/util/parser/AbstractFileParser.java b/util/src/main/java/io/luna/util/parser/AbstractFileParser.java similarity index 100% rename from src/main/java/io/luna/util/parser/AbstractFileParser.java rename to util/src/main/java/io/luna/util/parser/AbstractFileParser.java diff --git a/src/main/java/io/luna/util/parser/AbstractJsonFileParser.java b/util/src/main/java/io/luna/util/parser/AbstractJsonFileParser.java similarity index 100% rename from src/main/java/io/luna/util/parser/AbstractJsonFileParser.java rename to util/src/main/java/io/luna/util/parser/AbstractJsonFileParser.java diff --git a/src/main/java/io/luna/util/parser/AbstractNewLineFileParser.java b/util/src/main/java/io/luna/util/parser/AbstractNewLineFileParser.java similarity index 100% rename from src/main/java/io/luna/util/parser/AbstractNewLineFileParser.java rename to util/src/main/java/io/luna/util/parser/AbstractNewLineFileParser.java