mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-09-28 23:27:34 +02:00
awarp is now an alias of destination and destination permissions
This commit is contained in:
parent
fa9c1bdf9e
commit
80fcd96ba7
@ -10,10 +10,7 @@ commands:
|
|||||||
usage: /<command>
|
usage: /<command>
|
||||||
destination:
|
destination:
|
||||||
description: Can be used to access portal destinations.
|
description: Can be used to access portal destinations.
|
||||||
aliases: [desti]
|
aliases: [desti, awarp]
|
||||||
usage: /<command>
|
|
||||||
awarp:
|
|
||||||
description: Used to warp to destinations.
|
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permissions:
|
permissions:
|
||||||
advancedportals.*:
|
advancedportals.*:
|
||||||
@ -22,7 +19,8 @@ permissions:
|
|||||||
advancedportals.createportal: true
|
advancedportals.createportal: true
|
||||||
advancedportals.portal: true
|
advancedportals.portal: true
|
||||||
advancedportals.build: true
|
advancedportals.build: true
|
||||||
advancedportals.desti.*: true
|
advancedportals.desti: true
|
||||||
|
advancedportals.warp.*: true
|
||||||
advancedportals.createportal:
|
advancedportals.createportal:
|
||||||
description: Allows you to create portals
|
description: Allows you to create portals
|
||||||
default: op
|
default: op
|
||||||
@ -32,10 +30,9 @@ permissions:
|
|||||||
advancedportals.build:
|
advancedportals.build:
|
||||||
description: Allows you to build in the portal regions
|
description: Allows you to build in the portal regions
|
||||||
default: op
|
default: op
|
||||||
advancedportals.desti.*:
|
advancedportals.desti:
|
||||||
description: Gives access to all desti commands
|
description: Gives access to all desti commands
|
||||||
children:
|
|
||||||
advancedportals.desti.create: true
|
|
||||||
advancedportals.desti.create:
|
|
||||||
description: Allows users to create portal destinations
|
|
||||||
default: op
|
default: op
|
||||||
|
advancedportals.warp.*:
|
||||||
|
description: Access to all warps
|
||||||
|
default: true
|
||||||
|
@ -56,7 +56,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
|||||||
new PluginMessages(this);
|
new PluginMessages(this);
|
||||||
new AdvancedPortalsCommand(this);
|
new AdvancedPortalsCommand(this);
|
||||||
new DestinationCommand(this);
|
new DestinationCommand(this);
|
||||||
new WarpCommand(this);
|
|
||||||
|
|
||||||
new WarpEffects(this);
|
new WarpEffects(this);
|
||||||
|
|
||||||
|
@ -108,6 +108,10 @@ public class Destination {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean warp(Player player, String name) {
|
public static boolean warp(Player player, String name) {
|
||||||
|
if (!player.hasPermission("advancedportals.warp.*") && !player.hasPermission("advancedportals.warp." + name)) {
|
||||||
|
player.sendMessage(PluginMessages.customPrefixFail + " You don't have permission to warp to " + name + "!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
if (config.getConfig().getString(name + ".world") != null) {
|
if (config.getConfig().getString(name + ".world") != null) {
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
|
@ -30,7 +30,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
if (args.length > 0) { switch (args[0].toLowerCase()) {
|
if (args.length > 0) { switch (args[0].toLowerCase()) {
|
||||||
case "create":
|
case "create":
|
||||||
if (sender.hasPermission("advancedportals.desti.create")) {
|
if (sender.hasPermission("advancedportals.desti")) {
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
String posX = config.getConfig().getString(args[1].toLowerCase() + ".pos.X");
|
String posX = config.getConfig().getString(args[1].toLowerCase() + ".pos.X");
|
||||||
if (posX == null) {
|
if (posX == null) {
|
||||||
@ -44,11 +44,12 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
sender.sendMessage(PluginMessages.customPrefixFail + " Please state the name of the destination you would like to create!");
|
sender.sendMessage(PluginMessages.customPrefixFail + " Please state the name of the destination you would like to create!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(PluginMessages.customPrefixFail + " You do not have permission to create portals so you cannot give yourself a \u00A7ePortal Region Selector\u00A7c!");
|
sender.sendMessage(PluginMessages.customPrefixFail + " You do not have permission to create destinations!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "destinations.yml");
|
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
|
if (sender.hasPermission("advancedportals.desti")) {
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
String posX = portalConfig.getConfig().getString(args[1] + ".pos.X");
|
String posX = portalConfig.getConfig().getString(args[1] + ".pos.X");
|
||||||
if (posX != null) {
|
if (posX != null) {
|
||||||
@ -60,13 +61,8 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
} else {
|
} else {
|
||||||
sender.sendMessage(PluginMessages.customPrefixFail + " You need to state the name of the destination you wish to remove.");
|
sender.sendMessage(PluginMessages.customPrefixFail + " You need to state the name of the destination you wish to remove.");
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case "goto":
|
|
||||||
case "warp":
|
|
||||||
if (args.length > 1) {
|
|
||||||
Destination.warp((Player) sender, args[1]);
|
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(PluginMessages.customPrefixFail + " You need to state the name of the destination you wish to warp to.");
|
sender.sendMessage(PluginMessages.customPrefixFail + " You do not have permission to remove destinations!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "list":
|
case "list":
|
||||||
@ -74,6 +70,9 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
for (String desti : config.getConfig().getKeys(false)) message = message + " " + desti;
|
for (String desti : config.getConfig().getKeys(false)) message = message + " " + desti;
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
Destination.warp((Player) sender, args[0]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PluginMessages.UnknownCommand(sender, command);
|
PluginMessages.UnknownCommand(sender, command);
|
||||||
@ -85,10 +84,14 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
|
||||||
LinkedList<String> autoComplete = new LinkedList<String>();
|
LinkedList<String> autoComplete = new LinkedList<String>();
|
||||||
|
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
||||||
if (sender.hasPermission("AdvancedPortals.CreatePortal")) {
|
for (String string : config.getConfig().getKeys(false)) {
|
||||||
|
if (sender.hasPermission("advancedportals.desti.*") | sender.hasPermission("advancedportals.desti." + string))
|
||||||
|
autoComplete.add(string);
|
||||||
|
}
|
||||||
|
if (sender.hasPermission("advancedportals.desti") | sender.hasPermission("AdvancedPortals.CreatePortal")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
autoComplete.addAll(Arrays.asList("create", "goto", "redefine", "move", "rename", "remove"));
|
autoComplete.addAll(Arrays.asList("create", "remove", "help"));
|
||||||
} else if (args[0].toLowerCase().equals("create")) {
|
} else if (args[0].toLowerCase().equals("create")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
package com.sekwah.advancedportals.destinations;
|
|
||||||
|
|
||||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
|
||||||
import com.sekwah.advancedportals.ConfigAccessor;
|
|
||||||
import com.sekwah.advancedportals.PluginMessages;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.TabCompleter;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WarpCommand implements CommandExecutor, TabCompleter {
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private AdvancedPortalsPlugin plugin;
|
|
||||||
|
|
||||||
public WarpCommand(AdvancedPortalsPlugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
|
|
||||||
|
|
||||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
|
||||||
boolean useWarpCommand = !config.getConfig().getBoolean("DisableWarpCommand");
|
|
||||||
//plugin.getCommand("warp").setExecutor(this);
|
|
||||||
plugin.getCommand("awarp").setExecutor(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
|
|
||||||
if (args.length > 0) {
|
|
||||||
Destination.warp((Player) sender, args[0]);
|
|
||||||
} else {
|
|
||||||
PluginMessages.UnknownCommand(sender, command);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
|
|
||||||
LinkedList<String> autoComplete = new LinkedList<String>();
|
|
||||||
|
|
||||||
/**if(sender.hasPermission("AdvancedPortals.CreatePortal")){
|
|
||||||
if(args.length == 1){
|
|
||||||
autoComplete.addAll(Arrays.asList("create", "goto", "redefine", "move", "rename", "remove"));
|
|
||||||
}
|
|
||||||
else if(args[0].toLowerCase().equals("create")){
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Collections.sort(autoComplete);
|
|
||||||
for(Object result: autoComplete.toArray()){
|
|
||||||
if(!result.toString().startsWith(args[args.length - 1])){
|
|
||||||
autoComplete.remove(result);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
return autoComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user