summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/yulqen/test/GiveMeDiamond.java
blob: 359a5311da53207518f348633d6cd19eb72d3b7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.yulqen.test;

import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

public class GiveMeDiamond implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
        if (commandSender instanceof Player) {
            Player player = (Player) commandSender;
            ItemStack diamond = new ItemStack(Material.DIAMOND);
            diamond.setAmount(64);
            player.getInventory().addItem(diamond);
        }
        return true;
    }
}