forked from Upstream/CommandPanels
3.12.1 Fixes
This commit is contained in:
parent
5104d8e93f
commit
b87a45130e
@ -1,4 +1,4 @@
|
|||||||
version: 3.12.0
|
version: 3.12.1
|
||||||
main: me.rockyhawk.commandpanels.CommandPanels
|
main: me.rockyhawk.commandpanels.CommandPanels
|
||||||
name: CommandPanels
|
name: CommandPanels
|
||||||
author: RockyHawk
|
author: RockyHawk
|
||||||
|
@ -376,6 +376,12 @@ public class EditorUserInput implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void itemSectionCheck(Player p, String section, String panelName, YamlConfiguration cf, File panelFile, AsyncPlayerChatEvent e){
|
void itemSectionCheck(Player p, String section, String panelName, YamlConfiguration cf, File panelFile, AsyncPlayerChatEvent e){
|
||||||
|
/*
|
||||||
|
I am using : instead of . because the
|
||||||
|
item sections could contain 18.hasperm <- the periods
|
||||||
|
so using a different symbol will help to separate the section from
|
||||||
|
everything else
|
||||||
|
*/
|
||||||
String tag = plugin.config.getString("config.format.tag") + " ";
|
String tag = plugin.config.getString("config.format.tag") + " ";
|
||||||
String itemSlot = section.split("\\:")[1];
|
String itemSlot = section.split("\\:")[1];
|
||||||
String sectionChange = section.replace("item:" + itemSlot + ":","");
|
String sectionChange = section.replace("item:" + itemSlot + ":","");
|
||||||
@ -467,7 +473,7 @@ public class EditorUserInput implements Listener {
|
|||||||
savePanelFile(cf, panelFile);
|
savePanelFile(cf, panelFile);
|
||||||
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Leather armor colour set to " + e.getMessage()));
|
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Leather armor colour set to " + e.getMessage()));
|
||||||
break;
|
break;
|
||||||
case "commands.add":
|
case "commands:add":
|
||||||
List<String> commandsOnOpenAdd = new ArrayList<>();
|
List<String> commandsOnOpenAdd = new ArrayList<>();
|
||||||
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".commands")){
|
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".commands")){
|
||||||
commandsOnOpenAdd = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".commands");
|
commandsOnOpenAdd = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".commands");
|
||||||
@ -477,7 +483,7 @@ public class EditorUserInput implements Listener {
|
|||||||
savePanelFile(cf, panelFile);
|
savePanelFile(cf, panelFile);
|
||||||
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
||||||
break;
|
break;
|
||||||
case "commands.remove":
|
case "commands:remove":
|
||||||
List<String> commandsOnOpenRemove;
|
List<String> commandsOnOpenRemove;
|
||||||
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".commands")){
|
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".commands")){
|
||||||
commandsOnOpenRemove = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".commands");
|
commandsOnOpenRemove = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".commands");
|
||||||
@ -499,7 +505,7 @@ public class EditorUserInput implements Listener {
|
|||||||
savePanelFile(cf, panelFile);
|
savePanelFile(cf, panelFile);
|
||||||
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||||
break;
|
break;
|
||||||
case "lore.add":
|
case "lore:add":
|
||||||
List<String> loreOnOpenAdd = new ArrayList<>();
|
List<String> loreOnOpenAdd = new ArrayList<>();
|
||||||
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".lore")){
|
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".lore")){
|
||||||
loreOnOpenAdd = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".lore");
|
loreOnOpenAdd = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".lore");
|
||||||
@ -509,7 +515,7 @@ public class EditorUserInput implements Listener {
|
|||||||
savePanelFile(cf, panelFile);
|
savePanelFile(cf, panelFile);
|
||||||
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new lore: " + e.getMessage()));
|
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new lore: " + e.getMessage()));
|
||||||
break;
|
break;
|
||||||
case "lore.remove":
|
case "lore:remove":
|
||||||
List<String> loreOnOpenRemove;
|
List<String> loreOnOpenRemove;
|
||||||
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".lore")){
|
if(cf.contains("panels." + panelName + ".item." + itemSlot + ".lore")){
|
||||||
loreOnOpenRemove = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".lore");
|
loreOnOpenRemove = cf.getStringList("panels." + panelName + ".item." + itemSlot + ".lore");
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.inventory.InventoryView;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class EditorUtils implements Listener {
|
public class EditorUtils implements Listener {
|
||||||
@ -261,7 +262,8 @@ public class EditorUtils implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e.getSlotType() != InventoryType.SlotType.CONTAINER){
|
if(e.getClickedInventory().getType() != InventoryType.CHEST){
|
||||||
|
clearTemp(p, panelName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(e.getAction() == InventoryAction.CLONE_STACK){
|
if(e.getAction() == InventoryAction.CLONE_STACK){
|
||||||
@ -274,6 +276,7 @@ public class EditorUtils implements Listener {
|
|||||||
}else if(e.getAction() == InventoryAction.COLLECT_TO_CURSOR){
|
}else if(e.getAction() == InventoryAction.COLLECT_TO_CURSOR){
|
||||||
saveTempItem(e, p, file, panelName);
|
saveTempItem(e, p, file, panelName);
|
||||||
saveFile(fileName,file,true);
|
saveFile(fileName,file,true);
|
||||||
|
removeOldItem(e, p, file, fileName, panelName);
|
||||||
}else if(e.getAction() == InventoryAction.DROP_ALL_CURSOR){
|
}else if(e.getAction() == InventoryAction.DROP_ALL_CURSOR){
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}else if(e.getAction() == InventoryAction.DROP_ALL_SLOT){
|
}else if(e.getAction() == InventoryAction.DROP_ALL_SLOT){
|
||||||
@ -296,6 +299,7 @@ public class EditorUtils implements Listener {
|
|||||||
}else if(e.getAction() == InventoryAction.PICKUP_ALL){
|
}else if(e.getAction() == InventoryAction.PICKUP_ALL){
|
||||||
saveTempItem(e, p, file, panelName);
|
saveTempItem(e, p, file, panelName);
|
||||||
saveFile(fileName,file,true);
|
saveFile(fileName,file,true);
|
||||||
|
removeOldItem(e, p, file, fileName, panelName);
|
||||||
}else if(e.getAction() == InventoryAction.PICKUP_HALF){
|
}else if(e.getAction() == InventoryAction.PICKUP_HALF){
|
||||||
saveTempItem(e, p, file, panelName);
|
saveTempItem(e, p, file, panelName);
|
||||||
saveFile(fileName,file,true);
|
saveFile(fileName,file,true);
|
||||||
@ -690,6 +694,11 @@ public class EditorUtils implements Listener {
|
|||||||
saveFile(fileName, file, true);
|
saveFile(fileName, file, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void removeOldItem(InventoryClickEvent e, Player p, YamlConfiguration file,String fileName, String panelName){
|
||||||
|
//removes the old item from config, if it has been picked up (use this only after saving)
|
||||||
|
file.set("panels." + panelName + ".item." + e.getSlot(),null);
|
||||||
|
saveFile(fileName, file, true);
|
||||||
|
}
|
||||||
public void clearTemp(Player p, String panelName){
|
public void clearTemp(Player p, String panelName){
|
||||||
//empty temp item
|
//empty temp item
|
||||||
tempEdit.set("panels." + panelName + ".temp." + p.getName(),null);
|
tempEdit.set("panels." + panelName + ".temp." + p.getName(),null);
|
||||||
|
Loading…
Reference in New Issue
Block a user