Changed soem internal messages and updated the issues

This commit is contained in:
jman13378 2023-07-09 03:47:44 -04:00
parent ff61588559
commit 69b650bc41
6 changed files with 67 additions and 12 deletions

View File

@ -40,6 +40,18 @@ body:
attributes:
label: What CommandPanels version are you using?
options:
- latest
- 3.19.0.3
- 3.19.0.2
- 3.19.0.1
- 3.19.0.0
- 3.18.6.2
- 3.18.6.1
- 3.18.6.0
- 3.18.5.1
- 3.18.5.0
- 3.18.4.1
- 3.18.4.0
- 3.18.3.0
- 3.18.2.0
- 3.18.1.4

View File

@ -1,6 +1,6 @@
name: Need help
description: Create an issue for a problem you are having.
labels: ["help wanted"]
labels: [ "help wanted" ]
body:
- type: checkboxes
id: searched
@ -38,6 +38,18 @@ body:
attributes:
label: What CommandPanels version are you using?
options:
- latest
- 3.19.0.3
- 3.19.0.2
- 3.19.0.1
- 3.19.0.0
- 3.18.6.2
- 3.18.6.1
- 3.18.6.0
- 3.18.5.1
- 3.18.5.0
- 3.18.4.1
- 3.18.4.0
- 3.18.3.0
- 3.18.2.0
- 3.18.1.4

View File

@ -1,4 +1,4 @@
version: 3.19.0.3
version: 3.19.0.3-DEV
main: me.rockyhawk.commandpanels.CommandPanels
name: CommandPanels
author: RockyHawk

View File

@ -11,7 +11,7 @@ public class Commandpanelversion implements CommandExecutor {
CommandPanels plugin;
public Commandpanelversion(CommandPanels pl) { this.plugin = pl; }
@EventHandler
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (label.equalsIgnoreCase("cpv") || label.equalsIgnoreCase("commandpanelversion") || label.equalsIgnoreCase("cpanelv")) {

View File

@ -24,7 +24,7 @@ public class CommandPanelsEditor implements CommandExecutor {
this.plugin = pl;
}
@EventHandler
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender.hasPermission("commandpanel.edit")) {
if (!(sender instanceof Player)) {

View File

@ -1,8 +1,13 @@
package me.rockyhawk.commandpanels.editor;
import me.rockyhawk.commandpanels.CommandPanels;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.*;
import java.net.URL;
@ -13,19 +18,23 @@ import java.util.logging.Level;
public class PanelDownloader {
CommandPanels plugin;
public PanelDownloader(CommandPanels pl) { this.plugin = pl; }
public PanelDownloader(CommandPanels pl) {
this.plugin = pl;
}
public void downloadPanel(CommandSender sender, String url, String fileName) {
BufferedInputStream in = null;
FileOutputStream fout = null;
//add extension if not already added
if(!fileName.endsWith(".yml") && !fileName.endsWith(".yaml")) {
if (!fileName.endsWith(".yml") && !fileName.endsWith(".yaml")) {
fileName = fileName + ".yml";
}
//Check if fileName contains file://
try {
if(URLDecoder.decode(url, StandardCharsets.UTF_8.toString()).contains("file://")) {
if (URLDecoder.decode(url, StandardCharsets.UTF_8.toString()).contains("file://")) {
sender.sendMessage(plugin.tag + ChatColor.RED + "Invalid URL. Using file:// is not supported.");
return;
}
@ -55,10 +64,32 @@ public class PanelDownloader {
byte[] data = new byte[1024];
int count;
while((count = in.read(data, 0, 1024)) != -1) {
while ((count = in.read(data, 0, 1024)) != -1) {
fout.write(data, 0, count);
}
sender.sendMessage(plugin.tag + ChatColor.GREEN + "Finished downloading.");
if (sender instanceof Player) {
YamlConfiguration panels = YamlConfiguration.loadConfiguration(file);
if (panels.getConfigurationSection("panels").getKeys(false).size()>1) {
sender.sendMessage(plugin.tag + ChatColor.GREEN + "Finished downloading," +
ChatColor.UNDERLINE +ChatColor.YELLOW+ " Panel '" + fileName + "'");
} else {
BaseComponent[] components = new ComponentBuilder(plugin.tag +
net.md_5.bungee.api.ChatColor.GREEN + "Finished downloading, " +
ChatColor.UNDERLINE + "Panel '" + fileName + "'.\n" +
ChatColor.YELLOW + ChatColor.UNDERLINE + " Click Here to open the panel.")
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/cp " +
panels.getConfigurationSection("panels").getKeys(false).toArray()[0]))
.create();
Player player =(Player) sender;
player.spigot().sendMessage(components);
}
} else {
sender.sendMessage(plugin.tag + ChatColor.GREEN + "Finished downloading, " +
ChatColor.UNDERLINE +ChatColor.YELLOW+ "Panel '" + fileName + "'");
}
} catch (Exception var22) {
sender.sendMessage(plugin.tag + ChatColor.RED + "Could not download panel.");
} finally {