mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-21 16:47:34 +01:00
Fixed sign alternative for /buyregion
This commit is contained in:
parent
3e9c7aa74b
commit
7b725d655c
@ -31,6 +31,7 @@
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -592,10 +593,14 @@ public void onBlockRightClick(BlockRightClickEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wcfg.useRegions && wcfg.useiConomy && cfg.getiConomy() != null && (type == Material.SIGN || type == Material.WALL_SIGN)) {
|
if (wcfg.useRegions && wcfg.useiConomy && cfg.getiConomy() != null
|
||||||
if (((Sign)blockClicked).getLine(0) == "[WorldGuard]" && ((Sign)blockClicked).getLine(1) == "For sale") {
|
&& (type == Material.SIGN_POST || type == Material.SIGN || type == Material.WALL_SIGN)) {
|
||||||
String regionId = ((Sign)blockClicked).getLine(2);
|
BlockState block = blockClicked.getState();
|
||||||
String regionComment = ((Sign)blockClicked).getLine(3);
|
|
||||||
|
if (((Sign)block).getLine(0).equalsIgnoreCase("[WorldGuard]")
|
||||||
|
&& ((Sign)block).getLine(1).equalsIgnoreCase("For sale")) {
|
||||||
|
String regionId = ((Sign)block).getLine(2);
|
||||||
|
String regionComment = ((Sign)block).getLine(3);
|
||||||
|
|
||||||
if (regionId != null && regionId != "") {
|
if (regionId != null && regionId != "") {
|
||||||
RegionManager mgr = cfg.getWorldGuardPlugin().getGlobalRegionManager().getRegionManager(player.getWorld().getName());
|
RegionManager mgr = cfg.getWorldGuardPlugin().getGlobalRegionManager().getRegionManager(player.getWorld().getName());
|
||||||
@ -608,7 +613,7 @@ public void onBlockRightClick(BlockRightClickEvent event) {
|
|||||||
if (iConomy.getBank().hasAccount(player.getName())) {
|
if (iConomy.getBank().hasAccount(player.getName())) {
|
||||||
Account account = iConomy.getBank().getAccount(player.getName());
|
Account account = iConomy.getBank().getAccount(player.getName());
|
||||||
double balance = account.getBalance();
|
double balance = account.getBalance();
|
||||||
double regionPrice = flags.getIntegerFlag(FlagType.PRICE).getValue();
|
double regionPrice = flags.getDoubleFlag(FlagType.PRICE).getValue();
|
||||||
|
|
||||||
if (balance >= regionPrice) {
|
if (balance >= regionPrice) {
|
||||||
account.subtract(regionPrice);
|
account.subtract(regionPrice);
|
||||||
@ -619,6 +624,8 @@ public void onBlockRightClick(BlockRightClickEvent event) {
|
|||||||
region.setOwners(owners);
|
region.setOwners(owners);
|
||||||
flags.getBooleanFlag(FlagType.BUYABLE).setValue(false);
|
flags.getBooleanFlag(FlagType.BUYABLE).setValue(false);
|
||||||
account.save();
|
account.save();
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.YELLOW + "You have not enough money.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.YELLOW + "You have not enough money.");
|
player.sendMessage(ChatColor.YELLOW + "You have not enough money.");
|
||||||
|
Loading…
Reference in New Issue
Block a user