Database correction / Code cleanup, Fixes #490

This commit is contained in:
boy0001
2015-08-07 02:05:15 +10:00
parent 5ea7403d2e
commit 46e48857bf
33 changed files with 350 additions and 183 deletions

View File

@ -232,7 +232,7 @@ public class LikePlotMeConverter {
for (final String world : plots.keySet()) {
int duplicate = 0;
for (final Plot plot : plots.get(world).values()) {
if (!PS.get().getPlots(world).containsKey(plot.id)) {
if (PS.get().getPlot(world, plot.id) == null) {
createdPlots.add(plot);
} else {
duplicate++;

View File

@ -1618,8 +1618,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
WEManager.bypass.remove(pp.getName());
}
if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) {
final Collection<Plot> plots = PS.get().getPlots(pp.getName()).values();
for (final Plot plot : plots) {
for (final Plot plot : PS.get().getPlotsInWorld(pp.getName())) {
plot.deletePlot(null);
PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
}

View File

@ -26,7 +26,7 @@ public class WEManager {
public static HashSet<RegionWrapper> getMask(PlotPlayer player) {
HashSet<RegionWrapper> regions = new HashSet<>();
UUID uuid = player.getUUID();
for (Plot plot : PS.get().getPlots(player.getLocation().getWorld()).values()) {
for (Plot plot : PS.get().getPlotsInWorld(player.getLocation().getWorld())) {
if (!plot.getMerged(0) && !plot.getMerged(3)) {
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);

View File

@ -222,7 +222,8 @@ public class BukkitPlayer extends PlotPlayer {
@Override
public void playMusic(Location loc, int id) {
player.playEffect(BukkitUtil.getLocation(loc), Effect.RECORD_PLAY, Material.getMaterial(id));
System.out.print("RECORD: " + id);
player.playEffect(BukkitUtil.getLocation(loc), Effect.RECORD_PLAY, id);
}
@Override

View File

@ -87,8 +87,8 @@ public class BukkitPlayerFunctions {
}
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
final Plot plot1 = PS.get().getPlots(world).get(pos1);
final Plot plot2 = PS.get().getPlots(world).get(pos2);
final Plot plot1 = PS.get().getPlot(world, pos1);
final Plot plot2 = PS.get().getPlot(world, pos2);
if (plot1 != null) {
pos1 = MainUtil.getBottomPlot(plot1).id;
}
@ -120,10 +120,7 @@ public class BukkitPlayerFunctions {
if (id == null) {
return null;
}
if (PS.get().getPlots(world).containsKey(id)) {
return PS.get().getPlots(world).get(id);
}
return new Plot(world, id, null);
return MainUtil.getPlot(world, id);
}
/**