/** * Add a flag to a plot * * @param origin * @param flag */ public static boolean addPlotFlag(final Plot origin, final Flag flag) { final boolean result = EventUtil.manager.callFlagAdd(flag, origin); if (!result) { return false; } for (Plot plot : origin.getConnectedPlots()) { plot.getFlags().put(flag.getKey(), flag); plot.reEnter(); DBFunc.setFlags(plot, plot.getFlags().values()); } return true; }
public static boolean removePlotFlag(final Plot plot, final String id) { final Flag flag = plot.getFlags().remove(id); if (flag == null) { return false; } final boolean result = EventUtil.manager.callFlagRemove(flag, plot); if (!result) { plot.getFlags().put(id, flag); return false; } plot.reEnter(); DBFunc.setFlags(plot, plot.getFlags().values()); return true; }
public static void setPlotFlags(final Plot origin, final Set<Flag> flags) { for (Plot plot : origin.getConnectedPlots()) { if (flags != null && !flags.isEmpty()) { plot.getFlags().clear(); for (final Flag flag : flags) { plot.getFlags().put(flag.getKey(), flag); } } else if (plot.getFlags().isEmpty()) { return; } else { plot.getFlags().clear(); } plot.reEnter(); DBFunc.setFlags(plot, plot.getFlags().values()); } }
public static boolean addPlotFlagAbs(final Plot plot, final Flag flag) { final boolean result = EventUtil.manager.callFlagAdd(flag, plot); if (!result) { return false; } plot.getFlags().put(flag.getKey(), flag); return true; }