Checking values on a list. Please Help.

Discussion in 'Plugin Development' started by meguy26, Dec 22, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    meguy26

    Okay, so I am working on the skelton of a grief prevention plugin for my server, and I have the plugin sucessfully logging block place events and block break events with a specialized ID of the form <UUIDofPlayer>:<Block>:<x>:<y>:<z> and i am trying to create a 'for' loop that finds if there has been a block place where a player tries to break a block and deny it if their was. Here is the loop:

    if(meguy26basic.plugin.getConfig().getList("BlockPlaces").contains(BlockPlaceID)) {
    }
    else {
    List<String> list = (List<String>) meguy26basic.plugin.getConfig().getList("BlockPlaces");
    for (int i = 0; i < list.size(); i++) {
    String element = list.get(i);
    String delims2 = ":";
    String[] IDS2 = element.split(delims2);
    if(IDS2[2] + IDS2[3] + IDS2[4] == IDS[2] + IDS[3] + IDS[4]){
    Bukkit.broadcastMessage("DENY!");
    onBlockBreakUngrief.setCancelled(true);
    break;
    }

    }
    }

    the event priority is set to highest and the"DENY" does not broadcast....
     
  2. Offline

    teej107

    Use .equals() to compare Object values, not ==. Use == for primitives and null checks.
     
  3. Offline

    meguy26

    Thanks.
     
Thread Status:
Not open for further replies.

Share This Page