Try this coolty

This commit is contained in:
Jesse Boyd 2016-03-27 16:01:53 +11:00
parent e3f5842299
commit 1bf05df706
6 changed files with 17 additions and 6 deletions

View File

@ -394,7 +394,9 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
if (econ.init()) { if (econ.init()) {
return econ; return econ;
} }
System.out.println("ECONOMY ENABLED!");
} catch (Throwable ignored) { } catch (Throwable ignored) {
ignored.printStackTrace();
} }
return null; return null;
} }

View File

@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.bukkit.Chunk; import org.bukkit.Chunk;
@ -139,8 +138,8 @@ public class FastQueue_1_8_3 extends SlowQueue {
Object[] sections = (Object[]) sections1.get(c); Object[] sections = (Object[]) sections1.get(c);
HashMap<?, ?> tiles = (HashMap<?, ?>) tileEntities.get(c); HashMap<?, ?> tiles = (HashMap<?, ?>) tileEntities.get(c);
List<Object> tilesUnload = (List<Object>) tileEntityUnload.of(w).get(); Collection<Object> tilesUnload = (Collection<Object>) tileEntityUnload.of(w).get();
List<?>[] entities = (List<?>[]) entitySlices.get(c); Collection<?>[] entities = (Collection<?>[]) entitySlices.get(c);
Method getX = null; Method getX = null;
Method getY = null; Method getY = null;

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.bukkit.Chunk; import org.bukkit.Chunk;
@ -153,7 +152,7 @@ public class FastQueue_1_9 extends SlowQueue {
Object[] sections = (Object[]) sf.get(c); Object[] sections = (Object[]) sf.get(c);
HashMap<?, ?> tiles = (HashMap<?, ?>) tf.get(c); HashMap<?, ?> tiles = (HashMap<?, ?>) tf.get(c);
List<Object> tilesUnload = (List<Object>) tileEntityUnload.of(w).get(); Collection<Object> tilesUnload = (Collection<Object>) tileEntityUnload.of(w).get();
Collection<?>[] entities = (Collection<?>[]) entitySlices.get(c); Collection<?>[] entities = (Collection<?>[]) entitySlices.get(c);
Method xm = null; Method xm = null;

View File

@ -264,6 +264,7 @@ public class PS {
TaskManager.runTask(new Runnable() { TaskManager.runTask(new Runnable() {
@Override @Override
public void run() { public void run() {
System.out.println("SETTING UP ECON");
EconHandler.manager = PS.this.IMP.getEconomyHandler(); EconHandler.manager = PS.this.IMP.getEconomyHandler();
} }
}); });

View File

@ -240,7 +240,7 @@ public abstract class PlotArea {
this.SCHEMATIC_FILE = config.getString("schematic.file"); this.SCHEMATIC_FILE = config.getString("schematic.file");
this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim"); this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim");
this.SCHEMATICS = config.getStringList("schematic.schematics"); this.SCHEMATICS = config.getStringList("schematic.schematics");
this.USE_ECONOMY = config.getBoolean("economy.use") && EconHandler.manager != null; this.USE_ECONOMY = config.getBoolean("economy.use") && EconHandler.getEconHandler() != null;
ConfigurationSection priceSection = config.getConfigurationSection("economy.prices"); ConfigurationSection priceSection = config.getConfigurationSection("economy.prices");
if (this.USE_ECONOMY) { if (this.USE_ECONOMY) {
this.PRICES = new HashMap<>(); this.PRICES = new HashMap<>();

View File

@ -1,5 +1,6 @@
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer; import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
@ -7,6 +8,15 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
public abstract class EconHandler { public abstract class EconHandler {
public static EconHandler manager; public static EconHandler manager;
private static boolean initialized;
public static EconHandler getEconHandler() {
if (initialized) {
return manager;
}
initialized = true;
return manager = PS.get().IMP.getEconomyHandler();
}
public double getMoney(PlotPlayer player) { public double getMoney(PlotPlayer player) {
if (ConsolePlayer.isConsole(player)) { if (ConsolePlayer.isConsole(player)) {