Originally Posted by
Tyluur
I don't know the packet structure - use some breakpoints to see where it fails.
After some more debugging, items that i drop appear on the ground, and items i pick up are removed from hte ground (only the dropped ones). I think there is an issue with loading the global drops because they all appear in 2's, instead of 1. This is how it is intialised on load up:
Code:
/**
* loads the items
*/
public static void initialize() {
String Data;
BufferedReader Checker;
try {
Checker = new BufferedReader(new FileReader(
"./Data/cfg/globaldrops.txt"));
while ((Data = Checker.readLine()) != null) {
if (Data.startsWith("#")) {
continue;
}
String[] args = Data.split(":");
getGlobalDrops().add(new GlobalDrop(Integer.parseInt(args[0]), // id
Integer.parseInt(args[1]), //amount
Integer.parseInt(args[2]), //x
Integer.parseInt(args[3]), //y
Integer.parseInt(args[4]))); //height
}
Checker.close();
} catch (Exception e) {
e.printStackTrace();
}
Misc.println("Loaded " + getGlobalDrops().size() + " global drops.");
for (Player player : PlayerHandler.players) {
final Client client = (Client) player;
if (client != null) {
CycleEventHandler.getSingleton().addEvent(client, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
for (GlobalDrop drop : getGlobalDrops()) {
if (drop.isTaken()) {
if (System.currentTimeMillis() - drop.getTakenAt() >= TIME_TO_RESPAWN * 1000) {
drop.setTaken(false);
if (client.distanceToPoint(drop.getX(), drop.getY()) <= 60) {
System.out.println(drop.getId());
client.getActionSender().createGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getH(),drop.getAmount());
}
}
}
}
}
@Override
public void stop() {
// TODO Auto-generated method stub
}
}, 1);
}
}
}