2013-07-30 21:27:35 +02:00

55 lines
1.6 KiB
Java

package nl.Steffion.BlockHunt.Commands;
import java.util.ArrayList;
import java.util.List;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class CMDwand extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.create, true)) {
if (player != null) {
ItemStack wand = new ItemStack(
Material.getMaterial((Integer) W.config
.get(ConfigC.wandID)));
ItemMeta im = wand.getItemMeta();
im.setDisplayName(MessageM.replaceAll((String) W.config
.get(ConfigC.wandName)));
W.config.load();
List<String> lores = W.config.getFile().getStringList(
ConfigC.wandDescription.getLocation());
List<String> lores2 = new ArrayList<String>();
for (String lore : lores) {
lores2.add(MessageM.replaceAll(lore));
}
im.setLore(lores2);
wand.setItemMeta(im);
player.getInventory().addItem(wand);
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 5, 0);
MessageM.sendFMessage(player, ConfigC.normal_wandGaveWand, true,
"type-"
+ wand.getType().toString()
.replaceAll("_", " ").toLowerCase());
} else {
MessageM.sendFMessage(player, ConfigC.error_onlyIngame, true);
}
}
return true;
}
}