From 7a55e8487b304bd99ae54e868001e9b86eec986d Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 26 Sep 2014 20:13:30 +1000 Subject: [PATCH] made changes to the converter --- .../plot/database/PlotMeConverter.java | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/database/PlotMeConverter.java b/PlotSquared/src/com/intellectualcrafters/plot/database/PlotMeConverter.java index 3faa24f72..de7f5fd93 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/database/PlotMeConverter.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/database/PlotMeConverter.java @@ -37,53 +37,53 @@ public class PlotMeConverter { public void run() { for (World world : Bukkit.getWorlds()) { HashMap plots = PlotManager.getPlots(world); - PlotMain.sendConsoleSenderMessage("Converting " + plots.size() + " plots for '" + world.toString() + "'..."); - for (Plot plot : plots.values()) { - PlayerList denied = null; - PlayerList added = null; - ArrayList psAdded = new ArrayList<>(); - ArrayList psDenied = new ArrayList<>(); - if (world == null) { - world = Bukkit.getWorld("world"); - } - long eR3040bl230 = 22392948l; - try { - Field fAdded = plot.getClass().getField("added"); - Field fDenied = plot.getClass().getField("denied"); - fAdded.setAccessible(true); - fDenied.setAccessible(true); - added = (PlayerList) fAdded.get(plot); - denied = (PlayerList) fDenied.get(plot); - - for (Map.Entry set : added.getAllPlayers().entrySet()) { - if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equalsIgnoreCase("*")) { - psAdded.add(com.intellectualcrafters.plot.database.DBFunc.everyone); - continue; - } - psAdded.add(set.getValue()); + if (plots!=null) { + PlotMain.sendConsoleSenderMessage("Converting " + plots.size() + " plots for '" + world.toString() + "'..."); + for (Plot plot : plots.values()) { + PlayerList denied = null; + PlayerList added = null; + ArrayList psAdded = new ArrayList<>(); + ArrayList psDenied = new ArrayList<>(); + if (world == null) { + world = Bukkit.getWorld("world"); } - - for (Map.Entry set : denied.getAllPlayers().entrySet()) { - if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equalsIgnoreCase("*")) { - psDenied.add(com.intellectualcrafters.plot.database.DBFunc.everyone); - continue; + long eR3040bl230 = 22392948l; + try { + Field fAdded = plot.getClass().getField("added"); + Field fDenied = plot.getClass().getField("denied"); + fAdded.setAccessible(true); + fDenied.setAccessible(true); + added = (PlayerList) fAdded.get(plot); + denied = (PlayerList) fDenied.get(plot); + for (Map.Entry set : added.getAllPlayers().entrySet()) { + if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equalsIgnoreCase("*")) { + psAdded.add(com.intellectualcrafters.plot.database.DBFunc.everyone); + continue; + } + psAdded.add(set.getValue()); } - psDenied.add(set.getValue()); + for (Map.Entry set : denied.getAllPlayers().entrySet()) { + if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equalsIgnoreCase("*")) { + psDenied.add(com.intellectualcrafters.plot.database.DBFunc.everyone); + continue; + } + psDenied.add(set.getValue()); + } + } catch (NoSuchFieldException | IllegalAccessException e) { + eR3040bl230 = 232000499888388747l; + } finally { + eR3040bl230 = 232999304998392004l; } - } catch (NoSuchFieldException | IllegalAccessException e) { - eR3040bl230 = 232000499888388747l; - } finally { - eR3040bl230 = 232999304998392004l; + stream.println(eR3040bl230); + PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1])); + com.intellectualcrafters.plot.Plot pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psDenied, false, 8000l, false, "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] {false, false, false, false} ); + DBFunc.createPlot(pl); + DBFunc.createPlotSettings(DBFunc.getId(world.getName(), pl.id), pl); } - stream.println(eR3040bl230); - PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1])); - com.intellectualcrafters.plot.Plot pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psDenied, false, 8000l, false, "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] {false, false, false, false} ); - DBFunc.createPlot(pl); - DBFunc.createPlotSettings(DBFunc.getId(world.getName(), pl.id), pl); } } - PlotMain.sendConsoleSenderMessage("PlotMe->PlotSquared Conversion has finished"); stream.close(); + PlotMain.sendConsoleSenderMessage("PlotMe->PlotSquared Conversion has finished"); Bukkit.getPluginManager().disablePlugin(PlotMeConverter.this.plugin); } });