Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: orphaned case

  1. #1
    Member
    Join Date
    Jan 2011
    Posts
    88
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Angry orphaned case

    i under stand that "orphaned case" means something is wrong with the "switch" i just dont see whats wrong with it.

    heres my full error
    .\icedice\io\packets\ActionButtons.java:336: orphaned case
                                            case 7:
                                            ^
    .\icedice\io\packets\ActionButtons.java:452: orphaned case
                        case 7://Dragon Slayer
                        ^
    Note: .\icedice\players\objectLoader.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: .\icedice\clanchat\Room.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
    Press any key to continue . . .

    heres my code

               case 274:
     
                    switch (buttonId) {
     
    				    case 5://Updates
                            p.frames.showInterface(p, 255);
                            p.frames.setString(p, "<col=77FF77>The latest and greatest client has come out, v3.1! Make sure you download it so you can access the new pvp world!", 255, 3);
                            p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to read the rule book!");
                            Engine.playerItems.addItem(p, 9003, 1);
                        break;
    				if (Engine.wildernessArea(p.absX, p.absY)) {
    					case 7:
                            if (p.jailed == (0)) {
                                p.teleportTo(2558+Misc.random(5), 2846+Misc.random(3), 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.frames.sendMessage(p, "<img=2>Theres no place like home!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                        break;
    					case 8://death cape
    						if (p.pkp <= 19) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 20) {
    							Engine.playerItems.addItem(p, 4353, 1);
    							p.frames.sendMessage(p, "You recive your death cape!");
    							p.pkp -= 20;
    						}
    						break;
     
    					case 9://granite maul
    						if (p.pkp <= 24) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 25) {
    							Engine.playerItems.addItem(p, 4153, 1);
    							p.frames.sendMessage(p, "You recive your granite maul!");
    							p.pkp -= 25;
    						}
    						break;
     
    					case 10://full granite
    						if (p.pkp <= 39) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 40) {
    							Engine.playerItems.addItem(p, 3122, 1);
    							Engine.playerItems.addItem(p, 6809, 1);
    							Engine.playerItems.addItem(p, 10564, 1);
    							Engine.playerItems.addItem(p, 10589, 1);
    							p.frames.sendMessage(p, "You recive your Granite Armour!");
    							p.pkp -= 40;
    						}
    						break;
    					case 11://dragon dagger (p++)
    						if (p.pkp <= 29) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 30) {
    							Engine.playerItems.addItem(p, 5698, 1);
    							p.frames.sendMessage(p, "You recive your Dragon dagger(p++)!");
    							p.pkp -= 30;
    						}
    						break;
    					case 12://10x Sharks
    						if (p.pkp <= 9) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 10) {
    							Engine.playerItems.addItem(p, 385, 10);
    							p.frames.sendMessage(p, "You recive your 10x Shakrs!");
    							p.pkp -= 10;
    						}
    						break;
    					case 13://100x Sharks
    						if (p.pkp <= 14) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 15) {
    							Engine.playerItems.addItem(p, 386, 100);
    							p.frames.sendMessage(p, "You recive your 100x Sharks!");
    							p.pkp -= 15;
    						}
    						break;
    					case 14://Potion Pack
    						if (p.pkp <= 9) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 10) {
    							Engine.playerItems.addItem(p, 2428, 1);
    							Engine.playerItems.addItem(p, 2432, 1);
    							Engine.playerItems.addItem(p, 2444, 1);
    							Engine.playerItems.addItem(p, 113, 1);
    							Engine.playerItems.addItem(p, 2446, 1);
    							Engine.playerItems.addItem(p, 3040, 1);
    							p.frames.sendMessage(p, "You recive your Potions!");
    							p.pkp -= 10;
    						}
    						break;
    					case 15://Super Potion Pack
    						if (p.pkp <= 14) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 15) {
    							Engine.playerItems.addItem(p, 2436, 1);
    							Engine.playerItems.addItem(p, 2440, 1);
    							Engine.playerItems.addItem(p, 2442, 1);
    							Engine.playerItems.addItem(p, 2446, 1);
    							Engine.playerItems.addItem(p, 3040, 1);
    							p.frames.sendMessage(p, "You recive your  Super Potions!");
    							p.pkp -= 15;
    						}
    						break;
    					case 16://Restore Special
    						if (p.pkp <= 9) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 10) {
    							p.specialAmount = 100;
                                p.specialAmountUpdateReq = true;
    							p.frames.sendMessage(p, "Your Spec has been restored!");
    							p.pkp -= 10;
    						}
    						break;
    					case 17://De-Poison
    						if (p.pkp <= 4) {
    							p.frames.sendMessage(p, "<img=2>You need more PKP to get this item!");
    						} else if (p.pkp >= 5) {
    							Engine.poison.startPoison(p, 0);
    							p.frames.sendMessage(p, "You are no longer poisoned!");
    							p.pkp -= 5;
    						}
    					break;
    				} else if (!Engine.wildernessArea(p.absX, p.absY)) {
     
                        case 7://Dragon Slayer
                            for (int i = 0; i < 30; i++) {
                                if (p.DragonSlayer == 0) {
                                    p.frames.showInterface(p, 275);
                                    p.frames.setString(p, "Dragon Slayer", 275, 2);
                                    p.frames.setString(p, "", 275, 11);
                                    p.frames.setString(p, "To start this quest, speak to the Guildmaster.", 275, 12);
                                    p.frames.setString(p, "He is located north of the home bank", 275, 13);
                                    p.frames.setString(p, "in falador park.", 275, 14);
                                    p.frames.setString(p, "", 275, 14 + i);
                                }
                                if (p.DragonSlayer == 1) {
                                    p.frames.showInterface(p, 275);
                                    p.frames.setString(p, "Dragon Slayer", 275, 2);
                                    p.frames.setString(p, "", 275, 11);
                                    p.frames.setString(p, "The Guildmaster told me to speak to Oziach.", 275, 12);
                                    p.frames.setString(p, "He is located in Edgeville.", 275, 13);
                                    p.frames.setString(p, "The fastest way to get there is ::edge.", 275, 14);
                                    p.frames.setString(p, "", 275, 14 + i);
                                }
                                if (p.DragonSlayer == 2) {
                                    p.frames.showInterface(p, 275);
                                    p.frames.setString(p, "Dragon Slayer", 275, 2);
                                    p.frames.setString(p, "", 275, 11);
                                    p.frames.setString(p, "Oziach put me on a quest to slay Elvarg the dragon.", 275, 12);
                                    p.frames.setString(p, "The guildmaster will give me more information.", 275, 13);
                                    p.frames.setString(p, "", 275, 13 + i);
                                }
                                if (p.DragonSlayer == 3) {
                                    p.frames.showInterface(p, 275);
                                    p.frames.setString(p, "Dragon Slayer", 275, 2);
                                    p.frames.setString(p, "", 275, 11);
                                    p.frames.setString(p, "The dragon is located on Crandor Island.", 275, 12);
                                    p.frames.setString(p, "", 275, 13);
                                    p.frames.setString(p, "I will need a map from the Oracle on Ice Mountain.", 275, 14);
                                    p.frames.setString(p, "I will need a shield to protect me.", 275, 15);
                                    p.frames.setString(p, "I will need a ship to get there.", 275, 16);
                                    p.frames.setString(p, "", 275, 16 + i);
                                }
                                if (p.DragonSlayer == 4) {
                                    p.frames.showInterface(p, 275);
                                    p.frames.setString(p, "Dragon Slayer", 275, 2);
                                    p.frames.setString(p, "", 275, 11);
                                    p.frames.setString(p, "I slayed the dragon!", 275, 12);
                                    p.frames.setString(p, "", 275, 13);
                                    p.frames.setString(p, "I should return to Oziach and tell him.", 275, 14);
                                    p.frames.setString(p, "", 275, 14 + i);
                                }
                                if (p.DragonSlayer == 5) {
                                    p.frames.showInterface(p, 275);
                                    p.frames.setString(p, "Dragon Slayer", 275, 2);
                                    p.frames.setString(p, "", 275, 11);
                                    p.frames.setString(p, "<col=66FF33>QUEST COMPLETE", 275, 12);
                                    p.frames.setString(p, "", 275, 13);
                                    p.frames.setString(p, "I now can wear rune platebodies, dragon platebodies,", 275, 14);
                                    p.frames.setString(p, "and dragon chainbodies", 275, 15);
                                    p.frames.setString(p, "Get your quest cape from the wise old man...", 275, 16);
                                    p.frames.setString(p, "He is sitting on the bench in falador park.", 275, 17);
                                    p.frames.setString(p, "", 275, 14 + i);
                                }
                            }
                            break;
                        case 10://starters & staff teleports
                            if (p.rights >= 1) {
                                p.teleportTo(2339, 3172, 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                            }
                            break;
    					case 13://Home tele
                            if (p.jailed == (0)) {
                                p.teleportTo(2558+Misc.random(5), 2846+Misc.random(3), 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.frames.sendMessage(p, "<img=2>Theres no place like home!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                        break;
                        case 14://Party Room
                            if (p.jailed == (0)) {
                                p.setCoords(3046 + Misc.random(6), 3381 + Misc.random(3), 0);
                                p.frames.sendMessage(p, "<img=2>Pull the lever to start a party!");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                                p.appearanceUpdateReq = true;
                                p.updateReq = true;
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 15://Shops Tele
                            p.Choice = 6;
                            p.Dialogue = 0;
                            p.frames.setString(p, "Home Shops", 458, 1);
                            p.frames.setString(p, "Grand Exchange", 458, 2);
                            p.frames.setString(p, "Donator Shops", 458, 3);
                            p.frames.showChatboxInterface(p, 458);
     
                            p.Cooking = false;
                            p.TalkAgent = false;
                            p.DecorChange = false;
                            break;
                        case 16://Training tele
                            if (p.jailed == (0)) {
                                p.setCoords(3032 + Misc.random(4), 9582, 0);
                                p.requestGFX(1679, 0);
                                p.requestAnim(8941, 0);
                                p.frames.sendMessage(p, "<img=2>You have just teleported to training!");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 17://Donators Training tele
                            if (p.jailed == (0)) {
                                if ((p.donator == 0 && p.rights == 0)) {
                                    p.frames.sendMessage(p, "<img=2>Sorry but you must first become a donator to enter.");
                                } else if ((p.donator == 1 || p.rights >= 1)) {
                                    p.setCoords(2520 + Misc.random(4), 3041 + Misc.random(4), 0);
                                    p.requestGFX(1679, 0);
                                    p.requestAnim(8941, 0);
                                    p.frames.sendMessage(p, "<img=2>You have just teleported to training!");
                                    p.frames.sendMessage(p, "<img=2>Please note this isnt 100% done yet! Thank you - iceyyscape");
                                    p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                                } else {
                                    p.frames.sendMessage(p, "You can't teleport while in jail.");
                                    p.frames.sendMessage(p, "Next time be more careful!");
                                }
                            }
                            break;
                        case 18://King black dragon
                            if (p.jailed == (0)) {
                                p.teleportTo(2270, 4690, 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.frames.sendMessage(p, "<img=2>You have just teleported to the King's layer...");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 19://Safety Dungeon tele
                            if (p.jailed == (0)) {
                                p.teleportTo(3175, 4239, 2, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.frames.sendMessage(p, "<img=2>You have just teleported to Safety Dungeon's Mini Game!");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                                Engine.playerItems.addItem(p, 13151, 1);
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 20://Barrows
                            if (p.jailed == (0)) {
                                p.teleportTo(3565, 3301, 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.frames.sendMessage(p, "<img=2>Barrows drop rate is NOW <img=2>80%");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 21://God Wars tele
                            if (p.jailed == (0)) {
                                p.teleportTo(2882, 5309, 2, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.heightLevel = 2;
                                p.frames.sendMessage(p, "<img=2>You Teleport to Godwars!");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 22://Castle wars tele
                            if (p.jailed == (0)) {
                                p.teleportTo(2443, 3088, 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.frames.sendMessage(p, "<img=2>You Teleport To Castle Wars");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 23://Fight Pits tele
                            if (p.jailed == (0)) {
                                p.teleportTo(2399, 5178, 0, 4, 0, 8939, 8941, 1678, 0, 1679, 0);
                                p.frames.sendMessage(p, "<img=2>Welcome to Fight Pits");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 24://Pvp
                            if (p.jailed == (0)) {
                                p.setCoords(3127 + Misc.random(8), 3689 + Misc.random(8), 0);
                                p.requestGFX(482, 0);
                                p.requestAnim(1914, 0);
                                p.frames.sendMessage(p, "<img=2>You Teleport to Pvp! On death items are:<col=77FF77>SAFE");
                                p.frames.sendMessage(p, "<img=2><col=77FF77>Dont forget to type ::savebackup incase your account gets reset!");
                                p.requestForceChat("RRRRRHHHHHAAAAAAA!!");
                            } else {
                                p.frames.sendMessage(p, "You can't teleport while in jail.");
                                p.frames.sendMessage(p, "Next time be more careful!");
                            }
                            break;
                        case 26://Quick Shop
                            p.Choice = 8;
                            p.Dialogue = 0;
                            p.frames.setString(p, "Food Shop", 458, 1);
                            p.frames.setString(p, "Skill Shop", 458, 2);
                            p.frames.setString(p, "-iCEYY!GENERAl-", 458, 3);
                            p.frames.showChatboxInterface(p, 458);
                            break;
    					}
                    }
                    break;

    i know that the cases are duplicated but they are in separate statements would that be my problem?


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: orphaned case

    You have case 7 inside an if statement. It might help to see where your code is wrong if you used poroper indentation. Currently your code is a nightmare to read.

  3. #3
    Member
    Join Date
    Jan 2011
    Posts
    88
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: orphaned case

    Quote Originally Posted by Junky View Post
    You have case 7 inside an if statement. It might help to see where your code is wrong if you used poroper indentation. Currently your code is a nightmare to read.
    i have it all in an if both sets is that the problem? and yea i know my code is horrendous lol

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: orphaned case

    Depends upon what you mean by all in an if.
    // This is ok
    if(...) {
        switch(...) {
            case 1: {
     
            } // end case
            case 2: {
     
            } // end case
        } //end switch
    } //end if
     
    // This is ok
    switch(...) {
        case 1: {
            if(...) {
     
            } // end if
        } // end case
        case 2: {
            if(...) {
     
            } // end if
        } // end case
    } // end switch
     
    // This is what you have and is not OK
    switch(...) {
        case 1:
     
        } // end case
        if (...) {
            case 2:
     
            } // end case
        } // end if
    } // end switch

Similar Threads

  1. Case statements to Method calls???
    By Java Neil in forum Java Theory & Questions
    Replies: 1
    Last Post: February 24th, 2011, 06:17 AM
  2. Ranging Case Values in Switch Construct
    By WhiteSoup12 in forum Loops & Control Statements
    Replies: 1
    Last Post: February 6th, 2011, 11:50 AM
  3. CompareToIngnore case problem
    By newTaz in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 7th, 2010, 05:28 PM
  4. wanting to convert printout to UPPER case
    By welikedogs in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 3rd, 2010, 01:22 PM
  5. [SOLVED] upper case
    By andaji in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 13th, 2010, 11:54 PM

Tags for this Thread