From b8c14b13f59e9137181abbc9a050ae1776f16144 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Mon, 29 Jun 2020 00:23:06 +0100 Subject: [PATCH] Moving stuff and looking at better registry --- .../config/RepositoryModule.java | 2 +- .../core/AdvancedPortalsCore.java | 26 +++--- .../advancedportals/core/CoreListeners.java | 4 +- .../{ => core}/api/commands/SubCommand.java | 2 +- .../api/destination/Destination.java | 8 +- .../{ => core}/api/effect/TestEffect.java | 4 +- .../{ => core}/api/effect/WarpEffect.java | 4 +- .../api/events/PortalEditEvent.java | 2 +- .../api/events/PortalsLoadedEvent.java | 2 +- .../{ => core}/api/events/WarpEvent.java | 0 .../{ => core}/api/portal/AdvancedPortal.java | 8 +- .../api/registry/SubCommandRegistry.java | 4 +- .../{ => core}/api/registry/TagRegistry.java | 4 +- .../api/registry/WarpEffectRegistry.java | 4 +- .../api/services/DestinationServices.java | 4 +- .../api/services/PortalServices.java | 4 +- .../api/services/PortalTempDataServices.java | 2 +- .../api/warphandler/ActivationData.java | 0 .../api/warphandler/TagHandler.java | 0 .../{ => core}/commands/CommandTemplate.java | 2 +- .../commands/CommandWithSubCommands.java | 9 +- .../subcommands/CreateSubCommand.java | 2 +- .../desti/CreateDestiSubCommand.java | 8 +- .../portal/CreatePortalSubCommand.java | 8 +- .../portal/EndGatewayBlockSubCommand.java | 4 +- .../portal/EndPortalBlockSubCommand.java | 4 +- .../portal/PortalBlockSubCommand.java | 4 +- .../subcommands/portal/ReloadSubCommand.java | 4 +- .../subcommands/portal/RemoveSubCommand.java | 6 +- .../portal/SelectorSubCommand.java | 4 +- .../portal/TransUpdateSubCommand.java | 4 +- .../subcommands/portal/VersionSubCommand.java | 7 +- .../core/registry/AnnotationScanner.java | 9 ++ .../advancedportals/core/registry/SubCmd.java | 18 ++++ .../coreconnector/command/CommandHandler.java | 2 +- .../command/CommandRegister.java | 2 +- .../repository/DestinationRepository.java | 2 - .../repository/DestinationRepositoryImpl.java | 8 +- .../DestinationRepositoryImpl2.java | 85 ------------------- .../repository/DestinationRepositoryOld.java | 2 +- .../repository/PortalRepositoryImpl.java | 11 +++ .../services/DestinationServices.java | 16 ++-- .../services/PortalServices.java | 10 +-- .../convertolddata/ConvertOldSubCommand.java | 2 +- .../command/SpigotCommandHandler.java | 2 +- .../command/SpigotCommandRegister.java | 2 +- .../container/SpigotPlayerContainer.java | 2 +- .../spigot/effect/WarpEffectEnder.java | 4 +- 48 files changed, 138 insertions(+), 189 deletions(-) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/commands/SubCommand.java (95%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/destination/Destination.java (93%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/effect/TestEffect.java (74%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/effect/WarpEffect.java (83%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/events/PortalEditEvent.java (81%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/events/PortalsLoadedEvent.java (84%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/events/WarpEvent.java (100%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/portal/AdvancedPortal.java (93%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/registry/SubCommandRegistry.java (95%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/registry/TagRegistry.java (97%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/registry/WarpEffectRegistry.java (94%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/services/DestinationServices.java (88%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/services/PortalServices.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/services/PortalTempDataServices.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/warphandler/ActivationData.java (100%) rename src/main/java/com/sekwah/advancedportals/{ => core}/api/warphandler/TagHandler.java (100%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/CommandTemplate.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/CommandWithSubCommands.java (95%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/CreateSubCommand.java (96%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/desti/CreateDestiSubCommand.java (90%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/CreatePortalSubCommand.java (90%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/EndGatewayBlockSubCommand.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/EndPortalBlockSubCommand.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/PortalBlockSubCommand.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/ReloadSubCommand.java (90%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/RemoveSubCommand.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/SelectorSubCommand.java (92%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/TransUpdateSubCommand.java (90%) rename src/main/java/com/sekwah/advancedportals/{ => core}/commands/subcommands/portal/VersionSubCommand.java (77%) create mode 100644 src/main/java/com/sekwah/advancedportals/core/registry/AnnotationScanner.java create mode 100644 src/main/java/com/sekwah/advancedportals/core/registry/SubCmd.java delete mode 100644 src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl2.java diff --git a/src/main/java/com/sekwah/advancedportals/config/RepositoryModule.java b/src/main/java/com/sekwah/advancedportals/config/RepositoryModule.java index 9148e8b3..1cd2f9ad 100644 --- a/src/main/java/com/sekwah/advancedportals/config/RepositoryModule.java +++ b/src/main/java/com/sekwah/advancedportals/config/RepositoryModule.java @@ -22,7 +22,7 @@ public class RepositoryModule extends AbstractModule { bind(DestinationRepository.class).to(DestinationRepositoryImpl.class).in(Scopes.SINGLETON); bind(PortalRepository.class).to(PortalRepositoryImpl.class).in(Scopes.SINGLETON); bind(ConfigRepository.class).to(ConfigRepositoryImpl.class).in(Scopes.SINGLETON); - bindListener(Matchers.Any(), new Log4JTypeListenr()); + //bindListener(Matchers.Any(), new Log4JTypeListenr()); } @Provides diff --git a/src/main/java/com/sekwah/advancedportals/core/AdvancedPortalsCore.java b/src/main/java/com/sekwah/advancedportals/core/AdvancedPortalsCore.java index 08d66ad3..8ee3640f 100644 --- a/src/main/java/com/sekwah/advancedportals/core/AdvancedPortalsCore.java +++ b/src/main/java/com/sekwah/advancedportals/core/AdvancedPortalsCore.java @@ -2,17 +2,17 @@ package com.sekwah.advancedportals.core; import com.google.inject.Guice; import com.google.inject.Injector; -import com.sekwah.advancedportals.api.commands.SubCommand; -import com.sekwah.advancedportals.api.destination.Destination; -import com.sekwah.advancedportals.api.portal.AdvancedPortal; -import com.sekwah.advancedportals.api.registry.TagRegistry; -import com.sekwah.advancedportals.api.registry.WarpEffectRegistry; -import com.sekwah.advancedportals.api.services.DestinationServices; -import com.sekwah.advancedportals.api.services.PortalServices; -import com.sekwah.advancedportals.api.services.PortalTempDataServices; -import com.sekwah.advancedportals.commands.CommandWithSubCommands; -import com.sekwah.advancedportals.commands.subcommands.desti.CreateDestiSubCommand; -import com.sekwah.advancedportals.commands.subcommands.portal.*; +import com.sekwah.advancedportals.core.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.destination.Destination; +import com.sekwah.advancedportals.core.api.portal.AdvancedPortal; +import com.sekwah.advancedportals.core.api.registry.TagRegistry; +import com.sekwah.advancedportals.core.api.registry.WarpEffectRegistry; +import com.sekwah.advancedportals.core.api.services.DestinationServices; +import com.sekwah.advancedportals.core.api.services.PortalServices; +import com.sekwah.advancedportals.core.api.services.PortalTempDataServices; +import com.sekwah.advancedportals.core.commands.CommandWithSubCommands; +import com.sekwah.advancedportals.core.commands.subcommands.desti.CreateDestiSubCommand; +import com.sekwah.advancedportals.core.commands.subcommands.portal.*; import com.sekwah.advancedportals.config.RepositoryModule; import com.sekwah.advancedportals.data.DataStorage; import com.sekwah.advancedportals.ConfigRepository; @@ -133,11 +133,14 @@ public class AdvancedPortalsCore { public void registerCommands(CommandRegister commandRegister) { this.registerPortalCommand(commandRegister); this.registerDestinationCommand(commandRegister); + + // TODO run annotation grabbing shit } private void registerPortalCommand(CommandRegister commandRegister) { this.portalCommand = new CommandWithSubCommands(); + // TODO remove once annotations are done this.portalCommand.registerSubCommand("version", new VersionSubCommand()); this.portalCommand.registerSubCommand("transupdate", new TransUpdateSubCommand()); this.portalCommand.registerSubCommand("reload", new ReloadSubCommand()); @@ -154,6 +157,7 @@ public class AdvancedPortalsCore { private void registerDestinationCommand(CommandRegister commandRegister) { this.destiCommand = new CommandWithSubCommands(); + // TODO remove once annotations are done this.destiCommand.registerSubCommand("create", new CreateDestiSubCommand()); commandRegister.registerCommand("destination", this.destiCommand); diff --git a/src/main/java/com/sekwah/advancedportals/core/CoreListeners.java b/src/main/java/com/sekwah/advancedportals/core/CoreListeners.java index c0f17f97..55470f58 100644 --- a/src/main/java/com/sekwah/advancedportals/core/CoreListeners.java +++ b/src/main/java/com/sekwah/advancedportals/core/CoreListeners.java @@ -1,8 +1,8 @@ package com.sekwah.advancedportals.core; import com.google.inject.Inject; -import com.sekwah.advancedportals.api.services.PortalServices; -import com.sekwah.advancedportals.api.services.PortalTempDataServices; +import com.sekwah.advancedportals.core.api.services.PortalServices; +import com.sekwah.advancedportals.core.api.services.PortalTempDataServices; import com.sekwah.advancedportals.PlayerLocation; import com.sekwah.advancedportals.PortalLocation; import com.sekwah.advancedportals.core.util.Lang; diff --git a/src/main/java/com/sekwah/advancedportals/api/commands/SubCommand.java b/src/main/java/com/sekwah/advancedportals/core/api/commands/SubCommand.java similarity index 95% rename from src/main/java/com/sekwah/advancedportals/api/commands/SubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/api/commands/SubCommand.java index 9ea9b5d9..d939b871 100644 --- a/src/main/java/com/sekwah/advancedportals/api/commands/SubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/commands/SubCommand.java @@ -1,4 +1,4 @@ -package com.sekwah.advancedportals.api.commands; +package com.sekwah.advancedportals.core.api.commands; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; diff --git a/src/main/java/com/sekwah/advancedportals/api/destination/Destination.java b/src/main/java/com/sekwah/advancedportals/core/api/destination/Destination.java similarity index 93% rename from src/main/java/com/sekwah/advancedportals/api/destination/Destination.java rename to src/main/java/com/sekwah/advancedportals/core/api/destination/Destination.java index 808f4459..1b1cddd4 100644 --- a/src/main/java/com/sekwah/advancedportals/api/destination/Destination.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/destination/Destination.java @@ -1,10 +1,10 @@ -package com.sekwah.advancedportals.api.destination; +package com.sekwah.advancedportals.core.api.destination; import com.google.gson.annotations.SerializedName; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.registry.TagRegistry; -import com.sekwah.advancedportals.api.warphandler.ActivationData; -import com.sekwah.advancedportals.api.warphandler.TagHandler; +import com.sekwah.advancedportals.core.api.registry.TagRegistry; +import com.sekwah.advancedportals.core.api.warphandler.ActivationData; +import com.sekwah.advancedportals.core.api.warphandler.TagHandler; import com.sekwah.advancedportals.DataTag; import com.sekwah.advancedportals.PlayerLocation; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/api/effect/TestEffect.java b/src/main/java/com/sekwah/advancedportals/core/api/effect/TestEffect.java similarity index 74% rename from src/main/java/com/sekwah/advancedportals/api/effect/TestEffect.java rename to src/main/java/com/sekwah/advancedportals/core/api/effect/TestEffect.java index 778a0e9e..216b386c 100644 --- a/src/main/java/com/sekwah/advancedportals/api/effect/TestEffect.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/effect/TestEffect.java @@ -1,6 +1,6 @@ -package com.sekwah.advancedportals.api.effect; +package com.sekwah.advancedportals.core.api.effect; -import com.sekwah.advancedportals.api.portal.AdvancedPortal; +import com.sekwah.advancedportals.core.api.portal.AdvancedPortal; import com.sekwah.advancedportals.PortalLocation; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/api/effect/WarpEffect.java b/src/main/java/com/sekwah/advancedportals/core/api/effect/WarpEffect.java similarity index 83% rename from src/main/java/com/sekwah/advancedportals/api/effect/WarpEffect.java rename to src/main/java/com/sekwah/advancedportals/core/api/effect/WarpEffect.java index 9464523d..c1773d0e 100644 --- a/src/main/java/com/sekwah/advancedportals/api/effect/WarpEffect.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/effect/WarpEffect.java @@ -1,6 +1,6 @@ -package com.sekwah.advancedportals.api.effect; +package com.sekwah.advancedportals.core.api.effect; -import com.sekwah.advancedportals.api.portal.AdvancedPortal; +import com.sekwah.advancedportals.core.api.portal.AdvancedPortal; import com.sekwah.advancedportals.PortalLocation; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/api/events/PortalEditEvent.java b/src/main/java/com/sekwah/advancedportals/core/api/events/PortalEditEvent.java similarity index 81% rename from src/main/java/com/sekwah/advancedportals/api/events/PortalEditEvent.java rename to src/main/java/com/sekwah/advancedportals/core/api/events/PortalEditEvent.java index f292fbc1..c795bc18 100644 --- a/src/main/java/com/sekwah/advancedportals/api/events/PortalEditEvent.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/events/PortalEditEvent.java @@ -1,4 +1,4 @@ -package com.sekwah.advancedportals.api.events; +package com.sekwah.advancedportals.core.api.events; /** * Activated when something about the event is edited. diff --git a/src/main/java/com/sekwah/advancedportals/api/events/PortalsLoadedEvent.java b/src/main/java/com/sekwah/advancedportals/core/api/events/PortalsLoadedEvent.java similarity index 84% rename from src/main/java/com/sekwah/advancedportals/api/events/PortalsLoadedEvent.java rename to src/main/java/com/sekwah/advancedportals/core/api/events/PortalsLoadedEvent.java index 5e0a3a46..e6961184 100644 --- a/src/main/java/com/sekwah/advancedportals/api/events/PortalsLoadedEvent.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/events/PortalsLoadedEvent.java @@ -1,4 +1,4 @@ -package com.sekwah.advancedportals.api.events; +package com.sekwah.advancedportals.core.api.events; /** diff --git a/src/main/java/com/sekwah/advancedportals/api/events/WarpEvent.java b/src/main/java/com/sekwah/advancedportals/core/api/events/WarpEvent.java similarity index 100% rename from src/main/java/com/sekwah/advancedportals/api/events/WarpEvent.java rename to src/main/java/com/sekwah/advancedportals/core/api/events/WarpEvent.java diff --git a/src/main/java/com/sekwah/advancedportals/api/portal/AdvancedPortal.java b/src/main/java/com/sekwah/advancedportals/core/api/portal/AdvancedPortal.java similarity index 93% rename from src/main/java/com/sekwah/advancedportals/api/portal/AdvancedPortal.java rename to src/main/java/com/sekwah/advancedportals/core/api/portal/AdvancedPortal.java index 5d3f40ff..9f5af33b 100644 --- a/src/main/java/com/sekwah/advancedportals/api/portal/AdvancedPortal.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/portal/AdvancedPortal.java @@ -1,10 +1,10 @@ -package com.sekwah.advancedportals.api.portal; +package com.sekwah.advancedportals.core.api.portal; import com.google.gson.annotations.SerializedName; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.registry.TagRegistry; -import com.sekwah.advancedportals.api.warphandler.ActivationData; -import com.sekwah.advancedportals.api.warphandler.TagHandler; +import com.sekwah.advancedportals.core.api.registry.TagRegistry; +import com.sekwah.advancedportals.core.api.warphandler.ActivationData; +import com.sekwah.advancedportals.core.api.warphandler.TagHandler; import com.sekwah.advancedportals.DataTag; import com.sekwah.advancedportals.PortalLocation; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/api/registry/SubCommandRegistry.java b/src/main/java/com/sekwah/advancedportals/core/api/registry/SubCommandRegistry.java similarity index 95% rename from src/main/java/com/sekwah/advancedportals/api/registry/SubCommandRegistry.java rename to src/main/java/com/sekwah/advancedportals/core/api/registry/SubCommandRegistry.java index 4e25c1d6..deacfe44 100644 --- a/src/main/java/com/sekwah/advancedportals/api/registry/SubCommandRegistry.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/registry/SubCommandRegistry.java @@ -1,7 +1,7 @@ -package com.sekwah.advancedportals.api.registry; +package com.sekwah.advancedportals.core.api.registry; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.InfoLogger; import java.util.ArrayList; diff --git a/src/main/java/com/sekwah/advancedportals/api/registry/TagRegistry.java b/src/main/java/com/sekwah/advancedportals/core/api/registry/TagRegistry.java similarity index 97% rename from src/main/java/com/sekwah/advancedportals/api/registry/TagRegistry.java rename to src/main/java/com/sekwah/advancedportals/core/api/registry/TagRegistry.java index 4fa0c3a1..35a0228d 100644 --- a/src/main/java/com/sekwah/advancedportals/api/registry/TagRegistry.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/registry/TagRegistry.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.api.registry; +package com.sekwah.advancedportals.core.api.registry; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.warphandler.TagHandler; +import com.sekwah.advancedportals.core.api.warphandler.TagHandler; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/com/sekwah/advancedportals/api/registry/WarpEffectRegistry.java b/src/main/java/com/sekwah/advancedportals/core/api/registry/WarpEffectRegistry.java similarity index 94% rename from src/main/java/com/sekwah/advancedportals/api/registry/WarpEffectRegistry.java rename to src/main/java/com/sekwah/advancedportals/core/api/registry/WarpEffectRegistry.java index f33f96a1..f1adf750 100644 --- a/src/main/java/com/sekwah/advancedportals/api/registry/WarpEffectRegistry.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/registry/WarpEffectRegistry.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.api.registry; +package com.sekwah.advancedportals.core.api.registry; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.effect.WarpEffect; +import com.sekwah.advancedportals.core.api.effect.WarpEffect; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/com/sekwah/advancedportals/api/services/DestinationServices.java b/src/main/java/com/sekwah/advancedportals/core/api/services/DestinationServices.java similarity index 88% rename from src/main/java/com/sekwah/advancedportals/api/services/DestinationServices.java rename to src/main/java/com/sekwah/advancedportals/core/api/services/DestinationServices.java index 88a271ad..60dc28a4 100644 --- a/src/main/java/com/sekwah/advancedportals/api/services/DestinationServices.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/services/DestinationServices.java @@ -1,6 +1,6 @@ -package com.sekwah.advancedportals.api.services; +package com.sekwah.advancedportals.core.api.services; -import com.sekwah.advancedportals.api.destination.Destination; +import com.sekwah.advancedportals.core.api.destination.Destination; import com.sekwah.advancedportals.DataTag; import com.sekwah.advancedportals.PlayerLocation; import com.sekwah.advancedportals.repository.DestinationRepositoryOld; diff --git a/src/main/java/com/sekwah/advancedportals/api/services/PortalServices.java b/src/main/java/com/sekwah/advancedportals/core/api/services/PortalServices.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/api/services/PortalServices.java rename to src/main/java/com/sekwah/advancedportals/core/api/services/PortalServices.java index a524d460..fc324ad5 100644 --- a/src/main/java/com/sekwah/advancedportals/api/services/PortalServices.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/services/PortalServices.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.api.services; +package com.sekwah.advancedportals.core.api.services; import com.google.common.collect.ImmutableList; import com.sekwah.advancedportals.repository.PortalRepository; -import com.sekwah.advancedportals.api.portal.AdvancedPortal; +import com.sekwah.advancedportals.core.api.portal.AdvancedPortal; import com.sekwah.advancedportals.DataTag; import com.sekwah.advancedportals.PlayerLocation; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/api/services/PortalTempDataServices.java b/src/main/java/com/sekwah/advancedportals/core/api/services/PortalTempDataServices.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/api/services/PortalTempDataServices.java rename to src/main/java/com/sekwah/advancedportals/core/api/services/PortalTempDataServices.java index 41f675db..1ca5ea69 100644 --- a/src/main/java/com/sekwah/advancedportals/api/services/PortalTempDataServices.java +++ b/src/main/java/com/sekwah/advancedportals/core/api/services/PortalTempDataServices.java @@ -1,4 +1,4 @@ -package com.sekwah.advancedportals.api.services; +package com.sekwah.advancedportals.core.api.services; import com.sekwah.advancedportals.PlayerTempData; import com.sekwah.advancedportals.PortalLocation; diff --git a/src/main/java/com/sekwah/advancedportals/api/warphandler/ActivationData.java b/src/main/java/com/sekwah/advancedportals/core/api/warphandler/ActivationData.java similarity index 100% rename from src/main/java/com/sekwah/advancedportals/api/warphandler/ActivationData.java rename to src/main/java/com/sekwah/advancedportals/core/api/warphandler/ActivationData.java diff --git a/src/main/java/com/sekwah/advancedportals/api/warphandler/TagHandler.java b/src/main/java/com/sekwah/advancedportals/core/api/warphandler/TagHandler.java similarity index 100% rename from src/main/java/com/sekwah/advancedportals/api/warphandler/TagHandler.java rename to src/main/java/com/sekwah/advancedportals/core/api/warphandler/TagHandler.java diff --git a/src/main/java/com/sekwah/advancedportals/commands/CommandTemplate.java b/src/main/java/com/sekwah/advancedportals/core/commands/CommandTemplate.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/commands/CommandTemplate.java rename to src/main/java/com/sekwah/advancedportals/core/commands/CommandTemplate.java index 8c40f052..7ccf62ad 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/CommandTemplate.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/CommandTemplate.java @@ -1,4 +1,4 @@ -package com.sekwah.advancedportals.commands; +package com.sekwah.advancedportals.core.commands; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/CommandWithSubCommands.java b/src/main/java/com/sekwah/advancedportals/core/commands/CommandWithSubCommands.java similarity index 95% rename from src/main/java/com/sekwah/advancedportals/commands/CommandWithSubCommands.java rename to src/main/java/com/sekwah/advancedportals/core/commands/CommandWithSubCommands.java index 64a1ae07..e34bd68a 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/CommandWithSubCommands.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/CommandWithSubCommands.java @@ -1,7 +1,7 @@ -package com.sekwah.advancedportals.commands; +package com.sekwah.advancedportals.core.commands; -import com.sekwah.advancedportals.api.commands.SubCommand; -import com.sekwah.advancedportals.api.registry.SubCommandRegistry; +import com.sekwah.advancedportals.core.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.registry.SubCommandRegistry; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; @@ -110,8 +110,7 @@ public class CommandWithSubCommands implements CommandTemplate { public List onTabComplete(CommandSenderContainer sender, String[] args) { if(args.length > 1) { if(args[0].equalsIgnoreCase("help")) { - List allowedCommands = new ArrayList<>(); - allowedCommands.addAll(this.subCommandRegistry.getSubCommands()); + List allowedCommands = new ArrayList<>(this.subCommandRegistry.getSubCommands()); Collections.sort(allowedCommands); return this.filterTabResults(allowedCommands, args[args.length - 1]); } diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/CreateSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/CreateSubCommand.java similarity index 96% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/CreateSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/CreateSubCommand.java index ce1b4b47..f946fd3a 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/CreateSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/CreateSubCommand.java @@ -1,4 +1,4 @@ -package com.sekwah.advancedportals.commands.subcommands; +package com.sekwah.advancedportals.core.commands.subcommands; import com.sekwah.advancedportals.DataTag; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/desti/CreateDestiSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/desti/CreateDestiSubCommand.java similarity index 90% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/desti/CreateDestiSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/desti/CreateDestiSubCommand.java index 46ad605d..eccbd2f6 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/desti/CreateDestiSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/desti/CreateDestiSubCommand.java @@ -1,9 +1,9 @@ -package com.sekwah.advancedportals.commands.subcommands.desti; +package com.sekwah.advancedportals.core.commands.subcommands.desti; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; -import com.sekwah.advancedportals.api.destination.Destination; -import com.sekwah.advancedportals.commands.subcommands.CreateSubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.destination.Destination; +import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand; import com.sekwah.advancedportals.DataTag; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/CreatePortalSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.java similarity index 90% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/CreatePortalSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.java index ce14c75a..e34b6f4d 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/CreatePortalSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.java @@ -1,9 +1,9 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; -import com.sekwah.advancedportals.api.portal.AdvancedPortal; -import com.sekwah.advancedportals.commands.subcommands.CreateSubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.portal.AdvancedPortal; +import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand; import com.sekwah.advancedportals.DataTag; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/EndGatewayBlockSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/EndGatewayBlockSubCommand.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/EndGatewayBlockSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/EndGatewayBlockSubCommand.java index f06f5815..1aa8fc13 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/EndGatewayBlockSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/EndGatewayBlockSubCommand.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/EndPortalBlockSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/EndPortalBlockSubCommand.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/EndPortalBlockSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/EndPortalBlockSubCommand.java index 270f172b..01a45ac4 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/EndPortalBlockSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/EndPortalBlockSubCommand.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/PortalBlockSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/PortalBlockSubCommand.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/PortalBlockSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/PortalBlockSubCommand.java index 24087c4a..5b5ec4f9 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/PortalBlockSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/PortalBlockSubCommand.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/ReloadSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/ReloadSubCommand.java similarity index 90% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/ReloadSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/ReloadSubCommand.java index b6a65841..ca9df45d 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/ReloadSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/ReloadSubCommand.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/RemoveSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/RemoveSubCommand.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/RemoveSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/RemoveSubCommand.java index caa6237a..47c0a25d 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/RemoveSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/RemoveSubCommand.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; -import com.sekwah.advancedportals.api.portal.AdvancedPortal; +import com.sekwah.advancedportals.core.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.portal.AdvancedPortal; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/SelectorSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/SelectorSubCommand.java similarity index 92% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/SelectorSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/SelectorSubCommand.java index 1ec77fbe..841db69c 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/SelectorSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/SelectorSubCommand.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/TransUpdateSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/TransUpdateSubCommand.java similarity index 90% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/TransUpdateSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/TransUpdateSubCommand.java index 4b1106e6..cede6142 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/TransUpdateSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/TransUpdateSubCommand.java @@ -1,8 +1,8 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.google.inject.Inject; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; diff --git a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/VersionSubCommand.java b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/VersionSubCommand.java similarity index 77% rename from src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/VersionSubCommand.java rename to src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/VersionSubCommand.java index 4eb203dc..9e396248 100644 --- a/src/main/java/com/sekwah/advancedportals/commands/subcommands/portal/VersionSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/VersionSubCommand.java @@ -1,13 +1,16 @@ -package com.sekwah.advancedportals.commands.subcommands.portal; +package com.sekwah.advancedportals.core.commands.subcommands.portal; import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; +import com.sekwah.advancedportals.core.registry.SubCmd; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; import java.util.List; +@SubCmd(name="version", parent=SubCmd.TYPE.PORTAL, minArgs=5, permissions= {"Test"}) public class VersionSubCommand implements SubCommand { + @Override public void onCommand(CommandSenderContainer sender, String[] args) { sender.sendMessage(Lang.translateColor("messageprefix.positive") + " Advanced Portals v" + AdvancedPortalsCore.version); diff --git a/src/main/java/com/sekwah/advancedportals/core/registry/AnnotationScanner.java b/src/main/java/com/sekwah/advancedportals/core/registry/AnnotationScanner.java new file mode 100644 index 00000000..a7f2535a --- /dev/null +++ b/src/main/java/com/sekwah/advancedportals/core/registry/AnnotationScanner.java @@ -0,0 +1,9 @@ +package com.sekwah.advancedportals.core.registry; + +public class AnnotationScanner { + + public void registerSubCommands() { + //AnnotationScanner.class.getClassLoader() + } + +} diff --git a/src/main/java/com/sekwah/advancedportals/core/registry/SubCmd.java b/src/main/java/com/sekwah/advancedportals/core/registry/SubCmd.java new file mode 100644 index 00000000..0d7b4297 --- /dev/null +++ b/src/main/java/com/sekwah/advancedportals/core/registry/SubCmd.java @@ -0,0 +1,18 @@ +package com.sekwah.advancedportals.core.registry; + +public @interface SubCmd { + + TYPE parent(); + + String name(); + + int minArgs(); + + String[] permissions(); + + public enum TYPE { + PORTAL, + DESTI + } + +} diff --git a/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandHandler.java b/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandHandler.java index e4151312..b43f8ffc 100644 --- a/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandHandler.java +++ b/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandHandler.java @@ -1,7 +1,7 @@ package com.sekwah.advancedportals.coreconnector.command; -import com.sekwah.advancedportals.commands.CommandTemplate; +import com.sekwah.advancedportals.core.commands.CommandTemplate; public abstract class CommandHandler { diff --git a/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandRegister.java b/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandRegister.java index a86662cb..683f34d7 100644 --- a/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandRegister.java +++ b/src/main/java/com/sekwah/advancedportals/coreconnector/command/CommandRegister.java @@ -1,6 +1,6 @@ package com.sekwah.advancedportals.coreconnector.command; -import com.sekwah.advancedportals.commands.CommandTemplate; +import com.sekwah.advancedportals.core.commands.CommandTemplate; public interface CommandRegister { diff --git a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepository.java b/src/main/java/com/sekwah/advancedportals/repository/DestinationRepository.java index cb1c6221..4cfda0a0 100644 --- a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepository.java +++ b/src/main/java/com/sekwah/advancedportals/repository/DestinationRepository.java @@ -1,6 +1,4 @@ package com.sekwah.advancedportals.repository; -import com.sekwah.advancedportals.api.destination.Destination; - public interface DestinationRepository extends JsonRepository { } diff --git a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl.java b/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl.java index fb6f7d75..50d78c47 100644 --- a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl.java +++ b/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl.java @@ -1,11 +1,7 @@ package com.sekwah.advancedportals.repository; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableMap; -import com.sekwah.advancedportals.api.destination.Destination; -import it.unimi.dsi.fastutil.Hash; +import com.sekwah.advancedportals.core.api.destination.Destination; import javax.inject.Singleton; import java.io.FileWriter; @@ -14,7 +10,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.TimeUnit; @Singleton public class DestinationRepositoryImpl implements DestinationRepository{ @@ -56,5 +51,6 @@ public class DestinationRepositoryImpl implements DestinationRepository get(String s) { + return null; } } diff --git a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl2.java b/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl2.java deleted file mode 100644 index 9d190435..00000000 --- a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryImpl2.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.sekwah.advancedportals.repository; - -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableMap; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.sekwah.advancedportals.DataTag; -import com.sekwah.advancedportals.PlayerLocation; -import com.sekwah.advancedportals.core.AdvancedPortalsCore; -import com.sekwah.advancedportals.api.destination.Destination; -import com.sekwah.advancedportals.api.warphandler.TagHandler; -import com.sekwah.advancedportals.core.util.Lang; -import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -@Singleton -@Deprecated -public class DestinationRepositoryImpl2 implements DestinationRepositoryOld { - - - @Inject - private AdvancedPortalsCore portalsCore; - - - public void create(String name, Destination destination) { - destiHashMap.put(name, destination); - } - - @Override - public void delete(String name) { - destiHashMap.remove(name); - } - - @Override - public ImmutableMap getDestinations() { - return ImmutableMap.copyOf(destiHashMap); - } - - - public Destination createDesti(String name, PlayerContainer player, PlayerLocation playerLocation, ArrayList tags) { - // TODO change to write messages - if(name == null || name.equals("")) { - player.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("desti.error.noname")); - return null; - } - else if(this.destiHashMap.containsKey(name)) { - player.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translate("desti.error.takenname")); - return null; - } - - Destination desti = new Destination(playerLocation); - for(DataTag portalTag : tags) { - desti.setArg(portalTag); - } - for(DataTag destiTag : tags) { - TagHandler.Creation creation = AdvancedPortalsCore.getDestinationTagRegistry().getCreationHandler(destiTag.NAME); - if(creation != null) { - creation.created(desti, player, destiTag.VALUE); - } - } - this.destiHashMap.put(name, desti); - this.saveDestinations(); - return desti; - } - - public void loadDestinations() { - Type type = new TypeToken>() { - }.getType(); - this.destiHashMap = this.portalsCore.getDataStorage().loadJson(type, "destinations.json"); - this.saveDestinations(); - } - - public void saveDestinations() { - if (this.destiHashMap == null) { - this.destiHashMap = new HashMap<>(); - } - this.portalsCore.getDataStorage().storeJson(this.destiHashMap, "destinations.json"); - } -} diff --git a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryOld.java b/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryOld.java index b9cb3872..9e7bb73a 100644 --- a/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryOld.java +++ b/src/main/java/com/sekwah/advancedportals/repository/DestinationRepositoryOld.java @@ -1,7 +1,7 @@ package com.sekwah.advancedportals.repository; import com.google.common.collect.ImmutableMap; -import com.sekwah.advancedportals.api.destination.Destination; +import com.sekwah.advancedportals.core.api.destination.Destination; @Deprecated public interface DestinationRepositoryOld { diff --git a/src/main/java/com/sekwah/advancedportals/repository/PortalRepositoryImpl.java b/src/main/java/com/sekwah/advancedportals/repository/PortalRepositoryImpl.java index af656f51..e25f9ece 100644 --- a/src/main/java/com/sekwah/advancedportals/repository/PortalRepositoryImpl.java +++ b/src/main/java/com/sekwah/advancedportals/repository/PortalRepositoryImpl.java @@ -21,6 +21,17 @@ public class PortalRepositoryImpl implements PortalRepository { public String getSelectedPortal(UUID uuid) { return selectedPortal.getIfPresent(uuid); } + + @Override + public boolean save(String name, PortalLocation portalLocation) { + return false; + } + + @Override + public boolean containsKey(String name) { + return false; + } + @Override public boolean delete(String name) { return false; diff --git a/src/main/java/com/sekwah/advancedportals/services/DestinationServices.java b/src/main/java/com/sekwah/advancedportals/services/DestinationServices.java index 8108e4eb..e320b8d8 100644 --- a/src/main/java/com/sekwah/advancedportals/services/DestinationServices.java +++ b/src/main/java/com/sekwah/advancedportals/services/DestinationServices.java @@ -5,13 +5,12 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.reflect.TypeToken; import com.sekwah.advancedportals.DataTag; import com.sekwah.advancedportals.PlayerLocation; -import com.sekwah.advancedportals.api.destination.Destination; -import com.sekwah.advancedportals.api.warphandler.TagHandler; +import com.sekwah.advancedportals.core.api.destination.Destination; +import com.sekwah.advancedportals.core.api.warphandler.TagHandler; import com.sekwah.advancedportals.core.AdvancedPortalsCore; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer; import com.sekwah.advancedportals.repository.DestinationRepositoryImpl; -import org.apache.log4j.Logger; import javax.inject.Inject; import java.io.IOException; @@ -26,12 +25,10 @@ import java.util.HashMap; public class DestinationServices { DestinationRepositoryImpl destinationRepository; - Logger logger; @Inject - private DestinationServices(DestinationRepositoryImpl destinationRepository, Logger logger) { + private DestinationServices(DestinationRepositoryImpl destinationRepository) { this.destinationRepository = destinationRepository; - this.logger = logger; } public Response create(String name, Destination destination) { @@ -74,7 +71,6 @@ public class DestinationServices { Destination desti = new Destination(playerLocation); for(DataTag portalTag : tags) { desti.setArg(portalTag); - logger.warn("Derp A Derp"); } for(DataTag destiTag : tags) { TagHandler.Creation creation = AdvancedPortalsCore.getDestinationTagRegistry().getCreationHandler(destiTag.NAME); @@ -96,14 +92,14 @@ public class DestinationServices { public void loadDestinations() { Type type = new TypeToken>() { }.getType(); - this.destiHashMap = this.portalsCore.getDataStorage().loadJson(type, "destinations.json"); + //this.destiHashMap = this.portalsCore.getDataStorage().loadJson(type, "destinations.json"); this.saveDestinations(); } public void saveDestinations() { - if (this.destiHashMap == null) { + /*if (this.destiHashMap == null) { this.destiHashMap = new HashMap<>(); } - this.portalsCore.getDataStorage().storeJson(this.destiHashMap, "destinations.json"); + this.portalsCore.getDataStorage().storeJson(this.destiHashMap, "destinations.json");*/ } } diff --git a/src/main/java/com/sekwah/advancedportals/services/PortalServices.java b/src/main/java/com/sekwah/advancedportals/services/PortalServices.java index b614a57a..ca3bb121 100644 --- a/src/main/java/com/sekwah/advancedportals/services/PortalServices.java +++ b/src/main/java/com/sekwah/advancedportals/services/PortalServices.java @@ -22,20 +22,20 @@ public class PortalServices { } public void removeSelectedPortal(UUID uuid) { - selectedPortal.invalidate(uuid); + //selectedPortal.invalidate(uuid); } public void addSelectedPosition(UUID uuid, boolean isPos1, PortalLocation portalLocation) { - selectedPositions.put(uuid, isPos1, portalLocation); + //selectedPositions.put(uuid, isPos1, portalLocation); } public void removeSelectedPosition(UUID uuid, boolean isPos1) { - selectedPositions.remove(uuid, isPos1); + //selectedPositions.remove(uuid, isPos1); } public void removeAllSelectedHand(UUID uuid) { - selectedPositions.remove(uuid, true); - selectedPositions.remove(uuid, false); + //selectedPositions.remove(uuid, true); + //selectedPositions.remove(uuid, false); } public void activateCooldown(PlayerContainer player) { diff --git a/src/main/java/com/sekwah/advancedportals/spigot/convertolddata/ConvertOldSubCommand.java b/src/main/java/com/sekwah/advancedportals/spigot/convertolddata/ConvertOldSubCommand.java index cab6a096..89f9499b 100644 --- a/src/main/java/com/sekwah/advancedportals/spigot/convertolddata/ConvertOldSubCommand.java +++ b/src/main/java/com/sekwah/advancedportals/spigot/convertolddata/ConvertOldSubCommand.java @@ -1,6 +1,6 @@ package com.sekwah.advancedportals.spigot.convertolddata; -import com.sekwah.advancedportals.api.commands.SubCommand; +import com.sekwah.advancedportals.core.api.commands.SubCommand; import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer; diff --git a/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandHandler.java b/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandHandler.java index a1754a31..d3ea61fc 100644 --- a/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandHandler.java +++ b/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandHandler.java @@ -1,6 +1,6 @@ package com.sekwah.advancedportals.spigot.coreconnector.command; -import com.sekwah.advancedportals.commands.CommandTemplate; +import com.sekwah.advancedportals.core.commands.CommandTemplate; import com.sekwah.advancedportals.spigot.coreconnector.container.SpigotCommandSenderContainer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandRegister.java b/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandRegister.java index e1d31aca..e281451f 100644 --- a/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandRegister.java +++ b/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/command/SpigotCommandRegister.java @@ -1,6 +1,6 @@ package com.sekwah.advancedportals.spigot.coreconnector.command; -import com.sekwah.advancedportals.commands.CommandTemplate; +import com.sekwah.advancedportals.core.commands.CommandTemplate; import com.sekwah.advancedportals.coreconnector.command.CommandRegister; import com.sekwah.advancedportals.spigot.AdvancedPortalsPlugin; diff --git a/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/container/SpigotPlayerContainer.java b/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/container/SpigotPlayerContainer.java index db03f1a6..8724e461 100644 --- a/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/container/SpigotPlayerContainer.java +++ b/src/main/java/com/sekwah/advancedportals/spigot/coreconnector/container/SpigotPlayerContainer.java @@ -54,7 +54,7 @@ public class SpigotPlayerContainer implements PlayerContainer { } public void teleport(PlayerLocation location) { - this.player.teleport(new Location(Bukkit.getWorld(location.worldName), location.posX, location.posY, location.posZ)); + this.player.teleport(new Location(Bukkit.getWorld(location.getWorldName()), location.getPosX(), location.getPosY(), location.getPosZ())); } public boolean hasPermission(String permission) { diff --git a/src/main/java/com/sekwah/advancedportals/spigot/effect/WarpEffectEnder.java b/src/main/java/com/sekwah/advancedportals/spigot/effect/WarpEffectEnder.java index 9f3ad695..c44f3e5b 100644 --- a/src/main/java/com/sekwah/advancedportals/spigot/effect/WarpEffectEnder.java +++ b/src/main/java/com/sekwah/advancedportals/spigot/effect/WarpEffectEnder.java @@ -1,7 +1,7 @@ package com.sekwah.advancedportals.spigot.effect; -import com.sekwah.advancedportals.api.effect.WarpEffect; -import com.sekwah.advancedportals.api.portal.AdvancedPortal; +import com.sekwah.advancedportals.core.api.effect.WarpEffect; +import com.sekwah.advancedportals.core.api.portal.AdvancedPortal; import com.sekwah.advancedportals.PortalLocation; import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;