本文整理匯總了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);
}
}
}
示例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;
}