本文整理匯總了Java中com.intellectualcrafters.plot.database.DBFunc.setFlags方法的典型用法代碼示例。如果您正苦於以下問題:Java DBFunc.setFlags方法的具體用法?Java DBFunc.setFlags怎麽用?Java DBFunc.setFlags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellectualcrafters.plot.database.DBFunc
的用法示例。
在下文中一共展示了DBFunc.setFlags方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCommand
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
@Override
public boolean onCommand(PlotPlayer player, String[] args) {
PlotArea area = PS.get().getPlotAreaByString(args[0]);
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD, args[0]);
return false;
}
MainUtil.sendMessage(player, "&8--- &6Starting task &8 ---");
for (Plot plot : area.getPlots()) {
HashMap<Flag<?>, Object> flags = plot.getFlags();
Iterator<Entry<Flag<?>, Object>> i = flags.entrySet().iterator();
boolean changed = false;
while (i.hasNext()) {
if (i.next().getKey() == null) {
changed = true;
i.remove();
}
}
if (changed) {
DBFunc.setFlags(plot, plot.getFlags());
}
}
MainUtil.sendMessage(player, "&aDone!");
return true;
}
示例2: removePlotFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
/**
* Removes a flag from a certain plot.
* @param origin the plot to remove the flag from
* @param id the flag to remove
* @return true if the plot contained the flag and was removed successfully
*/
public static boolean removePlotFlag(Plot origin, Flag<?> id) {
for (Plot plot : origin.getConnectedPlots()) {
Object value = plot.getFlags().remove(id);
if (value == null) {
return false;
}
if (plot == origin) {
boolean result = EventUtil.manager.callFlagRemove(id, plot, value);
if (!result) {
plot.getFlags().put(id, value);
return false;
}
}
plot.reEnter();
DBFunc.setFlags(plot, plot.getFlags());
}
return true;
}
示例3: setPlotFlags
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static void setPlotFlags(Plot origin, HashMap<Flag<?>, Object> flags) {
for (Plot plot : origin.getConnectedPlots()) {
if (flags != null && !flags.isEmpty()) {
plot.getFlags().clear();
for (Map.Entry<Flag<?>, Object> flag : flags.entrySet()) {
plot.getFlags().put(flag.getKey(), flag.getValue());
}
} else if (plot.getFlags().isEmpty()) {
return;
} else {
plot.getFlags().clear();
}
plot.reEnter();
DBFunc.setFlags(plot, plot.getFlags());
}
}
示例4: execute
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (plr != null) {
MainUtil.sendMessage(plr, C.NOT_CONSOLE);
return false;
}
if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags <世界名稱>");
return false;
}
final String world = args[0];
if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(world)) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]);
return false;
}
MainUtil.sendMessage(plr, "&8--- &6開始進程 &8 ---");
for (final Plot plot : PlotSquared.getPlots(world).values()) {
final HashMap<String, Flag> flags = plot.settings.flags;
Iterator<Entry<String, Flag>> i = flags.entrySet().iterator();
boolean changed = false;
while (i.hasNext()) {
if (FlagManager.getFlag(i.next().getKey()) == null) {
changed = true;
i.remove();
}
}
if (changed) {
DBFunc.setFlags(plot.world, plot, plot.settings.flags.values());
}
}
MainUtil.sendMessage(plr, "&a已完成!");
return true;
}
示例5: addPlotFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
/**
* Add a flag to a plot
* @param plot
* @param flag
*/
public static boolean addPlotFlag(final Plot plot, final Flag flag) {
final boolean result = EventUtil.manager.callFlagAdd(flag, plot);
if (!result) {
return false;
}
plot.settings.flags.put(flag.getKey(), flag);
DBFunc.setFlags(plot.world, plot, plot.settings.flags.values());
return true;
}
示例6: addClusterFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static boolean addClusterFlag(final PlotCluster cluster, final Flag flag) {
//TODO plot cluster flag event
final Flag hasFlag = getSettingFlag(cluster.world, cluster.settings, flag.getKey());
cluster.settings.flags.put(flag.getKey(), flag);
DBFunc.setFlags(cluster, cluster.settings.flags.values());
return true;
}
示例7: removePlotFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static boolean removePlotFlag(final Plot plot, final String id) {
Flag flag = plot.settings.flags.remove(id);
if (flag == null) {
return false;
}
final boolean result = EventUtil.manager.callFlagRemove(flag, plot);
if (!result) {
plot.settings.flags.put(id, flag);
return false;
}
DBFunc.setFlags(plot.world, plot, plot.settings.flags.values());
return true;
}
示例8: removeClusterFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static boolean removeClusterFlag(final PlotCluster cluster, final String id) {
Flag flag = cluster.settings.flags.remove(id);
if (flag == null) {
return false;
}
final boolean result = EventUtil.manager.callFlagRemove(flag, cluster);
if (!result) {
cluster.settings.flags.put(id, flag);
return false;
}
DBFunc.setFlags(cluster, cluster.settings.flags.values());
return true;
}
示例9: setPlotFlags
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static void setPlotFlags(final Plot plot, final Set<Flag> flags) {
if (flags != null && flags.size() != 0) {
plot.settings.flags.clear();
for (Flag flag : flags) {
plot.settings.flags.put(flag.getKey(), flag);
}
}
else if (plot.settings.flags.size() == 0) {
return;
}
else {
plot.settings.flags.clear();
}
DBFunc.setFlags(plot.world, plot, plot.settings.flags.values());
}
示例10: setClusterFlags
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static void setClusterFlags(final PlotCluster cluster, final Set<Flag> flags) {
if (flags != null && flags.size() != 0) {
cluster.settings.flags.clear();
for (Flag flag : flags) {
cluster.settings.flags.put(flag.getKey(), flag);
}
}
else if (cluster.settings.flags.size() == 0) {
return;
}
else {
cluster.settings.flags.clear();
}
DBFunc.setFlags(cluster, cluster.settings.flags.values());
}
示例11: addPlotFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
/**
* Add a flag to a plot.
* @param origin
* @param flag
* @param value
*/
public static <V> boolean addPlotFlag(Plot origin, Flag<V> flag, Object value) {
boolean result = EventUtil.manager.callFlagAdd(flag, origin);
if (!result) {
return false;
}
for (Plot plot : origin.getConnectedPlots()) {
plot.getFlags().put(flag, value);
plot.reEnter(); //TODO fix this so FlagTest will run during compile
DBFunc.setFlags(plot, plot.getFlags());
}
return true;
}
示例12: removeClusterFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static boolean removeClusterFlag(PlotCluster cluster, Flag id) {
Object object = cluster.settings.flags.remove(id);
if (object == null) {
return false;
}
boolean result = EventUtil.manager.callFlagRemove(id, object, cluster);
if (!result) {
cluster.settings.flags.put(id, object);
return false;
}
DBFunc.setFlags(cluster, cluster.settings.flags);
return true;
}
示例13: setClusterFlags
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static void setClusterFlags(PlotCluster cluster, Set<Flag> flags) {
if (flags != null && !flags.isEmpty()) {
cluster.settings.flags.clear();
for (Flag flag : flags) {
cluster.settings.flags.put(flag, flag);
}
} else if (cluster.settings.flags.isEmpty()) {
return;
} else {
cluster.settings.flags.clear();
}
DBFunc.setFlags(cluster, cluster.settings.flags);
}
示例14: addClusterFlag
import com.intellectualcrafters.plot.database.DBFunc; //導入方法依賴的package包/類
public static <V> boolean addClusterFlag(PlotCluster cluster, Flag<V> flag, V value) {
getSettingFlag(cluster.area, cluster.settings, flag);
cluster.settings.flags.put(flag, value);
DBFunc.setFlags(cluster, cluster.settings.flags);
return true;
}