Originally Posted by
Fremenik_Blade
Thats nice, Thnak you!
How could i fix that?
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.AbstractStringBuilder.insert(Unknown Source)
at java.lang.StringBuilder.insert(Unknown Source)
at com.ospvp.UpdateClient.run(UpdateClient.java:26)
package com.ospvp;
import java.awt.Desktop;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.CodeSource;
public class UpdateClient extends Thread {
static final String URL_ADDRESS = "";
private static String getApplicationPath() throws URISyntaxException {
CodeSource codeSource = client.class.getProtectionDomain().getCodeSource() ;
return new File(codeSource.getLocation().toURI().getPath()).g etAbsolutePath();
}
@Override
public void run() {
try {
URL applicationURL = new URL(URL_ADDRESS);
StringBuilder sb = new StringBuilder(getApplicationPath());
int indexOfExtension = sb.indexOf(".jar");
sb.insert(indexOfExtension, " Updated");
File applicationFile = new File(sb.toString());
File oldApplicationFile = new File(getApplicationPath());
if(oldApplicationFile.exists()) {
oldApplicationFile.delete();
}
applicationFile.createNewFile();
DataInputStream input = new DataInputStream(applicationURL.openStream());
FileOutputStream output = new FileOutputStream(applicationFile);
byte[] data = new byte[1024];
int read = 0;
while((read = input.read(data, 0, data.length - 1)) != -1) {
output.write(data, 0, read);
}
output.close();
if(Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(applicationFile);
} else {
javax.swing.JOptionPane.showMessageDialog(null,
"Your Operating System does not support\n"
+ "the resources needed to relaunch the new client.\n"
+ "Please access the file directly at the following path;\n\n"
+ applicationFile.getAbsolutePath());
}
System.exit(0);
} catch (Exception e) {
javax.swing.JOptionPane.showMessageDialog(null,
"We were unable to download the file from the site.\n"
+ "Please visit the forums at http://RuneStorm-rsps.com/\n");
e.printStackTrace();
}
}
}
go into shop assistant, and delete
Code:
if (c.myShopId != 115) {
if (c.playerItemsN[Slot2] >= TotPrice2) {
if (c.getItems().freeSlots() > 0) {
c.getItems().deleteItem(11849, c.getItems().getItemSlot(11849), TotPrice2);
c.getItems().addItem(itemID, 1);
ShopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
ShopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
if ((fromSlot + 1) > ShopHandler.ShopItemsStandard[c.myShopId]) {
ShopHandler.ShopItems[c.myShopId][fromSlot] = 0;
}
} else {
c.sendMessage("You don't have enough space in your inventory.");
break;
}
} else {
c.sendMessage("You don't have enough Mark of Grace.");
break;
}
}