Package com.bekvon.bukkit.residence.protection

Examples of com.bekvon.bukkit.residence.protection.ClaimedResidence


    }

    public static void showResidenceFlagGUI(SpoutPlayer p, Residence plug, String resname, boolean resadmin)
    {
        ClaimedResidence res = Residence.getResidenceManager().getByName(resname);
        if (res.getPermissions().hasResidencePermission(p, false)) {

            Color fieldcolor = new Color(0F,0F,0.3F,1F);
            Color textPrimaryColor = new Color(1F,1F,1F,1F);
            Color textSecondaryColor = new Color(1F,1F,0,1F);
            Color hoverColor = new Color(1F,0,0,1F);
           
            ResidencePopup popup = new ResidencePopup(PopupType.FLAG_GUI);

            popup.getMetaData().put("admin", resadmin);
           
            popup.gridAttachWidget(plug, new GenericLabel("Admin: ").setTextColor(textPrimaryColor), 3, 1);
            popup.gridAttachWidget(plug, new GenericLabel(Boolean.toString(resadmin)).setTextColor(textSecondaryColor), 4, 1);
            popup.gridAttachWidget(plug, new GenericLabel("Residence: ").setTextColor(textPrimaryColor), 0, 0);
            popup.gridAttachWidget(plug, new GenericLabel("Flag: ").setTextColor(textPrimaryColor), 0, 1);
            popup.gridAttachWidget(plug, new GenericLabel("Player: ").setTextColor(textPrimaryColor), 0, 2);
            popup.gridAttachWidget(plug, new GenericLabel("Group: ").setTextColor(textPrimaryColor), 0, 3);
            popup.gridAttachWidget("ResidenceName",plug, new GenericLabel(resname).setTextColor(textSecondaryColor), 1, 0);
            popup.gridAttachWidget(plug, new GenericLabel("Owner: ").setTextColor(textPrimaryColor), 0, 4);
            popup.gridAttachWidget(plug, new GenericLabel("World: ").setTextColor(textPrimaryColor), 0, 5);
            popup.gridAttachWidget(plug, new GenericLabel(res.getOwner()).setTextColor(textSecondaryColor), 1, 4);
            popup.gridAttachWidget(plug, new GenericLabel(res.getWorld()).setTextColor(textSecondaryColor), 1, 5);

            GenericTextField flag = new GenericTextField();
            flag.setTooltip("The name of the flag...");
            flag.setColor(textSecondaryColor);
            flag.setFieldColor(fieldcolor);
View Full Code Here


            if (type == PopupType.FLAG_GUI) {
                ResidencePopup popup = (ResidencePopup) screen;
                String flagval = null;
                String flag = null;
                String player = null;
                ClaimedResidence res = null;
                String group = null;
                boolean resadmin = (Boolean)popup.getMetaData().get("admin");
                Button button = event.getButton();
                if (button.getText().equalsIgnoreCase("Close")) {
                    event.getPlayer().getMainScreen().removeWidget(screen);
                    return;
                } else if (button.getText().equalsIgnoreCase("RemoveAll")) {
                    flagval = "removeall";
                } else if (button.getText().equalsIgnoreCase("SetTrue")) {
                    flagval = "true";
                } else if (button.getText().equalsIgnoreCase("SetFalse")) {
                    flagval = "false";
                } else if (button.getText().equalsIgnoreCase("Remove")) {
                    flagval = "remove";
                }
                player = ((GenericTextField) popup.getWidget("PlayerName")).getText();
                group = ((GenericTextField)popup.getWidget("GroupName")).getText();
                flag = ((GenericTextField) popup.getWidget("FlagName")).getText();
                res = Residence.getResidenceManager().getByName(((GenericLabel) popup.getWidget("ResidenceName")).getText());
                if(res==null || flagval == null || flagval.equalsIgnoreCase("") || ((flag == null || flag.equalsIgnoreCase("")) && !flagval.equalsIgnoreCase("removeall")))
                    return;
                if((player==null || player.equalsIgnoreCase("")) && (group == null || group.equalsIgnoreCase("")))
                {
                    res.getPermissions().setFlag(p, flag, flagval, resadmin);
                }
                else if(group!=null && !group.equalsIgnoreCase("")) {
                    if(flagval.equalsIgnoreCase("removeall"))
                        res.getPermissions().removeAllGroupFlags(p, group, resadmin);
                    else
                        res.getPermissions().setGroupFlag(p, group, flag, flagval, resadmin);
                }
                else if(player!=null && !player.equalsIgnoreCase(""))
                {
                    if(flagval.equalsIgnoreCase("removeall"))
                        res.getPermissions().removeAllPlayerFlags(p, player, resadmin);
                    else
                        res.getPermissions().setPlayerFlag(p, player, flag, flagval, resadmin);
                }
            }
        }
    }
View Full Code Here

        }
        return language;
    }

    public static FlagPermissions getPermsByLoc(Location loc) {
        ClaimedResidence res = rmanager.getByLoc(loc);
        if (res != null) {
            return res.getPermissions();
        } else {
            return wmanager.getPerms(loc.getWorld().getName());
        }
    }
