Merge remote-tracking branch 'origin/1.6.x' into 1.6.x
This commit is contained in:
commit
dac07178e5
@ -295,13 +295,16 @@ public class FactionsPlugin extends MPlugin {
|
||||
new MissionHandler(this),
|
||||
new FChestListener(),
|
||||
new MenuListener(),
|
||||
timerManager.graceTimer,
|
||||
new AntiChestListener()
|
||||
};
|
||||
|
||||
for (Listener eventListener : eventsListener)
|
||||
getServer().getPluginManager().registerEvents(eventListener, this);
|
||||
|
||||
if(Conf.useGraceSystem){
|
||||
getServer().getPluginManager().registerEvents(timerManager.graceTimer, this);
|
||||
}
|
||||
|
||||
this.getCommand(refCommand).setExecutor(cmdBase);
|
||||
|
||||
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
|
||||
|
@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.util.ItemBuilder;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CmdGetVault extends FCommand {
|
||||
@ -30,9 +30,13 @@ public class CmdGetVault extends FCommand {
|
||||
context.fPlayer.msg(TL.GENERIC_DISABLED, "Faction Vaults");
|
||||
return;
|
||||
}
|
||||
Location vaultLocation = context.faction.getVault();
|
||||
ItemStack vault = FactionsPlugin.getInstance().createItem(Material.CHEST, 1, (short) 0, FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fvault.Item.Name")), FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fvault.Item.Lore")));
|
||||
|
||||
Location vaultLocation = context.faction.getVault();
|
||||
ItemStack vault = new ItemBuilder(Material.CHEST)
|
||||
.amount(1)
|
||||
.name(FactionsPlugin.getInstance().getConfig().getString("fvault.Item.Name"))
|
||||
.lore(FactionsPlugin.getInstance().getConfig().getStringList("fvault.Item.Lore"))
|
||||
.build();
|
||||
|
||||
//check if vault is set
|
||||
if (vaultLocation != null) {
|
||||
@ -40,36 +44,19 @@ public class CmdGetVault extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//has enough money?
|
||||
int amount = FactionsPlugin.getInstance().getConfig().getInt("fvault.Price");
|
||||
if (!context.fPlayer.hasMoney(amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.fPlayer.takeMoney(amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//success :)
|
||||
context.fPlayer.takeMoney(amount);
|
||||
context.player.getInventory().addItem(vault);
|
||||
context.fPlayer.msg(TL.COMMAND_GETVAULT_RECEIVE);
|
||||
|
||||
}
|
||||
|
||||
public boolean inventoryContains(Inventory inventory, ItemStack item) {
|
||||
int count = 0;
|
||||
ItemStack[] items = inventory.getContents();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i] != null && items[i].getType() == item.getType() && items[i].getDurability() == item.getDurability()) {
|
||||
count += items[i].getAmount();
|
||||
}
|
||||
if (count >= item.getAmount()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
|
Loading…
Reference in New Issue
Block a user