Code:
[07-09-13 09:26]: Exception in thread "AWT-EventQueue-0" [07-09-13 09:26]: java.lang.ArrayIndexOutOfBoundsException: -1
[07-09-13 09:26]: at server.console.Commands.doCommand(Commands.java:16)
[07-09-13 09:26]: at server.console.Console$1.actionPerformed(Console.java:42)
[07-09-13 09:26]: at javax.swing.JTextField.fireActionPerformed(Unknown Source)
[07-09-13 09:26]: at javax.swing.JTextField.postActionEvent(Unknown Source)
[07-09-13 09:26]: at javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source)
[07-09-13 09:26]: at javax.swing.SwingUtilities.notifyAction(Unknown Source)
[07-09-13 09:26]: at javax.swing.JComponent.processKeyBinding(Unknown Source)
[07-09-13 09:26]: at javax.swing.JComponent.processKeyBindings(Unknown Source)
[07-09-13 09:26]: at javax.swing.JComponent.processKeyEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.Component.processEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.Container.processEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.Component.dispatchEventImpl(Unknown Source)
[07-09-13 09:26]: at java.awt.Container.dispatchEventImpl(Unknown Source)
[07-09-13 09:26]: at java.awt.Component.dispatchEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
[07-09-13 09:26]: at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.Component.dispatchEventImpl(Unknown Source)
[07-09-13 09:26]: at java.awt.Container.dispatchEventImpl(Unknown Source)
[07-09-13 09:26]: at java.awt.Window.dispatchEventImpl(Unknown Source)
[07-09-13 09:26]: at java.awt.Component.dispatchEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
[07-09-13 09:26]: at java.awt.EventQueue.access$200(Unknown Source)
[07-09-13 09:26]: at java.awt.EventQueue$3.run(Unknown Source)
[07-09-13 09:26]: at java.awt.EventQueue$3.run(Unknown Source)
[07-09-13 09:26]: at java.security.AccessController.doPrivileged(Native Method)
[07-09-13 09:26]: at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
[07-09-13 09:26]: at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
[07-09-13 09:26]: at java.awt.EventQueue$4.run(Unknown Source)
[07-09-13 09:26]: at java.awt.EventQueue$4.run(Unknown Source)
[07-09-13 09:26]: at java.security.AccessController.doPrivileged(Native Method)
[07-09-13 09:26]: at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
[07-09-13 09:26]: at java.awt.EventQueue.dispatchEvent(Unknown Source)
[07-09-13 09:26]: at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
[07-09-13 09:26]: at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
[07-09-13 09:26]: at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
[07-09-13 09:26]: at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
[07-09-13 09:26]: at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
[07-09-13 09:26]: at java.awt.EventDispatchThread.run(Unknown Source)
Code:
public static void doCommand(String command, Client c)
{
if (command.startsWith("givemaster")) {
String otherPName = command.substring(10);
int otherPIndex = PlayerHandler.getPlayerID(otherPName);
Client p = (Client) PlayerHandler.players[otherPIndex];
for (int j = 0; j < 6; j++) {
p.playerXP[j] = 200000000;
p.playerLevel[j] = p.getPA().getLevelForXP(c.playerXP[j]);
p.getPA().refreshSkill(j);
}
}
}
Code:
package server.console;
import java.awt.*;
import java.awt.event.*;
import server.model.players.*;
import javax.swing.*;
public class Console extends JFrame
{
private static final long serialVersionUID = -1007035659094178546L;
public Console()
{
super("Regicide Command Console");
setVisible(true);
setSize(400,49);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(new BorderLayout());
setResizable(false);
configureTextpane();
add(input,BorderLayout.SOUTH);
}
JTextField input = new JTextField();
Client c;
public void configureTextpane()
{
input.setBounds(0, 483, 400, 20);
input.setSize(400, 20);
input.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
String command = input.getText().toLowerCase();
Commands.doCommand(command, c);
}
});
}
}
If you need any more info, just tell me!