View Full Code Here

        }
    }

    public static FlagPermissions getPermsByLocForPlayer(Location loc, Player player)
    {
        ClaimedResidence res = rmanager.getByLoc(loc);
        if (res != null) {
            return res.getPermissions();
        } else {
            if (player != null)
                return wmanager.getPerms(player);
            else
                return wmanager.getPerms(loc.getWorld().getName());
View Full Code Here

    public void setRentRepeatable(Player player, String landName, boolean value, boolean resadmin)
    {
        String[] split = landName.split("\\.");
        RentableLand land = rentableLand.get(landName);
        ClaimedResidence res = Residence.getResidenceManager().getByName(landName);
        if(land!=null && res!=null && (res.getPermissions().getOwner().equalsIgnoreCase(player.getName()) || resadmin))
        {
            land.repeatable = value;
            if(!value && this.isRented(landName))
                rentedLand.get(landName).autoRefresh = false;
            if(value && split.length!=0)
View Full Code Here

    {
        Set<String> set = rentableLand.keySet();
        int count = 0;
        for(String land : set)
        {
            ClaimedResidence res = Residence.getResidenceManager().getByName(land);
            if(res!=null)
                if(res.getPermissions().getOwner().equalsIgnoreCase(player))
                    count++;
        }
        return count;
    }
View Full Code Here

                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("InvalidAmount"));
                return;
            }
        }
        String pname = player.getName();
        ClaimedResidence area = manager.getByName(areaname);
        if (area == null) {
            player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("InvalidResidence"));
            return;
        }
        if (!area.getPermissions().getOwner().equals(pname) && !resadmin) {
            player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("NoPermission"));
            return;
        }
        if (sellAmount.containsKey(areaname)) {
            player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("AlreadySellFail"));
View Full Code Here

        if (Residence.getConfigManager().enabledRentSystem()) {
            if (Residence.getRentManager().isForRent(areaname)) {
                return false;
            }
        }
        ClaimedResidence area = manager.getByName(areaname);
        if (area == null) {
            return false;
        }
        if (sellAmount.containsKey(areaname)) {
            return false;
View Full Code Here

                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("NoPermission"));
                return;
            }
        }
        if (isForSale(areaname)) {
            ClaimedResidence res = manager.getByName(areaname);
            if (res == null) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("InvalidArea"));
                sellAmount.remove(areaname);
                return;
            }
            if (res.getPermissions().getOwner().equals(player.getName())) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("OwnerBuyFail"));
                return;
            }
            if (Residence.getResidenceManager().getOwnedZoneCount(player.getName()) >= group.getMaxZones() && !resadmin) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceTooMany"));
                return;
            }
            Server serv = Residence.getServ();
            int amount = sellAmount.get(areaname);
            if (!resadmin) {
                if (!group.buyLandIgnoreLimits()) {
                    CuboidArea[] areas = res.getAreaArray();
                    for (CuboidArea thisarea : areas) {
                        if (!group.inLimits(thisarea)) {
                            player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceBuyTooBig"));
                            return;
                        }
                    }
                }
            }
            EconomyInterface econ = Residence.getEconomyManager();
            if (econ == null) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("MarketDisabled"));
                return;
            }
            String buyerName = player.getName();
            String sellerName = res.getPermissions().getOwner();
            Player sellerNameFix = Residence.getServ().getPlayer(sellerName);
            if (sellerNameFix != null) {
                sellerName = sellerNameFix.getName();
            }
            if (econ.canAfford(buyerName, amount)) {
                if (!econ.transfer(buyerName, sellerName, amount)) {
                    player.sendMessage(ChatColor.RED + "Error, could not transfer " + amount + " from " + buyerName + " to " + sellerName);
                    return;
                }
                res.getPermissions().setOwner(player.getName(), true);
                res.getPermissions().applyDefaultFlags();
                this.removeFromSale(areaname);
                player.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("MoneyCharged", ChatColor.YELLOW + String.format("%d", amount) + ChatColor.GREEN + "." + ChatColor.YELLOW + econ.getName() + ChatColor.GREEN));
                player.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("ResidenceBought", ChatColor.GREEN + areaname + ChatColor.YELLOW));
                Player seller = serv.getPlayer(sellerName);
                if (seller != null && seller.isOnline()) {
View Full Code Here

            player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("InvalidResidence"));
        }
    }

    public void removeFromSale(Player player, String areaname, boolean resadmin) {
        ClaimedResidence area = manager.getByName(areaname);
        if (area != null) {
            if (!isForSale(areaname)) {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceNotForSale"));
                return;
            }
            if (area.getPermissions().getOwner().equals(player.getName()) || resadmin) {
                removeFromSale(areaname);
                player.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("ResidenceStopSelling"));
            } else {
                player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("NoPermission"));
            }
View Full Code Here

TOP

Related Classes of com.bekvon.bukkit.residence.protection.ClaimedResidence

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.