mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Major Restructure
This commit is contained in:
parent
38c7edbddd
commit
23d88763d1
36
PlotSquared/PlotSquared.iml
Normal file
36
PlotSquared/PlotSquared.iml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.7.9-R0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.milkbowl.vault:Vault:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sk89q:worldedit:6.0.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: me.confuser:BarAPI:2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sk89q:worldguard:5.9" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: com.worldcretornica:PlotMe:0.13d-SNAPSHOT">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/plotme-0.13f.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
@ -21,16 +21,23 @@
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import com.intellectualcrafters.plot.Logger.LogLevel;
|
||||
import com.intellectualcrafters.plot.commands.Auto;
|
||||
import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.*;
|
||||
import com.intellectualcrafters.plot.events.PlayerTeleportToPlotEvent;
|
||||
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.generator.DefaultPlotManager;
|
||||
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
|
||||
import com.intellectualcrafters.plot.generator.WorldGenerator;
|
||||
import com.intellectualcrafters.plot.listeners.*;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.Logger.LogLevel;
|
||||
import com.intellectualcrafters.plot.uuid.PlotUUIDSaver;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDSaver;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
@ -1285,15 +1292,15 @@ public class PlotMain extends JavaPlugin {
|
||||
return plots;
|
||||
}
|
||||
|
||||
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||
PlotMain.plots = plots;
|
||||
}
|
||||
|
||||
public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||
PlotMain.plots = new LinkedHashMap<>(plots);
|
||||
// PlotMain.plots.putAll(plots);
|
||||
}
|
||||
|
||||
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||
PlotMain.plots = plots;
|
||||
}
|
||||
|
||||
/**
|
||||
* !!WorldGeneration!!
|
||||
*/
|
||||
|
@ -21,9 +21,19 @@
|
||||
|
||||
package com.intellectualcrafters.plot.api;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.commands.SubCommand;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -108,8 +118,8 @@ public class PlotAPI {
|
||||
* @param plotWorld Plot World Object
|
||||
* @param manager World Manager
|
||||
* @see com.intellectualcrafters.plot.PlotMain#addPlotWorld(String,
|
||||
* com.intellectualcrafters.plot.PlotWorld,
|
||||
* com.intellectualcrafters.plot.PlotManager)
|
||||
* com.intellectualcrafters.plot.object.PlotWorld,
|
||||
* com.intellectualcrafters.plot.object.PlotManager)
|
||||
*/
|
||||
public void addPlotWorld(final String world, final PlotWorld plotWorld, final PlotManager manager) {
|
||||
PlotMain.addPlotWorld(world, plotWorld, manager);
|
||||
|
@ -21,22 +21,57 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Auto extends SubCommand {
|
||||
public static PlotId lastPlot = new PlotId(0, 0);
|
||||
|
||||
public Auto() {
|
||||
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING, true);
|
||||
}
|
||||
|
||||
public static PlotId lastPlot = new PlotId(0, 0);
|
||||
public static PlotId getNextPlot(final PlotId id, final int step) {
|
||||
final int absX = Math.abs(id.x);
|
||||
final int absY = Math.abs(id.y);
|
||||
if (absX > absY) {
|
||||
if (id.x > 0) {
|
||||
return new PlotId(id.x, id.y + 1);
|
||||
} else {
|
||||
return new PlotId(id.x, id.y - 1);
|
||||
}
|
||||
} else if (absY > absX) {
|
||||
if (id.y > 0) {
|
||||
return new PlotId(id.x - 1, id.y);
|
||||
} else {
|
||||
return new PlotId(id.x + 1, id.y);
|
||||
}
|
||||
} else {
|
||||
if (id.x.equals(id.y) && (id.x > 0)) {
|
||||
return new PlotId(id.x, id.y + step);
|
||||
}
|
||||
if (id.x == absX) {
|
||||
return new PlotId(id.x, id.y + 1);
|
||||
}
|
||||
if (id.y == absY) {
|
||||
return new PlotId(id.x, id.y - 1);
|
||||
}
|
||||
return new PlotId(id.x + 1, id.y);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO auto claim a mega plot with schematic
|
||||
@Override
|
||||
@ -172,35 +207,6 @@ public class Auto extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static PlotId getNextPlot(final PlotId id, final int step) {
|
||||
final int absX = Math.abs(id.x);
|
||||
final int absY = Math.abs(id.y);
|
||||
if (absX > absY) {
|
||||
if (id.x > 0) {
|
||||
return new PlotId(id.x, id.y + 1);
|
||||
} else {
|
||||
return new PlotId(id.x, id.y - 1);
|
||||
}
|
||||
} else if (absY > absX) {
|
||||
if (id.y > 0) {
|
||||
return new PlotId(id.x - 1, id.y);
|
||||
} else {
|
||||
return new PlotId(id.x + 1, id.y);
|
||||
}
|
||||
} else {
|
||||
if (id.x.equals(id.y) && (id.x > 0)) {
|
||||
return new PlotId(id.x, id.y + step);
|
||||
}
|
||||
if (id.x == absX) {
|
||||
return new PlotId(id.x, id.y + 1);
|
||||
}
|
||||
if (id.y == absY) {
|
||||
return new PlotId(id.x, id.y - 1);
|
||||
}
|
||||
return new PlotId(id.x + 1, id.y);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isUnowned(final World world, final PlotId pos1, final PlotId pos2) {
|
||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -21,13 +21,20 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetBlockFast;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -40,48 +47,6 @@ public class Claim extends SubCommand {
|
||||
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(final Player plr, final String... args) {
|
||||
String schematic = "";
|
||||
if (args.length >= 1) {
|
||||
schematic = args[0];
|
||||
}
|
||||
if (!PlayerFunctions.isInPlot(plr)) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (PlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= PlayerFunctions.getAllowedPlots(plr)) {
|
||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||
}
|
||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||
if (plot.hasOwner()) {
|
||||
return sendMessage(plr, C.PLOT_IS_CLAIMED);
|
||||
}
|
||||
final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
||||
if (PlotMain.useEconomy && world.USE_ECONOMY) {
|
||||
final double cost = world.PLOT_PRICE;
|
||||
if (cost > 0d) {
|
||||
final Economy economy = PlotMain.economy;
|
||||
if (economy.getBalance(plr) < cost) {
|
||||
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
||||
}
|
||||
economy.withdrawPlayer(plr, cost);
|
||||
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||
}
|
||||
}
|
||||
if (!schematic.equals("")) {
|
||||
if (world.SCHEMATIC_CLAIM_SPECIFY) {
|
||||
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||
return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
}
|
||||
if (!PlotMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
|
||||
return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !claimPlot(plr, plot, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||
}
|
||||
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
|
||||
return claimPlot(player, plot, teleport, "");
|
||||
}
|
||||
@ -129,4 +94,46 @@ public class Claim extends SubCommand {
|
||||
}
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(final Player plr, final String... args) {
|
||||
String schematic = "";
|
||||
if (args.length >= 1) {
|
||||
schematic = args[0];
|
||||
}
|
||||
if (!PlayerFunctions.isInPlot(plr)) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (PlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= PlayerFunctions.getAllowedPlots(plr)) {
|
||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||
}
|
||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||
if (plot.hasOwner()) {
|
||||
return sendMessage(plr, C.PLOT_IS_CLAIMED);
|
||||
}
|
||||
final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
||||
if (PlotMain.useEconomy && world.USE_ECONOMY) {
|
||||
final double cost = world.PLOT_PRICE;
|
||||
if (cost > 0d) {
|
||||
final Economy economy = PlotMain.economy;
|
||||
if (economy.getBalance(plr) < cost) {
|
||||
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
||||
}
|
||||
economy.withdrawPlayer(plr, cost);
|
||||
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||
}
|
||||
}
|
||||
if (!schematic.equals("")) {
|
||||
if (world.SCHEMATIC_CLAIM_SPECIFY) {
|
||||
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||
return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
}
|
||||
if (!PlotMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
|
||||
return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !claimPlot(plr, plot, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotSelection;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotSelection;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static com.intellectualcrafters.plot.PlotSelection.currentSelection;
|
||||
import static com.intellectualcrafters.plot.object.PlotSelection.currentSelection;
|
||||
|
||||
public class Clipboard extends SubCommand {
|
||||
|
||||
|
@ -21,8 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotComment;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,7 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotSelection;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Copy extends SubCommand {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.StringComparsion;
|
||||
import com.intellectualcrafters.plot.database.MySQL;
|
||||
import com.intellectualcrafters.plot.database.SQLManager;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -76,7 +76,7 @@ public class Database extends SubCommand {
|
||||
if (args.length < 1) {
|
||||
return sendMessage(plr, "/plot database [sqlite/mysql]");
|
||||
}
|
||||
String type = new StringComparsion(args[0], new String[]{"mysql", "sqlite"}).getBestMatch().toLowerCase();
|
||||
String type = new StringComparison(args[0], new String[]{"mysql", "sqlite"}).getBestMatch().toLowerCase();
|
||||
switch (type) {
|
||||
case "mysql":
|
||||
if (args.length < 6) {
|
||||
|
@ -21,7 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.util.Lag;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.RUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -22,9 +22,15 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
@ -45,6 +51,26 @@ public class DebugClaimTest extends SubCommand {
|
||||
super(Command.DEBUGCLAIMTEST, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. Execution time may vary", "debugclaimtest", CommandCategory.DEBUG, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
|
||||
return claimPlot(player, plot, teleport, "");
|
||||
}
|
||||
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) {
|
||||
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
PlotHelper.createPlot(player, plot);
|
||||
PlotHelper.setSign(player, plot);
|
||||
PlayerFunctions.sendMessage(player, C.CLAIMED);
|
||||
if (teleport) {
|
||||
PlotMain.teleportPlayer(player, player.getLocation(), plot);
|
||||
}
|
||||
plot.settings.setFlags(FlagManager.parseFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS));
|
||||
}
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(final Player plr, final String... args) {
|
||||
if (plr == null) {
|
||||
@ -150,24 +176,4 @@ public class DebugClaimTest extends SubCommand {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
|
||||
return claimPlot(player, plot, teleport, "");
|
||||
}
|
||||
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) {
|
||||
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
PlotHelper.createPlot(player, plot);
|
||||
PlotHelper.setSign(player, plot);
|
||||
PlayerFunctions.sendMessage(player, C.CLAIMED);
|
||||
if (teleport) {
|
||||
PlotMain.teleportPlayer(player, player.getLocation(), plot);
|
||||
}
|
||||
plot.settings.setFlags(FlagManager.parseFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS));
|
||||
}
|
||||
return event.isCancelled();
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -21,8 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,12 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,12 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -21,8 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotComment;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,8 +21,15 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.StringComparsion;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -225,7 +225,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
/* Let's try to get a proper usage string */
|
||||
String command = new StringComparsion(args[0], commands).getBestMatch();
|
||||
String command = new StringComparison(args[0], commands).getBestMatch();
|
||||
return PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
|
||||
//PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new StringComparsion(args[0], commands).getBestMatch());
|
||||
}
|
||||
|
@ -21,8 +21,15 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.SetBlockFast;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotSelection;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Paste extends SubCommand {
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@SuppressWarnings({"unused", "deprecated", "javadoc"})
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@SuppressWarnings({"unused", "deprecated", "javadoc"})
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Reload extends SubCommand {
|
||||
|
@ -22,9 +22,14 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.SchematicHandler.DataCollection;
|
||||
import com.intellectualcrafters.plot.SchematicHandler.Dimension;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@ -21,11 +21,22 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
|
||||
import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
|
||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotHomePosition;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -225,7 +236,7 @@ public class Set extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
final Biome biome = Biome.valueOf(new StringComparsion(args[1], Biome.values()).getBestMatch());
|
||||
final Biome biome = Biome.valueOf(new StringComparison(args[1], Biome.values()).getBestMatch());
|
||||
/*
|
||||
* for (Biome b : Biome.values()) {
|
||||
* if (b.toString().equalsIgnoreCase(args[1])) {
|
||||
@ -443,7 +454,7 @@ public class Set extends SubCommand {
|
||||
}
|
||||
|
||||
private Material getMaterial(final String input, final List<Material> blocks) {
|
||||
return Material.valueOf(new StringComparsion(input, blocks.toArray()).getBestMatch());
|
||||
return Material.valueOf(new StringComparison(input, blocks.toArray()).getBestMatch());
|
||||
}
|
||||
|
||||
private String getBlockList(final List<Material> blocks) {
|
||||
|
@ -21,8 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -21,8 +21,13 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
|
||||
import com.intellectualcrafters.plot.object.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,14 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotSelection;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.SetBlockFast;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -21,7 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
@ -21,12 +21,12 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -21,9 +21,17 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.SetBlockFast;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -21,7 +21,13 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -146,7 +152,7 @@ public class list extends SubCommand {
|
||||
return true;
|
||||
} else {
|
||||
// execute(plr);
|
||||
sendMessage(plr, C.DID_YOU_MEAN, new StringComparsion(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch());
|
||||
sendMessage(plr, C.DID_YOU_MEAN, new StringComparison(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -19,8 +19,9 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.config;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualsites.translation.*;
|
||||
import com.intellectualsites.translation.bukkit.BukkitTranslation;
|
||||
import org.bukkit.ChatColor;
|
@ -19,8 +19,9 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.config;
|
||||
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.util.ArrayList;
|
@ -19,9 +19,9 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.config;
|
||||
|
||||
import com.intellectualcrafters.plot.Configuration.SettingValue;
|
||||
import com.intellectualcrafters.plot.config.Configuration.SettingValue;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.config;
|
||||
|
||||
/**
|
||||
* Updater and DB settings
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotComment;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotComment;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@ -40,6 +40,11 @@ public abstract class AbstractDB {
|
||||
|
||||
// TODO MongoDB @Brandon
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public UUID everyone = UUID.fromString("1-1-3-3-7");
|
||||
|
||||
/**
|
||||
* Set Plot owner
|
||||
*
|
||||
@ -119,11 +124,6 @@ public abstract class AbstractDB {
|
||||
*/
|
||||
public abstract HashMap<String, Object> getSettings(final int id);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public UUID everyone = UUID.fromString("1-1-3-3-7");
|
||||
|
||||
/**
|
||||
* @param plot
|
||||
* @param player
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotComment;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotComment;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -22,10 +22,10 @@
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.intellectualcrafters.plot.PlotHomePosition;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.generator.WorldGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotHomePosition;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.worldcretornica.plotme.PlayerList;
|
||||
import com.worldcretornica.plotme.Plot;
|
||||
import com.worldcretornica.plotme.PlotManager;
|
||||
@ -73,7 +73,7 @@ public class PlotMeConverter {
|
||||
public void run() {
|
||||
sendMessage("&7Conversion has started");
|
||||
sendMessage("7Caching playerdata...");
|
||||
final ArrayList<com.intellectualcrafters.plot.Plot> createdPlots =
|
||||
final ArrayList<com.intellectualcrafters.plot.object.Plot> createdPlots =
|
||||
new ArrayList<>();
|
||||
// Online Mode
|
||||
final boolean online =
|
||||
@ -193,14 +193,14 @@ public class PlotMeConverter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
final PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1]));
|
||||
com.intellectualcrafters.plot.Plot pl;
|
||||
com.intellectualcrafters.plot.object.Plot pl;
|
||||
if (online) {
|
||||
pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied,
|
||||
pl = new com.intellectualcrafters.plot.object.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied,
|
||||
|
||||
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
|
||||
} else {
|
||||
final String owner = plot.getOwner();
|
||||
pl = new com.intellectualcrafters.plot.Plot(id, UUID.nameUUIDFromBytes(("OfflinePlayer:" + owner).getBytes(Charsets.UTF_8)), plot.getBiome(), psAdded, psTrusted, psDenied,
|
||||
pl = new com.intellectualcrafters.plot.object.Plot(id, UUID.nameUUIDFromBytes(("OfflinePlayer:" + owner).getBytes(Charsets.UTF_8)), plot.getBiome(), psAdded, psTrusted, psDenied,
|
||||
|
||||
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
|
||||
}
|
||||
|
@ -21,8 +21,15 @@
|
||||
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.Logger.LogLevel;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotComment;
|
||||
import com.intellectualcrafters.plot.object.PlotHomePosition;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.Logger;
|
||||
import com.intellectualcrafters.plot.util.Logger.LogLevel;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -529,10 +536,6 @@ public class SQLManager extends AbstractDB {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (biome == null) {
|
||||
biome = Biome.FOREST;
|
||||
}
|
||||
plot.settings.setBiome(biome);
|
||||
|
||||
final String alias = r.getString("alias");
|
||||
if (alias != null) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.database.sqlobjects;
|
||||
|
||||
import com.intellectualcrafters.plot.Settings;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-10-28.
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -32,9 +32,8 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
*/
|
||||
public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final Plot plot;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* PlayerClaimPlotEvent: Called when a plot is claimed
|
||||
@ -47,6 +46,10 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
||||
this.plot = plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plot involved
|
||||
*
|
||||
@ -56,10 +59,6 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
||||
return this.plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
@ -46,6 +46,10 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
|
||||
this.plot = plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plot involved
|
||||
*
|
||||
@ -55,10 +59,6 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
|
||||
return this.plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
@ -45,6 +45,10 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
|
||||
this.plot = plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plot involved
|
||||
*
|
||||
@ -54,10 +58,6 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
|
||||
return this.plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -55,6 +55,10 @@ public class PlayerPlotDeniedEvent extends Event {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* If a user was added
|
||||
*
|
||||
@ -91,10 +95,6 @@ public class PlayerPlotDeniedEvent extends Event {
|
||||
return this.initiator;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -54,6 +54,10 @@ public class PlayerPlotHelperEvent extends Event {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* If a player was added
|
||||
*
|
||||
@ -90,10 +94,6 @@ public class PlayerPlotHelperEvent extends Event {
|
||||
return this.initiator;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -54,6 +54,10 @@ public class PlayerPlotTrustedEvent extends Event {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* If a player was added
|
||||
*
|
||||
@ -90,10 +94,6 @@ public class PlayerPlotTrustedEvent extends Event {
|
||||
return this.initiator;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
@ -52,6 +52,10 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
|
||||
this.plot = plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
@ -75,10 +79,6 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
|
||||
return this.plot;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -31,10 +31,9 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class PlotClearEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final PlotId id;
|
||||
private final String world;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* PlotDeleteEvent: Called when a plot is cleared
|
||||
@ -47,6 +46,10 @@ public class PlotClearEvent extends Event implements Cancellable {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotId
|
||||
*
|
||||
@ -65,10 +68,6 @@ public class PlotClearEvent extends Event implements Cancellable {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -31,10 +31,9 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class PlotDeleteEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final PlotId id;
|
||||
private final String world;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* PlotDeleteEvent: Called when a plot is deleted
|
||||
@ -47,6 +46,10 @@ public class PlotDeleteEvent extends Event implements Cancellable {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotId
|
||||
*
|
||||
@ -65,10 +68,6 @@ public class PlotDeleteEvent extends Event implements Cancellable {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -32,10 +32,9 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class PlotFlagAddEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final Plot plot;
|
||||
private final Flag flag;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* PlotFlagAddEvent: Called when a Flag is added to a plot
|
||||
@ -48,6 +47,10 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plot involved
|
||||
*
|
||||
@ -66,10 +69,6 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
|
||||
return this.flag;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -32,10 +32,9 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final Plot plot;
|
||||
private final Flag flag;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
|
||||
@ -48,6 +47,10 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plot involved
|
||||
*
|
||||
@ -66,10 +69,6 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
||||
return this.flag;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
@ -35,9 +35,8 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class PlotMergeEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final ArrayList<PlotId> plots;
|
||||
private boolean cancelled;
|
||||
private Plot plot;
|
||||
private World world;
|
||||
|
||||
@ -51,6 +50,10 @@ public class PlotMergeEvent extends Event implements Cancellable {
|
||||
this.plots = plots;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plots being added;
|
||||
*
|
||||
@ -73,10 +76,6 @@ public class PlotMergeEvent extends Event implements Cancellable {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
@ -34,10 +34,9 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class PlotUnlinkEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private final ArrayList<PlotId> plots;
|
||||
private final World world;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* Called when a mega-plot is unlinked.
|
||||
@ -50,6 +49,10 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plots involved
|
||||
*
|
||||
@ -63,10 +66,6 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.flag;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.flag;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -19,8 +19,9 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.flag;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
@ -21,7 +21,10 @@
|
||||
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -487,7 +490,6 @@ public class DefaultPlotManager extends PlotManager {
|
||||
}
|
||||
}
|
||||
|
||||
plot.settings.setBiome(biome);
|
||||
PlotMain.updatePlot(plot);
|
||||
PlotHelper.refreshPlotChunks(world, plot);
|
||||
|
||||
|
@ -21,7 +21,11 @@
|
||||
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.Configuration;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
|
@ -21,22 +21,19 @@
|
||||
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotBlock;
|
||||
import com.intellectualcrafters.plot.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.PlotManager;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author Citymonstret The default generator is very messy, as we have decided
|
||||
@ -47,20 +44,10 @@ import com.intellectualcrafters.plot.PlotWorld;
|
||||
* @auther Empire92
|
||||
*/
|
||||
public class WorldGenerator extends PlotGenerator {
|
||||
/**
|
||||
* result object is returned for each generated chunk, do stuff to it
|
||||
*/
|
||||
short[][] result;
|
||||
|
||||
/**
|
||||
* plotworld object
|
||||
*/
|
||||
DefaultPlotWorld plotworld = null;
|
||||
/**
|
||||
* Set to static to re-use the same managet for all Default World Generators
|
||||
*/
|
||||
private static PlotManager manager = null;
|
||||
|
||||
/**
|
||||
* Some generator specific variables (implementation dependent)
|
||||
*/
|
||||
@ -77,6 +64,48 @@ public class WorldGenerator extends PlotGenerator {
|
||||
final int plotheight;
|
||||
final PlotBlock[] plotfloors;
|
||||
final PlotBlock[] filling;
|
||||
/**
|
||||
* result object is returned for each generated chunk, do stuff to it
|
||||
*/
|
||||
short[][] result;
|
||||
/**
|
||||
* plotworld object
|
||||
*/
|
||||
DefaultPlotWorld plotworld = null;
|
||||
/**
|
||||
* Faster sudo-random number generator than java.util.random
|
||||
*/
|
||||
private long state;
|
||||
|
||||
/**
|
||||
* Initialize variables, and create plotworld object used in calculations
|
||||
*/
|
||||
public WorldGenerator(final String world) {
|
||||
super(world);
|
||||
|
||||
if (this.plotworld == null) {
|
||||
this.plotworld = (DefaultPlotWorld) PlotMain.getWorldSettings(world);
|
||||
}
|
||||
|
||||
this.plotsize = this.plotworld.PLOT_WIDTH;
|
||||
|
||||
this.pathsize = this.plotworld.ROAD_WIDTH;
|
||||
|
||||
this.floor1 = this.plotworld.ROAD_BLOCK;
|
||||
this.floor2 = this.plotworld.ROAD_STRIPES;
|
||||
|
||||
this.wallfilling = this.plotworld.WALL_FILLING;
|
||||
this.size = this.pathsize + this.plotsize;
|
||||
this.wall = this.plotworld.WALL_BLOCK;
|
||||
|
||||
this.plotfloors = this.plotworld.TOP_BLOCK;
|
||||
this.filling = this.plotworld.MAIN_BLOCK;
|
||||
this.wallheight = this.plotworld.WALL_HEIGHT;
|
||||
this.roadheight = this.plotworld.ROAD_HEIGHT;
|
||||
this.plotheight = this.plotworld.PLOT_HEIGHT;
|
||||
|
||||
this.biome = this.plotworld.PLOT_BIOME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plot manager for this type of generator, or create one For
|
||||
@ -109,11 +138,6 @@ public class WorldGenerator extends PlotGenerator {
|
||||
return this.plotworld;
|
||||
}
|
||||
|
||||
/**
|
||||
* Faster sudo-random number generator than java.util.random
|
||||
*/
|
||||
private long state;
|
||||
|
||||
public final long nextLong() {
|
||||
final long a = this.state;
|
||||
this.state = xorShift64(a);
|
||||
@ -172,36 +196,6 @@ public class WorldGenerator extends PlotGenerator {
|
||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize variables, and create plotworld object used in calculations
|
||||
*/
|
||||
public WorldGenerator(final String world) {
|
||||
super(world);
|
||||
|
||||
if (this.plotworld == null) {
|
||||
this.plotworld = (DefaultPlotWorld) PlotMain.getWorldSettings(world);
|
||||
}
|
||||
|
||||
this.plotsize = this.plotworld.PLOT_WIDTH;
|
||||
|
||||
this.pathsize = this.plotworld.ROAD_WIDTH;
|
||||
|
||||
this.floor1 = this.plotworld.ROAD_BLOCK;
|
||||
this.floor2 = this.plotworld.ROAD_STRIPES;
|
||||
|
||||
this.wallfilling = this.plotworld.WALL_FILLING;
|
||||
this.size = this.pathsize + this.plotsize;
|
||||
this.wall = this.plotworld.WALL_BLOCK;
|
||||
|
||||
this.plotfloors = this.plotworld.TOP_BLOCK;
|
||||
this.filling = this.plotworld.MAIN_BLOCK;
|
||||
this.wallheight = this.plotworld.WALL_HEIGHT;
|
||||
this.roadheight = this.plotworld.ROAD_HEIGHT;
|
||||
this.plotheight = this.plotworld.PLOT_HEIGHT;
|
||||
|
||||
this.biome = this.plotworld.PLOT_BIOME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the block populator
|
||||
*/
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotBlock;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
@ -41,9 +41,53 @@ public class XPopulator extends BlockPopulator {
|
||||
* information about how a BlockPopulator works.
|
||||
*/
|
||||
|
||||
private final DefaultPlotWorld plotworld;
|
||||
int plotsize;
|
||||
int pathsize;
|
||||
PlotBlock wall;
|
||||
PlotBlock wallfilling;
|
||||
PlotBlock floor1;
|
||||
PlotBlock floor2;
|
||||
int size;
|
||||
Biome biome;
|
||||
int roadheight;
|
||||
int wallheight;
|
||||
int plotheight;
|
||||
PlotBlock[] plotfloors;
|
||||
PlotBlock[] filling;
|
||||
private int X;
|
||||
private int Z;
|
||||
private long state;
|
||||
private double pathWidthLower;
|
||||
|
||||
public XPopulator(final PlotWorld pw) {
|
||||
this.plotworld = (DefaultPlotWorld) pw;
|
||||
|
||||
// save configuration
|
||||
|
||||
this.plotsize = this.plotworld.PLOT_WIDTH;
|
||||
this.pathsize = this.plotworld.ROAD_WIDTH;
|
||||
|
||||
this.floor1 = this.plotworld.ROAD_BLOCK;
|
||||
this.floor2 = this.plotworld.ROAD_STRIPES;
|
||||
|
||||
this.wallfilling = this.plotworld.WALL_FILLING;
|
||||
this.size = this.pathsize + this.plotsize;
|
||||
this.wall = this.plotworld.WALL_BLOCK;
|
||||
|
||||
this.plotfloors = this.plotworld.TOP_BLOCK;
|
||||
this.filling = this.plotworld.MAIN_BLOCK;
|
||||
|
||||
this.wallheight = this.plotworld.WALL_HEIGHT;
|
||||
this.roadheight = this.plotworld.ROAD_HEIGHT;
|
||||
this.plotheight = this.plotworld.PLOT_HEIGHT;
|
||||
|
||||
if ((this.pathsize % 2) == 0) {
|
||||
this.pathWidthLower = Math.floor(this.pathsize / 2) - 1;
|
||||
} else {
|
||||
this.pathWidthLower = Math.floor(this.pathsize / 2);
|
||||
}
|
||||
}
|
||||
|
||||
public final long nextLong() {
|
||||
final long a = this.state;
|
||||
@ -102,52 +146,6 @@ public class XPopulator extends BlockPopulator {
|
||||
return new short[]{Short.parseShort(block), 0};
|
||||
}
|
||||
|
||||
int plotsize;
|
||||
int pathsize;
|
||||
PlotBlock wall;
|
||||
PlotBlock wallfilling;
|
||||
PlotBlock floor1;
|
||||
PlotBlock floor2;
|
||||
int size;
|
||||
Biome biome;
|
||||
int roadheight;
|
||||
int wallheight;
|
||||
int plotheight;
|
||||
PlotBlock[] plotfloors;
|
||||
PlotBlock[] filling;
|
||||
|
||||
private double pathWidthLower;
|
||||
private final DefaultPlotWorld plotworld;
|
||||
|
||||
public XPopulator(final PlotWorld pw) {
|
||||
this.plotworld = (DefaultPlotWorld) pw;
|
||||
|
||||
// save configuration
|
||||
|
||||
this.plotsize = this.plotworld.PLOT_WIDTH;
|
||||
this.pathsize = this.plotworld.ROAD_WIDTH;
|
||||
|
||||
this.floor1 = this.plotworld.ROAD_BLOCK;
|
||||
this.floor2 = this.plotworld.ROAD_STRIPES;
|
||||
|
||||
this.wallfilling = this.plotworld.WALL_FILLING;
|
||||
this.size = this.pathsize + this.plotsize;
|
||||
this.wall = this.plotworld.WALL_BLOCK;
|
||||
|
||||
this.plotfloors = this.plotworld.TOP_BLOCK;
|
||||
this.filling = this.plotworld.MAIN_BLOCK;
|
||||
|
||||
this.wallheight = this.plotworld.WALL_HEIGHT;
|
||||
this.roadheight = this.plotworld.ROAD_HEIGHT;
|
||||
this.plotheight = this.plotworld.PLOT_HEIGHT;
|
||||
|
||||
if ((this.pathsize % 2) == 0) {
|
||||
this.pathWidthLower = Math.floor(this.pathsize / 2) - 1;
|
||||
} else {
|
||||
this.pathWidthLower = Math.floor(this.pathsize / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(final World w, final Random r, final Chunk c) {
|
||||
int cx = c.getX(), cz = c.getZ();
|
||||
|
@ -1,17 +1,12 @@
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -21,62 +16,21 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotHelper;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.Settings;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class EntityListener implements Listener {
|
||||
|
||||
public static HashMap<String, HashMap<Plot, HashSet<Integer>>> entityMap = new HashMap<String, HashMap<Plot, HashSet<Integer>>>();
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public static void onPlayerInteract(final PlayerInteractEvent e) {
|
||||
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
final Player p = e.getPlayer();
|
||||
World w = p.getWorld();
|
||||
String n = w.getName();
|
||||
if (e.getMaterial() == Material.MONSTER_EGG || e.getMaterial() == Material.MONSTER_EGGS) {
|
||||
if (entityMap.containsKey(n)) {
|
||||
Location l = e.getClickedBlock().getLocation();
|
||||
Plot plot = PlotHelper.getCurrentPlot(l);
|
||||
if (plot!=null && plot.hasRights(p)) {
|
||||
int mobs;
|
||||
if (entityMap.get(n).containsKey(plot)) {
|
||||
mobs = entityMap.get(n).get(plot).size();
|
||||
}
|
||||
else {
|
||||
mobs = 0;
|
||||
}
|
||||
if (!(PlotMain.hasPermissionRange(p, "plots.mobcap", Settings.MOB_CAP)>mobs)) {
|
||||
PlayerFunctions.sendMessage(p, C.NO_PLOTS, "plots.mobcap."+(mobs+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public static void onCreatureSpawn(CreatureSpawnEvent e) {
|
||||
Location l = e.getLocation();
|
||||
String w = l.getWorld().getName();
|
||||
if (PlotMain.isPlotWorld(w)) {
|
||||
Plot plot = PlotHelper.getCurrentPlot(l);
|
||||
if (plot!=null && plot.hasOwner()) {
|
||||
addEntity(e.getEntity(), plot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EntityListener() {
|
||||
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
||||
scheduler.scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() {
|
||||
@ -122,8 +76,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
@ -136,6 +89,44 @@ public class EntityListener implements Listener {
|
||||
}, 24000L, 48000L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public static void onPlayerInteract(final PlayerInteractEvent e) {
|
||||
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
final Player p = e.getPlayer();
|
||||
World w = p.getWorld();
|
||||
String n = w.getName();
|
||||
if (e.getMaterial() == Material.MONSTER_EGG || e.getMaterial() == Material.MONSTER_EGGS) {
|
||||
if (entityMap.containsKey(n)) {
|
||||
Location l = e.getClickedBlock().getLocation();
|
||||
Plot plot = PlotHelper.getCurrentPlot(l);
|
||||
if (plot != null && plot.hasRights(p)) {
|
||||
int mobs;
|
||||
if (entityMap.get(n).containsKey(plot)) {
|
||||
mobs = entityMap.get(n).get(plot).size();
|
||||
} else {
|
||||
mobs = 0;
|
||||
}
|
||||
if (!(PlotMain.hasPermissionRange(p, "plots.mobcap", Settings.MOB_CAP) > mobs)) {
|
||||
PlayerFunctions.sendMessage(p, C.NO_PLOTS, "plots.mobcap." + (mobs + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public static void onCreatureSpawn(CreatureSpawnEvent e) {
|
||||
Location l = e.getLocation();
|
||||
String w = l.getWorld().getName();
|
||||
if (PlotMain.isPlotWorld(w)) {
|
||||
Plot plot = PlotHelper.getCurrentPlot(l);
|
||||
if (plot != null && plot.hasOwner()) {
|
||||
addEntity(e.getEntity(), plot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public static void onChunkLoad(final ChunkLoadEvent e) {
|
||||
if (PlotMain.isPlotWorld(e.getWorld())) {
|
||||
@ -177,8 +168,7 @@ public class EntityListener implements Listener {
|
||||
if (entityMap.get(w).containsKey(plot)) {
|
||||
entityMap.get(w).get(plot).remove(id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Iterator<Entry<Plot, HashSet<Integer>>> it = entityMap.get(w).entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<Plot, HashSet<Integer>> n = it.next();
|
||||
@ -201,8 +191,7 @@ public class EntityListener implements Listener {
|
||||
if (entityMap.get(w).containsKey(plot)) {
|
||||
if (entityMap.get(w).get(plot).size() == 1) {
|
||||
entityMap.get(w).remove(plot);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
entityMap.get(w).get(plot).remove(entity.getEntityId());
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -21,9 +21,13 @@
|
||||
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.commands.Setup;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -424,14 +428,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
|
||||
if (e.getBlock() != null) {
|
||||
world = e.getBlock().getWorld();
|
||||
}
|
||||
else if (e.getIgnitingEntity() != null) {
|
||||
} else if (e.getIgnitingEntity() != null) {
|
||||
world = e.getIgnitingEntity().getWorld();
|
||||
}
|
||||
else if (e.getPlayer() != null) {
|
||||
} else if (e.getPlayer() != null) {
|
||||
world = e.getPlayer().getWorld();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,15 @@
|
||||
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
|
||||
import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
@ -211,7 +217,6 @@ public class PlotListener {
|
||||
final PlayerEnterPlotEvent callEvent = new PlayerEnterPlotEvent(player, plot);
|
||||
Bukkit.getPluginManager().callEvent(callEvent);
|
||||
}
|
||||
PlayerFunctions.sendMessage(player, plot.settings.getJoinMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +237,6 @@ public class PlotListener {
|
||||
if (plot.settings.getFlag("weather") != null) {
|
||||
player.resetPlayerWeather();
|
||||
}
|
||||
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
|
||||
}
|
||||
|
||||
public static boolean getFlagValue(final String value) {
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import com.intellectualcrafters.plot.C;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
|
||||
import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -21,9 +21,14 @@
|
||||
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.PWE;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -21,11 +21,15 @@
|
||||
|
||||
package com.intellectualcrafters.plot.listeners;
|
||||
|
||||
import com.intellectualcrafters.plot.*;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
||||
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
/**
|
||||
* Wrapper class for blocks, using
|
@ -19,9 +19,12 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
@ -92,7 +95,6 @@ public class Plot implements Cloneable {
|
||||
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> denied, final String world) {
|
||||
this.id = id;
|
||||
this.settings = new PlotSettings(this);
|
||||
this.settings.setBiome(plotBiome);
|
||||
this.owner = owner;
|
||||
this.deny_entry = this.owner == null;
|
||||
this.helpers = helpers;
|
||||
@ -118,7 +120,6 @@ public class Plot implements Cloneable {
|
||||
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String alias, final PlotHomePosition position, final Flag[] flags, final String world, final boolean[] merged) {
|
||||
this.id = id;
|
||||
this.settings = new PlotSettings(this);
|
||||
this.settings.setBiome(plotBiome);
|
||||
this.owner = owner;
|
||||
this.deny_entry = this.owner != null;
|
||||
this.trusted = trusted;
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
public class PlotBlock {
|
||||
public short id;
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
public class PlotComment {
|
||||
public final String comment;
|
@ -19,8 +19,9 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public abstract class PlotGenerator extends ChunkGenerator {
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-05.
|
@ -19,30 +19,10 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
public class PlotId {
|
||||
|
||||
/**
|
||||
* Get a Plot Id based on a string
|
||||
*
|
||||
* @param string to create id from
|
||||
* @return null if the string is invalid
|
||||
*/
|
||||
public static PlotId fromString(final String string) {
|
||||
int x, y;
|
||||
String[] parts = string.split(";");
|
||||
if (parts.length < 2)
|
||||
return null;
|
||||
try {
|
||||
x = Integer.parseInt(parts[0]);
|
||||
y = Integer.parseInt(parts[1]);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return new PlotId(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* x value
|
||||
*/
|
||||
@ -63,6 +43,26 @@ public class PlotId {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Plot Id based on a string
|
||||
*
|
||||
* @param string to create id from
|
||||
* @return null if the string is invalid
|
||||
*/
|
||||
public static PlotId fromString(final String string) {
|
||||
int x, y;
|
||||
String[] parts = string.split(";");
|
||||
if (parts.length < 2)
|
||||
return null;
|
||||
try {
|
||||
x = Integer.parseInt(parts[0]);
|
||||
y = Integer.parseInt(parts[1]);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return new PlotId(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -27,6 +27,7 @@ import org.bukkit.block.Biome;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class PlotManager {
|
||||
|
||||
/*
|
@ -19,8 +19,10 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.SetBlockFast;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
@ -19,8 +19,10 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -32,6 +34,7 @@ import java.util.Set;
|
||||
* plot settings
|
||||
*
|
||||
* @author Citymonstret
|
||||
* @author Empire92
|
||||
*/
|
||||
public class PlotSettings {
|
||||
/**
|
||||
@ -43,23 +46,26 @@ public class PlotSettings {
|
||||
*/
|
||||
private String alias;
|
||||
/**
|
||||
* plot biome
|
||||
* Comments
|
||||
*/
|
||||
private Biome biome;
|
||||
|
||||
private ArrayList<PlotComment> comments = null;
|
||||
/**
|
||||
*
|
||||
* Flags
|
||||
*/
|
||||
private Set<Flag> flags;
|
||||
|
||||
/**
|
||||
* Home Position
|
||||
*/
|
||||
private PlotHomePosition position;
|
||||
|
||||
/**
|
||||
* Plot
|
||||
*/
|
||||
private Plot plot;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param plot
|
||||
* @param plot object
|
||||
*/
|
||||
public PlotSettings(final Plot plot) {
|
||||
this.alias = "";
|
||||
@ -73,8 +79,8 @@ public class PlotSettings {
|
||||
* 2 = South<br>
|
||||
* 3 = West<br>
|
||||
*
|
||||
* @param direction
|
||||
* @return boolean
|
||||
* @param direction Direction to check
|
||||
* @return boolean merged
|
||||
*/
|
||||
public boolean getMerged(final int direction) {
|
||||
return this.merged[direction];
|
||||
@ -107,14 +113,7 @@ public class PlotSettings {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setBiome(final Biome b) {
|
||||
this.biome = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flag
|
||||
* @param flag to add
|
||||
*/
|
||||
public void addFlag(final Flag flag) {
|
||||
final Flag hasFlag = getFlag(flag.getKey());
|
||||
@ -125,7 +124,9 @@ public class PlotSettings {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* Get all flags applied for the plot
|
||||
*
|
||||
* @return flags
|
||||
*/
|
||||
public Set<Flag> getFlags() {
|
||||
return this.flags;
|
||||
@ -164,22 +165,37 @@ public class PlotSettings {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param alias
|
||||
* Set the plot alias
|
||||
*
|
||||
* @param alias alias to be used
|
||||
*/
|
||||
public void setAlias(final String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public String getJoinMessage() {
|
||||
Flag greeting = getFlag("greeting");
|
||||
if (greeting != null) {
|
||||
return greeting.getValue();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "farewell" flag value
|
||||
*
|
||||
* @return Farewell flag
|
||||
*/
|
||||
public String getLeaveMessage() {
|
||||
Flag farewell = getFlag("farewell");
|
||||
if (farewell != null) {
|
||||
return farewell.getValue();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public ArrayList<PlotComment> getComments(final int tier) {
|
||||
final ArrayList<PlotComment> c = new ArrayList<PlotComment>();
|
||||
final ArrayList<PlotComment> c = new ArrayList<>();
|
||||
for (final PlotComment comment : this.comments) {
|
||||
if (comment.tier == tier) {
|
||||
c.add(comment);
|
||||
@ -206,7 +222,7 @@ public class PlotSettings {
|
||||
|
||||
public void addComment(final PlotComment comment) {
|
||||
if (this.comments == null) {
|
||||
this.comments = new ArrayList<PlotComment>();
|
||||
this.comments = new ArrayList<>();
|
||||
}
|
||||
this.comments.add(comment);
|
||||
}
|
@ -19,8 +19,10 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import com.intellectualcrafters.plot.config.Configuration;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -172,7 +174,47 @@ public abstract class PlotWorld {
|
||||
}
|
||||
}
|
||||
|
||||
public String worldname;
|
||||
/**
|
||||
* Saving core plotworld settings
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
public void saveConfiguration(final ConfigurationSection config) {
|
||||
final HashMap<String, Object> options = new HashMap<String, Object>();
|
||||
|
||||
options.put("natural_mob_spawning", PlotWorld.MOB_SPAWNING_DEFAULT);
|
||||
options.put("plot.auto_merge", PlotWorld.AUTO_MERGE_DEFAULT);
|
||||
options.put("plot.biome", PlotWorld.PLOT_BIOME_DEFAULT.toString());
|
||||
options.put("schematic.on_claim", PlotWorld.SCHEMATIC_ON_CLAIM_DEFAULT);
|
||||
options.put("schematic.file", PlotWorld.SCHEMATIC_FILE_DEFAULT);
|
||||
options.put("schematic.specify_on_claim", PlotWorld.SCHEMATIC_CLAIM_SPECIFY_DEFAULT);
|
||||
options.put("schematic.schematics", PlotWorld.SCHEMATICS_DEFAULT);
|
||||
options.put("economy.use", PlotWorld.USE_ECONOMY_DEFAULT);
|
||||
options.put("economy.prices.claim", PlotWorld.PLOT_PRICE_DEFAULT);
|
||||
options.put("economy.prices.merge", PlotWorld.MERGE_PRICE_DEFAULT);
|
||||
options.put("economy.prices.sell", PlotWorld.SELL_PRICE_DEFAULT);
|
||||
options.put("chat.enabled", PlotWorld.PLOT_CHAT_DEFAULT);
|
||||
options.put("flags.default", PlotWorld.DEFAULT_FLAGS_DEFAULT);
|
||||
options.put("event.pvp", PlotWorld.PVP_DEFAULT);
|
||||
options.put("event.pve", PlotWorld.PVE_DEFAULT);
|
||||
options.put("event.spawn.egg", PlotWorld.SPAWN_EGGS_DEFAULT);
|
||||
options.put("event.spawn.custom", PlotWorld.SPAWN_CUSTOM_DEFAULT);
|
||||
options.put("event.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT);
|
||||
final ConfigurationNode[] settings = getSettingNodes();
|
||||
|
||||
/*
|
||||
* Saving generator specific settings
|
||||
*/
|
||||
for (final ConfigurationNode setting : settings) {
|
||||
options.put(setting.getConstant(), setting.getType().parseObject(setting.getValue()));
|
||||
}
|
||||
|
||||
for (final String option : options.keySet()) {
|
||||
if (!config.contains(option)) {
|
||||
config.set(option, options.get(option));
|
||||
}
|
||||
}
|
||||
} public String worldname;
|
||||
|
||||
/**
|
||||
* Used for the <b>/plot setup</b> command Return null if you do not want to
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
/**
|
||||
* @author Empire92
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -38,6 +38,11 @@ import java.util.Map;
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class Title {
|
||||
private static final Map<Class<?>, Class<?>> CORRESPONDING_TYPES;
|
||||
|
||||
static {
|
||||
CORRESPONDING_TYPES = new HashMap<>();
|
||||
}
|
||||
/* Title packet */
|
||||
private Class<?> packetTitle;
|
||||
/* Title packet actions ENUM */
|
||||
@ -56,12 +61,6 @@ public class Title {
|
||||
private int fadeOutTime = -1;
|
||||
private boolean ticks = false;
|
||||
|
||||
private static final Map<Class<?>, Class<?>> CORRESPONDING_TYPES;
|
||||
|
||||
static {
|
||||
CORRESPONDING_TYPES = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new 1.8 title
|
||||
*
|
||||
@ -102,6 +101,18 @@ public class Title {
|
||||
loadClasses();
|
||||
}
|
||||
|
||||
private static boolean equalsTypeArray(final Class<?>[] a, final Class<?>[] o) {
|
||||
if (a.length != o.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (!a[i].equals(o[i]) && !a[i].isAssignableFrom(o[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load spigot and NMS classes
|
||||
*/
|
||||
@ -325,18 +336,6 @@ public class Title {
|
||||
return types;
|
||||
}
|
||||
|
||||
private static boolean equalsTypeArray(final Class<?>[] a, final Class<?>[] o) {
|
||||
if (a.length != o.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
if (!a[i].equals(o[i]) && !a[i].isAssignableFrom(o[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Object getHandle(final Object obj) {
|
||||
try {
|
||||
return getMethod("getHandle", obj.getClass()).invoke(obj);
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
/**
|
||||
* TPS and Lag Checker.
|
||||
@ -78,12 +78,6 @@ public class Lag implements Runnable {
|
||||
return System.currentTimeMillis() - t;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
T[TC % T.length] = System.currentTimeMillis();
|
||||
TC++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lag percentage
|
||||
*
|
||||
@ -101,4 +95,10 @@ public class Lag implements Runnable {
|
||||
public static double getFullPercentage() {
|
||||
return getTPS() * 5.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
T[TC % T.length] = System.currentTimeMillis();
|
||||
TC++;
|
||||
}
|
||||
}
|
@ -19,7 +19,10 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
@ -50,22 +53,6 @@ public class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
public enum LogLevel {
|
||||
GENERAL("General"),
|
||||
WARNING("Warning"),
|
||||
DANGER("Danger");
|
||||
private final String name;
|
||||
|
||||
LogLevel(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
public static void write() throws IOException {
|
||||
final FileWriter writer = new FileWriter(log);
|
||||
for (final String string : entries) {
|
||||
@ -81,4 +68,20 @@ public class Logger {
|
||||
private static void append(final String string) {
|
||||
entries.add("[" + new Date().toString() + "]" + string);
|
||||
}
|
||||
|
||||
public enum LogLevel {
|
||||
GENERAL("General"),
|
||||
WARNING("Warning"),
|
||||
DANGER("Danger");
|
||||
private final String name;
|
||||
|
||||
LogLevel(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
@ -111,6 +111,114 @@ public class Metrics {
|
||||
this.debug = this.configuration.getBoolean("debug", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* GZip compress a string of bytes
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static byte[] gzip(final String input) {
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
GZIPOutputStream gzos = null;
|
||||
try {
|
||||
gzos = new GZIPOutputStream(baos);
|
||||
gzos.write(input.getBytes("UTF-8"));
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (gzos != null) {
|
||||
try {
|
||||
gzos.close();
|
||||
} catch (final IOException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a json encoded key/value pair to the given string builder.
|
||||
*
|
||||
* @param json
|
||||
* @param key
|
||||
* @param value
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
private static void appendJSONPair(final StringBuilder json, final String key, final String value) throws UnsupportedEncodingException {
|
||||
boolean isValueNumeric = false;
|
||||
try {
|
||||
if (value.equals("0") || !value.endsWith("0")) {
|
||||
Double.parseDouble(value);
|
||||
isValueNumeric = true;
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
isValueNumeric = false;
|
||||
}
|
||||
if (json.charAt(json.length() - 1) != '{') {
|
||||
json.append(',');
|
||||
}
|
||||
json.append(escapeJSON(key));
|
||||
json.append(':');
|
||||
if (isValueNumeric) {
|
||||
json.append(value);
|
||||
} else {
|
||||
json.append(escapeJSON(value));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a string to create a valid JSON string
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private static String escapeJSON(final String text) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append('"');
|
||||
for (int index = 0; index < text.length(); index++) {
|
||||
final char chr = text.charAt(index);
|
||||
switch (chr) {
|
||||
case '"':
|
||||
case '\\':
|
||||
builder.append('\\');
|
||||
builder.append(chr);
|
||||
break;
|
||||
case '\b':
|
||||
builder.append("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
builder.append("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
builder.append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
builder.append("\\r");
|
||||
break;
|
||||
default:
|
||||
if (chr < ' ') {
|
||||
final String t = "000" + Integer.toHexString(chr);
|
||||
builder.append("\\u" + t.substring(t.length() - 4));
|
||||
} else {
|
||||
builder.append(chr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.append('"');
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode text as UTF-8
|
||||
*
|
||||
* @param text the text to encode
|
||||
* @return the encoded text, as UTF-8
|
||||
*/
|
||||
private static String urlEncode(final String text) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(text, "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct and create a Graph that can be used to separate specific
|
||||
* plotters to their own graphs on the metrics website. Plotters can be
|
||||
@ -445,31 +553,6 @@ public class Metrics {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GZip compress a string of bytes
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static byte[] gzip(final String input) {
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
GZIPOutputStream gzos = null;
|
||||
try {
|
||||
gzos = new GZIPOutputStream(baos);
|
||||
gzos.write(input.getBytes("UTF-8"));
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (gzos != null) {
|
||||
try {
|
||||
gzos.close();
|
||||
} catch (final IOException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mineshafter is present. If it is, we need to bypass it to send
|
||||
* POST requests
|
||||
@ -485,89 +568,6 @@ public class Metrics {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a json encoded key/value pair to the given string builder.
|
||||
*
|
||||
* @param json
|
||||
* @param key
|
||||
* @param value
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
private static void appendJSONPair(final StringBuilder json, final String key, final String value) throws UnsupportedEncodingException {
|
||||
boolean isValueNumeric = false;
|
||||
try {
|
||||
if (value.equals("0") || !value.endsWith("0")) {
|
||||
Double.parseDouble(value);
|
||||
isValueNumeric = true;
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
isValueNumeric = false;
|
||||
}
|
||||
if (json.charAt(json.length() - 1) != '{') {
|
||||
json.append(',');
|
||||
}
|
||||
json.append(escapeJSON(key));
|
||||
json.append(':');
|
||||
if (isValueNumeric) {
|
||||
json.append(value);
|
||||
} else {
|
||||
json.append(escapeJSON(value));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a string to create a valid JSON string
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private static String escapeJSON(final String text) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append('"');
|
||||
for (int index = 0; index < text.length(); index++) {
|
||||
final char chr = text.charAt(index);
|
||||
switch (chr) {
|
||||
case '"':
|
||||
case '\\':
|
||||
builder.append('\\');
|
||||
builder.append(chr);
|
||||
break;
|
||||
case '\b':
|
||||
builder.append("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
builder.append("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
builder.append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
builder.append("\\r");
|
||||
break;
|
||||
default:
|
||||
if (chr < ' ') {
|
||||
final String t = "000" + Integer.toHexString(chr);
|
||||
builder.append("\\u" + t.substring(t.length() - 4));
|
||||
} else {
|
||||
builder.append(chr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.append('"');
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode text as UTF-8
|
||||
*
|
||||
* @param text the text to encode
|
||||
* @return the encoded text, as UTF-8
|
||||
*/
|
||||
private static String urlEncode(final String text) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(text, "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a custom graph on the website
|
||||
*/
|
@ -19,9 +19,12 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.Vector;
|
@ -19,8 +19,15 @@
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package com.intellectualcrafters.plot;
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Player;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user