mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Various changes and Merge Economy Fix
This commit is contained in:
parent
8739f3ef78
commit
ae885eafca
@ -5,9 +5,17 @@ import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -17,7 +25,12 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.*;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.Sandstone;
|
||||
import org.bukkit.material.Step;
|
||||
import org.bukkit.material.Tree;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.bukkit.material.Wool;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -282,7 +295,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
final World world = getWorld(loc.getWorld());
|
||||
final Block block = world.getBlockAt(loc.getX(), loc.getY(), loc.getZ());
|
||||
if (block == null) {
|
||||
return new PlotBlock((short) 0, (byte) 0);
|
||||
return PlotBlock.EVERYTHING;
|
||||
}
|
||||
return new PlotBlock((short) block.getTypeId(), block.getData());
|
||||
}
|
||||
|
@ -32,14 +32,8 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "auto",
|
||||
permission = "plots.auto",
|
||||
category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Claim the nearest plot",
|
||||
aliases = { "a" },
|
||||
usage = "/plot auto [length,width]")
|
||||
@CommandDeclaration(command = "auto", permission = "plots.auto", category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE,
|
||||
description = "Claim the nearest plot", aliases = "a", usage = "/plot auto [length,width]")
|
||||
public class Auto extends SubCommand {
|
||||
|
||||
public static PlotId getNextPlotId(final PlotId id, final int step) {
|
||||
@ -149,7 +143,7 @@ public class Auto extends SubCommand {
|
||||
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||
}
|
||||
}
|
||||
if (schematic != null && !schematic.equals("")) {
|
||||
if (schematic != null && !schematic.isEmpty()) {
|
||||
if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
return true;
|
||||
|
@ -31,14 +31,8 @@ import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "claim",
|
||||
aliases = { "c" },
|
||||
description = "Claim the current plot you're standing on",
|
||||
category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.claim",
|
||||
usage = "/plot claim")
|
||||
@CommandDeclaration(command = "claim", aliases = "c", description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE, permission = "plots.claim", usage = "/plot claim")
|
||||
public class Claim extends SubCommand {
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer plr, final String... args) {
|
||||
@ -87,7 +81,7 @@ public class Claim extends SubCommand {
|
||||
}
|
||||
sendMessage(plr, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
|
||||
}
|
||||
if (!schematic.equals("")) {
|
||||
if (!schematic.isEmpty()) {
|
||||
if (world.SCHEMATIC_CLAIM_SPECIFY) {
|
||||
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||
return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
|
@ -89,8 +89,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
final PlotArea plotworld = plot.getArea();
|
||||
final double price = plotworld.PRICES.get("merge");
|
||||
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d
|
||||
&& EconHandler.manager.getMoney(plr) < price) {
|
||||
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(plr) < price) {
|
||||
sendMessage(plr, C.CANNOT_AFFORD_MERGE, price + "");
|
||||
return false;
|
||||
}
|
||||
@ -123,7 +122,7 @@ public class Merge extends SubCommand {
|
||||
terrain = "true".equalsIgnoreCase(args[1]);
|
||||
}
|
||||
if (plot.autoMerge(-1, maxSize, uuid, terrain)) {
|
||||
if (EconHandler.manager != null && price > 0d) {
|
||||
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) {
|
||||
EconHandler.manager.withdrawMoney(plr, price);
|
||||
sendMessage(plr, C.REMOVED_BALANCE, price + "");
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class BO3Handler {
|
||||
BO3 bo3 = map.get(loc);
|
||||
for (int y = 1; y < height; y++) {
|
||||
final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, y, z));
|
||||
if ((block != null) && !contains(cpw.MAIN_BLOCK, block)) {
|
||||
if (!contains(cpw.MAIN_BLOCK, block)) {
|
||||
if (bo3 == null) {
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
@ -105,7 +105,7 @@ public class BO3Handler {
|
||||
}
|
||||
}
|
||||
final PlotBlock floor = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, height, z));
|
||||
if ((floor != null) && !contains(cpw.TOP_BLOCK, floor)) {
|
||||
if (!contains(cpw.TOP_BLOCK, floor)) {
|
||||
if (bo3 == null) {
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
@ -115,7 +115,7 @@ public class BO3Handler {
|
||||
}
|
||||
for (int y = height + 1; y < 256; y++) {
|
||||
final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, y, z));
|
||||
if ((block != null) && (block.id != 0)) {
|
||||
if (block.id != 0) {
|
||||
if (bo3 == null) {
|
||||
bo3 = new BO3(alias, loc);
|
||||
map.put(loc, bo3);
|
||||
@ -205,4 +205,4 @@ public class BO3Handler {
|
||||
}
|
||||
return base;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,9 +155,6 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user