12
0
Fork 0
SpigotCore/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java

80 Zeilen
2.5 KiB
Java

/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.inventory;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_14 {
private SWItem_14(){}
static Material getMaterial(String material) {
return Material.valueOf("LEGACY_" + material);
}
static Material getDye(int colorCode){
switch(colorCode){
case 1:
return Material.RED_DYE;
case 2:
return Material.GREEN_DYE;
case 3:
return Material.BROWN_DYE;
case 4:
return Material.LAPIS_LAZULI;
case 5:
return Material.PURPLE_DYE;
case 6:
return Material.CYAN_DYE;
case 7:
return Material.LIGHT_GRAY_DYE;
case 8:
return Material.GRAY_DYE;
case 9:
return Material.PINK_DYE;
case 10:
return Material.LIME_DYE;
case 11:
return Material.YELLOW_DYE;
case 12:
return Material.LIGHT_BLUE_DYE;
case 13:
return Material.MAGENTA_DYE;
case 14:
return Material.ORANGE_DYE;
case 15:
return Material.WHITE_DYE;
default:
return Material.BLACK_DYE;
}
}
static ItemStack setSkullOwner(String player){
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta headmeta = (SkullMeta) head.getItemMeta();
assert headmeta != null;
headmeta.setOwner(player);
headmeta.setDisplayName(player);
head.setItemMeta(headmeta);
return head;
}
}