mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 02:25:49 +01:00
fix: references to services in portal subcommands
This commit is contained in:
parent
722ef68ed0
commit
ef9241e260
@ -1,17 +1,24 @@
|
||||
package com.sekwah.advancedportals.core.commands.subcommands.portal;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.sekwah.advancedportals.core.commands.SubCommand;
|
||||
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer;
|
||||
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
|
||||
import com.sekwah.advancedportals.core.data.DataTag;
|
||||
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.core.services.PortalServices;
|
||||
import com.sekwah.advancedportals.core.util.Lang;
|
||||
import com.sekwah.advancedportals.core.util.TagReader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CreatePortalSubCommand implements SubCommand {
|
||||
|
||||
@Inject
|
||||
PortalServices portalServices;
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||
if(args.length > 1) {
|
||||
@ -22,16 +29,15 @@ public class CreatePortalSubCommand implements SubCommand {
|
||||
}
|
||||
ArrayList<DataTag> portalTags = TagReader.getTagsFromArgs(args);
|
||||
|
||||
// TODO sort portal services
|
||||
/*AdvancedPortal portal = AdvancedPortalsCore.getPortalServices().createPortal(args[1], player, portalTags);
|
||||
AdvancedPortal portal = portalServices.createPortal(args[1], player, portalTags);
|
||||
if(portal != null) {
|
||||
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translateColor("command.create.complete"));
|
||||
sender.sendMessage(Lang.translateColor("command.create.tags"));
|
||||
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.create.complete"));
|
||||
sender.sendMessage(Lang.translate("command.create.tags"));
|
||||
sender.sendMessage("\u00A7a" + "triggerBlock\u00A77:\u00A7e" + Arrays.toString(portal.getTriggerBlocks()));
|
||||
for (DataTag tag: portal.getArgs()) {
|
||||
sender.sendMessage("\u00A7a" + tag.NAME + "\u00A77:\u00A7e" + tag.VALUE);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.create.error"));
|
||||
}
|
||||
else {
|
||||
|
@ -18,7 +18,6 @@ public class LangUpdateSubCommand implements SubCommand {
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||
//this.portalsCore.getDataStorage().copyDefaultFile("lang/en_GB.lang", true);
|
||||
if(args.length > 1 && args[1].equalsIgnoreCase("overwrite")) {
|
||||
this.portalsCore.getDataStorage().copyDefaultFile("lang/en_GB.lang", true);
|
||||
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("translatedata.replaced"));
|
||||
|
@ -4,6 +4,8 @@ import com.google.inject.Inject;
|
||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||
import com.sekwah.advancedportals.core.commands.SubCommand;
|
||||
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer;
|
||||
import com.sekwah.advancedportals.core.services.DestinationServices;
|
||||
import com.sekwah.advancedportals.core.services.PortalServices;
|
||||
import com.sekwah.advancedportals.core.util.Lang;
|
||||
|
||||
import java.util.List;
|
||||
@ -13,13 +15,17 @@ public class ReloadSubCommand implements SubCommand {
|
||||
@Inject
|
||||
private AdvancedPortalsCore portalsCore;
|
||||
|
||||
@Inject
|
||||
PortalServices portalServices;
|
||||
|
||||
@Inject
|
||||
DestinationServices destinationServices;
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||
portalsCore.loadPortalConfig();
|
||||
// TODO re-add or figure out a replacement.
|
||||
//portalsCore.getPortalServices().loadPortals();
|
||||
//portalsCore.getDestinationServices().loadDestinations();
|
||||
// TODO also reload stuff like translations.
|
||||
portalServices.loadPortals();
|
||||
destinationServices.loadDestinations();
|
||||
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.reload.reloaded"));
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.sekwah.advancedportals.core.commands.subcommands.portal;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||
import com.sekwah.advancedportals.core.commands.SubCommand;
|
||||
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer;
|
||||
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
|
||||
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.core.services.PortalServices;
|
||||
import com.sekwah.advancedportals.core.util.Lang;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -14,17 +16,21 @@ import java.util.Map;
|
||||
|
||||
public class RemoveSubCommand implements SubCommand {
|
||||
|
||||
|
||||
@Inject
|
||||
PortalServices portalServices;
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||
if(args.length > 1) {
|
||||
// TODO sort portal services
|
||||
/*if(AdvancedPortalsCore.getPortalServices().removePortal(args[1], sender.getPlayerContainer())) {
|
||||
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translateColor("command.remove.complete"));
|
||||
if(portalServices.removePortal(args[1], sender.getPlayerContainer())) {
|
||||
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.remove.complete"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(Lang.translateColor("messageprefix.negative")
|
||||
+ Lang.translateColor("command.remove.error"));
|
||||
}*/
|
||||
sender.sendMessage(Lang.translate("messageprefix.negative")
|
||||
+ Lang.translate("command.remove.error"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
PlayerContainer player = sender.getPlayerContainer();
|
||||
@ -32,14 +38,13 @@ public class RemoveSubCommand implements SubCommand {
|
||||
sender.sendMessage(Lang.translate("command.remove.noname"));
|
||||
}
|
||||
else {
|
||||
// TODO sort portal services
|
||||
/*if(AdvancedPortalsCore.getPortalServices().removePlayerSelection(player)) {
|
||||
if(portalServices.removePlayerSelection(player)) {
|
||||
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(Lang.translateColor("messageprefix.negative")
|
||||
+ Lang.translateColor("command.remove.error"));
|
||||
}*/
|
||||
sender.sendMessage(Lang.translate("messageprefix.negative")
|
||||
+ Lang.translate("command.remove.error"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -52,11 +57,10 @@ public class RemoveSubCommand implements SubCommand {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
|
||||
List<String> portalNames = new ArrayList<>();
|
||||
// TODO sort portal services
|
||||
/*for(Map.Entry<String, AdvancedPortal> portal : AdvancedPortalsCore.getPortalServices().getPortals()) {
|
||||
for(Map.Entry<String, AdvancedPortal> portal : portalServices.getPortals()) {
|
||||
portalNames.add(portal.getKey());
|
||||
}
|
||||
Collections.sort(portalNames);*/
|
||||
Collections.sort(portalNames);
|
||||
return portalNames;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,11 @@ import com.sekwah.advancedportals.core.config.Config;
|
||||
import com.sekwah.advancedportals.core.config.ConfigProvider;
|
||||
import com.sekwah.advancedportals.core.data.DataStorage;
|
||||
import com.sekwah.advancedportals.core.repository.ConfigRepository;
|
||||
import com.sekwah.advancedportals.core.repository.IDestinationRepository;
|
||||
import com.sekwah.advancedportals.core.repository.IPortalRepository;
|
||||
import com.sekwah.advancedportals.core.repository.impl.ConfigRepositoryImpl;
|
||||
import com.sekwah.advancedportals.core.services.PortalServices;
|
||||
import com.sekwah.advancedportals.core.repository.impl.DestinationRepositoryImpl;
|
||||
import com.sekwah.advancedportals.core.repository.impl.PortalRepositoryImpl;
|
||||
import com.sekwah.advancedportals.core.util.InfoLogger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -31,11 +34,14 @@ public class AdvancedPortalsModule extends AbstractModule {
|
||||
*/
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(IPortalRepository.class).to(PortalRepositoryImpl.class).in(Scopes.SINGLETON);
|
||||
bind(IDestinationRepository.class).to(DestinationRepositoryImpl.class).in(Scopes.SINGLETON);
|
||||
bind(ConfigRepository.class).to(ConfigRepositoryImpl.class).in(Scopes.SINGLETON);
|
||||
|
||||
// Instances
|
||||
bind(AdvancedPortalsCore.class).toInstance(advancedPortalsCore);
|
||||
bind(InfoLogger.class).toInstance(advancedPortalsCore.getInfoLogger());
|
||||
bind(DataStorage.class).toInstance(advancedPortalsCore.getDataStorage());
|
||||
bind(ConfigRepository.class).to(ConfigRepositoryImpl.class).in(Scopes.SINGLETON);
|
||||
|
||||
// Providers
|
||||
bind(Config.class).toProvider(ConfigProvider.class);
|
||||
|
Loading…
Reference in New Issue
Block a user