Moving stuff and looking at better registry

This commit is contained in:
Sekwah 2020-06-29 00:23:06 +01:00
parent f8da332f1d
commit b87edaa8a8
No known key found for this signature in database
GPG Key ID: C3BE2E6C861A461A
48 changed files with 142 additions and 193 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.api.commands;
package com.sekwah.advancedportals.core.api.commands;
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.api.events;
package com.sekwah.advancedportals.core.api.events;
/**

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.api.events;
package com.sekwah.advancedportals.core.api.events;
/**
* Trigered whenever a player activates the warp after the tags are handled.
@ -69,4 +69,4 @@ public class WarpEvent /*extends Event implements Cancellable*/ {
public HandlerList getHandlers() {
return handlers;
}*/
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.api.warphandler;
package com.sekwah.advancedportals.core.api.warphandler;
import com.sekwah.advancedportals.PlayerLocation;

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.api.warphandler;
package com.sekwah.advancedportals.core.api.warphandler;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.commands;
package com.sekwah.advancedportals.core.commands;
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;

View File

@ -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<String> onTabComplete(CommandSenderContainer sender, String[] args) {
if(args.length > 1) {
if(args[0].equalsIgnoreCase("help")) {
List<String> allowedCommands = new ArrayList<>();
allowedCommands.addAll(this.subCommandRegistry.getSubCommands());
List<String> allowedCommands = new ArrayList<>(this.subCommandRegistry.getSubCommands());
Collections.sort(allowedCommands);
return this.filterTabResults(allowedCommands, args[args.length - 1]);
}

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.commands.subcommands;
package com.sekwah.advancedportals.core.commands.subcommands;
import com.sekwah.advancedportals.DataTag;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -0,0 +1,9 @@
package com.sekwah.advancedportals.core.registry;
public class AnnotationScanner {
public void registerSubCommands() {
//AnnotationScanner.class.getClassLoader()
}
}

View File

@ -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
}
}

View File

@ -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 {

View File

@ -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 {

View File

@ -1,6 +1,4 @@
package com.sekwah.advancedportals.repository;
import com.sekwah.advancedportals.api.destination.Destination;
public interface DestinationRepository<T> extends JsonRepository<T> {
}

View File

@ -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<Destination>{
@ -56,5 +51,6 @@ public class DestinationRepositoryImpl implements DestinationRepository<Destinat
}
public ImmutableMap<String, Destination> get(String s) {
return null;
}
}

View File

@ -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<String, Destination> getDestinations() {
return ImmutableMap.copyOf(destiHashMap);
}
public Destination createDesti(String name, PlayerContainer player, PlayerLocation playerLocation, ArrayList<DataTag> 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<Destination> 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<HashMap<String, Destination>>() {
}.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");
}
}

View File

@ -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 {

View File

@ -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;

View File

@ -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<Destination> creation = AdvancedPortalsCore.getDestinationTagRegistry().getCreationHandler(destiTag.NAME);
@ -96,14 +92,14 @@ public class DestinationServices {
public void loadDestinations() {
Type type = new TypeToken<HashMap<String, Destination>>() {
}.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");*/
}
}

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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;