feat: add basic desti create and remove

This commit is contained in:
Sekwah 2023-12-05 09:20:08 +00:00
parent c3e60fa02e
commit 3c517a97c9
23 changed files with 262 additions and 101 deletions

View File

@ -4,6 +4,7 @@ import com.google.inject.Inject;
import com.google.inject.Injector;
import com.sekwah.advancedportals.core.commands.CommandWithSubCommands;
import com.sekwah.advancedportals.core.commands.subcommands.desti.CreateDestiSubCommand;
import com.sekwah.advancedportals.core.commands.subcommands.desti.RemoveDestiSubCommand;
import com.sekwah.advancedportals.core.commands.subcommands.portal.*;
import com.sekwah.advancedportals.core.connector.commands.CommandRegister;
import com.sekwah.advancedportals.core.registry.TagRegistry;
@ -45,6 +46,7 @@ public class AdvancedPortalsCore {
this.dataStorage = new DataStorage(dataStorageLoc);
this.infoLogger = infoLogger;
this.module = new AdvancedPortalsModule(this);
// Provide any items that need to be provided.
//this.module.addInstanceBinding(DataCollector.class, this.infoLogger);
@ -96,7 +98,7 @@ public class AdvancedPortalsCore {
this.portalCommand.registerSubCommand("endportalblock", new EndPortalBlockSubCommand());
this.portalCommand.registerSubCommand("endgatewayblock", new EndGatewayBlockSubCommand());
this.portalCommand.registerSubCommand("create", new CreatePortalSubCommand());
this.portalCommand.registerSubCommand("remove", new RemoveSubCommand());
this.portalCommand.registerSubCommand("remove", new RemovePortalSubCommand());
this.portalCommand.registerSubCommand("list", new ListSubCommand());
commandRegister.registerCommand("portal", this.portalCommand);
@ -105,6 +107,7 @@ public class AdvancedPortalsCore {
private void registerDestinationCommand(CommandRegister commandRegister) {
this.destiCommand = new CommandWithSubCommands(this);
this.destiCommand.registerSubCommand("create", new CreateDestiSubCommand());
this.destiCommand.registerSubCommand("remove", new RemoveDestiSubCommand());
commandRegister.registerCommand("destination", this.destiCommand);
}

View File

@ -48,30 +48,23 @@ public class CreateDestiSubCommand extends CreateTaggedSubCommand {
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.error.noname"));
return;
}
sender.sendMessage(Lang.centeredTitle(Lang.translate("command.createdesti.prep")));
sender.sendMessage("");
sender.sendMessage(Lang.translate("command.create.tags"));
if(destinationTags.isEmpty()) {
sender.sendMessage(Lang.translate("desti.info.noargs"));
}
else {
this.printTags(sender, destinationTags, Tag.TagType.DESTINATION);
}
sender.sendMessage("");
Destination destination = destinationServices.createDesti(player, player.getLoc(), destinationTags);
if(destination != null) {
sender.sendMessage("");
sender.sendMessage(Lang.translate("command.create.tags"));
ArrayList<DataTag> destiArgs = destination.getArgs();
if(destiArgs.isEmpty()) {
sender.sendMessage(Lang.translate("desti.info.noargs"));
}
else {
for (DataTag tag : destiArgs) {
if(tag.VALUES.length == 1) {
sender.sendMessage(" \u00A7a" + tag.NAME + "\u00A77:\u00A7e" + tag.VALUES[0]);
} else {
sender.sendMessage("\u00A7a" + tag.NAME + "\u00A77:\u00A7e" + tag.VALUES[0]);
}
}
}
sender.sendMessage("");
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.createdesti.complete"));
}
else {
sender.sendMessage("");
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.createdesti.error"));
}
}

View File

@ -0,0 +1,63 @@
package com.sekwah.advancedportals.core.commands.subcommands.desti;
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.destination.Destination;
import com.sekwah.advancedportals.core.permissions.PortalPermissions;
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.services.DestinationServices;
import com.sekwah.advancedportals.core.util.Lang;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class RemoveDestiSubCommand implements SubCommand {
@Inject
DestinationServices destinationServices;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
if(args.length > 1) {
if(destinationServices.removeDesti(args[1], sender.getPlayerContainer())) {
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.portal.remove.complete"));
}
else {
sender.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("command.destination.remove.error"));
}
}
else {
sender.sendMessage(Lang.translate("command.portal.remove.noname"));
}
}
@Override
public boolean hasPermission(CommandSenderContainer sender) {
return sender.isOp() || PortalPermissions.CREATE_PORTAL.hasPermission(sender);
}
@Override
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
if(args.length > 2) {
return Collections.emptyList();
}
List<String> destiNames = destinationServices.getDestinations();
Collections.sort(destiNames);
return destiNames;
}
@Override
public String getBasicHelpText() {
return Lang.translate("command.create.help");
}
@Override
public String getDetailedHelpText() {
return Lang.translate("command.create.detailedhelp");
}
}

