feat: can create basic portals with tags

This commit is contained in:
Sekwah 2023-12-18 01:33:14 +00:00
parent 21e7481a1a
commit ad7a482915
16 changed files with 218 additions and 107 deletions

View File

@ -12,6 +12,7 @@ import com.sekwah.advancedportals.core.serializeddata.DataStorage;
import com.sekwah.advancedportals.core.module.AdvancedPortalsModule;
import com.sekwah.advancedportals.core.repository.ConfigRepository;
import com.sekwah.advancedportals.core.services.DestinationServices;
import com.sekwah.advancedportals.core.services.PortalServices;
import com.sekwah.advancedportals.core.tags.activation.DestiTag;
import com.sekwah.advancedportals.core.tags.activation.NameTag;
import com.sekwah.advancedportals.core.util.GameScheduler;
@ -51,6 +52,9 @@ public class AdvancedPortalsCore {
@Inject
private TagRegistry tagRegistry;
@Inject
private PortalServices portalServices;
@Inject
private DestinationServices destinationServices;
@ -97,6 +101,7 @@ public class AdvancedPortalsCore {
this.registerCommands();
this.registerTags();
this.portalServices.loadPortals();
this.destinationServices.loadDestinations();
this.infoLogger.log(Lang.translate("logger.pluginenable"));
}

View File

@ -36,7 +36,7 @@ public class CreateDestiSubCommand extends CreateTaggedSubCommand {
ArrayList<DataTag> destinationTags = TagReader.getTagsFromArgs(args);
// Find the tag with the "name" NAME
DataTag nameTag = destinationTags.stream().findFirst().filter(tag -> tag.NAME.equals("name")).orElse(null);
DataTag nameTag = destinationTags.stream().filter(tag -> tag.NAME.equals("name")).findFirst().orElse(null);
// If the tag is null, check if arg[1] has a : to check it's not a tag.
if(nameTag == null && !args[1].contains(":")) {

View File

@ -20,7 +20,7 @@ public class RemoveDestiSubCommand implements SubCommand {
public void onCommand(CommandSenderContainer sender, String[] args) {
if(args.length > 1) {
if(destinationServices.removeDestination(args[1], sender.getPlayerContainer())) {
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.portal.remove.complete"));
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.destination.remove.complete"));
}
else {
sender.sendMessage(Lang.translate("messageprefix.negative")

View File

@ -89,7 +89,7 @@ public class ShowDestiSubCommand implements SubCommand, SubCommand.SubCommandOnI
for (Destination destination : destinationServices.getDestinations()) {
var pos = destination.getLoc();
if(pos.distanceTo(player.getLoc()) < config.getVisibleRange()) {
Debug.addMarker(player, pos.toBlockPos(), destination.getArgValues("name")[0], new Color(100, 100, 100, 100), 1000);
Debug.addMarker(player, pos.toBlockPos(), destination.getArgValues("name")[0], new Color(100, 100, 100, 100), 1300);
}
}
}

View File

@ -9,6 +9,8 @@ import com.sekwah.advancedportals.core.serializeddata.DataTag;
import com.sekwah.advancedportals.core.permissions.PortalPermissions;
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.services.PortalServices;
import com.sekwah.advancedportals.core.tags.activation.NameTag;
import com.sekwah.advancedportals.core.util.InfoLogger;
import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.core.util.TagReader;
import com.sekwah.advancedportals.core.warphandler.Tag;
@ -25,6 +27,9 @@ public class CreatePortalSubCommand extends CreateTaggedSubCommand {
@Inject
TagRegistry tagRegistry;
@Inject
InfoLogger infoLogger;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
if(args.length > 1) {
@ -36,7 +41,11 @@ public class CreatePortalSubCommand extends CreateTaggedSubCommand {
ArrayList<DataTag> portalTags = TagReader.getTagsFromArgs(args);
// Find the tag with the "name" NAME
DataTag nameTag = portalTags.stream().findFirst().filter(tag -> tag.NAME.equals("name")).orElse(null);
DataTag nameTag = portalTags.stream().filter(tag -> {
this.infoLogger.log("Tag: " + tag.NAME);
this.infoLogger.log("Equals: " + tag.NAME.equals(NameTag.TAG_NAME));
return tag.NAME.equals(NameTag.TAG_NAME);
}).findFirst().orElse(null);
// If the tag is null, check if arg[1] has a : to check it's not a tag.
if(nameTag == null && !args[1].contains(":")) {
@ -63,10 +72,11 @@ public class CreatePortalSubCommand extends CreateTaggedSubCommand {
if(portal != null) {
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()));
sender.sendMessage("\u00A7a" + " triggerBlock\u00A77:\u00A7e" + Arrays.toString(portal.getTriggerBlocks()));
this.printTags(sender, portal.getArgs());
} else {
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.create.error"));
}
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.create.error"));
}
else {
sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.error.notags"));

View File

@ -18,7 +18,7 @@ public class ListPortalsSubCommand implements SubCommand {
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.portal.list")
+ " " + portalServices.getPortals().asList().stream().map(Map.Entry::getKey).sorted().collect(Collectors.joining(", ")));
+ " " + portalServices.getPortalNames().stream().sorted().collect(Collectors.joining(", ")));
}
@Override

View File

@ -32,19 +32,7 @@ public class RemovePortalSubCommand implements SubCommand {
}
}
else {
PlayerContainer player = sender.getPlayerContainer();
if(player == null) {
sender.sendMessage(Lang.translate("command.portal.remove.noname"));
}
else {
if(portalServices.removePlayerSelection(player)) {
}
else {
sender.sendMessage(Lang.translate("messageprefix.negative")
+ Lang.translate("command.portal.remove.error"));
}
}
sender.sendMessage(Lang.translate("command.portal.remove.noname"));
}
}
@ -55,12 +43,7 @@ public class RemovePortalSubCommand implements SubCommand {
@Override
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
List<String> portalNames = new ArrayList<>();
for(Map.Entry<String, AdvancedPortal> portal : portalServices.getPortals()) {
portalNames.add(portal.getKey());
}
Collections.sort(portalNames);
return portalNames;
return portalServices.getPortalNames();
}
@Override

View File

@ -6,9 +6,12 @@ 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.connector.containers.ServerContainer;
import com.sekwah.advancedportals.core.repository.ConfigRepository;
import com.sekwah.advancedportals.core.serializeddata.BlockLocation;
import com.sekwah.advancedportals.core.serializeddata.PlayerTempData;
import com.sekwah.advancedportals.core.services.PortalServices;
import com.sekwah.advancedportals.core.services.PortalTempDataServices;
import com.sekwah.advancedportals.core.tags.activation.NameTag;
import com.sekwah.advancedportals.core.util.Debug;
import com.sekwah.advancedportals.core.util.GameScheduler;
import com.sekwah.advancedportals.core.util.Lang;
@ -21,6 +24,8 @@ import java.util.List;
*/
public class ShowPortalSubCommand implements SubCommand, SubCommand.SubCommandOnInit {
static final int SHOW_TICKS = 1300;
@Inject
PortalTempDataServices tempDataServices;
@ -33,6 +38,12 @@ public class ShowPortalSubCommand implements SubCommand, SubCommand.SubCommandOn
@Inject
ServerContainer serverContainer;
@Inject
PortalServices portalServices;
@Inject
ConfigRepository config;
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
if(core.getMcVersion()[1] < 16) {
@ -77,40 +88,53 @@ public class ShowPortalSubCommand implements SubCommand, SubCommand.SubCommandOn
if(!tempData.isPortalVisible()) {
continue;
}
for (var portal : portalServices.getPortals()) {
if(portal.isLocationInPortal(player.getLoc(), config.getVisibleRange())) {
BlockLocation minLoc = portal.getMinLoc();
BlockLocation maxLoc = portal.getMaxLoc();
int midX = (minLoc.posX + maxLoc.posX) / 2;
int midZ = (minLoc.posZ + maxLoc.posZ) / 2;
BlockLocation midPoint = new BlockLocation(minLoc.worldName, midX, maxLoc.posY, midZ);
var color = new Color(0, 255, 0, 100);
debugPortal(player, portal.getMinLoc(), portal.getMaxLoc(), color, 1000, false);
Debug.addMarker(player, midPoint, portal.getArgValues(NameTag.TAG_NAME)[0], color, SHOW_TICKS);
}
}
if(tempData.getPos1() != null) {
Debug.addMarker(player, tempData.getPos1(), "Pos1", new Color(0, 255, 0), 1000);
Debug.addMarker(player, tempData.getPos1(), "Pos1", new Color(0, 255, 0), SHOW_TICKS);
}
if(tempData.getPos2() != null) {
Debug.addMarker(player, tempData.getPos2(), "Pos2", new Color(255, 0, 0), 1000);
Debug.addMarker(player, tempData.getPos2(), "Pos2", new Color(255, 0, 0), SHOW_TICKS);
}
if (tempData.getPos1() != null && tempData.getPos2() != null) {
int minX = Math.min(tempData.getPos1().posX, tempData.getPos2().posX);
int minY = Math.min(tempData.getPos1().posY, tempData.getPos2().posY);
int minZ = Math.min(tempData.getPos1().posZ, tempData.getPos2().posZ);
int maxX = Math.max(tempData.getPos1().posX, tempData.getPos2().posX);
int maxY = Math.max(tempData.getPos1().posY, tempData.getPos2().posY);
int maxZ = Math.max(tempData.getPos1().posZ, tempData.getPos2().posZ);
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
for (int z = minZ; z <= maxZ; z++) {
if ((x == minX || x == maxX) && (y == minY || y == maxY || z == minZ || z == maxZ) ||
(y == minY || y == maxY) && (x == minX || x == maxX || z == minZ || z == maxZ) ||
(z == minZ || z == maxZ) && (x == minX || x == maxX || y == minY || y == maxY)) {
var pos = new BlockLocation(tempData.getPos1().worldName, x, y, z);
if (pos.equals(tempData.getPos1()) || pos.equals(tempData.getPos2()))
continue;
Debug.addMarker(player, pos, "", new Color(255, 0, 0, 100), 1000);
}
}
}
}
debugPortal(player, tempData.getPos1(), tempData.getPos2(), new Color(255, 0, 0, 100), SHOW_TICKS, true);
}
}
}, 1, 20);
}
private static void debugPortal(PlayerContainer player, BlockLocation pos1, BlockLocation pos2, Color color, int time, boolean hideCorners) {
int minX = Math.min(pos1.posX, pos2.posX);
int minY = Math.min(pos1.posY, pos2.posY);
int minZ = Math.min(pos1.posZ, pos2.posZ);
int maxX = Math.max(pos1.posX, pos2.posX);
int maxY = Math.max(pos1.posY, pos2.posY);
int maxZ = Math.max(pos1.posZ, pos2.posZ);
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
for (int z = minZ; z <= maxZ; z++) {
if ((y == minY || y == maxY) && (x == minX || x == maxX || z == minZ || z == maxZ) || (z == minZ || z == maxZ) && (x == minX || x == maxX)) {
var pos = new BlockLocation(pos1.worldName, x, y, z);
if ((pos.equals(pos1) || pos.equals(pos2)) && hideCorners)
continue;
Debug.addMarker(player, pos, "", color, time);
}
}
}
}
}
}

View File

@ -7,6 +7,7 @@ import com.sekwah.advancedportals.core.registry.TagTarget;
import com.sekwah.advancedportals.core.serializeddata.BlockLocation;
import com.sekwah.advancedportals.core.serializeddata.DataTag;
import com.sekwah.advancedportals.core.registry.TagRegistry;
import com.sekwah.advancedportals.core.serializeddata.PlayerLocation;
import com.sekwah.advancedportals.core.warphandler.ActivationData;
import com.sekwah.advancedportals.core.warphandler.Tag;
@ -34,9 +35,8 @@ public class AdvancedPortal implements TagTarget {
@SerializedName("a")
private HashMap<String, String[]> args = new HashMap<>();
public AdvancedPortal(BlockLocation maxLoc, BlockLocation minLoc) {
this.maxLoc = maxLoc;
this.minLoc = minLoc;
public AdvancedPortal(BlockLocation minLoc, BlockLocation maxLoc) {
this.updateBounds(minLoc, maxLoc);
}
public BlockLocation getMaxLoc() {
@ -67,6 +67,25 @@ public class AdvancedPortal implements TagTarget {
this.args.remove(arg);
}
/**
* Updates the bounds of the portal based on the provided locations.
*
* @param loc1 The first location.
* @param loc2 The second location.
*/
public void updateBounds(BlockLocation loc1, BlockLocation loc2) {
int minX = Math.min(loc1.posX, loc2.posX);
int minY = Math.min(loc1.posY, loc2.posY);
int minZ = Math.min(loc1.posZ, loc2.posZ);
int maxX = Math.max(loc1.posX, loc2.posX);
int maxY = Math.max(loc1.posY, loc2.posY);
int maxZ = Math.max(loc1.posZ, loc2.posZ);
this.minLoc = new BlockLocation(loc1.worldName, minX, minY, minZ);
this.maxLoc = new BlockLocation(loc2.worldName, maxX, maxY, maxZ);
}
public boolean hasTriggerBlock(String blockMaterial) {
for(String triggerBlock : triggerBlocks) {
if(blockMaterial.equals(triggerBlock)) {
@ -105,6 +124,24 @@ public class AdvancedPortal implements TagTarget {
return true;
}
public boolean isLocationInPortal(PlayerLocation playerLocation) {
return this.isLocationInPortal(playerLocation, 0);
}
public boolean isLocationInPortal(PlayerLocation playerLocation, int additionalArea) {
double playerX = playerLocation.getPosX();
double playerY = playerLocation.getPosY();
double playerZ = playerLocation.getPosZ();
return playerX >= this.minLoc.posX - additionalArea &&
playerX < this.maxLoc.posX + 1 + additionalArea &&
playerY >= this.minLoc.posY - additionalArea &&
playerY < this.maxLoc.posY + 1 + additionalArea &&
playerZ >= this.minLoc.posZ - additionalArea &&
playerZ < this.maxLoc.posZ + 1 + additionalArea;
}
public void setArgValues(DataTag portalTag) {
this.setArgValues(portalTag.NAME, portalTag.VALUES);
}

View File

@ -1,7 +1,7 @@
package com.sekwah.advancedportals.core.repository;
import com.sekwah.advancedportals.core.serializeddata.WorldLocation;
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
public interface IPortalRepository extends IJsonRepository<WorldLocation> {
public interface IPortalRepository extends IJsonRepository<AdvancedPortal> {
}

View File

@ -22,9 +22,6 @@ public class DestinationRepositoryImpl implements IDestinationRepository {
@Inject
DataStorage dataStorage;
@Inject
InfoLogger infoLogger;
@Override
public boolean save(String name, Destination destination) {
return dataStorage.storeJson(destination, fileLocation + name + ".json");
@ -44,8 +41,8 @@ public class DestinationRepositoryImpl implements IDestinationRepository {
return false;
}
public Destination get(String desti) {
return dataStorage.loadJson(Destination.class, fileLocation + desti + ".json");
public Destination get(String name) {
return dataStorage.loadJson(Destination.class, fileLocation + name + ".json");
}
@Override
@ -56,13 +53,13 @@ public class DestinationRepositoryImpl implements IDestinationRepository {
@Override
public List<Destination> getAll() {
List<Destination> destinations = new ArrayList<>();
List<String> allFiles = dataStorage.listAllFiles(fileLocation, false);
List<String> allFiles = dataStorage.listAllFiles(fileLocation, true);
for (String fileName : allFiles) {
Destination destination = dataStorage.loadJson(Destination.class, fileLocation + fileName);
Destination destination = this.get(fileName);
// Forces the name tag to be up-to-date on load
String[] name = destination.getArgValues(NameTag.TAG_NAME);
if(name != null && name.length > 0) {
destination.setArgValues(NameTag.TAG_NAME, new String[]{fileName.replace(".json", "")});
destination.setArgValues(NameTag.TAG_NAME, new String[]{fileName});
}
destinations.add(destination);
}

View File

@ -1,17 +1,25 @@
package com.sekwah.advancedportals.core.repository.impl;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
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.DataStorage;
import com.sekwah.advancedportals.core.serializeddata.WorldLocation;
import com.sekwah.advancedportals.core.repository.IPortalRepository;
import com.sekwah.advancedportals.core.tags.activation.NameTag;
import java.util.*;
@Singleton
public class PortalRepositoryImpl implements IPortalRepository {
private final String fileLocation = "portals/";
@Inject
DataStorage dataStorage;
/**
* In memory copy of the portal files as they will be accessed every movement tick.
*
@ -19,42 +27,49 @@ public class PortalRepositoryImpl implements IPortalRepository {
*/
private List<AdvancedPortal> portals = new ArrayList<>();
public String getSelectedPortal(UUID uuid) {
return null;
}
@Override
public boolean save(String name, WorldLocation portalLocation) {
return false;
public boolean save(String name, AdvancedPortal portal) {
return dataStorage.storeJson(portal, fileLocation + name + ".json");
}
@Override
public boolean containsKey(String name) {
return false;
return dataStorage.fileExists(fileLocation + name + ".json");
}
@Override
public boolean delete(String name) {
return dataStorage.deleteFile(fileLocation + name + ".json");
}
@Override
public boolean update(String name, AdvancedPortal portal) {
return false;
}
@Override
public boolean update(String name, WorldLocation portalLocation) {
return false;
}
@Override
public WorldLocation get(String name) {
return null;
public AdvancedPortal get(String name) {
return dataStorage.loadJson(AdvancedPortal.class, fileLocation + name + ".json");
}
@Override
public List<String> getAllNames() {
return null;
return dataStorage.listAllFiles(fileLocation, true);
}
@Override
public List<WorldLocation> getAll() {
return null;
public List<AdvancedPortal> getAll() {
List<AdvancedPortal> portals = new ArrayList<>();
List<String> allFiles = dataStorage.listAllFiles(fileLocation, false);
for (String fileName : allFiles) {
AdvancedPortal portal = dataStorage.loadJson(AdvancedPortal.class, fileLocation + fileName);
// Forces the name tag to be up-to-date on load
String[] name = portal.getArgValues(NameTag.TAG_NAME);
if(name != null && name.length > 0) {
portal.setArgValues(NameTag.TAG_NAME, new String[]{fileName.replace(".json", "")});
}
portals.add(portal);
}
return portals;
}
}

View File

@ -3,21 +3,19 @@ package com.sekwah.advancedportals.core.services;
import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
import com.sekwah.advancedportals.core.destination.Destination;
import com.sekwah.advancedportals.core.repository.IDestinationRepository;
import com.sekwah.advancedportals.core.registry.TagRegistry;
import com.sekwah.advancedportals.core.repository.IPortalRepository;
import com.sekwah.advancedportals.core.serializeddata.DataTag;
import com.sekwah.advancedportals.core.serializeddata.PlayerLocation;
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.serializeddata.PlayerTempData;
import com.sekwah.advancedportals.core.tags.activation.NameTag;
import com.sekwah.advancedportals.core.util.InfoLogger;
import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.core.warphandler.Tag;
import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Singleton
public class PortalServices {
@ -33,7 +31,17 @@ public class PortalServices {
private final Map<String, AdvancedPortal> portalCache = new HashMap<>();
@Inject
TagRegistry tagRegistry;
public void loadPortals() {
List<String> portalNames = portalRepository.getAllNames();
portalCache.clear();
for (String name : portalNames) {
AdvancedPortal portal = portalRepository.get(name);
portalCache.put(name, portal);
portal.updateBounds(portal.getMinLoc(), portal.getMaxLoc());
}
}
@ -45,25 +53,29 @@ public class PortalServices {
return false;
}
public ImmutableList<? extends Map.Entry<String, AdvancedPortal>> getPortals() {
return ImmutableList.copyOf(Collections.emptyList());
public List<String> getPortalNames() {
return portalRepository.getAllNames();
}
public List<AdvancedPortal> getPortals() {
return new ArrayList<>(portalCache.values());
}
public boolean removePortal(String name, PlayerContainer player) {
this.portalCache.remove(name);
if(this.portalRepository.containsKey(name)) {
this.portalRepository.delete(name);
return true;
}
return false;
}
public AdvancedPortal createPortal(PlayerContainer player, ArrayList<DataTag> tags) {
// Find the tag with the "name" NAME
DataTag nameTag = tags.stream().filter(tag -> tag.NAME.equals("name")).findFirst().orElse(null);
DataTag nameTag = tags.stream().filter(tag -> tag.NAME.equals(NameTag.TAG_NAME)).findFirst().orElse(null);
String name = nameTag == null ? null : nameTag.VALUES[0];
if(nameTag == null) {
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("desti.error.noname"));
return null;
}
if(name == null || name.equals("")) {
if(nameTag == null || name == null || name.isEmpty()) {
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.error.noname"));
return null;
}
@ -75,18 +87,42 @@ public class PortalServices {
PlayerTempData tempData = portalTempDataServices.getPlayerTempData(player);
if(tempData.getPos1() == null || tempData.getPos2() == null) {
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("portal.selector.error.missing"));
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("portal.error.selection.missing"));
return null;
}
if(!tempData.getPos1().worldName.equals(tempData.getPos2().worldName)) {
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("portal.selector.error.worlds"));
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("portal.error.selection.differentworlds"));
return null;
}
AdvancedPortal portal = new AdvancedPortal(tempData.getPos1(), tempData.getPos2());
return null;
for (DataTag portalTag : tags) {
portal.setArgValues(portalTag);
}
for (DataTag portalTag : tags) {
Tag.Creation creation = tagRegistry.getCreationHandler(portalTag.NAME);
if(creation != null) {
if(!creation.created(portal, player, portalTag.VALUES)) {
return null;
}
}
}
try {
if(this.portalRepository.save(name, portal)) {
this.portalCache.put(name, portal);
} else {
return null;
}
} catch (Exception e) {
e.printStackTrace();
player.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("portal.error.save"));
}
return portal;
}
public boolean removePlayerSelection(PlayerContainer player) {

View File

@ -11,7 +11,7 @@ import java.util.List;
public class DestiTag implements Tag.Activation, Tag.AutoComplete {
public static String TAG_NAME = "name";
public static String TAG_NAME = "destination";
@Inject
DestinationServices destinationServices;

View File

@ -56,7 +56,7 @@ command.reload.detailedhelp=Reloads all portal data from files in the data folde
command.reload.reloaded= All Advanced Portals data reloaded
command.create.help=Creates portals
command.create.error= There was a problem making the portal:
command.create.error= There was a problem making the portal.
command.create.portal.console= You cannot create a portal using the console.
command.create.detailedhelp=Format is /portal 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.create.complete= The portal has been successfully created.
@ -86,6 +86,7 @@ command.portal.show.disabled= Portal markers are now disabled.
command.portal.show.unsupported= Portal markers are not supported on this version of minecraft. (1.16+ atm only)
command.destination.remove.error= There was a problem removing the destination.
command.destination.remove.complete= The destination has been successfully removed.
command.destination.show.help=Shows nearby destinations
command.destination.show.detailedhelp=Shows nearby destinations. Relies on debug markers so may not work on certain versions of minecraft (1.16+ atm only).
@ -113,17 +114,19 @@ command.endportalblock= You have been given a &8End Portal Block Placer&a!
command.gatewayblock= You have been given a &8Gateway Block Placer&a!
portal.error.invalidselection=You must have both pos1 and pos2 selected to create a portal.
portal.error.takenname=The name given for the portal is already taken.
portal.error.selection.differentworlds=Both the selected points need to be in the same world.
portal.error.invalidselection= You must have both pos1 and pos2 selected to create a portal.
portal.error.takenname= The name given for the portal is already taken.
portal.error.selection.differentworlds= Both the selected points need to be in the same world.
portal.error.selection.missing= You need to select both points for the portal.
portal.error.save= There was a problem saving the portal.
desti.info.noargs=&cNo tags were given
command.error.noname= You must specify a name. (name:someNameHere)
command.error.noname= You must specify a name &ename:someNameHere
command.error.notags= No tags have been given. You need to include at least &ename:(name)&c.
command.error.nametaken= The name &e%1$s &cis already taken.
desti.error.save= There was a problem saving the destination:
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

@ -6,6 +6,7 @@ import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
import com.sekwah.advancedportals.core.connector.containers.WorldContainer;
import com.sekwah.advancedportals.core.serializeddata.BlockLocation;
import com.sekwah.advancedportals.core.serializeddata.PlayerLocation;
import com.sekwah.advancedportals.spigot.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.spigot.reflection.MinecraftCustomPayload;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -102,7 +103,7 @@ public class SpigotPlayerContainer implements PlayerContainer {
if(channel.startsWith("minecraft:")) {
return MinecraftCustomPayload.sendCustomPayload(player, channel, bytes);
} else {
player.sendPluginMessage(null, channel, bytes);
player.sendPluginMessage(AdvancedPortalsPlugin.getInstance(), channel, bytes);
}
return true;
}