okay got bored and started looking through other classes having things being processed through the main server tick and since i was in itemhandler already, i looked there first, this is the only thing ive found being processed in itemhandler
Code:
for(GroundItem i : Server.itemHandler.items) {
if(i.hideTicks > 0) {
i.hideTicks--;
}
if(i.hideTicks == 1) { // item can now be seen by others
i.hideTicks = 0;
Server.itemHandler.createGlobalItem(i);
i.removeTicks = ItemHandler.HIDE_TICKS;
}
if(i.removeTicks > 0) {
i.removeTicks--;
}
if(i.removeTicks == 1) {
i.removeTicks = 0;
Server.itemHandler.removeGlobalItem(i, i.getItemId(), i.getItemX(), i.getItemY(), i.getItemAmount());
break;
}
}
so i was like k.. i can really just turn this to a simple task. so here we go..
Code:
package rs2.main.cycle.event.impl;
import rs2.main.Server;
import rs2.main.cycle.event.CycleEvent;
import rs2.main.cycle.event.CycleEventContainer;
import rs2.main.model.items.GroundItem;
import rs2.main.world.ItemHandler;
/**
* Starts the task for ground item removal and hide ticks after an item is dropped
* @author Final Project
*
*/
public class GroundItemEvent extends CycleEvent {
@Override
public void execute(CycleEventContainer container) {
for(GroundItem i : Server.itemHandler.items) {
System.out.println(Integer.toString(i.hideTicks) + "hide");
System.out.println(Integer.toString(i.removeTicks) + "remove");
if(i.hideTicks > 0) {
i.hideTicks--;
}
if(i.hideTicks == 1) { // item can now be seen by others
i.hideTicks = 0;
Server.itemHandler.createGlobalItem(i);
i.removeTicks = ItemHandler.HIDE_TICKS;
}
if(i.removeTicks > 0) {
i.removeTicks--;
}
if(i.removeTicks == 1) {
i.removeTicks = 0;
Server.itemHandler.removeGlobalItem(i, i.getItemId(), i.getItemX(), i.getItemY(), i.getItemAmount());
container.stop();
break;
}
}
}
@Override
public void stop() {
// TODO Auto-generated method stub
}
}
Code:
/**
* Creates the ground item
**/
public void createGroundItem(Client c, int itemId, int itemX, int itemY, int itemAmount, int playerId) {
if(itemId > 0) {
c.getItems().createGroundItem(itemId, itemX, itemY, itemAmount);
GroundItem item = new GroundItem(itemId, itemX, itemY, itemAmount, c.playerId, HIDE_TICKS);
CycleEventHandler.getSingleton().addEvent(c, new GroundItemEvent(), 1);
addItem(item);
}
}
no more things being processed in my itemhandler
Code:
public void process() {
}
sorry if im annoying people with all my process removal threads, but at least im contributing. these shits shouldve been released years ago.