use of com.builtbroken.mc.lib.access.AccessUser in project Engine by VoltzEngine-Project.
the class GSCList method handle.
@Override
public boolean handle(ICommandSender sender, AccessGroup group, String user, String[] args) {
// TODO add page support, so we don't spam the console
if (args != null && args.length >= 0) {
if (args[0].equalsIgnoreCase("perms")) {
if (group.getNodes() != null && group.getNodes().size() > 0) {
sender.addChatMessage(new ChatComponentText("==== Permission Nodes ====="));
for (String node : group.getNodes()) {
sender.addChatMessage(new ChatComponentText(node));
}
sender.addChatMessage(new ChatComponentText(""));
} else {
sender.addChatMessage(new ChatComponentText("No perms to list"));
}
return true;
} else if (args[0].equalsIgnoreCase("users") || args[0].equalsIgnoreCase("members")) {
if (group.getMembers() != null && group.getMembers().size() > 0) {
sender.addChatMessage(new ChatComponentText("===== Members ====="));
for (AccessUser u : group.getMembers()) {
sender.addChatMessage(new ChatComponentText(u.getName()));
}
sender.addChatMessage(new ChatComponentText(""));
} else {
sender.addChatMessage(new ChatComponentText("Group contains no members"));
}
return true;
}
}
sender.addChatMessage(new ChatComponentText("Not sure what you want listed"));
return true;
}
use of com.builtbroken.mc.lib.access.AccessUser in project Engine by VoltzEngine-Project.
the class GroupProfileHandler method canExecuteCommand.
public boolean canExecuteCommand(ICommandSender sender, ICommand command, String[] args) {
if (sender instanceof EntityPlayer) {
AccessUser user = getAccessProfile().getUserAccess((EntityPlayer) sender);
String node = PermissionsRegistry.getNodeFor(command, args);
return user.hasNode(node);
}
return command.canCommandSenderUseCommand(sender);
}
use of com.builtbroken.mc.lib.access.AccessUser in project Engine by VoltzEngine-Project.
the class RegionController method onPlayerInteract.
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent event) {
if (!event.world.isRemote && event.world.provider.dimensionId == dim) {
EntityPlayer player = event.entityPlayer;
List<Region> regionList = getRegionsAtLocation(new Pos(event.x, event.y, event.z));
if (regionList != null && regionList.size() > 0) {
for (Region region : regionList) {
AccessUser user = region.getAccessProfile().getUserAccess(player);
if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) {
if (!user.hasNode(RegionManager.leftClick.toString())) {
event.setCanceled(true);
player.addChatComponentMessage(new ChatComponentText("You do not have the permission to do that here!"));
}
} else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
if (!user.hasNode(RegionManager.rightClick.toString())) {
event.setCanceled(true);
player.addChatComponentMessage(new ChatComponentText("You do not have the permission to do that here!"));
}
}
}
}
}
}
use of com.builtbroken.mc.lib.access.AccessUser in project Engine by VoltzEngine-Project.
the class CommandUser method handleConsoleCommand.
@Override
public boolean handleConsoleCommand(ICommandSender sender, String[] args) {
if (isHelpCommand(args)) {
handleHelp(sender, args);
} else {
String name = args[0];
AccessUser user = GroupProfileHandler.GLOBAL.getAccessProfile().getUserAccess(name);
if (user != null && user.getGroup() != null) {
if (args.length > 1) {
for (AbstractCommand command : subCommands) {
if (command instanceof UserSubCommand && command.getCommandName().equalsIgnoreCase(args[1])) {
if (((UserSubCommand) command).handle(sender, user, removeFront(args, 2))) {
return true;
}
}
}
}
sender.addChatMessage(new ChatComponentText("Unknown user sub command"));
} else {
sender.addChatMessage(new ChatComponentText("User not found in permissions profile"));
}
}
return true;
}
Aggregations