mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-02 23:43:50 +01:00
Improved iConomy support: added functionality to /buyregion to set the owenr of the region
This commit is contained in:
parent
3341574e02
commit
0e45dc5a3f
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
import com.nijikokun.bukkit.iConomy.iConomy;
|
import com.nijikokun.bukkit.iConomy.iConomy;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||||
import com.sk89q.worldguard.bukkit.commands.CommandHandler.CommandHandlingException;
|
import com.sk89q.worldguard.bukkit.commands.CommandHandler.CommandHandlingException;
|
||||||
import com.sk89q.worldguard.protection.regionmanager.RegionManager;
|
import com.sk89q.worldguard.protection.regionmanager.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.AreaFlags;
|
import com.sk89q.worldguard.protection.regions.AreaFlags;
|
||||||
@ -75,6 +76,9 @@ public boolean handle(CommandSender sender, String senderName, String command, S
|
|||||||
iConomy.database.setBalance(player.getName(), balance - regionPrice);
|
iConomy.database.setBalance(player.getName(), balance - regionPrice);
|
||||||
player.sendMessage(ChatColor.YELLOW + "You have bought the region " + id + " for " +
|
player.sendMessage(ChatColor.YELLOW + "You have bought the region " + id + " for " +
|
||||||
iConomy.Misc.formatCurrency(regionPrice, iConomy.currency));
|
iConomy.Misc.formatCurrency(regionPrice, iConomy.currency));
|
||||||
|
DefaultDomain owners = region.getOwners();
|
||||||
|
owners.addPlayer(player.getName());
|
||||||
|
region.setOwners(owners);
|
||||||
}
|
}
|
||||||
} 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