Update from Git Manager GUI
This commit is contained in:
26
src/main/java/de/nexuslobby/modules/gadgets/HatManager.java
Normal file
26
src/main/java/de/nexuslobby/modules/gadgets/HatManager.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package de.nexuslobby.modules.gadgets;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class HatManager {
|
||||
|
||||
public static void setHat(Player player, Material material, String name) {
|
||||
ItemStack hat = new ItemStack(material);
|
||||
ItemMeta meta = hat.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName("§6Hut: " + name);
|
||||
hat.setItemMeta(meta);
|
||||
}
|
||||
|
||||
// Den Gegenstand auf den Kopf setzen
|
||||
player.getInventory().setHelmet(hat);
|
||||
player.sendMessage("§8[§6Nexus§8] §aDu trägst nun: " + name);
|
||||
}
|
||||
|
||||
public static void removeHat(Player player) {
|
||||
player.getInventory().setHelmet(null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user