Solved Right-clicking sign doesn't work after restarting server

Discussion in 'Plugin Development' started by thapengwin, Aug 3, 2013.

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

    thapengwin

    I'm making a plugin that uses signs for several actions. When I place them and right-click them, they work perfectly, but, whenever I restart the server they stop working. What's up with that?
    Some code:
    Code:java
    1. @EventHandler
    2. public void onSignInteract(PlayerInteractEvent e){
    3. if (e.getClickedBlock() != null){
    4. Player p = e.getPlayer();
    5. if (e.getClickedBlock().getType().equals(Material.WALL_SIGN) || e.getClickedBlock().getType().equals(Material.SIGN_POST)){
    6. Sign sign = (Sign) e.getClickedBlock().getState();
    7. //Join Sign
    8. if (sign.getLine(1) == "Click to Join" && sign.getLine(2) == "the game!"){
    9. pl.sendMsg("", "Joining game", p, 1);
    10. //TODO Add game joining
    11. }
    12. }
    13. }
    14. }
    15.  
     
  2. Offline

    xTrollxDudex

    thapengwin
    Use .equals() instead of == for strings.
     
  3. Offline

    thapengwin

    Thanks! Worked like a charm.
     
Thread Status:
Not open for further replies.

Share This Page