mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-02-03 05:51:25 +01:00
Changed inject annotation and build so it only does for spigot atm
Still learning a lot about all this and loving it so far
This commit is contained in:
parent
ed3c28faee
commit
f7d47519b7
@ -55,7 +55,7 @@ group = 'com.sekwah.advancedportals'
|
|||||||
|
|
||||||
description = ""
|
description = ""
|
||||||
|
|
||||||
minecraft {
|
/*minecraft {
|
||||||
version = "1.12.2-14.23.2.2611"
|
version = "1.12.2-14.23.2.2611"
|
||||||
runDir = "run"
|
runDir = "run"
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ minecraft {
|
|||||||
// simply re-run your setup task after changing the mappings to update your workspace.
|
// simply re-run your setup task after changing the mappings to update your workspace.
|
||||||
mappings = "snapshot_20180607"
|
mappings = "snapshot_20180607"
|
||||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||||
}
|
}*/
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
@ -458,7 +458,7 @@ task runJar() << {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources
|
/*processResources
|
||||||
{
|
{
|
||||||
// this will ensure that this task is redone when the versions change.
|
// this will ensure that this task is redone when the versions change.
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
@ -476,4 +476,4 @@ processResources
|
|||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'mcmod.info'
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
@ -4,18 +4,18 @@ import com.google.inject.Guice;
|
|||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.api.destination.Destination;
|
import com.sekwah.advancedportals.core.api.destination.Destination;
|
||||||
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.config.RepositoryModule;
|
|
||||||
import com.sekwah.advancedportals.core.repository.ConfigRepository;
|
|
||||||
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
|
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
|
||||||
import com.sekwah.advancedportals.core.api.registry.TagRegistry;
|
import com.sekwah.advancedportals.core.api.registry.TagRegistry;
|
||||||
import com.sekwah.advancedportals.core.api.registry.WarpEffectRegistry;
|
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.CommandWithSubCommands;
|
||||||
import com.sekwah.advancedportals.core.commands.subcommands.desti.CreateDestiSubCommand;
|
import com.sekwah.advancedportals.core.commands.subcommands.desti.CreateDestiSubCommand;
|
||||||
import com.sekwah.advancedportals.core.commands.subcommands.portal.*;
|
import com.sekwah.advancedportals.core.commands.subcommands.portal.*;
|
||||||
|
import com.sekwah.advancedportals.core.config.RepositoryModule;
|
||||||
import com.sekwah.advancedportals.core.data.DataStorage;
|
import com.sekwah.advancedportals.core.data.DataStorage;
|
||||||
|
import com.sekwah.advancedportals.core.repository.ConfigRepository;
|
||||||
import com.sekwah.advancedportals.core.util.InfoLogger;
|
import com.sekwah.advancedportals.core.util.InfoLogger;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
import com.sekwah.advancedportals.coreconnector.ConnectorDataCollector;
|
import com.sekwah.advancedportals.coreconnector.ConnectorDataCollector;
|
||||||
@ -40,7 +40,7 @@ public class AdvancedPortalsCore {
|
|||||||
|
|
||||||
private CoreListeners coreListeners = injector.getInstance(CoreListeners.class);
|
private CoreListeners coreListeners = injector.getInstance(CoreListeners.class);
|
||||||
|
|
||||||
private final DataStorage dataStorage = injector.getInstance(DataStorage.class);
|
private final DataStorage dataStorage;
|
||||||
|
|
||||||
private CommandWithSubCommands portalCommand;
|
private CommandWithSubCommands portalCommand;
|
||||||
private CommandWithSubCommands destiCommand;
|
private CommandWithSubCommands destiCommand;
|
||||||
@ -62,7 +62,7 @@ public class AdvancedPortalsCore {
|
|||||||
*/
|
*/
|
||||||
public AdvancedPortalsCore(File dataStorageLoc, InfoLogger infoLogger, CommandRegister commandRegister,
|
public AdvancedPortalsCore(File dataStorageLoc, InfoLogger infoLogger, CommandRegister commandRegister,
|
||||||
ConnectorDataCollector dataCollector, int[] mcVer) {
|
ConnectorDataCollector dataCollector, int[] mcVer) {
|
||||||
this.dataStorage.setStorageLocation(dataStorageLoc);
|
this.dataStorage = new DataStorage(dataStorageLoc);
|
||||||
this.infoLogger = infoLogger;
|
this.infoLogger = infoLogger;
|
||||||
instance = this;
|
instance = this;
|
||||||
this.commandRegister = commandRegister;
|
this.commandRegister = commandRegister;
|
||||||
@ -113,8 +113,8 @@ public class AdvancedPortalsCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onEnable() {
|
private void onEnable() {
|
||||||
this.portalTagRegistry = new TagRegistry<>(this);
|
this.portalTagRegistry = new TagRegistry<>();
|
||||||
this.destiTagRegistry = new TagRegistry<>(this);
|
this.destiTagRegistry = new TagRegistry<>();
|
||||||
|
|
||||||
this.dataStorage.copyDefaultFile("lang/en_GB.lang", false);
|
this.dataStorage.copyDefaultFile("lang/en_GB.lang", false);
|
||||||
|
|
||||||
@ -136,12 +136,12 @@ public class AdvancedPortalsCore {
|
|||||||
this.portalCommand = new CommandWithSubCommands();
|
this.portalCommand = new CommandWithSubCommands();
|
||||||
|
|
||||||
this.portalCommand.registerSubCommand("version", new VersionSubCommand());
|
this.portalCommand.registerSubCommand("version", new VersionSubCommand());
|
||||||
this.portalCommand.registerSubCommand("transupdate", new TransUpdateSubCommand(this));
|
this.portalCommand.registerSubCommand("transupdate", new TransUpdateSubCommand());
|
||||||
this.portalCommand.registerSubCommand("reload", new ReloadSubCommand(this));
|
this.portalCommand.registerSubCommand("reload", new ReloadSubCommand());
|
||||||
this.portalCommand.registerSubCommand("selector", new SelectorSubCommand(this), "wand");
|
this.portalCommand.registerSubCommand("selector", new SelectorSubCommand(), "wand");
|
||||||
this.portalCommand.registerSubCommand("portalblock", new PortalBlockSubCommand(this));
|
this.portalCommand.registerSubCommand("portalblock", new PortalBlockSubCommand());
|
||||||
this.portalCommand.registerSubCommand("endportalblock", new EndPortalBlockSubCommand(this));
|
this.portalCommand.registerSubCommand("endportalblock", new EndPortalBlockSubCommand());
|
||||||
this.portalCommand.registerSubCommand("endgatewayblock", new EndGatewayBlockSubCommand(this));
|
this.portalCommand.registerSubCommand("endgatewayblock", new EndGatewayBlockSubCommand());
|
||||||
this.portalCommand.registerSubCommand("create", new CreatePortalSubCommand());
|
this.portalCommand.registerSubCommand("create", new CreatePortalSubCommand());
|
||||||
this.portalCommand.registerSubCommand("remove", new RemoveSubCommand());
|
this.portalCommand.registerSubCommand("remove", new RemoveSubCommand());
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core;
|
package com.sekwah.advancedportals.core;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.name.Named;
|
|
||||||
import com.sekwah.advancedportals.core.api.services.PortalServices;
|
import com.sekwah.advancedportals.core.api.services.PortalServices;
|
||||||
import com.sekwah.advancedportals.core.api.services.PortalTempDataServices;
|
import com.sekwah.advancedportals.core.api.services.PortalTempDataServices;
|
||||||
import com.sekwah.advancedportals.core.entities.PlayerLocation;
|
import com.sekwah.advancedportals.core.entities.PlayerLocation;
|
||||||
@ -19,7 +18,6 @@ public class CoreListeners {
|
|||||||
private PortalServices portalServices;
|
private PortalServices portalServices;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("portals-core")
|
|
||||||
private AdvancedPortalsCore portalsCore;
|
private AdvancedPortalsCore portalsCore;
|
||||||
|
|
||||||
public void playerJoin(PlayerContainer player) {
|
public void playerJoin(PlayerContainer player) {
|
||||||
|
@ -2,10 +2,10 @@ package com.sekwah.advancedportals.core.api.destination;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.entities.DataTag;
|
|
||||||
import com.sekwah.advancedportals.core.api.registry.TagRegistry;
|
import com.sekwah.advancedportals.core.api.registry.TagRegistry;
|
||||||
import com.sekwah.advancedportals.core.api.warphandler.ActivationData;
|
import com.sekwah.advancedportals.core.api.warphandler.ActivationData;
|
||||||
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
|
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
|
||||||
|
import com.sekwah.advancedportals.core.entities.DataTag;
|
||||||
import com.sekwah.advancedportals.core.entities.PlayerLocation;
|
import com.sekwah.advancedportals.core.entities.PlayerLocation;
|
||||||
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.sekwah.advancedportals.core.api.registry;
|
|||||||
|
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
|
|
||||||
import com.sekwah.advancedportals.core.util.InfoLogger;
|
import com.sekwah.advancedportals.core.util.InfoLogger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.api.registry;
|
package com.sekwah.advancedportals.core.api.registry;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
|
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
|
||||||
|
|
||||||
@ -16,7 +17,8 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class TagRegistry<T> {
|
public class TagRegistry<T> {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of tag names which should be in order alphabetically
|
* List of tag names which should be in order alphabetically
|
||||||
@ -30,10 +32,6 @@ public class TagRegistry<T> {
|
|||||||
private Map<String, TagHandler.Creation<T>> creationHandlers = new HashMap();
|
private Map<String, TagHandler.Creation<T>> creationHandlers = new HashMap();
|
||||||
private Map<String, TagHandler.TagStatus<T>> statusHandlers = new HashMap();
|
private Map<String, TagHandler.TagStatus<T>> statusHandlers = new HashMap();
|
||||||
|
|
||||||
public TagRegistry(AdvancedPortalsCore portalsCore) {
|
|
||||||
this.portalsCore = portalsCore;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param arg
|
* @param arg
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.api.registry;
|
package com.sekwah.advancedportals.core.api.registry;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.name.Named;
|
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.effect.WarpEffect;
|
import com.sekwah.advancedportals.core.api.effect.WarpEffect;
|
||||||
|
|
||||||
@ -19,7 +18,6 @@ public class WarpEffectRegistry {
|
|||||||
private Map<String, WarpEffect> soundEffects = new HashMap();
|
private Map<String, WarpEffect> soundEffects = new HashMap();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("portals-core")
|
|
||||||
private AdvancedPortalsCore portalsCore;
|
private AdvancedPortalsCore portalsCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,6 +144,9 @@ public class CommandWithSubCommands implements CommandTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> filterTabResults(List<String> tabList, String lastArg) {
|
public List<String> filterTabResults(List<String> tabList, String lastArg) {
|
||||||
|
if(tabList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
for(String arg : tabList.toArray(new String[0])) {
|
for(String arg : tabList.toArray(new String[0])) {
|
||||||
if(!arg.startsWith(lastArg.toLowerCase())) {
|
if(!arg.startsWith(lastArg.toLowerCase())) {
|
||||||
tabList.remove(arg);
|
tabList.remove(arg);
|
||||||
|
@ -3,8 +3,8 @@ package com.sekwah.advancedportals.core.commands.subcommands.desti;
|
|||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.api.destination.Destination;
|
import com.sekwah.advancedportals.core.api.destination.Destination;
|
||||||
import com.sekwah.advancedportals.core.entities.DataTag;
|
|
||||||
import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand;
|
import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand;
|
||||||
|
import com.sekwah.advancedportals.core.entities.DataTag;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
|
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
|
||||||
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
||||||
|
@ -3,8 +3,8 @@ package com.sekwah.advancedportals.core.commands.subcommands.portal;
|
|||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
|
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
|
||||||
import com.sekwah.advancedportals.core.entities.DataTag;
|
|
||||||
import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand;
|
import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand;
|
||||||
|
import com.sekwah.advancedportals.core.entities.DataTag;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
|
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
|
||||||
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.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.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
@ -10,11 +11,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class EndGatewayBlockSubCommand implements SubCommand {
|
public class EndGatewayBlockSubCommand implements SubCommand {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
public EndGatewayBlockSubCommand(AdvancedPortalsCore portalsCore) {
|
|
||||||
this.portalsCore = portalsCore;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.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.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
@ -10,11 +11,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class EndPortalBlockSubCommand implements SubCommand {
|
public class EndPortalBlockSubCommand implements SubCommand {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
public EndPortalBlockSubCommand(AdvancedPortalsCore portalsCore) {
|
|
||||||
this.portalsCore = portalsCore;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.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.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
@ -10,11 +11,9 @@ import java.util.List;
|
|||||||
|
|
||||||
public class PortalBlockSubCommand implements SubCommand {
|
public class PortalBlockSubCommand implements SubCommand {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
|
|
||||||
public PortalBlockSubCommand(AdvancedPortalsCore portalsCore) {
|
|
||||||
this.portalsCore = portalsCore;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.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.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
@ -9,11 +10,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ReloadSubCommand implements SubCommand {
|
public class ReloadSubCommand implements SubCommand {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
public ReloadSubCommand(AdvancedPortalsCore portalsCore) {
|
|
||||||
this.portalsCore = portalsCore;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.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.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
@ -10,11 +11,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class SelectorSubCommand implements SubCommand {
|
public class SelectorSubCommand implements SubCommand {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
public SelectorSubCommand(AdvancedPortalsCore portalsCore) {
|
|
||||||
this.portalsCore = portalsCore;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.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.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
@ -9,10 +10,10 @@ import java.util.List;
|
|||||||
|
|
||||||
public class TransUpdateSubCommand implements SubCommand {
|
public class TransUpdateSubCommand implements SubCommand {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
|
|
||||||
public TransUpdateSubCommand(AdvancedPortalsCore portalsCore) {
|
public TransUpdateSubCommand() {
|
||||||
this.portalsCore = portalsCore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,12 +3,9 @@ package com.sekwah.advancedportals.core.config;
|
|||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.Scopes;
|
import com.google.inject.Scopes;
|
||||||
import com.google.inject.name.Named;
|
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.repository.*;
|
import com.sekwah.advancedportals.core.repository.*;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class RepositoryModule extends AbstractModule {
|
public class RepositoryModule extends AbstractModule {
|
||||||
|
|
||||||
private final AdvancedPortalsCore portalsCore;
|
private final AdvancedPortalsCore portalsCore;
|
||||||
@ -26,7 +23,6 @@ public class RepositoryModule extends AbstractModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Named("portals-core")
|
|
||||||
AdvancedPortalsCore providePortalsCore() {
|
AdvancedPortalsCore providePortalsCore() {
|
||||||
return this.portalsCore;
|
return this.portalsCore;
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,9 @@ package com.sekwah.advancedportals.core.data;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.inject.name.Named;
|
import com.google.inject.Inject;
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.xml.crypto.Data;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
@ -18,17 +15,10 @@ public class DataStorage {
|
|||||||
private File dataFolder;
|
private File dataFolder;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("portals-core")
|
|
||||||
private AdvancedPortalsCore portalsCore;
|
private AdvancedPortalsCore portalsCore;
|
||||||
|
|
||||||
/**
|
public DataStorage(File dataStorageLoc) {
|
||||||
* Only lets it be set once
|
this.dataFolder = dataStorageLoc;
|
||||||
* @param location
|
|
||||||
*/
|
|
||||||
public void setStorageLocation(File location) {
|
|
||||||
if(this.dataFolder == null) {
|
|
||||||
this.dataFolder = location;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,11 +2,12 @@ package com.sekwah.advancedportals.core.repository;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.api.destination.Destination;
|
import com.sekwah.advancedportals.core.api.destination.Destination;
|
||||||
import com.sekwah.advancedportals.core.entities.DataTag;
|
|
||||||
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
|
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
|
||||||
|
import com.sekwah.advancedportals.core.entities.DataTag;
|
||||||
import com.sekwah.advancedportals.core.entities.PlayerLocation;
|
import com.sekwah.advancedportals.core.entities.PlayerLocation;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
|
||||||
@ -20,6 +21,9 @@ import java.util.Map;
|
|||||||
public class DestinationRepositoryImpl implements DestinationRepository {
|
public class DestinationRepositoryImpl implements DestinationRepository {
|
||||||
private Map<String, Destination> destiHashMap = new HashMap<>();
|
private Map<String, Destination> destiHashMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private AdvancedPortalsCore portalsCore;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(String name, Destination destination) {
|
public void create(String name, Destination destination) {
|
||||||
destiHashMap.put(name, destination);
|
destiHashMap.put(name, destination);
|
||||||
@ -35,11 +39,6 @@ public class DestinationRepositoryImpl implements DestinationRepository {
|
|||||||
return ImmutableMap.copyOf(destiHashMap);
|
return ImmutableMap.copyOf(destiHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void loadDestinations() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Destination createDesti(String name, PlayerContainer player, PlayerLocation playerLocation, ArrayList<DataTag> tags) {
|
public Destination createDesti(String name, PlayerContainer player, PlayerLocation playerLocation, ArrayList<DataTag> tags) {
|
||||||
// TODO change to write messages
|
// TODO change to write messages
|
||||||
@ -63,25 +62,21 @@ public class DestinationRepositoryImpl implements DestinationRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.destiHashMap.put(name, desti);
|
this.destiHashMap.put(name, desti);
|
||||||
this.saveDestinations(AdvancedPortalsCore.getInstance());
|
this.saveDestinations();
|
||||||
return desti;
|
return desti;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void loadDestinations() {
|
||||||
* TODO change these, may be good if the data storage was an inject as well as it would save time and clean up layout
|
|
||||||
* @param portalsCore
|
|
||||||
*/
|
|
||||||
public void loadDestinations(AdvancedPortalsCore portalsCore) {
|
|
||||||
Type type = new TypeToken<HashMap<String, Destination>>() {
|
Type type = new TypeToken<HashMap<String, Destination>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
this.destiHashMap = portalsCore.getDataStorage().loadJson(type, "destinations.json");
|
this.destiHashMap = this.portalsCore.getDataStorage().loadJson(type, "destinations.json");
|
||||||
this.saveDestinations(portalsCore);
|
this.saveDestinations();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveDestinations(AdvancedPortalsCore portalsCore) {
|
public void saveDestinations() {
|
||||||
if (this.destiHashMap == null) {
|
if (this.destiHashMap == null) {
|
||||||
this.destiHashMap = new HashMap<>();
|
this.destiHashMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
portalsCore.getDataStorage().storeJson(this.destiHashMap, "destinations.json");
|
this.portalsCore.getDataStorage().storeJson(this.destiHashMap, "destinations.json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package com.sekwah.advancedportals.coreconnector.container;
|
package com.sekwah.advancedportals.coreconnector.container;
|
||||||
|
|
||||||
|
import com.sekwah.advancedportals.core.entities.PlayerLocation;
|
||||||
|
import com.sekwah.advancedportals.core.entities.PortalLocation;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,13 +17,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.sekwah.advancedportals.spigot;
|
package com.sekwah.advancedportals.spigot;
|
||||||
|
|
||||||
import com.google.inject.Guice;
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.util.DataStorage;
|
import com.sekwah.advancedportals.core.util.DataStorage;
|
||||||
import com.sekwah.advancedportals.coreconnector.ConnectorDataCollector;
|
import com.sekwah.advancedportals.coreconnector.ConnectorDataCollector;
|
||||||
@ -10,7 +8,6 @@ import com.sekwah.advancedportals.metrics.Metrics;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.sekwah.advancedportals.spigot;
|
package com.sekwah.advancedportals.spigot;
|
||||||
|
|
||||||
import com.google.inject.name.Named;
|
|
||||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||||
import com.sekwah.advancedportals.core.CoreListeners;
|
import com.sekwah.advancedportals.core.CoreListeners;
|
||||||
import com.sekwah.advancedportals.core.data.PortalLocation;
|
import com.sekwah.advancedportals.core.data.PortalLocation;
|
||||||
@ -15,8 +14,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
public class Listeners implements Listener {
|
public class Listeners implements Listener {
|
||||||
|
|
||||||
private CoreListeners coreListeners = AdvancedPortalsCore.getInstance().getCoreListeners();
|
private CoreListeners coreListeners = AdvancedPortalsCore.getInstance().getCoreListeners();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.sekwah.advancedportals.spigot.convertolddata;
|
package com.sekwah.advancedportals.spigot.convertolddata;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
Loading…
Reference in New Issue
Block a user