Package com.bekvon.bukkit.residence.permissions

Examples of com.bekvon.bukkit.residence.permissions.PermissionGroup


        if(!leaseExpires(area))
        {
            player.sendMessage(ChatColor.RED+Residence.getLanguage().getPhrase("LeaseNotExpire"));
            return;
        }
        PermissionGroup limits = Residence.getPermissionManager().getGroup(player);
        int max = limits.getMaxLeaseTime();
        int add = limits.getLeaseGiveTime();
        int rem = daysRemaining(area);
        EconomyInterface econ = Residence.getEconomyManager();
        if(econ!=null)
        {
            double cost = limits.getLeaseRenewCost();
            ClaimedResidence res = manager.getByName(area);
            int amount = (int) Math.ceil((double)res.getTotalSize() * cost);
            if(cost!=0D)
            {
                //Account account = iConomy.getBank().getAccount(player.getName());
View Full Code Here


        player.sendMessage(ChatColor.YELLOW+Residence.getLanguage().getPhrase("LeaseRenew",ChatColor.GREEN + "" + getExpireTime(area)));
    }

    public int getRenewCost(ClaimedResidence res)
    {
        PermissionGroup limits = Residence.getPermissionManager().getGroup(res.getPermissions().getOwner(), res.getPermissions().getWorld());
        double cost = limits.getLeaseRenewCost();
        int amount = (int) Math.ceil((double)res.getTotalSize() * cost);
        return amount;
    }
View Full Code Here

                if (res == null) {
                    it.remove();
                } else {
                    boolean renewed = false;
                    String owner = res.getPermissions().getOwner();
                    PermissionGroup limits = Residence.getPermissionManager().getGroup(owner, res.getPermissions().getWorld());
                    int cost = this.getRenewCost(res);
                    if (Residence.getConfigManager().enableEconomy() && Residence.getConfigManager().autoRenewLeases()) {
                        if (cost == 0) {
                            renewed = true;
                        } else if (res.getBank().hasEnough(cost)) {
                            res.getBank().subtract(cost);
                            renewed = true;
                            if(Residence.getConfigManager().debugEnabled())
                                System.out.println("Lease Renewed From Residence Bank: "+resname);
                        } else if (Residence.getEconomyManager().canAfford(owner, cost)) {
                            if (Residence.getEconomyManager().subtract(owner, cost)) {
                                renewed = true;
                                if(Residence.getConfigManager().debugEnabled())
                                    System.out.println("Lease Renewed From Economy: "+resname);
                            }
                        }
                    }
                    if (!renewed) {
                        if (!Residence.getConfigManager().enabledRentSystem() || !Residence.getRentManager().isRented(resname)) {
                            ResidenceDeleteEvent resevent = new ResidenceDeleteEvent(null, res, DeleteCause.LEASE_EXPIRE);
                            Residence.getServ().getPluginManager().callEvent(resevent);
                            if (!resevent.isCancelled()) {
                                manager.removeResidence(next.getKey());
                                it.remove();
                                if(Residence.getConfigManager().debugEnabled())
                                    System.out.println("Lease NOT removed, Removing: "+resname);
                            }
                        }
                    } else {
                        if (Residence.getConfigManager().enableEconomy() && Residence.getConfigManager().enableLeaseMoneyAccount()) {
                            Residence.getEconomyManager().add("Lease Money", cost);
                        }
                        if(Residence.getConfigManager().debugEnabled())
                            System.out.println("Lease Renew Old: "+next.getValue());
                        next.setValue(System.currentTimeMillis() + daysToMs(limits.getLeaseGiveTime()));
                        if(Residence.getConfigManager().debugEnabled())
                            System.out.println("Lease Renew New: " + next.getValue());
                    }
                }
            }
View Full Code Here

        for(int i = 0; i < list.length; i++)
        {
            if(list[i]!=null)
            {
                ClaimedResidence res = Residence.getResidenceManager().getByName(list[i]);
                PermissionGroup group = Residence.getPermissionManager().getGroup(res.getPermissions().getOwner(),res.getPermissions().getWorld());
                this.setExpireTime(null,list[i], group.getLeaseGiveTime());
            }
        }
        System.out.println("[Residence] - Set default leases.");
    }
