mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
Merge branch 'development' into bugfix/debug
This commit is contained in:
@@ -28,4 +28,5 @@ public class Configuration extends org.parabot.api.Configuration {
|
||||
|
||||
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;
|
||||
|
||||
@@ -42,8 +45,8 @@ public final class ScriptSelector extends JFrame {
|
||||
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