Compost Bins Done 100% by events
This Tut will add compost bins to your serv
Tested on Devo
Think before flaming because i dont give a damn and i wont reply to people who flame
Add in player.java
Declare
Code:
pubic int compostbin;
public int compost;
public boolean cangetcompost = false;
public void getcompost() {
Server.registerEvent(new Event(100) {
public void execute() {
if (playerHasItem(1925, 1) && compostbin < 6 && compostbin > 0) {
deleteItem(1925, 1);
addItem(6032, 1);
compostbin--;
sM("You have "+compostbin+" Buckets of compost left in the bin");
} else {
if (!playerHasItem(1925, 1) && compostbin < 6 && compostbin > 0) {
sM("You need a bucket to get more compost");
Server.deregisterEvent(this);
} else {
Server.deregisterEvent(this);
ReplaceObject2(2804, 3464, 7837, 3, 10);
cangetcompost = false;
compostbin = 0;
}
}
}
});
}
public void compost() {
Time = 30;
Server.registerEvent(new Event(100) {
public void execute() {
ReplaceObject(2804, 3464, 7813, 3, 10);
if (Time <= 1) {
sM("Your Compost is now ready.");
compostbin = 5;
cangetcompost = true;
Server.deregisterEvent(this);
}
Time--;
sM("Time Left Till Compost Is Ready: "+Time+"");
}
});
}
Add this with use item on object packet Easy to convert
ID would = to the objectid and itemid will stay the same on most servers.
Code:
if (id == 7837) {
if (itemid == 6055) {
if (compostbin == 0 && playerHasItem(6055, 1)) {
compostbin = 1;
deleteItem(6055, 1);
ReplaceObject2(X, Y, 7809, 3, 10);
sM("The Compost Bin is Now Half Full");
}
}
}
if (id == 7809) {
if (itemid == 6055 && cangetcompost != true) {
if (playerHasItem(6055, 1)) {
compostbin = 5;
deleteItem(6055, 1);
ReplaceObject2(X, Y, 7810, 3, 10);
sM("The Compost Bin is Now Full");
} else {
sM("You can use a bucket on this to get Compost now");
}
}
}
if (id == 7809) {
if (itemid == 1925 && cangetcompost == true) {
getcompost();
}
}
Add this to object clicking
Code:
case 7810:
c.compost();
break;
case 7813:
if (c.Time >= 1) {
c.sM("Your Compost is not ready yet.");
} else {
if (c.Time <= 1) {
c.ReplaceObject(objectXz, objectYz, 7809, 3, 10);
c.cangetcompost = true;
}
}
break;
and there you have it a Simple compost bin.