View Full Code Here

            if (player != null) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("SelectPoints"));
            }
            return false;
        }
        PermissionGroup group = Residence.getPermissionManager().getGroup(owner, loc1.getWorld().getName());
        boolean createpermission = group.canCreateResidences() || (player == null ? true : player.hasPermission("residence.create"));
        if (!createpermission && !resadmin) {
            if (player != null) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("NoPermission"));
            }
            return false;
        }
        if (player != null) {
            if (getOwnedZoneCount(player.getName()) >= group.getMaxZones() && !resadmin) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceTooMany"));
                return false;
            }
        }
        CuboidArea newArea = new CuboidArea(loc1, loc2);
        ClaimedResidence newRes = new ClaimedResidence(owner, loc1.getWorld().getName());
        newRes.getPermissions().applyDefaultFlags();
        newRes.setEnterMessage(group.getDefaultEnterMessage());
        newRes.setLeaveMessage(group.getDefaultLeaveMessage());

        ResidenceCreationEvent resevent = new ResidenceCreationEvent(player, name, newRes, newArea);
        Residence.getServ().getPluginManager().callEvent(resevent);
        if (resevent.isCancelled()) {
            return false;
        }
        newArea = resevent.getPhysicalArea();
        name = resevent.getResidenceName();
        if (residences.containsKey(name)) {
            if (player != null) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceAlreadyExists", ChatColor.YELLOW + name + ChatColor.RED));
            }
            return false;
        }
        if (player != null) {
            newRes.addArea(player, newArea, "main", resadmin);
        } else {
            newRes.addArea(newArea, "main");
        }
        if (newRes.getAreaCount() != 0) {
            residences.put(name, newRes);
            calculateChunks(name);
            Residence.getLeaseManager().removeExpireTime(name);
            if (player != null) {
                player.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("ResidenceCreate", ChatColor.YELLOW + name + ChatColor.GREEN));
            }
            if (Residence.getConfigManager().useLeases()) {
                if (player != null) {
                    Residence.getLeaseManager().setExpireTime(player, name, group.getLeaseGiveTime());
                } else {
                    Residence.getLeaseManager().setExpireTime(name, group.getLeaseGiveTime());
                }
            }
            return true;
        }
        return false;
View Full Code Here

        if (giveplayer == null || !giveplayer.isOnline()) {
            reqPlayer.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("NotOnline"));
            return;
        }
        CuboidArea[] areas = res.getAreaArray();
        PermissionGroup g = Residence.getPermissionManager().getGroup(giveplayer);
        if (areas.length > g.getMaxPhysicalPerResidence() && !resadmin) {
            reqPlayer.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceGiveLimits"));
            return;
        }
        if (getOwnedZoneCount(giveplayer.getName()) >= g.getMaxZones() && !resadmin) {
            reqPlayer.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceGiveLimits"));
            return;
        }
        if (!resadmin) {
            for (CuboidArea area : areas) {
                if (!g.inLimits(area)) {
                    reqPlayer.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceGiveLimits"));
                    return;
                }
            }
        }
