Improved iConomy support: added functionality to /buyregion to set the owenr of the region

This commit is contained in:
DarkLiKally 2011-02-25 12:37:15 +01:00
parent 3341574e02
commit 0e45dc5a3f

View File

@ -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.");