mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-12-25 02:17:40 +01:00
Started work on Permissions/isOP() support.
This commit is contained in:
parent
b8ee4c7f53
commit
178b15926f
@ -20,8 +20,13 @@ public class MVCoord extends MVCommandHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean perform(CommandSender sender, String[] args) {
|
public boolean perform(CommandSender sender, String[] args) {
|
||||||
// TODO: Add Permissions
|
// Check if the command was sent from a Player.
|
||||||
if(sender instanceof Player){
|
if(sender instanceof Player){
|
||||||
|
// If this command was sent from a Player then we need to check Permissions
|
||||||
|
if(!(plugin.ph.has(((Player) sender), "multiverse.coord"))){
|
||||||
|
sender.sendMessage("You do not have access to this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
|
|
||||||
p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName());
|
p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName());
|
||||||
@ -29,6 +34,8 @@ public class MVCoord extends MVCommandHandler {
|
|||||||
p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + locMan.strCoords(p.getLocation()));
|
p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + locMan.strCoords(p.getLocation()));
|
||||||
p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + locMan.getDirection(p.getLocation()));
|
p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + locMan.getDirection(p.getLocation()));
|
||||||
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));
|
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("This command needs to be used from a Player.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,55 @@
|
|||||||
package com.onarandombox.MultiVerseCore.commands;
|
package com.onarandombox.MultiVerseCore.commands;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.onarandombox.MultiVerseCore.MVCommandHandler;
|
import com.onarandombox.MultiVerseCore.MVCommandHandler;
|
||||||
|
import com.onarandombox.MultiVerseCore.MVWorld;
|
||||||
import com.onarandombox.MultiVerseCore.MultiVerseCore;
|
import com.onarandombox.MultiVerseCore.MultiVerseCore;
|
||||||
|
|
||||||
public class MVList extends MVCommandHandler {
|
public class MVList extends MVCommandHandler {
|
||||||
|
|
||||||
public MVList(MultiVerseCore plugin) {
|
public MVList(MultiVerseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean perform(CommandSender sender, String[] args) {
|
public boolean perform(CommandSender sender, String[] args) {
|
||||||
// TODO Auto-generated method stub
|
Player p = null;
|
||||||
return false;
|
if(sender instanceof Player){
|
||||||
|
p = (Player) sender;
|
||||||
|
if(!(plugin.ph.has(p, "multiverse.world.list"))){
|
||||||
|
sender.sendMessage("You do not have access to this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String output = ChatColor.GREEN + "Worlds which you can view - \n";
|
||||||
|
MultiVerseCore.debugMsg("Size - " + plugin.worlds.size());
|
||||||
|
for(int i=0;i<plugin.getServer().getWorlds().size();i++){
|
||||||
|
|
||||||
|
World world = plugin.getServer().getWorlds().get(i);
|
||||||
|
|
||||||
|
if(!(plugin.worlds.containsKey(world.getName()))){ continue; }
|
||||||
|
if(p!=null && (!plugin.ph.canEnterWorld(p, world))){ continue; }
|
||||||
|
|
||||||
|
ChatColor color;
|
||||||
|
|
||||||
|
if (world.getEnvironment() == Environment.NETHER)
|
||||||
|
color = ChatColor.RED;
|
||||||
|
else
|
||||||
|
color = ChatColor.GREEN;
|
||||||
|
|
||||||
|
output += color + world.getName() + " - " + world.getEnvironment().toString() + " \n";
|
||||||
|
|
||||||
|
}
|
||||||
|
String[] response = output.split("\n");
|
||||||
|
for(String msg : response){
|
||||||
|
sender.sendMessage(msg);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,14 @@ public class MVWho extends MVCommandHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean perform(CommandSender sender, String[] args) {
|
public boolean perform(CommandSender sender, String[] args) {
|
||||||
// TODO: Permissions
|
// If this command was sent from a Player then we need to check Permissions
|
||||||
|
if(sender instanceof Player){
|
||||||
|
if(!(plugin.ph.has(((Player) sender), "multiverse.who"))){
|
||||||
|
sender.sendMessage("You do not have access to this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<World> worlds = new ArrayList<World>();
|
List<World> worlds = new ArrayList<World>();
|
||||||
|
|
||||||
if(args.length>1){
|
if(args.length>1){
|
||||||
|
Loading…
Reference in New Issue
Block a user