Problem causing all the portals to stop working has been solved

This commit is contained in:
sekwah41 2015-04-11 14:17:28 +01:00
parent 6318716511
commit 7f6f6cd758
4 changed files with 17 additions and 8 deletions

View File

@ -115,7 +115,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
else if(args[i].toLowerCase().startsWith("permission:") && args[i].length() > 11){ // not completely implemented
needsPermission = true;
permission = args[i].toLowerCase().replaceFirst("permission:", "");
extraData.add(new PortalArg("permission", serverName));
extraData.add(new PortalArg("permission", permission));
}
}
if(!hasName){
@ -161,7 +161,9 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
triggerBlockMat = Material.getMaterial(triggerBlock.toUpperCase());
if(triggerBlockMat != null){
player.sendMessage("\u00A7atriggerBlock: \u00A7e" + triggerBlock.toUpperCase());
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, triggerBlockMat, serverName, (PortalArg[]) extraData.toArray()));
PortalArg[] portalArgs = new PortalArg[extraData.size()];
portalArgs = extraData.toArray(portalArgs);
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, triggerBlockMat, serverName, portalArgs));
}
else{
hasTriggerBlock = false;
@ -169,13 +171,17 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
player.sendMessage("\u00A7ctriggerBlock: \u00A7edefault(" + Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
player.sendMessage("\u00A7cThe block " + triggerBlock.toUpperCase() + " is not a valid block name in minecraft so the trigger block has been set to the default!");
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, serverName, (PortalArg[]) extraData.toArray()));
PortalArg[] portalArgs = new PortalArg[extraData.size()];
portalArgs = extraData.toArray(portalArgs);
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, serverName, portalArgs));
}
}
else{
ConfigAccessor Config = new ConfigAccessor(plugin, "Config.yml");
player.sendMessage("\u00A7atriggerBlock: \u00A7edefault(" + Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, serverName, (PortalArg[]) extraData.toArray()));
PortalArg[] portalArgs = new PortalArg[extraData.size()];
portalArgs = extraData.toArray(portalArgs);
player.sendMessage(Portal.create(pos1, pos2, portalName, destination, serverName, portalArgs));
}
}
else{

View File

@ -74,7 +74,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
}
else if(args[0].toLowerCase().equals("goto") || args[0].toLowerCase().equals("warp")) {
if(args.length > 1){
System.out.println(args[1]);
//System.out.println(args[1]);
ConfigAccessor configDesti = new ConfigAccessor(plugin, "Destinations.yml");
if(configDesti.getConfig().getString(args[1] + ".world") != null){
Destination.warp(sender, args[1]);

View File

@ -72,7 +72,6 @@ public class Portal {
}
Portals[portalId].trigger = blockType;
System.out.println("Test: " + portal.toString());
Portals[portalId].portalName = portal.toString();
Portals[portalId].worldName = config.getConfig().getString(portal.toString() + ".world");
World world = Bukkit.getWorld(config.getConfig().getString(portal.toString() + ".world"));
@ -345,7 +344,7 @@ public class Portal {
String destiName = config.getConfig().getString(portalName + ".destination");
if(configDesti.getConfig().getString(destiName + ".world") != null){
String permission = config.getConfig().getString(portalName + ".portalArgs.permission");
if(permission != null && player.hasPermission(permission) || player.isOp()){
if(permission == null || (permission != null && player.hasPermission(permission)) || player.isOp()){
boolean warped = Destination.warp(player, destiName);
return warped;
}

View File

@ -1,6 +1,6 @@
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
name: AdvancedPortals
version: 0.0.4
version: 0.0.6
author: SEKWAH41
description: An advanced portals plugin for bukkit.
commands:
@ -20,10 +20,14 @@ permissions:
description: Gives access to all portal commands
children:
advancedportals.createportal: true
advancedportals.portal: true
advancedportals.build: true
advancedportals.createportal:
description: Allows you to create portals
default: op
advancedportals.portal:
description: Allows use of portal commands
default: op
advancedportals.build:
description: Allows you to build in the portal regions
default: op