From 51db1eca5347af2c3d55c04b286be0571f572120 Mon Sep 17 00:00:00 2001 From: sekwah41 Date: Thu, 1 Feb 2018 22:15:26 +0000 Subject: [PATCH] Added being able to give items --- .../coreconnector/container/PlayerContainer.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java b/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java index e42219a..19658fe 100644 --- a/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java +++ b/src/com/sekwah/advancedportals/coreconnector/container/PlayerContainer.java @@ -1,10 +1,14 @@ package com.sekwah.advancedportals.coreconnector.container; +import org.bukkit.Material; import org.bukkit.entity.Player; import com.sekwah.advancedportals.core.data.PlayerLocation; import com.sekwah.advancedportals.core.data.PortalLocation; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import java.util.Arrays; import java.util.UUID; /** @@ -62,5 +66,12 @@ public class PlayerContainer { } - public void giveItem(String material, String itemName, String... itemDescription) {} + public void giveItem(String material, String itemName, String... itemDescription) { + ItemStack regionselector = new ItemStack(Material.getMaterial(material)); + ItemMeta selectorname = regionselector.getItemMeta(); + selectorname.setDisplayName(itemName); + selectorname.setLore(Arrays.asList(itemDescription)); + regionselector.setItemMeta(selectorname); + this.player.getInventory().addItem(regionselector); + } }