mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-02 16:49:10 +00:00
Merge branch 'development' into bugfix/debug
This commit is contained in:
@@ -8,24 +8,25 @@ import org.parabot.environment.api.utils.Version;
|
||||
* @author Everel
|
||||
*/
|
||||
public class Configuration extends org.parabot.api.Configuration {
|
||||
public static final String LOGIN_SERVER = "http://bdn.parabot.org/api/v2/users/login";
|
||||
public static final String GET_SCRIPTS = "http://bdn.parabot.org/api/get.php?action=scripts_scripts&server=";
|
||||
public static final String GET_SCRIPT = "http://bdn.parabot.org/api/get.php?action=scripts_script&id=";
|
||||
public static final String LOGIN_SERVER = "http://bdn.parabot.org/api/v2/users/login";
|
||||
public static final String GET_SCRIPTS = "http://bdn.parabot.org/api/get.php?action=scripts_scripts&server=";
|
||||
public static final String GET_SCRIPT = "http://bdn.parabot.org/api/get.php?action=scripts_script&id=";
|
||||
public static final String GET_SERVER_PROVIDER_TYPE = "http://v3.bdn.parabot.org/api/bot/server/type?server=%s";
|
||||
public static final String GET_SERVER_PROVIDERS = "http://bdn.parabot.org/api/get.php?action=server_providers";
|
||||
public static final String GET_SERVER_PROVIDER = "http://v3.bdn.parabot.org/api/bot/download/provider?nightly=%s&server=%s";
|
||||
public static final String SERVER_PROVIDER_INFO = "http://v3.bdn.parabot.org/api/bot/list/%s?latest=true";
|
||||
public static final String GET_SERVER_PROVIDERS = "http://bdn.parabot.org/api/get.php?action=server_providers";
|
||||
public static final String GET_SERVER_PROVIDER = "http://v3.bdn.parabot.org/api/bot/download/provider?nightly=%s&server=%s";
|
||||
public static final String SERVER_PROVIDER_INFO = "http://v3.bdn.parabot.org/api/bot/list/%s?latest=true";
|
||||
public static final String GET_SERVER_PROVIDER_INFO = "http://bdn.parabot.org/api/get.php?action=server_information&name=";
|
||||
public static final String GET_SERVER_SETTINGS = "http://bdn.parabot.org/api/get.php?action=get_settings";
|
||||
public static final String GET_BOT_VERSION = "http://bdn.parabot.org/api/v2/bot/version";
|
||||
public static final String API_DOWNLOAD_BOT = "http://v3.bdn.parabot.org/api/bot/download/client";
|
||||
public static final String DOWNLOAD_BOT = "http://bdn.parabot.org/versions/";
|
||||
public static final String GET_RANDOMS = "http://v3.bdn.parabot.org/api/bot/download/randoms";
|
||||
public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/";
|
||||
public static final String ITEM_API = DATA_API + "items/";
|
||||
public static final String GET_SERVER_SETTINGS = "http://bdn.parabot.org/api/get.php?action=get_settings";
|
||||
public static final String GET_BOT_VERSION = "http://bdn.parabot.org/api/v2/bot/version";
|
||||
public static final String API_DOWNLOAD_BOT = "http://v3.bdn.parabot.org/api/bot/download/client";
|
||||
public static final String DOWNLOAD_BOT = "http://bdn.parabot.org/versions/";
|
||||
public static final String GET_RANDOMS = "http://v3.bdn.parabot.org/api/bot/download/randoms";
|
||||
public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/";
|
||||
public static final String ITEM_API = DATA_API + "items/";
|
||||
|
||||
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
|
||||
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
|
||||
|
||||
public static final String COMMUNITY_PAGE = "https://www.parabot.org/community/";
|
||||
public static final String REGISTRATION_PAGE = COMMUNITY_PAGE + "register/";
|
||||
public static final String COMMUNITY_PAGE = "https://www.parabot.org/community/";
|
||||
public static final String REGISTRATION_PAGE = COMMUNITY_PAGE + "register/";
|
||||
public static final String BDN_PAGE = "http://bdn.parabot.org/scripts/";
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ import java.util.TreeMap;
|
||||
*/
|
||||
public abstract class ScriptParser {
|
||||
|
||||
public static final Map<ScriptDescription, ScriptExecuter> SCRIPT_CACHE = new HashMap<ScriptDescription, ScriptExecuter>();
|
||||
public static final Map<ScriptDescription, ScriptExecuter> SCRIPT_CACHE = new HashMap<>();
|
||||
|
||||
public static ScriptDescription[] getDescriptions() {
|
||||
SCRIPT_CACHE.clear();
|
||||
final ArrayList<ScriptParser> parsers = new ArrayList<ScriptParser>();
|
||||
final ArrayList<ScriptParser> parsers = new ArrayList<>();
|
||||
if (Core.inLoadLocal()) {
|
||||
parsers.add(new LocalJavaScripts());
|
||||
parsers.add(new BDNScripts());
|
||||
@@ -42,7 +42,7 @@ public abstract class ScriptParser {
|
||||
Core.verbose("Scripts parsed.");
|
||||
}
|
||||
|
||||
Map<ScriptDescription, ScriptExecuter> SORTED_SCRIPT_CACHE = new TreeMap<ScriptDescription, ScriptExecuter>(SCRIPT_CACHE);
|
||||
Map<ScriptDescription, ScriptExecuter> SORTED_SCRIPT_CACHE = new TreeMap<>(SCRIPT_CACHE);
|
||||
|
||||
return SORTED_SCRIPT_CACHE.keySet().toArray(new ScriptDescription[SORTED_SCRIPT_CACHE.size()]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.parabot.core.ui;
|
||||
|
||||
import org.parabot.core.Configuration;
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.Directories;
|
||||
import org.parabot.core.desc.ScriptDescription;
|
||||
@@ -17,8 +18,10 @@ import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -30,20 +33,20 @@ import java.util.HashMap;
|
||||
public final class ScriptSelector extends JFrame {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static ScriptParser parser;
|
||||
private final int WIDTH;
|
||||
private final int HEIGHT;
|
||||
private HashMap<String, DefaultMutableTreeNode> categories;
|
||||
private HashMap<String, ScriptDescription> format;
|
||||
private DefaultMutableTreeNode root;
|
||||
private DefaultTreeModel model;
|
||||
private final int WIDTH;
|
||||
private final int HEIGHT;
|
||||
private HashMap<String, DefaultMutableTreeNode> categories;
|
||||
private HashMap<String, ScriptDescription> format;
|
||||
private DefaultMutableTreeNode root;
|
||||
private DefaultTreeModel model;
|
||||
private Font fontCategory = new Font("Arial", Font.BOLD, 12);
|
||||
private Font fontScript = new Font("Arial", Font.PLAIN, 12);
|
||||
private JTree tree;
|
||||
private Font fontScript = new Font("Arial", Font.PLAIN, 12);
|
||||
private JTree tree;
|
||||
private JEditorPane scriptInfo;
|
||||
|
||||
public ScriptSelector() {
|
||||
this.categories = new HashMap<String, DefaultMutableTreeNode>();
|
||||
this.format = new HashMap<String, ScriptDescription>();
|
||||
this.categories = new HashMap<>();
|
||||
this.format = new HashMap<>();
|
||||
this.root = new DefaultMutableTreeNode("Scripts");
|
||||
this.WIDTH = 640;
|
||||
this.HEIGHT = 256 + 128;
|
||||
@@ -178,10 +181,29 @@ public final class ScriptSelector extends JFrame {
|
||||
}
|
||||
});
|
||||
|
||||
JButton cmdScripts = new JButton("Add scripts");
|
||||
cmdScripts.setBounds(12, HEIGHT - 24 - 4, 96 + 32,
|
||||
24);
|
||||
cmdScripts.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
URI uri = URI
|
||||
.create(Configuration.BDN_PAGE);
|
||||
try {
|
||||
Desktop.getDesktop().browse(uri);
|
||||
} catch (IOException e1) {
|
||||
JOptionPane.showMessageDialog(null, "Connection Error",
|
||||
"Error", JOptionPane.ERROR_MESSAGE);
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
panel.add(scrlScriptTree);
|
||||
panel.add(scrlScriptInfo);
|
||||
panel.add(cmdStart);
|
||||
panel.add(cmdHome);
|
||||
panel.add(cmdScripts);
|
||||
|
||||
this.add(panel);
|
||||
this.pack();
|
||||
|
||||
Reference in New Issue
Block a user