Compare commits
4 Commits
59133a36f9
...
f8619e4802
Author | SHA1 | Date | |
---|---|---|---|
f8619e4802 | |||
e97fadfbec | |||
567b0a2442 | |||
7b04697895 |
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>15.4</version>
|
||||
<version>15.6_dev-3</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
|
@ -52,6 +52,20 @@ public class T2CitemBuilder {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void setItem(Integer slot, Integer amount, String material, String displayName, List<String> lore, Inventory inventory) {
|
||||
ItemStack item;
|
||||
if (getLegacy && material.contains(",")) {
|
||||
String[] split = material.split(",");
|
||||
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||
} else item = new ItemStack(Material.valueOf(material));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
item.setAmount(amount);
|
||||
inventory.setItem(slot, item);
|
||||
}
|
||||
|
||||
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
|
||||
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
||||
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
|
@ -1,76 +1,54 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.items;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class T2CitemVersion {
|
||||
@Getter
|
||||
private static Material Head;
|
||||
@Getter
|
||||
private static ItemStack HeadIS;
|
||||
private static ItemStack CRAFTING_TABLE;
|
||||
private static ItemStack YELLOW_WOOL;
|
||||
private static ItemStack ORANGE_WOOL;
|
||||
private static ItemStack GREEN_WOOL;
|
||||
private static ItemStack GRAY_WOOL;
|
||||
private static ItemStack RED_WOOL;
|
||||
private static ItemStack RED_STAINED_GLASS_PANE;
|
||||
@Getter
|
||||
private static ItemStack CraftingTable;
|
||||
@Getter
|
||||
private static ItemStack YellowWool;
|
||||
@Getter
|
||||
private static ItemStack OrangeWool;
|
||||
@Getter
|
||||
private static ItemStack GreenWool;
|
||||
@Getter
|
||||
private static ItemStack GrayWool;
|
||||
@Getter
|
||||
private static ItemStack RedWool;
|
||||
@Getter
|
||||
private static ItemStack RedStainedGlassPane;
|
||||
@Getter
|
||||
private static ItemStack BlackStainedGlassPane;
|
||||
|
||||
public static void scan() {
|
||||
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||
Head = Material.valueOf("SKULL_ITEM");
|
||||
YELLOW_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);
|
||||
ORANGE_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
|
||||
GREEN_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
|
||||
GRAY_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
|
||||
RED_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
|
||||
RED_STAINED_GLASS_PANE = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
|
||||
CRAFTING_TABLE = new ItemStack(Material.valueOf("WORKBENCH"));
|
||||
YellowWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);
|
||||
OrangeWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
|
||||
GreenWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
|
||||
GrayWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
|
||||
RedWool = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
|
||||
RedStainedGlassPane = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
|
||||
BlackStainedGlassPane = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 15);
|
||||
CraftingTable = new ItemStack(Material.valueOf("WORKBENCH"));
|
||||
} else {
|
||||
Head = Material.valueOf("PLAYER_HEAD");
|
||||
CRAFTING_TABLE = new ItemStack(Material.CRAFTING_TABLE);
|
||||
YELLOW_WOOL = new ItemStack(Material.YELLOW_WOOL);
|
||||
ORANGE_WOOL = new ItemStack(Material.ORANGE_WOOL);
|
||||
GREEN_WOOL = new ItemStack(Material.GREEN_WOOL);
|
||||
GRAY_WOOL = new ItemStack(Material.GRAY_WOOL);
|
||||
RED_WOOL = new ItemStack(Material.RED_WOOL);
|
||||
RED_STAINED_GLASS_PANE = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
CraftingTable = new ItemStack(Material.CRAFTING_TABLE);
|
||||
YellowWool = new ItemStack(Material.YELLOW_WOOL);
|
||||
OrangeWool = new ItemStack(Material.ORANGE_WOOL);
|
||||
GreenWool = new ItemStack(Material.GREEN_WOOL);
|
||||
GrayWool = new ItemStack(Material.GRAY_WOOL);
|
||||
RedWool = new ItemStack(Material.RED_WOOL);
|
||||
RedStainedGlassPane = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
BlackStainedGlassPane = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
|
||||
}
|
||||
HeadIS = new ItemStack(Head, 1, (byte) 3);
|
||||
}
|
||||
|
||||
public static Material getHead() {
|
||||
return Head;
|
||||
}
|
||||
|
||||
public static ItemStack getHeadIS() {
|
||||
return HeadIS;
|
||||
}
|
||||
|
||||
public static ItemStack getCraftingTable() {
|
||||
return CRAFTING_TABLE;
|
||||
}
|
||||
|
||||
public static ItemStack getYellowWool() {
|
||||
return YELLOW_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getOrangeWool() {
|
||||
return ORANGE_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getGreenWool() {
|
||||
return GREEN_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getGrayWool() {
|
||||
return GRAY_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getRedWool() {
|
||||
return RED_WOOL;
|
||||
}
|
||||
|
||||
public static ItemStack getRedStainedGlassPane() {
|
||||
return RED_STAINED_GLASS_PANE;
|
||||
}
|
||||
}
|
||||
|
@ -171,4 +171,19 @@ public class T2Creplace {
|
||||
.replace("&o", "<italic>").replace("§o", "<italic>")
|
||||
.replace("&r", "<reset>").replace("§r", "<reset>");
|
||||
}
|
||||
|
||||
public static Object replace(Object object,String placeholder,String replacement) {
|
||||
if (object instanceof String) {
|
||||
object = ((String) object).replace(placeholder, replacement);
|
||||
}
|
||||
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
output.add(input.replace(placeholder, replacement));
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ public class T2Ctemplate {
|
||||
T2Csend.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_, String v) {
|
||||
onLoadFooter(prefix,long_);
|
||||
}
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
Loading…
Reference in New Issue
Block a user