Started the create and destroy files, added permissions and a plugin

messsages file that makes it easier to change all common messages.
This commit is contained in:
sekwah41 2013-10-09 22:14:44 +01:00
parent 18976dd765
commit 4fe85da4bf
8 changed files with 66 additions and 5 deletions

View File

@ -27,7 +27,7 @@ public class AdvancedPortalsCommand implements CommandExecutor {
ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
if(args.length > 0){
if(args[0].toLowerCase().equals("wand") || args[0].toLowerCase().equals("selector")){
if(sender.hasPermission("AdvancedPortals.create")){
if(sender.hasPermission("AdvancedPortals.CreatePortal")){
PlayerInventory inventory = player.getInventory();
ItemStack regionselector = new ItemStack(Material.IRON_AXE);
@ -41,9 +41,12 @@ public class AdvancedPortalsCommand implements CommandExecutor {
sender.sendMessage("§a[§7AdvancedPortals§a] You have been given a §ePortal Region Selector§a!");
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to create portals so you cannot give yourself a §ePortal Region Selector§c!");
PluginMessages.NoPermission(sender, command);
}
}
else{
PluginMessages.UnknownCommand(sender, command);
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n"

View File

@ -1,8 +1,14 @@
package com.sekwah.advancedportals;
import java.util.Arrays;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
public class DestinationCommand implements CommandExecutor {
@ -17,8 +23,20 @@ public class DestinationCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
if(args.length > 0){
if(args[0].toLowerCase().equals("create")){
if(sender.hasPermission("AdvancedPortals.create")){
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to create portals so you cannot give yourself a §ePortal Region Selector§c!");
}
}
}
else{
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n"
+ "if you do not know what you can put or would like some help with the commands please type /" + command + " help");
}
return true;
}

View File

@ -41,7 +41,7 @@ public class Listeners implements Listener {
// also any other detections such as sign interaction or basic block protection
Player player = event.getPlayer();
Location blockloc = event.getClickedBlock().getLocation();
if(player.hasPermission("AdvancedPortals.create")){
if(player.hasPermission("AdvancedPortals.CreatePortal")){
// UseOnlyServerMadeAxe being set to true makes is so only the axe generated by the server can be used so other iron axes can be used normally,
// by default its false but it is a nice feature in case the user wants to use the axe normally too, such as a admin playing survival or it being used

View File

@ -0,0 +1,20 @@
package com.sekwah.advancedportals;
import org.bukkit.command.CommandSender;
public class PluginMessages {
// This class is so then the common messages in commands or just messages over the commands are the same and can be
// easily changed.
public static void UnknownCommand(CommandSender sender, String command) {
sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n"
+ "if you do not know what you can put or would like some help with the commands please type " + '"' + "/" + command + " help" + '"' + " or you can check out the Advanced Portals wiki"
+ "\n ");
}
public static void NoPermission(CommandSender sender, String command) {
sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to perform that command!");
}
}

View File

@ -0,0 +1,5 @@
package com.sekwah.advancedportals.destinations;
public class CreateDestination {
}

View File

@ -0,0 +1,5 @@
package com.sekwah.advancedportals.destinations;
public class DestroyDestination {
}

View File

@ -0,0 +1,5 @@
package com.sekwah.advancedportals.portalcontrolls;
public class CreatePortal {
}

View File

@ -0,0 +1,5 @@
package com.sekwah.advancedportals.portalcontrolls;
public class DestroyPortal {
}