Look in clickitem.java for another case 6199 or change the one you are using to another.
Orphaned case means that case is already used.
|
Hello,
While I am following a tutorial, I opened 'ClickItem.java' and added the code:
[SPOIL]case 6199:
if(System.currentTimeMillis() - c.lastMysteryBox < 5000) {
c.sendMessage("You can only use the mystery box every 5 seconds.");
return;
}
MysteryBox.addItem(c);
break/SPOIL]
After I've finished everything, I got an error:
Your help is needed & appreciated. I'm new to coding. :l
Look in clickitem.java for another case 6199 or change the one you are using to another.
Orphaned case means that case is already used.
iirc orphaned case means it's not in a switch. Check if you entered it correctly.
post your clickitem.java.
Check that it's actually inside the switch statement, or if it's definitely inside the switch, make sure it's not surrounded by an if statement
Here's ClickItem class:
package server.model.players.packets;
import server.model.players.Client;
import server.model.players.PacketType;
/**
* Clicking an item, bury bone, eat food etc
**/
public class ClickItem implements PacketType {
@Override
public void processPacket(Client c, int packetType, int packetSize) {
int junk = c.getInStream().readSignedWordBigEndianA();
int itemSlot = c.getInStream().readUnsignedWordA();
int itemId = c.getInStream().readUnsignedWordBigEndian();
if (itemId != c.playerItems[itemSlot] - 1) {
return;
}
if (itemId >= 5509 && itemId <= 5514) {
int pouch = -1;
int a = itemId;
if (a == 5509)
pouch = 0;
if (a == 5510)
pouch = 1;
if (a == 5512)
pouch = 2;
if (a == 5514)
pouch = 3;
c.getPA().fillPouch(pouch);
return;
}
case 6199:
if(System.currentTimeMillis() - c.lastMysteryBox < 5000) {
c.sendMessage("You can only use the mystery box every 5 seconds.");
return;
}else
MysteryBox.addItem(c);
if (c.getHerblore().isUnidHerb(itemId))
c.getHerblore().handleHerbClick(itemId);
if (c.getFood().isFood(itemId))
c.getFood().eat(itemId,itemSlot);
//ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot);
if (c.getPotions().isPotion(itemId))
c.getPotions().handlePotion(itemId,itemSlot);
if (c.getPrayer().isBone(itemId))
c.getPrayer().buryBone(itemId, itemSlot);
if (itemId == 952) {
if(c.inArea(3553, 3301, 3561, 3294)) {
c.teleTimer = 3;
c.newLocation = 1;
} else if(c.inArea(3550, 3287, 3557, 3278)) {
c.teleTimer = 3;
c.newLocation = 2;
} else if(c.inArea(3561, 3292, 3568, 3285)) {
c.teleTimer = 3;
c.newLocation = 3;
} else if(c.inArea(3570, 3302, 3579, 3293)) {
c.teleTimer = 3;
c.newLocation = 4;
} else if(c.inArea(3571, 3285, 3582, 3278)) {
c.teleTimer = 3;
c.newLocation = 5;
} else if(c.inArea(3562, 3279, 3569, 3273)) {
c.teleTimer = 3;
c.newLocation = 6;
}
}
}
}
[SPOIL][/SPOIL]Code:package server.model.players.packets; import server.model.players.Client; import server.model.players.PacketType; /** * Clicking an item, bury bone, eat food etc **/ public class ClickItem implements PacketType { @Override public void processPacket(Client c, int packetType, int packetSize) { int junk = c.getInStream().readSignedWordBigEndianA(); int itemSlot = c.getInStream().readUnsignedWordA(); int itemId = c.getInStream().readUnsignedWordBigEndian(); if (itemId != c.playerItems[itemSlot] - 1) { return; } if (itemId >= 5509 && itemId <= 5514) { int pouch = -1; int a = itemId; if (a == 5509) pouch = 0; if (a == 5510) pouch = 1; if (a == 5512) pouch = 2; if (a == 5514) pouch = 3; c.getPA().fillPouch(pouch); return; } case 6199: if(System.currentTimeMillis() - c.lastMysteryBox < 5000) { c.sendMessage("You can only use the mystery box every 5 seconds."); return; }else { MysteryBox.addItem(c); return; } if (c.getHerblore().isUnidHerb(itemId)) c.getHerblore().handleHerbClick(itemId); if (c.getFood().isFood(itemId)) c.getFood().eat(itemId,itemSlot); //ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot); if (c.getPotions().isPotion(itemId)) c.getPotions().handlePotion(itemId,itemSlot); if (c.getPrayer().isBone(itemId)) c.getPrayer().buryBone(itemId, itemSlot); if (itemId == 952) { if(c.inArea(3553, 3301, 3561, 3294)) { c.teleTimer = 3; c.newLocation = 1; } else if(c.inArea(3550, 3287, 3557, 3278)) { c.teleTimer = 3; c.newLocation = 2; } else if(c.inArea(3561, 3292, 3568, 3285)) { c.teleTimer = 3; c.newLocation = 3; } else if(c.inArea(3570, 3302, 3579, 3293)) { c.teleTimer = 3; c.newLocation = 4; } else if(c.inArea(3571, 3285, 3582, 3278)) { c.teleTimer = 3; c.newLocation = 5; } else if(c.inArea(3562, 3279, 3569, 3273)) { c.teleTimer = 3; c.newLocation = 6; } } } }
Try this, havnt coded in awhile but guess this should work.
your code is showing as orphaned because it isn't inside a switch statement.
The red code indicates what was changedCode:package server.model.players.packets; import server.model.players.Client; import server.model.players.PacketType; /** * Clicking an item, bury bone, eat food etc **/ public class ClickItem implements PacketType { @Override public void processPacket(Client c, int packetType, int packetSize) { int junk = c.getInStream().readSignedWordBigEndianA(); int itemSlot = c.getInStream().readUnsignedWordA(); int itemId = c.getInStream().readUnsignedWordBigEndian(); if (itemId != c.playerItems[itemSlot] - 1) { return; } if (itemId >= 5509 && itemId <= 5514) { int pouch = -1; int a = itemId; if (a == 5509) pouch = 0; if (a == 5510) pouch = 1; if (a == 5512) pouch = 2; if (a == 5514) pouch = 3; c.getPA().fillPouch(pouch); return; } if (itemId == 6199) { if (System.currentTimeMillis() - c.lastMysteryBox & lt; 5000) { c.sendMessage("You can only use the mystery box every 5 seconds."); return; } else { MysteryBox.addItem(c); } } if (c.getHerblore().isUnidHerb(itemId)) c.getHerblore().handleHerbClick(itemId); if (c.getFood().isFood(itemId)) c.getFood().eat(itemId,itemSlot); //ScriptManager.callFunc("itemClick_"+itemId, c, itemId, itemSlot); if (c.getPotions().isPotion(itemId)) c.getPotions().handlePotion(itemId,itemSlot); if (c.getPrayer().isBone(itemId)) c.getPrayer().buryBone(itemId, itemSlot); if (itemId == 952) { if(c.inArea(3553, 3301, 3561, 3294)) { c.teleTimer = 3; c.newLocation = 1; } else if(c.inArea(3550, 3287, 3557, 3278)) { c.teleTimer = 3; c.newLocation = 2; } else if(c.inArea(3561, 3292, 3568, 3285)) { c.teleTimer = 3; c.newLocation = 3; } else if(c.inArea(3570, 3302, 3579, 3293)) { c.teleTimer = 3; c.newLocation = 4; } else if(c.inArea(3571, 3285, 3582, 3278)) { c.teleTimer = 3; c.newLocation = 5; } else if(c.inArea(3562, 3279, 3569, 3273)) { c.teleTimer = 3; c.newLocation = 6; } } } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |