Thread: [PI] Certain Unspawnables?

Results 1 to 8 of 8
  1. #1 [PI] Certain Unspawnables? 
    Registered Member
    Join Date
    Dec 2011
    Posts
    109
    Thanks given
    9
    Thanks received
    1
    Rep Power
    11
    I've been grave digging and can't find exactly what I want, I'm new to coding so thought I'd try for some help.

    I'm in the process of creating a spawn server but I want certain items unspawnable for; Players, Donors and Mods.

    Example; Torva - Only want so Owners AND/OR Admins can spawn it

    Whereas I want everyone to be able to spawn items like Barrows etc

    Any help would be appreciated.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Jan 2009
    Posts
    1,319
    Thanks given
    71
    Thanks received
    105
    Rep Power
    334
    if you have the item ID's go into your commands class and find "item" and under it with all the other if statements just add

    Code:
    if (id.equals(TORVAIDHERE || id.equals(TORVAIDHERE) && rights < 2) {
    return;
    }
    EDIT:
    Or you could do:
    Code:
    int[] torva = {TORVAHELMID, TORVALEGSID, TORVAPLATEID};
    if (id.equals(torva.length) && rights < 2) {
    return;
    }
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Dec 2011
    Posts
    109
    Thanks given
    9
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by -_Timmeh_- View Post
    if you have the item ID's go into your commands class and find "item" and under it with all the other if statements just add

    Code:
    if (id.equals(TORVAIDHERE || id.equals(TORVAIDHERE) && rights < 2) {
    return;
    }
    EDIT:
    Or you could do:
    Code:
    int[] torva = {TORVAHELMID, TORVALEGSID, TORVAPLATEID};
    if (id.equals(torva.length) && rights < 2) {
    return;
    }
    Added and not working
    Reply With Quote  
     

  4. #4  
    Donator
    Trivium's Avatar
    Join Date
    Nov 2009
    Posts
    290
    Thanks given
    21
    Thanks received
    88
    Rep Power
    48
    Declare this in your config class

    Code:
    public static int[] UNSPAWNABLES = {995,4151};//Coins and whips unspawnable
    and add this to the top of your item command

    Code:
    for(int i = 0; i < Config.UNSPAWNABLES.length; i++) {
         if(Config.UNSPAWNABLES[i] == YOURITEM) {
            c.sendMessage("That item cannot be spawned.");
            return;
         }
    }
    You might need to import the config class, but you should be able to do that yourself.

    Just add more id's into the UNSPAWNABLES array and seperate them with a comma.
    Reply With Quote  
     

  5. #5  
    PokeFrontier Java Developer

    Pokemon's Avatar
    Join Date
    May 2011
    Posts
    2,726
    Thanks given
    495
    Thanks received
    807
    Rep Power
    1260
    Quote Originally Posted by -_Timmeh_- View Post
    if you have the item ID's go into your commands class and find "item" and under it with all the other if statements just add

    Code:
    if (id.equals(TORVAIDHERE || id.equals(TORVAIDHERE) && rights < 2) {
    return;
    }
    EDIT:
    Or you could do:
    Code:
    int[] torva = {TORVAHELMID, TORVALEGSID, TORVAPLATEID};
    if (id.equals(torva.length) && rights < 2) {
    return;
    }
    Wouldn't an array just be a waste of data?


    Attached image


    I love
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Jan 2009
    Posts
    1,319
    Thanks given
    71
    Thanks received
    105
    Rep Power
    334
    Quote Originally Posted by Pokemon View Post
    Wouldn't an array just be a waste of data?
    yeah but i was just giving him other options
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Sep 2012
    Posts
    97
    Thanks given
    0
    Thanks received
    5
    Rep Power
    11
    heres my code take from it what you need

    if (playerCommand.startsWith("item")) {
    if (c.inWild()) {
    c.sendMessage("You cannot spawn inside the wilderness.");
    return;
    }
    try {
    String[] args = playerCommand.split(" ");
    if (args.length == 2 || args.length == 3) {
    int newItemID = Integer.parseInt(args[1]);
    int newItemAmount = 1;
    //int newItemAmount = Integer.parseInt(args[2]);
    if(args.length == 3) {
    newItemAmount = Integer.parseInt(args[2]);
    }
    /* if (newItemID == 10548 || newItemID == 11694 || newItemID == 11696 || newItemID == 11700 || newItemID == 11698 || newItemID == 11730 || newItemID == 15001 || newItemID == 11720|| newItemID == 11722 || newItemID == 11718 || newItemID == 11724 || newItemID == 11726 || newItemID == 11283 || newItemID == 15018 || newItemID == 15019 || newItemID == 15020 || newItemID == 15220 || newItemID == 13736 || newItemID == 13734) {
    c.sendMessage("You cannot spawn this item.");
    return;
    }*/
    if ((newItemID <= 20000) && (newItemID >= 0)) {
    c.getItems().addItem(newItemID, newItemAmount);
    } else {
    c.sendMessage("No such item.");
    }
    } else {
    c.sendMessage("Use as ::item 995 200");
    }
    } catch(Exception e) {

    }
    }
    Hope i Helped,
    -G-unit
    Reply With Quote  
     

  8. #8  
    Banned

    Join Date
    Oct 2010
    Posts
    716
    Thanks given
    82
    Thanks received
    131
    Rep Power
    0
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 4
    Last Post: 09-17-2012, 02:36 AM
  2. [PI] Unspawnables
    By Charlie in forum Help
    Replies: 26
    Last Post: 07-10-2012, 02:08 AM
  3. Unspawnables
    By Jan Julius in forum Help
    Replies: 8
    Last Post: 11-03-2011, 05:24 PM
  4. Replies: 4
    Last Post: 09-28-2011, 02:35 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •