mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-09-19 11:01:13 +02:00
Fixed arg finding
This commit is contained in:
parent
3e176566cc
commit
bf2e7a6295
@ -55,6 +55,7 @@ command.remove.error= Removing the portal was blocked:
|
|||||||
command.remove.noname=No portal by that name was found
|
command.remove.noname=No portal by that name was found
|
||||||
command.remove.invalidselection=The portal selection you had is no longer valid
|
command.remove.invalidselection=The portal selection you had is no longer valid
|
||||||
command.remove.noselection=You don't have a portal selected
|
command.remove.noselection=You don't have a portal selected
|
||||||
|
command.create.complete= The portal has been successfully removed.
|
||||||
|
|
||||||
command.selector= You have been given a portal selector.
|
command.selector= You have been given a portal selector.
|
||||||
command.selector.help=Gives you a portal region selector
|
command.selector.help=Gives you a portal region selector
|
||||||
|
@ -104,7 +104,7 @@ public class PortalManager {
|
|||||||
return this.createPortal(name, player, this.portalSelectorLeftClick.get(player.getUUID().toString()),
|
return this.createPortal(name, player, this.portalSelectorLeftClick.get(player.getUUID().toString()),
|
||||||
this.portalSelectorRightClick.get(player.getUUID().toString()), tags);
|
this.portalSelectorRightClick.get(player.getUUID().toString()), tags);
|
||||||
} else {
|
} else {
|
||||||
throw new PortalException("portal.invalidselection");
|
throw new PortalException("portal.error.invalidselection");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,9 +220,13 @@ public class PortalManager {
|
|||||||
|
|
||||||
for(DataTag portalTag : portal.getArgs()) {
|
for(DataTag portalTag : portal.getArgs()) {
|
||||||
TagHandler.Creation<AdvancedPortal> creation = AdvancedPortalsCore.getPortalTagRegistry().getCreationHandler(portalTag.NAME);
|
TagHandler.Creation<AdvancedPortal> creation = AdvancedPortalsCore.getPortalTagRegistry().getCreationHandler(portalTag.NAME);
|
||||||
creation.created(portal, player, portalTag.VALUE);
|
if(creation != null) {
|
||||||
|
creation.destroyed(portal, player, portalTag.VALUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.portalHashMap.remove(portalName);
|
||||||
|
AdvancedPortalsCore.getPortalManager().savePortals();
|
||||||
}
|
}
|
||||||
|
|
||||||
private AdvancedPortal getPortal(String portalName) {
|
private AdvancedPortal getPortal(String portalName) {
|
||||||
|
@ -26,7 +26,7 @@ public abstract class CreateSubCommand {
|
|||||||
else {
|
else {
|
||||||
String detectedTag = this.getTag(args[i].toLowerCase());
|
String detectedTag = this.getTag(args[i].toLowerCase());
|
||||||
if(detectedTag != null) {
|
if(detectedTag != null) {
|
||||||
String arg = args[i].substring(detectedTag.length());
|
String arg = args[i].substring(detectedTag.length() + 1);
|
||||||
if(arg.length() > 0 && arg.charAt(0) == '"') {
|
if(arg.length() > 0 && arg.charAt(0) == '"') {
|
||||||
argBeingParsed = detectedTag;
|
argBeingParsed = detectedTag;
|
||||||
currentParsedValue = arg;
|
currentParsedValue = arg;
|
||||||
|
@ -52,7 +52,7 @@ public class CreateDestiSubCommand extends CreateSubCommand implements SubComman
|
|||||||
protected String getTag(String arg) {
|
protected String getTag(String arg) {
|
||||||
int splitLoc = arg.indexOf(":");
|
int splitLoc = arg.indexOf(":");
|
||||||
if(splitLoc != -1) {
|
if(splitLoc != -1) {
|
||||||
return arg.substring(0,splitLoc + 1);
|
return arg.substring(0,splitLoc);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class CreatePortalSubCommand extends CreateSubCommand implements SubComma
|
|||||||
protected String getTag(String arg) {
|
protected String getTag(String arg) {
|
||||||
int splitLoc = arg.indexOf(":");
|
int splitLoc = arg.indexOf(":");
|
||||||
if(splitLoc != -1) {
|
if(splitLoc != -1) {
|
||||||
return arg.substring(0,splitLoc + 1);
|
return arg.substring(0,splitLoc);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class RemoveSubCommand implements SubCommand {
|
|||||||
if(args.length > 1) {
|
if(args.length > 1) {
|
||||||
try {
|
try {
|
||||||
AdvancedPortalsCore.getPortalManager().removePortal(args[1], sender.getPlayerContainer());
|
AdvancedPortalsCore.getPortalManager().removePortal(args[1], sender.getPlayerContainer());
|
||||||
|
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translateColor("command.remove.complete"));
|
||||||
} catch (PortalException portalTagExeption) {
|
} catch (PortalException portalTagExeption) {
|
||||||
sender.sendMessage(Lang.translateColor("messageprefix.negative")
|
sender.sendMessage(Lang.translateColor("messageprefix.negative")
|
||||||
+ Lang.translateColor("command.remove.error") + " " + Lang.translate(portalTagExeption.getMessage()));
|
+ Lang.translateColor("command.remove.error") + " " + Lang.translate(portalTagExeption.getMessage()));
|
||||||
|
Loading…
Reference in New Issue
Block a user