Saving flags properly

This commit is contained in:
boy0001 2014-11-10 20:13:07 +11:00
parent af04881965
commit 278b8bc0c3
2 changed files with 15 additions and 3 deletions

View File

@ -22,7 +22,10 @@
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.*; import com.intellectualcrafters.plot.*;
import com.intellectualcrafters.plot.database.DBFunc;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -120,7 +123,9 @@ public class Auto extends SubCommand {
final PlotWorld pw = PlotMain.getWorldSettings(world); final PlotWorld pw = PlotMain.getWorldSettings(world);
final Plot plot2 = PlotMain.getPlots(world).get(plot.id); final Plot plot2 = PlotMain.getPlots(world).get(plot.id);
if ((pw.DEFAULT_FLAGS != null) && (pw.DEFAULT_FLAGS.size() > 0)) { if ((pw.DEFAULT_FLAGS != null) && (pw.DEFAULT_FLAGS.size() > 0)) {
plot2.settings.setFlags(FlagManager.parseFlags(pw.DEFAULT_FLAGS)); Flag[] flags = FlagManager.parseFlags(pw.DEFAULT_FLAGS);
plot2.settings.setFlags(flags);
DBFunc.setFlags(plot2.world, plot2, flags);
} }
} }
Auto.lastPlot = getNextPlot(Auto.lastPlot, 1); Auto.lastPlot = getNextPlot(Auto.lastPlot, 1);
@ -157,7 +162,9 @@ public class Auto extends SubCommand {
final PlotWorld pw = PlotMain.getWorldSettings(world); final PlotWorld pw = PlotMain.getWorldSettings(world);
final Plot plot2 = PlotMain.getPlots(world).get(start); final Plot plot2 = PlotMain.getPlots(world).get(start);
if ((pw.DEFAULT_FLAGS != null) && (pw.DEFAULT_FLAGS.size() > 0)) { if ((pw.DEFAULT_FLAGS != null) && (pw.DEFAULT_FLAGS.size() > 0)) {
plot2.settings.setFlags(FlagManager.parseFlags(pw.DEFAULT_FLAGS)); Flag[] flags = FlagManager.parseFlags(pw.DEFAULT_FLAGS);
plot2.settings.setFlags(flags);
DBFunc.setFlags(plot2.world, plot2, flags);
} }
} }
} }

View File

@ -22,9 +22,12 @@
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.*; import com.intellectualcrafters.plot.*;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import com.intellectualcrafters.plot.generator.DefaultPlotWorld; import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -110,7 +113,9 @@ public class Claim extends SubCommand {
SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0); SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0);
} }
if ((world.DEFAULT_FLAGS != null) && (world.DEFAULT_FLAGS.size() > 0)) { if ((world.DEFAULT_FLAGS != null) && (world.DEFAULT_FLAGS.size() > 0)) {
plot2.settings.setFlags(FlagManager.parseFlags(world.DEFAULT_FLAGS)); Flag[] flags = FlagManager.parseFlags(world.DEFAULT_FLAGS);
plot2.settings.setFlags(flags);
DBFunc.setFlags(plot.world, plot2, flags);
} }
if (world instanceof DefaultPlotWorld) { if (world instanceof DefaultPlotWorld) {
final DefaultPlotWorld pW = (DefaultPlotWorld) world; final DefaultPlotWorld pW = (DefaultPlotWorld) world;