Subtracting 10 from a value in a broadcast.

Discussion in 'Plugin Development' started by NNickey, Jun 14, 2012.

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

    NNickey

    Code:
    plugin.getServer().broadcastMessage(ChatColor.GOLD + "[AlwaysDay] " + 10-warn + " notices left.");
    warn=warn+1
    I am making warn go up once but it errors when I try to subtract 10-warn.
     
  2. Offline

    r0306

    NNickey
    Add parentheses around the expression.
    Code:
    plugin.getServer().broadcastMessage(ChatColor.GOLD + "[AlwaysDay] " + (10 - warn) + " notices left.");
    warn=warn+1
     
  3. Offline

    NNickey

    r0306

    if(warn~=10) {

    How about not equal too.
     
  4. Offline

    r0306

    NNickey
    Code:
    if(warn != 10) { // ! means "not" or "false" in Java and C++
     
  5. Offline

    RobotA69

    for(int code = 10; code > 0; code--) {
    plugin.blah.broadcastMessage(code + "");
    }
     
Thread Status:
Not open for further replies.

Share This Page