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: attributes:
label: What CommandPanels version are you using? label: What CommandPanels version are you using?
options: 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.3.0
- 3.18.2.0 - 3.18.2.0
- 3.18.1.4 - 3.18.1.4

View File

@ -1,6 +1,6 @@
name: Need help name: Need help
description: Create an issue for a problem you are having. description: Create an issue for a problem you are having.
labels: ["help wanted"] labels: [ "help wanted" ]
body: body:
- type: checkboxes - type: checkboxes
id: searched id: searched
@ -32,12 +32,24 @@ body:
- 1.18 - 1.18
- 1.19 - 1.19
validations: validations:
required: true required: true
- type: dropdown - type: dropdown
id: commandpanels_version id: commandpanels_version
attributes: attributes:
label: What CommandPanels version are you using? label: What CommandPanels version are you using?
options: 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.3.0
- 3.18.2.0 - 3.18.2.0
- 3.18.1.4 - 3.18.1.4
@ -64,7 +76,7 @@ body:
- 3.17.1.0 - 3.17.1.0
- Any other version - Any other version
validations: validations:
required: true required: true
- type: dropdown - type: dropdown
id: server_software id: server_software
attributes: attributes:
@ -82,7 +94,7 @@ body:
- Velocity - Velocity
- Travertine - Travertine
validations: validations:
required: true required: true
- type: textarea - type: textarea
id: what-happened id: what-happened
attributes: attributes:

View File

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

View File

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

View File

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

View File

@ -1,8 +1,13 @@
package me.rockyhawk.commandpanels.editor; package me.rockyhawk.commandpanels.editor;
import me.rockyhawk.commandpanels.CommandPanels; 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.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.*; import java.io.*;
import java.net.URL; import java.net.URL;
@ -13,19 +18,23 @@ import java.util.logging.Level;
public class PanelDownloader { public class PanelDownloader {
CommandPanels plugin; 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) { public void downloadPanel(CommandSender sender, String url, String fileName) {
BufferedInputStream in = null; BufferedInputStream in = null;
FileOutputStream fout = null; FileOutputStream fout = null;
//add extension if not already added //add extension if not already added
if(!fileName.endsWith(".yml") && !fileName.endsWith(".yaml")) { if (!fileName.endsWith(".yml") && !fileName.endsWith(".yaml")) {
fileName = fileName + ".yml"; fileName = fileName + ".yml";
} }
//Check if fileName contains file:// //Check if fileName contains file://
try { 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."); sender.sendMessage(plugin.tag + ChatColor.RED + "Invalid URL. Using file:// is not supported.");
return; return;
} }
@ -55,10 +64,32 @@ public class PanelDownloader {
byte[] data = new byte[1024]; byte[] data = new byte[1024];
int count; int count;
while((count = in.read(data, 0, 1024)) != -1) { while ((count = in.read(data, 0, 1024)) != -1) {
fout.write(data, 0, count); 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) { } catch (Exception var22) {
sender.sendMessage(plugin.tag + ChatColor.RED + "Could not download panel."); sender.sendMessage(plugin.tag + ChatColor.RED + "Could not download panel.");
} finally { } finally {