Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Mainp;
- import java.util.ArrayList;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- public class test implements CommandExecutor{
- @Override
- public boolean onCommand( CommandSender s, Command cmd, String lable, String[] args) {
- if(s instanceof Player) {
- Player p = (Player)s;
- FileConfiguration config = Main.GetPlugin().getConfig();
- @SuppressWarnings("unchecked")
- ArrayList<ItemStack> content = (ArrayList<ItemStack>) config.getList("inventar");
- ItemStack[] items = new ItemStack[content.size()];
- for (int i = 0; i < content.size(); i++) {
- ItemStack item = content.get(i);
- if (item != null) {
- items[i] = item;
- } else {
- items[i] = null;
- }
- }
- p.getInventory().setContents(items);
- config.set("inventar", p.getInventory().getContents());
- config.set("World", p.getWorld().getName());
- Main.GetPlugin().saveConfig();
- } else {
- s.sendMessage("stop");
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement