3.9.4 Changes

This commit is contained in:
rockyhawk64 2020-08-20 18:11:48 +10:00
parent 613ad0a9b2
commit 677d7d92bd
7 changed files with 63 additions and 14 deletions

View File

@ -0,0 +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!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/spigot-1.13.2.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -12,7 +12,8 @@
<orderEntry type="library" name="TokenManager-3.2.4" level="project" />
<orderEntry type="library" name="Vault" level="project" />
<orderEntry type="library" name="VotingPlugin" level="project" />
<orderEntry type="library" name="spigot-1.16.1" level="project" />
<orderEntry type="library" name="PlaceholderAPI-2.10.8" level="project" />
<orderEntry type="library" name="spigot-1.16.1" level="project" />
<orderEntry type="library" name="spigot-1.13.2" level="project" />
</component>
</module>

View File

@ -1,4 +1,4 @@
version: 3.9.3
version: 3.9.4
main: me.rockyhawk.commandPanels.commandpanels
name: CommandPanels
author: RockyHawk

View File

@ -29,6 +29,8 @@ import me.rockyhawk.commandPanels.ingameEditor.cpIngameEditCommand;
import me.rockyhawk.commandPanels.ingameEditor.cpTabCompleteIngame;
import me.rockyhawk.commandPanels.ingameEditor.editorUserInput;
import me.rockyhawk.commandPanels.ingameEditor.editorUtils;
import me.rockyhawk.commandPanels.ioClasses.sequence_1_13;
import me.rockyhawk.commandPanels.ioClasses.sequence_1_14;
import me.rockyhawk.commandPanels.openWithItem.utilsOpenWithItem;
import me.rockyhawk.commandPanels.panelBlocks.blocksTabComplete;
import me.rockyhawk.commandPanels.panelBlocks.commandpanelblocks;
@ -41,8 +43,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils;
import org.bukkit.craftbukkit.libs.org.apache.commons.io.input.CharSequenceReader;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.entity.Player;
@ -1550,8 +1550,11 @@ public class commandpanels extends JavaPlugin {
public Reader getReaderFromStream(InputStream initialStream) throws IOException {
//this reads the encrypted resource files in the jar file
byte[] buffer = IOUtils.toByteArray(initialStream);
return new CharSequenceReader(new String(buffer));
if(Bukkit.getVersion().contains("1.13")){
return new sequence_1_13().getReaderFromStream(initialStream);
}else{
return new sequence_1_14().getReaderFromStream(initialStream);
}
}
public String githubNewUpdate(boolean sendMessages){

View File

@ -203,9 +203,9 @@ public class editorUtils implements Listener {
if(!p.getOpenInventory().getTitle().contains(ChatColor.GRAY + "Editing Panel:")){
return;
}
String panelName = ""; //all panels from ALL files (panel names)
File fileName = null; //all panels from ALL files (panel names)
YamlConfiguration file = new YamlConfiguration(); //all panels from ALL files (panel yaml files)
String panelName = "";
String fileName = "";
YamlConfiguration file = new YamlConfiguration();
boolean found = false;
try {
//neew to loop through files to get file names
@ -219,7 +219,7 @@ public class editorUtils implements Listener {
key = s;
if (e.getView().getTitle().equals(ChatColor.GRAY + "Editing Panel: " + plugin.papi( Objects.requireNonNull(temp.getString("panels." + key + ".title"))))) {
panelName = key;
fileName = new File(plugin.panelsf + File.separator + tempName);
fileName = tempName;
file = temp;
found = true;
break;
@ -250,7 +250,7 @@ public class editorUtils implements Listener {
onEditPanelClose(p,e.getInventory(),e.getView());
inventoryItemSettingsOpening.add(p.getName());
//refresh the yaml config
file = YamlConfiguration.loadConfiguration(fileName);
file = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
plugin.openItemSettings(p,panelName,file,e.getSlot());
return;
}
@ -265,7 +265,7 @@ public class editorUtils implements Listener {
if(e.getAction() == InventoryAction.CLONE_STACK){
saveTempItem(e, p, file, panelName);
}else if(e.getAction() == InventoryAction.PLACE_ALL){
loadTempItem(e, p, file, fileName.getName(), panelName);
loadTempItem(e, p, file, fileName, panelName);
clearTemp(p, panelName);
}else if(e.getAction() == InventoryAction.COLLECT_TO_CURSOR){
//e.setCancelled(true);
@ -285,7 +285,7 @@ public class editorUtils implements Listener {
}else if(e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY){
e.setCancelled(true);
}else if(e.getAction() == InventoryAction.PLACE_SOME){
loadTempItem(e, p, file, fileName.getName(), panelName);
loadTempItem(e, p, file, fileName, panelName);
}else if(e.getAction() == InventoryAction.SWAP_WITH_CURSOR){
e.setCancelled(true);
}else if(e.getAction() == InventoryAction.PICKUP_ALL){
@ -297,7 +297,7 @@ public class editorUtils implements Listener {
}else if(e.getAction() == InventoryAction.PICKUP_SOME){
saveTempItem(e, p, file, panelName);
}else if(e.getAction() == InventoryAction.PLACE_ONE){
loadTempItem(e, p, file, fileName.getName(), panelName);
loadTempItem(e, p, file, fileName, panelName);
}
}
@EventHandler

View File

@ -0,0 +1,17 @@
package me.rockyhawk.commandPanels.ioClasses;
//1.13 Imports
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.input.CharSequenceReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
public class sequence_1_13{
public Reader getReaderFromStream(InputStream initialStream) throws IOException {
//this reads the encrypted resource files in the jar file
byte[] buffer = IOUtils.toByteArray(initialStream);
return new CharSequenceReader(new String(buffer));
}
}

View File

@ -0,0 +1,17 @@
package me.rockyhawk.commandPanels.ioClasses;
//1.14+ Imports
import org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils;
import org.bukkit.craftbukkit.libs.org.apache.commons.io.input.CharSequenceReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
public class sequence_1_14{
public Reader getReaderFromStream(InputStream initialStream) throws IOException {
//this reads the encrypted resource files in the jar file
byte[] buffer = IOUtils.toByteArray(initialStream);
return new CharSequenceReader(new String(buffer));
}
}