forked from Upstream/CommandPanels
v3.14.4.2
This commit is contained in:
parent
9a1fd4033c
commit
d594054c60
@ -1,11 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="spigot-1.13.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot-1.13.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot/v1_13_R2/spigot-1.13.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot-1.13.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot/v1_13_R2/spigot-1.13.2.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,11 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="spigot-1.16.1">
|
||||
<library name="spigot-1.16.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot-1.16.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot/v1_16_R3/spigot-1.16.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot-1.16.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot/v1_16_R3/spigot-1.16.4.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -11,11 +11,11 @@
|
||||
<orderEntry type="library" name="HeadDatabaseAPI" level="project" />
|
||||
<orderEntry type="library" name="TokenManager-3.2.4" level="project" />
|
||||
<orderEntry type="library" name="Vault" level="project" />
|
||||
<orderEntry type="library" name="spigot-1.16.1" level="project" />
|
||||
<orderEntry type="library" name="spigot-1.13.2" level="project" />
|
||||
<orderEntry type="library" name="PlaceholderAPI-2.10.8" level="project" />
|
||||
<orderEntry type="library" name="VotingPlugin" level="project" />
|
||||
<orderEntry type="library" name="MMOItems-6.5.1" level="project" />
|
||||
<orderEntry type="library" name="MMOLib" level="project" />
|
||||
<orderEntry type="library" name="spigot-1.16.4" level="project" />
|
||||
<orderEntry type="library" name="spigot-1.13.2" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,4 +1,4 @@
|
||||
version: 3.14.4.1
|
||||
version: 3.14.4.2
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
19
resource/template.yml
Normal file
19
resource/template.yml
Normal file
@ -0,0 +1,19 @@
|
||||
# |------------------------------------------------------------------------
|
||||
# | CommandPanels Template File
|
||||
# | By RockyHawk v1.0
|
||||
# | https://www.spigotmc.org/resources/command-panels-custom-guis.67788/
|
||||
# |------------------------------------------------------------------------
|
||||
panels:
|
||||
template:
|
||||
perm: default
|
||||
rows: 1
|
||||
title: '&8Template Panel'
|
||||
empty: GLASS_PANE
|
||||
item:
|
||||
'4':
|
||||
material: COBBLESTONE
|
||||
stack: 1
|
||||
name: '&fClick Me!'
|
||||
commands:
|
||||
- msg= You clicked the item!
|
||||
- cpc
|
@ -1,21 +1,18 @@
|
||||
package me.rockyhawk.commandpanels;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.realized.tokenmanager.api.TokenManager;
|
||||
import me.rockyhawk.commandpanels.classresources.*;
|
||||
import me.rockyhawk.commandpanels.commands.*;
|
||||
import me.rockyhawk.commandpanels.completetabs.CpTabComplete;
|
||||
import me.rockyhawk.commandpanels.customcommands.CommandPlaceholderLoader;
|
||||
import me.rockyhawk.commandpanels.customcommands.Commandpanelcustom;
|
||||
import me.rockyhawk.commandpanels.datamanager.PanelDataLoader;
|
||||
import me.rockyhawk.commandpanels.generatepanels.Commandpanelsgenerate;
|
||||
import me.rockyhawk.commandpanels.generatepanels.GenUtils;
|
||||
import me.rockyhawk.commandpanels.generatepanels.TabCompleteGenerate;
|
||||
@ -71,6 +68,7 @@ public class CommandPanels extends JavaPlugin {
|
||||
|
||||
//get alternate classes
|
||||
public CommandTags commandTags = new CommandTags(this);
|
||||
public PanelDataLoader panelData = new PanelDataLoader(this);
|
||||
public Placeholders placeholders = new Placeholders(this);
|
||||
public OpenEditorGuis editorGuis = new OpenEditorGuis(this);
|
||||
public ExecuteOpenVoids openVoids = new ExecuteOpenVoids(this);
|
||||
@ -86,12 +84,15 @@ public class CommandPanels extends JavaPlugin {
|
||||
|
||||
public File panelsf;
|
||||
public YamlConfiguration blockConfig; //where panel block locations are stored
|
||||
public YamlConfiguration dataConfig; //where arbitrary data is stored for players
|
||||
|
||||
public void onEnable() {
|
||||
Bukkit.getLogger().info("[CommandPanels] RockyHawk's CommandPanels v" + this.getDescription().getVersion() + " Plugin Loading...");
|
||||
|
||||
//register config files
|
||||
this.panelsf = new File(this.getDataFolder() + File.separator + "panels");
|
||||
this.blockConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder() + File.separator + "blocks.yml"));
|
||||
panelData.dataConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder() + File.separator + "data.yml"));
|
||||
this.config = YamlConfiguration.loadConfiguration(new File(this.getDataFolder() + File.separator + "config.yml"));
|
||||
|
||||
//save the config.yml file
|
||||
@ -170,16 +171,18 @@ public class CommandPanels extends JavaPlugin {
|
||||
this.getServer().getPluginManager().registerEvents(new SwapItemEvent(this), this);
|
||||
}
|
||||
|
||||
//save the example.yml file
|
||||
//save the example.yml file and the template.yml file
|
||||
if (!this.panelsf.exists() || Objects.requireNonNull(this.panelsf.list()).length == 0) {
|
||||
try {
|
||||
FileConfiguration exampleFileConfiguration;
|
||||
FileConfiguration templateFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(this.getResource("template.yml")));
|
||||
if(legacy.isLegacy()){
|
||||
exampleFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(this.getResource("exampleLegacy.yml")));
|
||||
}else {
|
||||
exampleFileConfiguration = YamlConfiguration.loadConfiguration(getReaderFromStream(this.getResource("example.yml")));
|
||||
}
|
||||
exampleFileConfiguration.save(new File(this.panelsf + File.separator + "example.yml"));
|
||||
templateFileConfiguration.save(new File(this.panelsf + File.separator + "template.yml"));
|
||||
} catch (IOException var11) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " WARNING: Could not save the example file!");
|
||||
}
|
||||
@ -212,6 +215,7 @@ public class CommandPanels extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
panelData.saveDataFile();
|
||||
if (Objects.requireNonNull(this.config.getString("config.updater.auto-update")).equalsIgnoreCase("true")) {
|
||||
updater.autoUpdatePlugin(this.getFile().getName());
|
||||
}
|
||||
|
@ -41,6 +41,21 @@ public class CommandTags {
|
||||
p.closeInventory();
|
||||
break;
|
||||
}
|
||||
case "set-data=":{
|
||||
//this will overwrite data. set-data= [data point] [data value]
|
||||
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2],true);
|
||||
break;
|
||||
}
|
||||
case "add-data=":{
|
||||
//this will not overwrite existing data. add-data= [data point] [data value]
|
||||
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2],false);
|
||||
break;
|
||||
}
|
||||
case "del-data=":{
|
||||
//this will remove data. del-data= [data point]
|
||||
plugin.panelData.delUserData(p.getUniqueId(),command.split("\\s")[1]);
|
||||
break;
|
||||
}
|
||||
case "open=":{
|
||||
//if player uses open= it will open the panel, with the option to add custom placeholders
|
||||
String panelName = commandRAW.split("\\s")[1];
|
||||
@ -560,7 +575,7 @@ public class CommandTags {
|
||||
//create the item to be removed
|
||||
ItemStack sellItem;
|
||||
if(command.split("\\s").length == 2) {
|
||||
sellItem = plugin.itemCreate.makeItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, true);
|
||||
sellItem = plugin.itemCreate.makeItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, false);
|
||||
}else{
|
||||
sellItem = new ItemStack(Objects.requireNonNull(Material.matchMaterial(command.split("\\s")[1])), Integer.parseInt(command.split("\\s")[2]), id);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class ExecuteOpenVoids {
|
||||
}
|
||||
ItemStack s;
|
||||
try {
|
||||
s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(cf.getConfigurationSection("open-with-item")), p, false, true, true);
|
||||
s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(cf.getConfigurationSection("open-with-item")), p, false, true, false);
|
||||
}catch(Exception n){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " open-with-item: material"));
|
||||
return;
|
||||
|
@ -2,6 +2,7 @@ package me.rockyhawk.commandpanels.classresources;
|
||||
|
||||
import me.arcaniax.hdb.api.HeadDatabaseAPI;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.ioclasses.NBTEditor;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
import net.Indyuce.mmoitems.manager.ItemManager;
|
||||
@ -36,7 +37,7 @@ public class ItemCreation {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ItemStack makeItemFromConfig(ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours, boolean hideAttributes){
|
||||
public ItemStack makeItemFromConfig(ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours, boolean addNBT){
|
||||
String material = plugin.papiNoColour(p,itemSection.getString("material"));
|
||||
try {
|
||||
if (Objects.requireNonNull(material).equalsIgnoreCase("AIR")) {
|
||||
@ -48,6 +49,7 @@ public class ItemCreation {
|
||||
return null;
|
||||
}
|
||||
ItemStack s = null;
|
||||
boolean hideAttributes = true;
|
||||
String mat;
|
||||
String matraw;
|
||||
String skullname;
|
||||
@ -162,9 +164,19 @@ public class ItemCreation {
|
||||
//itemType values
|
||||
if(itemSection.contains("itemType")){
|
||||
//if hidden, reverse
|
||||
if(itemSection.getStringList("itemType").contains("attributes")){
|
||||
hideAttributes = !hideAttributes;
|
||||
if(itemSection.getStringList("itemType").contains("noAttributes")){
|
||||
hideAttributes = false;
|
||||
}
|
||||
if(itemSection.getStringList("itemType").contains("noNBT")){
|
||||
addNBT = false;
|
||||
}
|
||||
if(itemSection.getStringList("itemType").contains("placeable")){
|
||||
addNBT = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(addNBT){
|
||||
s = NBTEditor.set(s,"CommandPanels","plugin");
|
||||
}
|
||||
|
||||
if (itemSection.contains("map")) {
|
||||
|
@ -38,7 +38,7 @@ public class OpenEditorGuis {
|
||||
panelNames.add(plugin.papi( key));
|
||||
panelTitles.add(plugin.papi( Objects.requireNonNull(temp.getString("panels." + key + ".title"))));
|
||||
if (temp.contains("panels." + key + ".open-with-item.material")) {
|
||||
panelItems.add(plugin.itemCreate.makeItemFromConfig(temp.getConfigurationSection("panels." + key + ".open-with-item"), p, false, true, true));
|
||||
panelItems.add(plugin.itemCreate.makeItemFromConfig(temp.getConfigurationSection("panels." + key + ".open-with-item"), p, false, true, false));
|
||||
} else {
|
||||
panelItems.add(new ItemStack(Material.PAPER));
|
||||
}
|
||||
@ -268,7 +268,7 @@ public class OpenEditorGuis {
|
||||
|
||||
if(cf.contains("open-with-item.material")){
|
||||
hotbarItems = true;
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf.getConfigurationSection("open-with-item"), p, false, true, true);
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf.getConfigurationSection("open-with-item"), p, false, true, false);
|
||||
}else{
|
||||
temp = new ItemStack(Material.REDSTONE_BLOCK, 1);
|
||||
}
|
||||
@ -505,7 +505,7 @@ public class OpenEditorGuis {
|
||||
plugin.setName(temp, ChatColor.RED + "Back", null, p, true, true, true);
|
||||
i.setItem(27, temp);
|
||||
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf,p,false,false, true);
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf,p,false,false, false);
|
||||
lore.clear();
|
||||
lore.add(ChatColor.GRAY + "Click to set custom material");
|
||||
lore.add(ChatColor.GRAY + "typically for custom heads");
|
||||
@ -544,7 +544,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "Compare: " + ChatColor.GRAY + cf.getString(section + ".compare"));
|
||||
}
|
||||
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf.getConfigurationSection(section),p,false,false, true);
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf.getConfigurationSection(section),p,false,false, false);
|
||||
plugin.setName(temp, ChatColor.AQUA + section, lore, p,false, true, true);
|
||||
i.setItem(slot, temp);
|
||||
slot++;
|
||||
|
@ -136,7 +136,7 @@ public class Placeholders {
|
||||
|
||||
try {
|
||||
//if it is a regular custom item
|
||||
ItemStack confItm = plugin.itemCreate.makeItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfigurationSection("custom-item." + matLoc),p,true,true, true);
|
||||
ItemStack confItm = plugin.itemCreate.makeItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfigurationSection("custom-item." + matLoc),p,true,true, false);
|
||||
if(plugin.itemCreate.isIdentical(confItm,itm)){
|
||||
isIdentical = true;
|
||||
}
|
||||
@ -176,6 +176,19 @@ public class Placeholders {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//returns value of stored data
|
||||
while (str.contains("%cp-data-")) {
|
||||
try {
|
||||
int start = str.indexOf("%cp-data-");
|
||||
int end = str.indexOf("%", str.indexOf("%cp-data-") + 1);
|
||||
String dataPoint = str.substring(start, end).replace("%cp-data-", "").replace("%", "");
|
||||
str = str.replace(str.substring(start, end) + "%", plugin.panelData.getUserData(p.getUniqueId(),dataPoint));
|
||||
}catch (Exception ex){
|
||||
plugin.debug(ex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//checks for players online
|
||||
while (str.contains("%cp-player-online-")) {
|
||||
try {
|
||||
int start = str.indexOf("%cp-player-online-");
|
||||
|
@ -40,10 +40,11 @@ public class Commandpanel implements CommandExecutor {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
|
||||
return true;
|
||||
}
|
||||
boolean disableCommand = false;
|
||||
if(cf.contains("panelType")) {
|
||||
if (cf.getStringList("panelType").contains("nocommand")) {
|
||||
//do not allow command with noCommand
|
||||
return true;
|
||||
disableCommand = true;
|
||||
}
|
||||
}
|
||||
//below will start the command, once it got the right file and panel
|
||||
@ -55,7 +56,9 @@ public class Commandpanel implements CommandExecutor {
|
||||
if(plugin.openPanels.hasPanelOpen(plugin.getServer().getPlayer(args[1]).getName())) {
|
||||
plugin.openPanels.skipPanels.add(plugin.getServer().getPlayer(args[1]).getName());
|
||||
}
|
||||
plugin.openVoids.openCommandPanel(sender,plugin.getServer().getPlayer(args[1]),panelName,cf,true);
|
||||
if(!disableCommand) {
|
||||
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panelName, cf, true);
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> [item] [player]"));
|
||||
}
|
||||
@ -79,7 +82,9 @@ public class Commandpanel implements CommandExecutor {
|
||||
if(plugin.openPanels.hasPanelOpen(p.getName())) {
|
||||
plugin.openPanels.skipPanels.add(p.getName());
|
||||
}
|
||||
plugin.openVoids.openCommandPanel(sender, p, panelName, cf,false);
|
||||
if(!disableCommand) {
|
||||
plugin.openVoids.openCommandPanel(sender, p, panelName, cf, false);
|
||||
}
|
||||
return true;
|
||||
}else if(args.length == 2){
|
||||
if (args[1].equals("item")) {
|
||||
@ -88,7 +93,9 @@ public class Commandpanel implements CommandExecutor {
|
||||
if(plugin.openPanels.hasPanelOpen(plugin.getServer().getPlayer(args[1]).getName())) {
|
||||
plugin.openPanels.skipPanels.add(plugin.getServer().getPlayer(args[1]).getName());
|
||||
}
|
||||
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panelName, cf,true);
|
||||
if(!disableCommand) {
|
||||
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panelName, cf, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}else if(args.length == 3){
|
||||
|
@ -0,0 +1,40 @@
|
||||
package me.rockyhawk.commandpanels.datamanager;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class PanelDataLoader {
|
||||
CommandPanels plugin;
|
||||
public PanelDataLoader(CommandPanels pl) {
|
||||
this.plugin = pl;
|
||||
}
|
||||
public YamlConfiguration dataConfig;
|
||||
|
||||
public String getUserData(UUID playerUUID, String dataPoint){
|
||||
return dataConfig.getString("playerData." + playerUUID + "." + dataPoint);
|
||||
}
|
||||
|
||||
public void setUserData(UUID playerUUID, String dataPoint, String dataValue, boolean overwrite){
|
||||
if(!overwrite && dataConfig.isSet("playerData." + playerUUID + "." + dataPoint)){
|
||||
return;
|
||||
}
|
||||
dataConfig.set("playerData." + playerUUID + "." + dataPoint, dataValue);
|
||||
}
|
||||
|
||||
public void delUserData(UUID playerUUID, String dataPoint){
|
||||
dataConfig.set("playerData." + playerUUID + "." + dataPoint, null);
|
||||
}
|
||||
|
||||
public void saveDataFile(){
|
||||
try {
|
||||
dataConfig.save(plugin.getDataFolder() + File.separator + "data.yml");
|
||||
} catch (IOException s) {
|
||||
s.printStackTrace();
|
||||
plugin.debug(s);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package me.rockyhawk.commandpanels.interactives;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.ioclasses.NBTEditor;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
@ -26,13 +27,7 @@ public class Commandpanelrefresher implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
HumanEntity h = e.getPlayer();
|
||||
Player p;
|
||||
if (h instanceof Player) {
|
||||
p = Bukkit.getPlayer(h.getName());
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
Player p = (Player) e.getPlayer();
|
||||
|
||||
if(!plugin.openPanels.hasPanelOpen(p.getName())){
|
||||
return;
|
||||
@ -106,30 +101,11 @@ public class Commandpanelrefresher implements Listener {
|
||||
p.updateInventory();
|
||||
for (ItemStack playerContent : plugin.legacy.getStorageContents(p.getInventory())) {
|
||||
//ensure the panel item is not a placeable item
|
||||
int itemSlot = 0;
|
||||
for (ItemStack panelContent : panelItemList) {
|
||||
if(cf.getStringList("item." + itemSlot + ".itemType").contains("placeable")){
|
||||
continue;
|
||||
try {
|
||||
if (NBTEditor.getString(playerContent, "plugin").equalsIgnoreCase("CommandPanels")) {
|
||||
p.getInventory().removeItem(playerContent);
|
||||
}
|
||||
if (playerContent != null && panelContent != null) {
|
||||
if (!playerContent.getType().equals(Material.matchMaterial("AIR")) && !panelContent.getType().equals(Material.matchMaterial("AIR"))) {
|
||||
if (playerContent.equals(panelContent)) {
|
||||
boolean isOriginal = false;
|
||||
for (ItemStack playerOriginalContent : playerItemList) {
|
||||
if (playerOriginalContent != null && !playerOriginalContent.getType().equals(Material.matchMaterial("AIR"))) {
|
||||
if (playerContent.equals(playerOriginalContent)) {
|
||||
isOriginal = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isOriginal) {
|
||||
p.getInventory().removeItem(playerContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemSlot++;
|
||||
}
|
||||
}catch(Exception ignore){}
|
||||
}
|
||||
}catch(Exception e){
|
||||
//oof
|
||||
|
1427
src/me/rockyhawk/commandpanels/ioclasses/NBTEditor.java
Normal file
1427
src/me/rockyhawk/commandpanels/ioclasses/NBTEditor.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
package me.rockyhawk.commandpanels.openpanelsmanager;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.ioclasses.NBTEditor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -136,6 +137,7 @@ public class OpenGUI {
|
||||
id = Short.parseShort(pconfig.getString("emptyID"));
|
||||
}
|
||||
empty = new ItemStack(Objects.requireNonNull(Material.matchMaterial(Objects.requireNonNull(pconfig.getString("empty")).toUpperCase())), 1,id);
|
||||
empty = NBTEditor.set(empty,"CommandPanels","plugin");
|
||||
if (empty.getType() == Material.AIR) {
|
||||
continue;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class HotbarItemLoader {
|
||||
}
|
||||
}
|
||||
if(tempFile.contains("open-with-item")){
|
||||
ItemStack panelItem = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(tempFile.getConfigurationSection("open-with-item")), p, false, true, true);
|
||||
ItemStack panelItem = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(tempFile.getConfigurationSection("open-with-item")), p, false, true, false);
|
||||
if(invItem != null && panelItem != null) {
|
||||
panelItem.setAmount(invItem.getAmount());
|
||||
}else{
|
||||
|
@ -111,7 +111,7 @@ public class UtilsOpenWithItem implements Listener {
|
||||
}
|
||||
}
|
||||
if (p.hasPermission("commandpanel.panel." + temp.getString("panels." + key + ".perm")) && temp.contains("panels." + key + ".open-with-item")) {
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, true);
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, false);
|
||||
if(temp.contains("panels." + key + ".open-with-item.stationary")) {
|
||||
if (0 <= Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary"))) && 33 >= Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary")))) {
|
||||
p.getInventory().setItem(Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary"))), s);
|
||||
@ -153,7 +153,7 @@ public class UtilsOpenWithItem implements Listener {
|
||||
}
|
||||
}
|
||||
if (p.hasPermission("commandpanel.panel." + temp.getString("panels." + key + ".perm")) && temp.contains("panels." + key + ".open-with-item")) {
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, true);
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, false);
|
||||
if(temp.contains("panels." + key + ".open-with-item.stationary") && 0 <= Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary"))) && 33 >= Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary")))){
|
||||
p.getInventory().setItem(Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary"))), s);
|
||||
}
|
||||
@ -187,7 +187,7 @@ public class UtilsOpenWithItem implements Listener {
|
||||
key = (String) var10.next();
|
||||
if (p.hasPermission("commandpanel.panel." + temp.getString("panels." + key + ".perm")) && temp.contains("panels." + key + ".open-with-item")) {
|
||||
if(temp.contains("panels." + key + ".open-with-item.stationary")){
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, true);
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, false);
|
||||
e.getDrops().remove(s);
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,7 @@ public class UtilsOpenWithItem implements Listener {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, true);
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(temp.getConfigurationSection("panels." + key + ".open-with-item")), p, false, true, false);
|
||||
if(temp.contains("panels." + key + ".open-with-item.stationary") && 0 <= Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary"))) && 33 >= Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary")))){
|
||||
p.getInventory().setItem(Integer.parseInt(Objects.requireNonNull(temp.getString("panels." + key + ".open-with-item.stationary"))), s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user