View Full Code Here

    public void showSelectionInfo(Player player) {
        String pname = player.getName();
        if (this.hasPlacedBoth(pname)) {
            CuboidArea cuboidArea = new CuboidArea(getPlayerLoc1(pname), getPlayerLoc2(pname));
            player.sendMessage(ChatColor.YELLOW+Residence.getLanguage().getPhrase("Selection.Total.Size")+":"+ChatColor.DARK_AQUA+" " + cuboidArea.getSize());
            PermissionGroup group = Residence.getPermissionManager().getGroup(player);
            if(Residence.getConfigManager().enableEconomy())
            player.sendMessage(ChatColor.YELLOW+Residence.getLanguage().getPhrase("Land.Cost")+":"+ChatColor.DARK_AQUA+" " + ((int)Math.ceil((double)cuboidArea.getSize()*group.getCostPerBlock())));
            player.sendMessage(ChatColor.YELLOW+"X"+Residence.getLanguage().getPhrase("Size")+":"+ChatColor.DARK_AQUA+" " + cuboidArea.getXSize());
            player.sendMessage(ChatColor.YELLOW+"Y"+Residence.getLanguage().getPhrase("Size")+":"+ChatColor.DARK_AQUA+" " + cuboidArea.getYSize());
            player.sendMessage(ChatColor.YELLOW+"Z"+Residence.getLanguage().getPhrase("Size")+":"+ChatColor.DARK_AQUA+" " + cuboidArea.getZSize());
        }
        else
View Full Code Here

    public void sky(Player player, boolean resadmin)
    {
        if(hasPlacedBoth(player.getName()))
        {
            PermissionGroup group = Residence.getPermissionManager().getGroup(player);
            int y1 = playerLoc1.get(player.getName()).getBlockY();
            int y2 = playerLoc2.get(player.getName()).getBlockY();
            if(y1>y2)
            {
                int newy = MAX_HEIGHT;
                if(!resadmin)
                {
                    if(group.getMaxHeight()<newy)
                        newy = group.getMaxHeight();
                    if(newy - y2 > (group.getMaxY()-1))
                        newy = y2 + (group.getMaxY()-1);
                }
                playerLoc1.get(player.getName()).setY(newy);
            }
            else
            {
                int newy = MAX_HEIGHT;
                if(!resadmin)
                {
                    if(group.getMaxHeight()<newy)
                        newy = group.getMaxHeight();
                    if(newy - y1 > (group.getMaxY()-1))
                        newy = y1 + (group.getMaxY()-1);
                }
                playerLoc2.get(player.getName()).setY(newy);
            }
            player.sendMessage(ChatColor.GREEN+Residence.getLanguage().getPhrase("SelectionSky"));
        }
View Full Code Here

    public void bedrock(Player player, boolean resadmin)
    {
        if(hasPlacedBoth(player.getName()))
        {
            PermissionGroup group = Residence.getPermissionManager().getGroup(player);
            int y1 = playerLoc1.get(player.getName()).getBlockY();
            int y2 = playerLoc2.get(player.getName()).getBlockY();
            if(y1<y2)
            {
                int newy = MIN_HEIGHT;
                if(!resadmin)
                {
                    if(newy<group.getMinHeight())
                        newy = group.getMinHeight();
                    if(y2 - newy > (group.getMaxY()-1))
                        newy = y2 - (group.getMaxY()-1);
                }
                playerLoc1.get(player.getName()).setY(newy);
            }
            else
            {
                int newy = MIN_HEIGHT;
                if(!resadmin)
                {
                    if(newy<group.getMinHeight())
                        newy = group.getMinHeight();
                    if(y1 - newy > (group.getMaxY()-1))
                        newy = y1 - (group.getMaxY()-1);
                }
                playerLoc2.get(player.getName()).setY(newy);
            }
            player.sendMessage(ChatColor.GREEN+Residence.getLanguage().getPhrase("SelectionBedrock"));
        }
View Full Code Here

    {
       
    }

    public void playerListChange(Player player, Material mat, boolean resadmin) {
        PermissionGroup group = Residence.getPermissionManager().getGroup(player);
        if(resadmin || (res.getPermissions().hasResidencePermission(player, true) && group.itemListAccess()))
        {
            if(super.toggle(mat))
                player.sendMessage(ChatColor.YELLOW + Residence.getLanguage().getPhrase("ListMaterialAdd",ChatColor.GREEN + mat.toString() + ChatColor.YELLOW+"."+ChatColor.GREEN + type.toString().toLowerCase() + ChatColor.YELLOW));
            else
                player.sendMessage(ChatColor.YELLOW + Residence.getLanguage().getPhrase("ListMaterialRemove",ChatColor.GREEN + mat.toString() + ChatColor.YELLOW+"."+ChatColor.GREEN + type.toString().toLowerCase() + ChatColor.YELLOW));
View Full Code Here

TOP

Related Classes of com.bekvon.bukkit.residence.permissions.PermissionGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.