mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Economy Support (Stage 1, alpha xD)
Added schematic support for Auto Continued working on setup command Made sexy exception thingy Tried to fix Errors in PWE Added some epic captions Added configuration options to PlotWorld YAY
This commit is contained in:
parent
c5195fc198
commit
b28c44b0df
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,12 @@ import org.bukkit.ChatColor;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum C {
|
public enum C {
|
||||||
|
/**
|
||||||
|
* Economy Stuff
|
||||||
|
*/
|
||||||
|
CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"),
|
||||||
|
CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"),
|
||||||
|
REMOVED_BALANCE("&6%s &chas been taken from your balance"),
|
||||||
/*
|
/*
|
||||||
* Setup Stuff
|
* Setup Stuff
|
||||||
*/
|
*/
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.*;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||||
import com.sk89q.worldedit.masks.RegionMask;
|
import com.sk89q.worldedit.masks.RegionMask;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
@ -18,16 +16,19 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
*/
|
*/
|
||||||
public class PWE {
|
public class PWE {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static void setMask(Player p, Location l) {
|
public static void setMask(Player p, Location l) {
|
||||||
LocalSession s = PlotMain.worldEdit.getSession(p);
|
try {
|
||||||
|
LocalSession s;
|
||||||
|
if (PlotMain.worldEdit == null) {
|
||||||
|
s = WorldEdit.getInstance().getSession(p.getName());
|
||||||
|
} else {
|
||||||
|
s = PlotMain.worldEdit.getSession(p);
|
||||||
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(p);
|
Plot plot = PlayerFunctions.getCurrentPlot(p);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
boolean r;
|
boolean r;
|
||||||
if (plot.getOwner() != null) {
|
r = plot.getOwner() != null && plot.getOwner().equals(p.getUniqueId());
|
||||||
r = plot.getOwner().equals(p.getUniqueId());
|
|
||||||
} else {
|
|
||||||
r = false;
|
|
||||||
}
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
if (p.hasPermission("plots.we.member") && plot.hasRights(p)) {
|
if (p.hasPermission("plots.we.member") && plot.hasRights(p)) {
|
||||||
r = true;
|
r = true;
|
||||||
@ -55,10 +56,22 @@ public class PWE {
|
|||||||
Vector p1 = new Vector(0, 0, 0), p2 = new Vector(0, 0, 0);
|
Vector p1 = new Vector(0, 0, 0), p2 = new Vector(0, 0, 0);
|
||||||
s.setMask(new RegionMask(new CuboidRegion(world, p1, p2)));
|
s.setMask(new RegionMask(new CuboidRegion(world, p1, p2)));
|
||||||
}
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
throw new PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY, "WorldEdit == Null?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeMask(Player p) {
|
public static void removeMask(Player p) {
|
||||||
LocalSession s = PlotMain.worldEdit.getSession(p);
|
try {
|
||||||
|
LocalSession s;
|
||||||
|
if(PlotMain.worldEdit == null) {
|
||||||
|
s = WorldEdit.getInstance().getSession(p.getName());
|
||||||
|
} else {
|
||||||
|
s = PlotMain.worldEdit.getSession(p);
|
||||||
|
}
|
||||||
s.setMask(null);
|
s.setMask(null);
|
||||||
|
} catch(Exception e) {
|
||||||
|
throw new PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY, "WorldEdit == Null?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import ca.mera.CameraAPI;
|
import ca.mera.CameraAPI;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.Logger.LogLevel;
|
import com.intellectualcrafters.plot.Logger.LogLevel;
|
||||||
import com.intellectualcrafters.plot.Settings.Web;
|
import com.intellectualcrafters.plot.Settings.Web;
|
||||||
import com.intellectualcrafters.plot.commands.Camera;
|
import com.intellectualcrafters.plot.commands.Camera;
|
||||||
@ -26,15 +25,16 @@ import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
|||||||
import com.intellectualcrafters.plot.listeners.WorldGuardListener;
|
import com.intellectualcrafters.plot.listeners.WorldGuardListener;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
|
||||||
import me.confuser.barapi.BarAPI;
|
import me.confuser.barapi.BarAPI;
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -95,6 +95,9 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
public static WorldGuardPlugin worldGuard;
|
public static WorldGuardPlugin worldGuard;
|
||||||
|
|
||||||
|
public static Economy economy;
|
||||||
|
public static boolean useEconomy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* !!WorldGeneration!!
|
* !!WorldGeneration!!
|
||||||
*/
|
*/
|
||||||
@ -545,7 +548,13 @@ public class PlotMain extends JavaPlugin {
|
|||||||
checkExpired(PlotMain.getMain(), true);
|
checkExpired(PlotMain.getMain(), true);
|
||||||
checkForExpiredPlots();
|
checkForExpiredPlots();
|
||||||
}
|
}
|
||||||
|
if(getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||||
|
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||||
|
if(economyProvider != null) {
|
||||||
|
economy = economyProvider.getProvider();
|
||||||
|
}
|
||||||
|
useEconomy = (economy != null);
|
||||||
|
}
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Lag(), 100L, 1L);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Lag(), 100L, 1L);
|
||||||
|
|
||||||
if (Web.ENABLED) {
|
if (Web.ENABLED) {
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Citymonstret on 2014-09-29.
|
||||||
|
*/
|
||||||
|
public class PlotSquaredException extends RuntimeException {
|
||||||
|
|
||||||
|
public PlotSquaredException(PlotError error, String details) {
|
||||||
|
super("PlotError >> " + error.getHeader() + ": " + details);
|
||||||
|
PlotMain.sendConsoleSenderMessage("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum PlotError {
|
||||||
|
MISSING_DEPENDENCY("Missing Dependency")
|
||||||
|
;
|
||||||
|
private String errorHeader;
|
||||||
|
PlotError(String errorHeader) {
|
||||||
|
this.errorHeader = errorHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeader() {
|
||||||
|
return this.errorHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getHeader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -210,4 +210,8 @@ public class PlotWorld {
|
|||||||
* Default default flags
|
* Default default flags
|
||||||
*/
|
*/
|
||||||
public static String[] DEFAULT_FLAGS_DEFAULT = new String[] {};
|
public static String[] DEFAULT_FLAGS_DEFAULT = new String[] {};
|
||||||
|
|
||||||
|
public boolean USE_ECONOMY = false;
|
||||||
|
public double PLOT_PRICE = 100;
|
||||||
|
public double MERGE_PRICE = 100;
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,9 @@ public class WorldGenerator extends ChunkGenerator {
|
|||||||
options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
|
options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
|
||||||
options.put("worlds." + world + ".schematic.schematics", plotworld.SCHEMATICS);
|
options.put("worlds." + world + ".schematic.schematics", plotworld.SCHEMATICS);
|
||||||
options.put("worlds." + world + ".schematic.specify_on_claim", plotworld.SCHEMATIC_CLAIM_SPECIFY);
|
options.put("worlds." + world + ".schematic.specify_on_claim", plotworld.SCHEMATIC_CLAIM_SPECIFY);
|
||||||
|
options.put("worlds." + world + ".economy.use", plotworld.USE_ECONOMY);
|
||||||
|
options.put("worlds." + world + ".economy.prices.claim", plotworld.PLOT_PRICE);
|
||||||
|
options.put("worlds." + world + ".economy.prices.merge", plotworld.MERGE_PRICE);
|
||||||
for (Entry<String, Object> node : options.entrySet()) {
|
for (Entry<String, Object> node : options.entrySet()) {
|
||||||
if (!config.contains(node.getKey())) {
|
if (!config.contains(node.getKey())) {
|
||||||
config.set(node.getKey(), node.getValue());
|
config.set(node.getKey(), node.getValue());
|
||||||
@ -119,6 +122,9 @@ public class WorldGenerator extends ChunkGenerator {
|
|||||||
this.plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file");
|
this.plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file");
|
||||||
this.plotworld.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("worlds." + world + ".schematic.specify_on_claim");
|
this.plotworld.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("worlds." + world + ".schematic.specify_on_claim");
|
||||||
this.plotworld.SCHEMATICS = config.getStringList("worlds." + world + ".schematic.schematics");
|
this.plotworld.SCHEMATICS = config.getStringList("worlds." + world + ".schematic.schematics");
|
||||||
|
this.plotworld.USE_ECONOMY = config.getBoolean("worlds." + world + ".economy.use");
|
||||||
|
this.plotworld.PLOT_PRICE = config.getDouble("worlds." + world + ".economy.prices.claim");
|
||||||
|
this.plotworld.MERGE_PRICE = config.getDouble("worlds." + world + ".economy.prices.merge");
|
||||||
|
|
||||||
String[] default_flags_string = config.getStringList("worlds." + world + ".flags.default").toArray(new String[0]);
|
String[] default_flags_string = config.getStringList("worlds." + world + ".flags.default").toArray(new String[0]);
|
||||||
Flag[] default_flags = new Flag[default_flags_string.length];
|
Flag[] default_flags = new Flag[default_flags_string.length];
|
||||||
|
@ -9,17 +9,12 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.*;
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
|
||||||
import com.intellectualcrafters.plot.Plot;
|
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class Auto extends SubCommand {
|
public class Auto extends SubCommand {
|
||||||
|
|
||||||
@ -68,6 +63,32 @@ public class Auto extends SubCommand {
|
|||||||
id = new PlotId(x, z);
|
id = new PlotId(x, z);
|
||||||
if (PlotHelper.getPlot(world, id).owner == null) {
|
if (PlotHelper.getPlot(world, id).owner == null) {
|
||||||
Plot plot = PlotHelper.getPlot(world, id);
|
Plot plot = PlotHelper.getPlot(world, id);
|
||||||
|
PlotWorld plotworld = PlotMain.getWorldSettings(plot.getWorld());
|
||||||
|
if(PlotMain.useEconomy && plotworld.USE_ECONOMY) {
|
||||||
|
double cost = plotworld.PLOT_PRICE;
|
||||||
|
if(cost > 0d) {
|
||||||
|
Economy economy = PlotMain.economy;
|
||||||
|
if(economy.getBalance(plr) < cost) {
|
||||||
|
sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
economy.withdrawPlayer(plr, cost);
|
||||||
|
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String schematic;
|
||||||
|
if(args.length > 0 && !(schematic = args[0]).equals("")) {
|
||||||
|
if(plotworld.SCHEMATIC_CLAIM_SPECIFY) {
|
||||||
|
if(!plotworld.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||||
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(!plr.hasPermission("plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
boolean result = Claim.claimPlot(plr, plot, true);
|
boolean result = Claim.claimPlot(plr, plot, true);
|
||||||
br = !result;
|
br = !result;
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,12 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.*;
|
||||||
|
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
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.PlotWorld;
|
|
||||||
import com.intellectualcrafters.plot.SchematicHandler;
|
|
||||||
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -51,8 +45,20 @@ public class Claim extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, C.PLOT_IS_CLAIMED);
|
PlayerFunctions.sendMessage(plr, C.PLOT_IS_CLAIMED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!schematic.equals("")) {
|
|
||||||
PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
||||||
|
if(PlotMain.useEconomy && world.USE_ECONOMY) {
|
||||||
|
double cost = world.PLOT_PRICE;
|
||||||
|
if(cost > 0d) {
|
||||||
|
Economy economy = PlotMain.economy;
|
||||||
|
if(economy.getBalance(plr) < cost) {
|
||||||
|
sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
economy.withdrawPlayer(plr, cost);
|
||||||
|
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!schematic.equals("")) {
|
||||||
if(world.SCHEMATIC_CLAIM_SPECIFY) {
|
if(world.SCHEMATIC_CLAIM_SPECIFY) {
|
||||||
if(!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
if(!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
||||||
|
@ -9,25 +9,15 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.*;
|
||||||
import java.util.Set;
|
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
|
||||||
import com.intellectualcrafters.plot.Plot;
|
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
|
||||||
import com.intellectualcrafters.plot.PlotWorld;
|
|
||||||
import com.intellectualcrafters.plot.SetBlockFast;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -45,14 +35,35 @@ public class Merge extends SubCommand {
|
|||||||
|
|
||||||
public static String direction(float yaw) {
|
public static String direction(float yaw) {
|
||||||
yaw = yaw / 90;
|
yaw = yaw / 90;
|
||||||
yaw = (float)Math.round(yaw);
|
// yaw = (float)Math.round(yaw);
|
||||||
|
/*
|
||||||
if (yaw == -4 || yaw == 0 || yaw == 4) {return "SOUTH";}
|
* if (yaw == -4 || yaw == 0 || yaw == 4) {return "SOUTH";}
|
||||||
if (yaw == -1 || yaw == 3) {return "EAST";}
|
* if (yaw == -1 || yaw == 3) {return "EAST";}
|
||||||
if (yaw == -2 || yaw == 2) {return "NORTH";}
|
* if (yaw == -2 || yaw == 2) {return "NORTH";}
|
||||||
if (yaw == -3 || yaw == 1) {return "WEST";}
|
* if (yaw == -3 || yaw == 1) {return "WEST";}
|
||||||
|
*/
|
||||||
|
int i = Math.round(yaw);
|
||||||
|
switch(i) {
|
||||||
|
case -4:
|
||||||
|
case 0:
|
||||||
|
case 4:
|
||||||
|
return "SOUTH";
|
||||||
|
case -1:
|
||||||
|
case 3:
|
||||||
|
return "EAST";
|
||||||
|
case -2:
|
||||||
|
case 2:
|
||||||
|
return "NORTH";
|
||||||
|
case -3:
|
||||||
|
case 1:
|
||||||
|
return "WEST";
|
||||||
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Had to... I'm sorry xD But it looks soo much better, and should be equally as fast. //
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player plr, String... args) {
|
public boolean execute(Player plr, String... args) {
|
||||||
@ -118,6 +129,20 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlotWorld plotWorld = PlotMain.getWorldSettings(world);
|
||||||
|
if(PlotMain.useEconomy && plotWorld.USE_ECONOMY) {
|
||||||
|
double cost = plotWorld.MERGE_PRICE;
|
||||||
|
if(cost > 0d) {
|
||||||
|
Economy economy = PlotMain.economy;
|
||||||
|
if(economy.getBalance(plr) < cost) {
|
||||||
|
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
economy.withdrawPlayer(plr, cost);
|
||||||
|
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PlotMergeEvent event = new PlotMergeEvent(world, plot, plots);
|
PlotMergeEvent event = new PlotMergeEvent(world, plot, plots);
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
@ -157,6 +157,7 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
sendMessage(plr, C.SETUP_INIT);
|
sendMessage(plr, C.SETUP_INIT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.intellectualcrafters.plot.listeners;
|
package com.intellectualcrafters.plot.listeners;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.*;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -8,20 +9,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerPortalEvent;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PWE;
|
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
|
||||||
import com.intellectualcrafters.plot.Plot;
|
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
|
||||||
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user