2.6.1
This commit is contained in:
parent
e98c047ff0
commit
92d4c86aa0
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>CommandGUI_V2</artifactId>
|
<artifactId>CommandGUI_V2</artifactId>
|
||||||
<version>2.6.0</version>
|
<version>2.6.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CommandGUI</name>
|
<name>CommandGUI</name>
|
||||||
|
@ -48,10 +48,10 @@ public class GUI_Listener implements Listener {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (e.getSlot() == slot.Slot) {
|
if (e.getSlot() == slot.Slot) {
|
||||||
|
if (!slot.Perm
|
||||||
if (!slot.Perm || player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
||||||
|
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1) + ".use")
|
||||||
|| player.hasPermission("commandgui.admin")) {
|
|| player.hasPermission("commandgui.admin")) {
|
||||||
|
|
||||||
if (slot.Enable) {
|
if (slot.Enable) {
|
||||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) {
|
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) {
|
||||||
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
|
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
|
||||||
|
@ -90,47 +90,25 @@ public class OpenGUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Slot slot : gui.GUI_Slots) {
|
for (Slot slot : gui.GUI_Slots) {
|
||||||
if (slot.Enable) {
|
if (!slot.Perm
|
||||||
if (slot.Empty) {
|
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
||||||
ItemStack air = new ItemStack(Material.AIR);
|
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1)+".see")
|
||||||
inventory.setItem(slot.Slot, air);
|
|| player.hasPermission("commandgui.admin")) {
|
||||||
} else {
|
if (slot.Enable) {
|
||||||
if (slot.PlayerHead_Enable) {
|
if (slot.Empty) {
|
||||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
ItemStack air = new ItemStack(Material.AIR);
|
||||||
send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
inventory.setItem(slot.Slot, air);
|
||||||
send.error(plugin, "Playerheads are only available from version 1.13!");
|
} else {
|
||||||
send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
if (slot.PlayerHead_Enable) {
|
||||||
} else {
|
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||||
ItemStack item = ItemVersion.getHeadIS();
|
send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
send.error(plugin, "Playerheads are only available from version 1.13!");
|
||||||
if (slot.Base64_Enable) {
|
send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||||
|
|
||||||
if (Main.PaPi) {
|
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
|
||||||
} else {
|
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
|
||||||
}
|
|
||||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
|
||||||
profile.getProperties().put("textures", new Property("textures", slot.Base64Value));
|
|
||||||
Field profileField = null;
|
|
||||||
try {
|
|
||||||
profileField = itemMeta.getClass().getDeclaredField("profile");
|
|
||||||
profileField.setAccessible(true);
|
|
||||||
profileField.set(itemMeta, profile);
|
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
item.setItemMeta(itemMeta);
|
|
||||||
Integer am;
|
|
||||||
if (slot.ItemAmount == 0) {
|
|
||||||
am = 1;
|
|
||||||
} else am = slot.ItemAmount;
|
|
||||||
item.setAmount(am);
|
|
||||||
inventory.setItem(slot.Slot, item);
|
|
||||||
} else {
|
} else {
|
||||||
if (slot.PlayerWhoHasOpenedTheGUI) {
|
ItemStack item = ItemVersion.getHeadIS();
|
||||||
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
|
if (slot.Base64_Enable) {
|
||||||
|
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
@ -138,7 +116,16 @@ public class OpenGUI {
|
|||||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
}
|
}
|
||||||
itemMeta.setOwner(player.getName());
|
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||||
|
profile.getProperties().put("textures", new Property("textures", slot.Base64Value));
|
||||||
|
Field profileField = null;
|
||||||
|
try {
|
||||||
|
profileField = itemMeta.getClass().getDeclaredField("profile");
|
||||||
|
profileField.setAccessible(true);
|
||||||
|
profileField.set(itemMeta, profile);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
Integer am;
|
Integer am;
|
||||||
if (slot.ItemAmount == 0) {
|
if (slot.ItemAmount == 0) {
|
||||||
@ -147,46 +134,63 @@ public class OpenGUI {
|
|||||||
item.setAmount(am);
|
item.setAmount(am);
|
||||||
inventory.setItem(slot.Slot, item);
|
inventory.setItem(slot.Slot, item);
|
||||||
} else {
|
} else {
|
||||||
if (Main.PaPi) {
|
if (slot.PlayerWhoHasOpenedTheGUI) {
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
if (Main.PaPi) {
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||||
|
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
|
} else {
|
||||||
|
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||||
|
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
|
}
|
||||||
|
itemMeta.setOwner(player.getName());
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
Integer am;
|
||||||
|
if (slot.ItemAmount == 0) {
|
||||||
|
am = 1;
|
||||||
|
} else am = slot.ItemAmount;
|
||||||
|
item.setAmount(am);
|
||||||
|
inventory.setItem(slot.Slot, item);
|
||||||
} else {
|
} else {
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
if (Main.PaPi) {
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||||
|
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
|
} else {
|
||||||
|
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||||
|
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
|
}
|
||||||
|
itemMeta.setOwner(slot.PlayerName);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
Integer am;
|
||||||
|
if (slot.ItemAmount == 0) {
|
||||||
|
am = 1;
|
||||||
|
} else am = slot.ItemAmount;
|
||||||
|
item.setAmount(am);
|
||||||
|
inventory.setItem(slot.Slot, item);
|
||||||
}
|
}
|
||||||
itemMeta.setOwner(slot.PlayerName);
|
|
||||||
item.setItemMeta(itemMeta);
|
|
||||||
Integer am;
|
|
||||||
if (slot.ItemAmount == 0) {
|
|
||||||
am = 1;
|
|
||||||
} else am = slot.ItemAmount;
|
|
||||||
item.setAmount(am);
|
|
||||||
inventory.setItem(slot.Slot, item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ItemStack item = new ItemStack(Material.valueOf(slot.Item.toUpperCase().replace(".", "_")));
|
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
|
||||||
if (Main.PaPi) {
|
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
|
||||||
} else {
|
} else {
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
ItemStack item = new ItemStack(Material.valueOf(slot.Item.toUpperCase().replace(".", "_")));
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
if (Main.PaPi) {
|
||||||
|
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||||
|
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
|
} else {
|
||||||
|
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||||
|
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||||
|
}
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
Integer am;
|
||||||
|
if (slot.ItemAmount == 0) {
|
||||||
|
am = 1;
|
||||||
|
} else am = slot.ItemAmount;
|
||||||
|
item.setAmount(am);
|
||||||
|
inventory.setItem(slot.Slot, item);
|
||||||
}
|
}
|
||||||
item.setItemMeta(itemMeta);
|
|
||||||
Integer am;
|
|
||||||
if (slot.ItemAmount == 0) {
|
|
||||||
am = 1;
|
|
||||||
} else am = slot.ItemAmount;
|
|
||||||
item.setAmount(am);
|
|
||||||
inventory.setItem(slot.Slot, item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.openInventory(inventory);
|
player.openInventory(inventory);
|
||||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));
|
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));
|
||||||
|
Loading…
Reference in New Issue
Block a user