當前位置: 首頁>>代碼示例>>Java>>正文


Java DBFunc.setMember方法代碼示例

本文整理匯總了Java中com.intellectualcrafters.plot.database.DBFunc.setMember方法的典型用法代碼示例。如果您正苦於以下問題:Java DBFunc.setMember方法的具體用法?Java DBFunc.setMember怎麽用?Java DBFunc.setMember使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellectualcrafters.plot.database.DBFunc的用法示例。


在下文中一共展示了DBFunc.setMember方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addMember

import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
/**
 * Add someone as a trusted user (updates database as well)
 *
 * @param uuid the uuid of the player to add as a member
 */
public void addMember(UUID uuid) {
    for (Plot current : getConnectedPlots()) {
        if (current.getMembers().add(uuid)) {
            DBFunc.setMember(current, uuid);
        }
    }
}
 
開發者ID:IntellectualSites,項目名稱:PlotSquared,代碼行數:13,代碼來源:Plot.java

示例2: execute

import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
    if (args.length != 1) {
        MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot add <玩家名稱>");
        return true;
    }
    final Location loc = plr.getLocation();
    final Plot plot = MainUtil.getPlot(loc);
    if (plot == null) {
        return !sendMessage(plr, C.NOT_IN_PLOT);
    }
    if ((plot == null) || !plot.hasOwner()) {
        MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
        return false;
    }
    if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.add")) {
        MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
        return true;
    }
    UUID uuid;
    if (args[0].equalsIgnoreCase("*")) {
        uuid = DBFunc.everyone;
    } else {
        uuid = UUIDHandler.getUUID(args[0]);
    }
    if (uuid == null) {
        MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
        return false;
    }
    if (!plot.members.contains(uuid)) {
        if (plot.isOwner(uuid)) {
            MainUtil.sendMessage(plr, C.ALREADY_OWNER);
            return false;
        }
        if (plot.trusted.contains(uuid)) {
            plot.trusted.remove(uuid);
            DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
        }
        if (plot.denied.contains(uuid)) {
            if (plot.members.size() + plot.trusted.size() >= PlotSquared.getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
                MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
                return false;
            }
            plot.denied.remove(uuid);
            DBFunc.removeDenied(loc.getWorld(), plot, uuid);
        }
        plot.addMember(uuid);
        DBFunc.setMember(loc.getWorld(), plot, uuid);
        EventUtil.manager.callMember(plr, plot, uuid, true);
    } else {
        MainUtil.sendMessage(plr, C.ALREADY_ADDED);
        return false;
    }
    if (plot.members.size() + plot.trusted.size() >= PlotSquared.getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
        MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
        return false;
    }
    MainUtil.sendMessage(plr, C.MEMBER_ADDED);
    return true;
}
 
開發者ID:Mayomi,項目名稱:PlotSquared-Chinese,代碼行數:61,代碼來源:Add.java


注:本文中的com.intellectualcrafters.plot.database.DBFunc.setMember方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。