@@ -62,39 +62,45 @@ public boolean onCommand(CommandSender sender, Command cmd, String command, Stri
62
62
Player player = (Player ) sender ;
63
63
PlayerInventory inventory = player .getInventory ();
64
64
65
+ if (args .length > 0 ) {
66
+ if (args [0 ].equalsIgnoreCase ("warp" ) && player .hasPermission ("advancedportals.warp" )) {
67
+ if (args .length == 2 && (player .hasPermission ("advancedportals.warp.*" )
68
+ || player .hasPermission ("advancedportals.warp." + args [1 ]))) {
69
+ AdvancedPortal portal = Portal .getPortal (args [1 ]);
70
+
71
+ if (portal == null ) {
72
+ sender .sendMessage (PluginMessages .customPrefixFail
73
+ + " Could not find a portal with that name" );
74
+ }
75
+ else {
76
+ if (portal .inPortal .contains (player .getUniqueId ()))
77
+ return true ;
78
+ WarpEvent warpEvent = new WarpEvent (player , portal );
79
+ plugin .getServer ().getPluginManager ().callEvent (warpEvent );
80
+
81
+ if (!warpEvent .isCancelled ()) {
82
+ Portal .activate (player , portal , false );
83
+ return true ;
84
+ }
85
+ }
86
+ } else if (args .length == 1 && player .hasPermission ("advancedportals.warp" )) {
87
+ sendMenu (player , "Help Menu: Warp" ,
88
+ "\u00A7 6/" + command + " warp <name> \u00A7 a- teleport to warp name" );
89
+ }
90
+ else {
91
+ sender .sendMessage (PluginMessages .customPrefixFail
92
+ + " You do not have permission to perform that command" );
93
+ }
94
+ return true ;
95
+ }
96
+
97
+ }
98
+
65
99
if (sender .hasPermission ("advancedportals.portal" )) {
66
100
if (args .length > 0 ) {
67
101
switch (args [0 ].toLowerCase ()) {
68
- case "warp" :
69
- if (args .length == 2 && (player .hasPermission ("advancedportals.warp.*" ) || player .hasPermission ("advancedportals.warp." + args [1 ]))) {
70
- AdvancedPortal portal = Portal .getPortal (args [1 ]);
71
-
72
- if (portal == null ) {
73
- sender .sendMessage (PluginMessages .customPrefixFail
74
- + " Could not find a portal with that name" );
75
- }
76
- else {
77
- if (portal .inPortal .contains (player .getUniqueId ()))
78
- return true ;
79
- WarpEvent warpEvent = new WarpEvent (player , portal );
80
- plugin .getServer ().getPluginManager ().callEvent (warpEvent );
81
-
82
- if (!warpEvent .isCancelled ()) {
83
- Portal .activate (player , portal );
84
- }
85
- }
86
- } else if (args .length == 1 && player .hasPermission ("advancedportals.portal.warp" )) {
87
- sendMenu (player , "Help Menu: Warp" ,
88
- "\u00A7 6/" + command + " warp <name> \u00A7 a- teleport to warp name" );
89
- }
90
- else {
91
- sender .sendMessage (PluginMessages .customPrefixFail
92
- + " You do not have permission" );
93
- }
94
- break ;
95
102
case "disablebeacon" :
96
- boolean DISABLE_BEACON = config .getConfig ().getBoolean ("DisableGatewayBeam" , true );
97
- if (player .hasPermission ("advancedportals.build" ) && DISABLE_BEACON ) {
103
+ if (player .hasPermission ("advancedportals.build" )) {
98
104
if (args .length == 1 ) {
99
105
sender .sendMessage (PluginMessages .customPrefixFail
100
106
+ " You need to specify a portal to replace the blocks." );
@@ -113,16 +119,6 @@ public boolean onCommand(CommandSender sender, Command cmd, String command, Stri
113
119
}
114
120
}
115
121
}
116
- else {
117
- if (DISABLE_BEACON ) {
118
-
119
- }
120
- else {
121
-
122
- }
123
- sender .sendMessage (PluginMessages .customPrefixFail + " You do not have permission " +
124
- "to do that." + " Needed: \u00A7 eadvancedportals.build" );
125
- }
126
122
break ;
127
123
case "wand" :
128
124
case "selector" :
@@ -847,11 +843,14 @@ private void portalEditMenu(CommandSender sender, ConfigAccessor portalConfig, S
847
843
@ Override
848
844
public List <String > onTabComplete (CommandSender sender , Command cmd , String command , String [] args ) {
849
845
LinkedList <String > autoComplete = new LinkedList <String >();
846
+ if (args .length == 1 && (sender .hasPermission ("advancedportals.warp" ))) {
847
+ autoComplete .add ("warp" );
848
+ }
850
849
if (sender .hasPermission ("advancedportals.createportal" )) {
851
850
if (args .length == 1 || (args .length == 2 && args [0 ].toLowerCase ().equals ("help" ))) {
852
851
autoComplete .addAll (Arrays .asList ("create" , "list" , "portalblock" , "select" , "unselect" , "command" ,
853
852
"selector" , "show" , "gatewayblock" , "endportalblock" , "variables" , "wand" , "disablebeacon" , "remove" , "rename" ,
854
- "help" , "bukkitpage" , "helppage" , "warp" ));
853
+ "help" , "bukkitpage" , "helppage" ));
855
854
} else if (args [0 ].toLowerCase ().equals ("create" )) {
856
855
857
856
boolean hasName = false ;
@@ -936,7 +935,9 @@ public List<String> onTabComplete(CommandSender sender, Command cmd, String comm
936
935
if (args .length == 2 && (args [0 ].equalsIgnoreCase ("warp" ))) {
937
936
for (AdvancedPortal portal : Portal .portals ) {
938
937
String perm = portal .getArg ("permission" );
939
- if (perm == null || sender .hasPermission (perm )) {
938
+ if ((perm == null || sender .hasPermission (perm ))
939
+ && (sender .hasPermission ("advancedportals.warp.*" )
940
+ || sender .hasPermission ("advancedportals.warp." + portal .getName ()))) {
940
941
autoComplete .add (portal .getName ());
941
942
}
942
943
}
0 commit comments