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="TokenManager-3.2.4" level="project" />
<orderEntry type="library" name="Vault" level="project" /> <orderEntry type="library" name="Vault" level="project" />
<orderEntry type="library" name="VotingPlugin" 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="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> </component>
</module> </module>

View File

@ -1,4 +1,4 @@
version: 3.9.3 version: 3.9.4
main: me.rockyhawk.commandPanels.commandpanels main: me.rockyhawk.commandPanels.commandpanels
name: CommandPanels name: CommandPanels
author: RockyHawk 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.cpTabCompleteIngame;
import me.rockyhawk.commandPanels.ingameEditor.editorUserInput; import me.rockyhawk.commandPanels.ingameEditor.editorUserInput;
import me.rockyhawk.commandPanels.ingameEditor.editorUtils; 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.openWithItem.utilsOpenWithItem;
import me.rockyhawk.commandPanels.panelBlocks.blocksTabComplete; import me.rockyhawk.commandPanels.panelBlocks.blocksTabComplete;
import me.rockyhawk.commandPanels.panelBlocks.commandpanelblocks; import me.rockyhawk.commandPanels.panelBlocks.commandpanelblocks;
@ -41,8 +43,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; 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.enchantments.Enchantment;
import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.Damageable;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -1550,8 +1550,11 @@ public class commandpanels extends JavaPlugin {
public Reader getReaderFromStream(InputStream initialStream) throws IOException { public Reader getReaderFromStream(InputStream initialStream) throws IOException {
//this reads the encrypted resource files in the jar file //this reads the encrypted resource files in the jar file
byte[] buffer = IOUtils.toByteArray(initialStream); if(Bukkit.getVersion().contains("1.13")){
return new CharSequenceReader(new String(buffer)); return new sequence_1_13().getReaderFromStream(initialStream);
}else{
return new sequence_1_14().getReaderFromStream(initialStream);
}
} }
public String githubNewUpdate(boolean sendMessages){ 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:")){ if(!p.getOpenInventory().getTitle().contains(ChatColor.GRAY + "Editing Panel:")){
return; return;
} }
String panelName = ""; //all panels from ALL files (panel names) String panelName = "";
File fileName = null; //all panels from ALL files (panel names) String fileName = "";
YamlConfiguration file = new YamlConfiguration(); //all panels from ALL files (panel yaml files) YamlConfiguration file = new YamlConfiguration();
boolean found = false; boolean found = false;
try { try {
//neew to loop through files to get file names //neew to loop through files to get file names
@ -219,7 +219,7 @@ public class editorUtils implements Listener {
key = s; key = s;
if (e.getView().getTitle().equals(ChatColor.GRAY + "Editing Panel: " + plugin.papi( Objects.requireNonNull(temp.getString("panels." + key + ".title"))))) { if (e.getView().getTitle().equals(ChatColor.GRAY + "Editing Panel: " + plugin.papi( Objects.requireNonNull(temp.getString("panels." + key + ".title"))))) {
panelName = key; panelName = key;
fileName = new File(plugin.panelsf + File.separator + tempName); fileName = tempName;
file = temp; file = temp;
found = true; found = true;
break; break;
@ -250,7 +250,7 @@ public class editorUtils implements Listener {
onEditPanelClose(p,e.getInventory(),e.getView()); onEditPanelClose(p,e.getInventory(),e.getView());
inventoryItemSettingsOpening.add(p.getName()); inventoryItemSettingsOpening.add(p.getName());
//refresh the yaml config //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()); plugin.openItemSettings(p,panelName,file,e.getSlot());
return; return;
} }
@ -265,7 +265,7 @@ public class editorUtils implements Listener {
if(e.getAction() == InventoryAction.CLONE_STACK){ if(e.getAction() == InventoryAction.CLONE_STACK){
saveTempItem(e, p, file, panelName); saveTempItem(e, p, file, panelName);
}else if(e.getAction() == InventoryAction.PLACE_ALL){ }else if(e.getAction() == InventoryAction.PLACE_ALL){
loadTempItem(e, p, file, fileName.getName(), panelName); loadTempItem(e, p, file, fileName, panelName);
clearTemp(p, panelName); clearTemp(p, panelName);
}else if(e.getAction() == InventoryAction.COLLECT_TO_CURSOR){ }else if(e.getAction() == InventoryAction.COLLECT_TO_CURSOR){
//e.setCancelled(true); //e.setCancelled(true);
@ -285,7 +285,7 @@ public class editorUtils implements Listener {
}else if(e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY){ }else if(e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY){
e.setCancelled(true); e.setCancelled(true);
}else if(e.getAction() == InventoryAction.PLACE_SOME){ }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){ }else if(e.getAction() == InventoryAction.SWAP_WITH_CURSOR){
e.setCancelled(true); e.setCancelled(true);
}else if(e.getAction() == InventoryAction.PICKUP_ALL){ }else if(e.getAction() == InventoryAction.PICKUP_ALL){
@ -297,7 +297,7 @@ public class editorUtils implements Listener {
}else if(e.getAction() == InventoryAction.PICKUP_SOME){ }else if(e.getAction() == InventoryAction.PICKUP_SOME){
saveTempItem(e, p, file, panelName); saveTempItem(e, p, file, panelName);
}else if(e.getAction() == InventoryAction.PLACE_ONE){ }else if(e.getAction() == InventoryAction.PLACE_ONE){
loadTempItem(e, p, file, fileName.getName(), panelName); loadTempItem(e, p, file, fileName, panelName);
} }
} }
@EventHandler @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));
}
}