View File

@ -45,16 +45,7 @@ public class CreatePortalSubCommand extends CreateTaggedSubCommand {
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()) {
if(tag.VALUES.length == 1) {
sender.sendMessage("\u00A7a" + tag.NAME + "\u00A77:\u00A7e" + tag.VALUES[0]);
} else {
// Output in the format tag.NAME(index): value
for (int i = 0; i < tag.VALUES.length; i++) {
sender.sendMessage("\u00A7a" + tag.NAME + "(" + i + ")\u00A77:\u00A7e" + tag.VALUES[i]);
}
}
}
this.printTags(sender, portal.getArgs(), Tag.TagType.PORTAL);
}
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.create.error"));
}

View File

@ -1,7 +1,6 @@
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;
@ -15,7 +14,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
public class RemoveSubCommand implements SubCommand {
public class RemovePortalSubCommand implements SubCommand {
@Inject
@ -25,17 +24,17 @@ public class RemoveSubCommand implements SubCommand {
public void onCommand(CommandSenderContainer sender, String[] args) {
if(args.length > 1) {
if(portalServices.removePortal(args[1], sender.getPlayerContainer())) {
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.remove.complete"));
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.portal.remove.complete"));
}
else {
sender.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("command.remove.error"));
+ Lang.translate("command.portal.remove.error"));
}
}
else {
PlayerContainer player = sender.getPlayerContainer();
if(player == null) {
sender.sendMessage(Lang.translate("command.remove.noname"));
sender.sendMessage(Lang.translate("command.portal.remove.noname"));
}
else {
if(portalServices.removePlayerSelection(player)) {
@ -43,7 +42,7 @@ public class RemoveSubCommand implements SubCommand {
}
else {
sender.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("command.remove.error"));
+ Lang.translate("command.portal.remove.error"));
}
}
}

View File

@ -76,10 +76,12 @@ public abstract class CreateTaggedSubCommand implements SubCommand {
if(portalTag.NAME.equals(tag.getName())) {
return false;
}
// check the tag aliases
for (String alias : tag.getAliases()) {
if(portalTag.NAME.equals(alias)) {
return false;
var aliases = tag.getAliases();
if(aliases != null) {
for (String alias : aliases) {
if(portalTag.NAME.equals(alias)) {
return false;
}
}
}
}
@ -99,4 +101,17 @@ public abstract class CreateTaggedSubCommand implements SubCommand {
return suggestions;
}
protected void printTags(CommandSenderContainer sender, List<DataTag> dataTags, Tag.TagType tagType) {
for (DataTag tag : dataTags) {
if(tag.VALUES.length == 1) {
sender.sendMessage(" \u00A7a" + tag.NAME + "\u00A77:\u00A7e" + tag.VALUES[0]);
} else {
for (int i = 0; i < tag.VALUES.length; i++) {
sender.sendMessage(" \u00A7a" + tag.NAME + "\u00A77[" + i + "]:\u00A7e" + tag.VALUES[i]);
}
}
}
// TODO add a note saying if tags were ignored due to not being valid for the type
}
}

View File

@ -23,6 +23,7 @@ public class AdvancedPortalsModule extends AbstractModule {
private Injector injector;
private AdvancedPortalsCore advancedPortalsCore;
private DataStorage dataStorage;
private List<DelayedBinding> delayedBindings = new ArrayList<>();

View File

@ -1,7 +1,6 @@
package com.sekwah.advancedportals.core.registry;
import com.google.inject.Inject;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.commands.SubCommand;
import com.sekwah.advancedportals.core.util.InfoLogger;
@ -37,12 +36,12 @@ public class SubCommandRegistry {
public boolean registerSubCommand(String arg, SubCommand subCommand) {
if (subCommand == null) {
this.infoLogger.logWarning("The subcommand '" + arg + "' cannot be null.");
this.infoLogger.warning("The subcommand '" + arg + "' cannot be null.");
return false;
}
if(this.subCommandMap.containsKey(arg)){
this.infoLogger.logWarning("The subcommand '" + arg + "' already exists.");
this.infoLogger.warning("The subcommand '" + arg + "' already exists.");
return false;
}

View File

@ -65,7 +65,7 @@ public class TagRegistry {
// Check literal tags for clashes
if(this.literalTags.contains(tagName)) {
this.portalsCore.getInfoLogger().logWarning("A tag with the name " + tagName + " already exists.");
this.portalsCore.getInfoLogger().warning("A tag with the name " + tagName + " already exists.");
return false;
}
@ -74,7 +74,7 @@ public class TagRegistry {
if(aliases != null) {
for (String alias : aliases) {
if(this.literalTags.contains(alias)) {
this.portalsCore.getInfoLogger().logWarning("A tag with the alias " + alias + " already exists.");
this.portalsCore.getInfoLogger().warning("A tag with the alias " + alias + " already exists.");
return false;
}
}
@ -83,7 +83,7 @@ public class TagRegistry {
}
if (tagName == null) {
this.portalsCore.getInfoLogger().logWarning("A tag cannot be null.");
this.portalsCore.getInfoLogger().warning("A tag cannot be null.");
return false;
}

View File

@ -44,7 +44,7 @@ public class WarpEffectRegistry {
list = this.visualEffects;
break;
default:
this.portalsCore.getInfoLogger().logWarning(type.toString()
this.portalsCore.getInfoLogger().warning(type.toString()
+ " effect type not recognised");
return false;
}
@ -65,7 +65,7 @@ public class WarpEffectRegistry {
list = this.visualEffects;
break;
default:
this.infoLogger.logWarning(type.toString()
this.infoLogger.warning(type.toString()
+ " effect type not recognised");
return null;
}
@ -73,7 +73,7 @@ public class WarpEffectRegistry {
return list.get(name);
}
else{
this.infoLogger.logWarning("No effect of type:"
this.infoLogger.warning("No effect of type:"
+ type.toString() + " was registered with the name: " + name);
return null;
}

View File

@ -3,8 +3,10 @@ package com.sekwah.advancedportals.core.repository;
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import java.util.List;
public interface IJsonRepository<T> {
Gson gson = new Gson();
boolean save(String name, T t);
boolean containsKey(String name);
@ -15,5 +17,5 @@ public interface IJsonRepository<T> {
T get(String name);
ImmutableMap<String, T> getAll();
List<String> listAll();
}

View File

@ -1,26 +1,31 @@
package com.sekwah.advancedportals.core.repository.impl;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.sekwah.advancedportals.core.destination.Destination;
import com.sekwah.advancedportals.core.repository.IDestinationRepository;
import com.sekwah.advancedportals.core.serializeddata.DataStorage;
import com.sekwah.advancedportals.core.util.InfoLogger;
import javax.inject.Singleton;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
@Singleton
public class DestinationRepositoryImpl implements IDestinationRepository {
private final String fileLocation = "";
private final String fileLocation = "desti/";
@Inject
DataStorage dataStorage;
private Map<String, Destination> destinationCache = new HashMap<String, Destination>();
@Inject
InfoLogger infoLogger;
public void addDestination(String name, Destination destination) throws IOException {
gson.toJson(destination, new FileWriter(fileLocation + name + ".json"));
public void addDestination(String name, Destination destination) {
infoLogger.log("Adding destination: " + fileLocation + name + ".json");
dataStorage.storeJson(destination, fileLocation + name + ".json");
}
@Override
@ -29,17 +34,12 @@ public class DestinationRepositoryImpl implements IDestinationRepository {
}
public boolean containsKey(String name) {
return Files.exists(Paths.get(fileLocation + "\\" + name + ".json"));
return dataStorage.fileExists(fileLocation + name + ".json");
}
@Override
public boolean delete(String name) {
try {
Files.deleteIfExists(Paths.get(fileLocation + "\\" + name + ".json"));
} catch (IOException e) {
e.printStackTrace();
}
return false;
return dataStorage.deleteFile(fileLocation + name + ".json");
}
@Override
@ -47,11 +47,12 @@ public class DestinationRepositoryImpl implements IDestinationRepository {
return false;
}
public Destination get(String s) {
return null;
public Destination get(String desti) {
return dataStorage.loadJson(Destination.class, fileLocation + desti + ".json");
}
public ImmutableMap<String, Destination> getAll() {
return null;
@Override
public List<String> listAll() {
return dataStorage.listAllFiles(fileLocation, true);
}
}

View File

@ -2,14 +2,23 @@ package com.sekwah.advancedportals.core.repository.impl;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Singleton;
import com.sekwah.advancedportals.core.destination.Destination;
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.serializeddata.WorldLocation;
import com.sekwah.advancedportals.core.repository.IPortalRepository;
import java.util.UUID;
import java.util.*;
@Singleton
public class PortalRepositoryImpl implements IPortalRepository {
/**
* In memory copy of the portal files as they will be accessed every movement tick.
*
* If we need to get it by name we can just load it from the file, but this is good for looping fast for the player move events.
*/
private List<AdvancedPortal> portals = new ArrayList<>();
public String getSelectedPortal(UUID uuid) {
return null;
}
@ -40,7 +49,7 @@ public class PortalRepositoryImpl implements IPortalRepository {
}
@Override
public ImmutableMap<String, WorldLocation> getAll() {
public List<String> listAll() {
return null;
}
}

View File

@ -9,6 +9,10 @@ import com.sekwah.advancedportals.core.util.InfoLogger;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class DataStorage {
@ -65,15 +69,24 @@ public class DataStorage {
return gson.fromJson(bufReader, dataHolder);
}
public void storeJson(Object dataHolder, String location) {
public boolean storeJson(Object dataHolder, String location) {
// Create folders if they don't exist
File outFile = new File(this.dataFolder, location);
if (!outFile.exists()) {
if(!outFile.getParentFile().mkdirs()) {
infoLogger.warning("Failed to create folder for file: " + location);
}
}
String json = gson.toJson(dataHolder);
try {
FileWriter fileWriter = new FileWriter(new File(this.dataFolder, location));
fileWriter.write(json);
fileWriter.close();
return true;
} catch (IOException e) {
e.printStackTrace();
infoLogger.error(e);
}
return false;
}
/**
@ -108,15 +121,15 @@ public class DataStorage {
writeToFile(inputStream, outFile);
} catch (NullPointerException e) {
e.printStackTrace();
this.infoLogger.logWarning("Could not load " + sourceLoc + ". The file does" +
this.infoLogger.warning("Could not load " + sourceLoc + ". The file does" +
"not exist or there has been an error reading the file.");
return false;
} catch (FileNotFoundException e) {
e.printStackTrace();
this.infoLogger.logWarning("Could not create " + sourceLoc);
this.infoLogger.warning("Could not create " + sourceLoc);
} catch (IOException e) {
e.printStackTrace();
this.infoLogger.logWarning("File error reading " + sourceLoc);
this.infoLogger.warning("File error reading " + sourceLoc);
}
}
return true;
@ -143,7 +156,7 @@ public class DataStorage {
return this.getClass().getClassLoader().getResourceAsStream(location);
} catch (NullPointerException e) {
e.printStackTrace();
this.infoLogger.logWarning("Could not load " + location + ". The file does" +
this.infoLogger.warning("Could not load " + location + ". The file does" +
"not exist or there has been an error reading the file.");
return null;
}
@ -169,4 +182,46 @@ public class DataStorage {
inputStream.close();
outStream.close();
}
public boolean fileExists(String name) {
return new File(this.dataFolder, name).exists();
}
/**
* @param fileLocation
* @param trimExtension
* @return
*/
public List<String> listAllFiles(String fileLocation, boolean trimExtension) {
File directory = new File(dataFolder, fileLocation);
var list = new ArrayList<String>();
if (directory.exists() && directory.isDirectory()) {
File[] files = directory.listFiles();
if (files != null) {
for (File file : files) {
if (file.isFile()) {
String fileName = file.getName();
if (trimExtension) {
int i = fileName.lastIndexOf('.');
if (i > 0) {
fileName = fileName.substring(0, i);
}
}
list.add(fileName);
}
}
}
} else {
infoLogger.warning("Directory does not exist or is not a directory: " + fileLocation);
}
return list;
}
public boolean deleteFile(String fileLocation) {
return new File(dataFolder, fileLocation).delete();
}
}

View File

@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName;
public class PlayerLocation extends WorldLocation {
@SerializedName("yaw")
@SerializedName("r")
private final float yaw;
@SerializedName("p")

View File

@ -1,10 +1,14 @@
package com.sekwah.advancedportals.core.services;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.gson.reflect.TypeToken;
import com.google.inject.Inject;
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.serializeddata.DataStorage;
import com.sekwah.advancedportals.core.serializeddata.DataTag;
import com.sekwah.advancedportals.core.serializeddata.PlayerLocation;
import com.sekwah.advancedportals.core.destination.Destination;
@ -16,6 +20,8 @@ import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Handles logic for all destination, this is a transient layer so it should
@ -47,20 +53,13 @@ public class DestinationServices {
return false;
}
public ImmutableMap<String, Destination> getDestination() {
return destinationRepository.getAll();
public List<String> getDestinations() {
return destinationRepository.listAll();
}
public ImmutableMap<String, Destination> getDestinations() {
return ImmutableMap.copyOf(destinationRepository.getAll());
}
public Destination createDesti(PlayerContainer player, PlayerLocation playerLocation, ArrayList<DataTag> tags) {
// Find the tag with the "name" NAME
DataTag nameTag = tags.stream().findFirst().filter(tag -> tag.NAME.equals("name")).orElse(null);
DataTag nameTag = tags.stream().filter(tag -> tag.NAME.equals("name")).findFirst().orElse(null);
String name = nameTag == null ? null : nameTag.VALUES[0];
@ -115,4 +114,12 @@ public class DestinationServices {
}
this.portalsCore.getDataStorage().storeJson(this.destiHashMap, "destinations.json");*/
}
public boolean removeDesti(String name, PlayerContainer playerContainer) {
if(this.destinationRepository.containsKey(name)) {
this.destinationRepository.delete(name);
return true;
}
return false;
}
}

View File

@ -42,7 +42,7 @@ public class PortalServices {
public AdvancedPortal createPortal(String name, PlayerContainer player, ArrayList<DataTag> portalTags) {
if(name == null){
infoLogger.logWarning("Attempted to make a portal with no name");
infoLogger.warning("Attempted to make a portal with no name");
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.error.noname"));
return null;
}

View File

@ -8,6 +8,13 @@ import com.sekwah.advancedportals.core.warphandler.Tag;
import java.util.List;
/**
* The name of the destination or portal.
* <p>
* Most of the implementation of this tag is external, this is just to allow for the tag to be used.
* <p>
* Most tags shouldn't be like this unless they are to be paired with another tag.
*/
public class NameTag implements Tag.Activation, Tag.AutoComplete {
private final TagType[] tagTypes = new TagType[]{ TagType.PORTAL, TagType.DESTINATION };

View File

@ -1,16 +1,19 @@
package com.sekwah.advancedportals.core.util;
public abstract class InfoLogger {
/**
* Problematic messages
* @param s warning message
*/
public abstract void logWarning(String s);
public abstract void warning(String s);
/**
* General information logging
* @param s info message
*/
public abstract void log(String s);
public abstract void error(Exception e);
}

View File

@ -113,11 +113,11 @@ public class Lang {
Map<String, String> initialMap = Lang.parseLang(url.openStream());
Lang.instance.languageMap.putAll(initialMap);
} else {
this.infoLogger.logWarning("Could not load " + fileName + ".lang from within Advanced Portals as it doesn't exist.");
this.infoLogger.warning("Could not load " + fileName + ".lang from within Advanced Portals as it doesn't exist.");
}
} catch (IOException e) {
e.printStackTrace();
this.infoLogger.logWarning("Could not load " + fileName + ".lang from within Advanced Portals.");
this.infoLogger.warning("Could not load " + fileName + ".lang from within Advanced Portals.");
}
Map<String, String> newLangMap = this.getLanguageMap(fileName );

View File

@ -62,21 +62,24 @@ command.create.detailedhelp=Format is /portal create (name) [tag:tagvalue] List
command.create.complete= The portal has been successfully created.
command.createdesti.help=Creates destinations
command.createdesti.error= There was an error making the destination
command.createdesti.error= There was a problem making the destination
command.createdesti.console= You cannot create a destination using the console.
command.createdesti.detailedhelp=Format is /desti create (name) [tag:tagvalue] List tags after create in the format tag:value, if your value needs spaces use the format tag:"value with spaces"
command.createdesti.prep=&aCreating destination
command.createdesti.complete= The destination has been successfully created.
command.create.tags=&aTags&e:
command.create.tags=&aTags&7:
command.playeronly= Sorry but that command can only be run by a player.
command.remove.noname= You need to give the name of the portal you want to remove.
command.remove.error= There was a problem removing the portal:
command.remove.noname=No portal by that name was found
command.remove.invalidselection=The portal selection you had is no longer valid
command.remove.noselection=You don't have a portal selected
command.remove.complete= The portal has been successfully removed.
command.portal.remove.noname= You need to give the name of the portal you want to remove.
command.portal.remove.error= There was a problem removing the portal.
command.portal.remove.noname=No portal by that name was found
command.portal.remove.invalidselection=The portal selection you had is no longer valid
command.portal.remove.noselection=You don't have a portal selected
command.portal.remove.complete= The portal has been successfully removed.
command.destination.remove.error= There was a problem removing the destination.
command.list.help=Lists portals
command.list=&7 Portals&e:
@ -102,6 +105,7 @@ command.error.notags= No tags have been given. You need to include at least &ena
command.error.nametaken= The name &e%1$s &cis already taken.
desti.error.save= There was a problem saving the destination:
desti.error.noname= You must specify a name. (name:someNameHere)
error.notplayer=Only players can do that.

View File

@ -2,6 +2,8 @@ package com.sekwah.advancedportals.spigot;
import com.sekwah.advancedportals.core.util.InfoLogger;
import java.util.logging.Level;
public class SpigotInfoLogger extends InfoLogger {
private final AdvancedPortalsPlugin plugin;
@ -11,7 +13,7 @@ public class SpigotInfoLogger extends InfoLogger {
}
@Override
public void logWarning(String s) {
public void warning(String s) {
plugin.getLogger().warning(s);
}
@ -19,4 +21,11 @@ public class SpigotInfoLogger extends InfoLogger {
public void log(String s) {
plugin.getLogger().info(s);
}
@Override
public void error(Exception e) {
plugin.getLogger().log(Level.SEVERE, e.getMessage(), e);
}
}

View File

@ -44,7 +44,7 @@ public class SpigotPlayerContainer implements PlayerContainer {
public PlayerLocation getLoc() {
Location loc = this.player.getLocation();
return new PlayerLocation(loc.getWorld().getName(), loc.getX(), loc.getY(), loc.getZ());
return new PlayerLocation(loc.getWorld().getName(), loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
}
public double getEyeHeight() {