Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unable to pause a timer through command

Comments in 'Plugin Development' started by args, Jun 20, 2014.

  1. args
    Offline

    args New Member

    Joined:
    Jun 14, 2014
    Posts:
    47
    Minecraft User:
    args
    Hey all,
    In a bit of a rush but heres my problem,
    I can't seem to set my variable $Pause to true so that my timer pauses,
    I've attempted to post it to github ,

    https://github.com/reevesdrums/EMCplugin/tree/23d9a34d330310d69b2d36f39649b8b9799f0588/EMC

    This may cause readers to realise I'm new to php and may be doing things incredibly wrong. If that's the case please do tell me what I should do to fix it, or where I can go to learn how to do it properly,

    But also if you can work out how to pause the timer that would be really helpfull, I'm got accepted into A University to learn to code anyway starting next month, So If my php is for some reason done really wrong, Ill be learning everything from scratch in a month anyway :)

    Regards args

    Edit: also my syntax may be bad but I know how to fix that, I just haven't gotten to it as of yet

    Also feel free to download and try out the plugin on your servers, It's mostly just a timer with a couple additions so far


    Edit: SOLVED
    I just switched it to a static variable, that way when i ran the command, i would just access the variable directly from the other class with serverTimer::pause = true;

    I don't know why it didn't work with getters and setters but Static variables are so much easier to use anyway:)
    is there a way to set a solved tag?
    Last edited: Jun 20, 2014
  2. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    Which file have that problem ?? I am too lazy to look it up
  3. args
    Offline

    args New Member

    Joined:
    Jun 14, 2014
    Posts:
    47
    Minecraft User:
    args
    In CMD and serverTimer, they both have pause variables,
    When the command "Pause" is run in the class CMD, I would like it to change pause to True,
    when serverTimer runs, It should then return wether its true of false, and then not update the timer if its true.
  4. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    That is so strange !? Does it gives you any errors?
  5. args
    Offline

    args New Member

    Joined:
    Jun 14, 2014
    Posts:
    47
    Minecraft User:
    args
    Nope, I have it set up to help me debug it though.
    It changes the boolean in CMD to True just fine,
    But whenever serverTimer attempts to return it, it always gives false.
  6. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    Sorry I am not a big fan in the new API :p
  7. args
    Offline

    args New Member

    Joined:
    Jun 14, 2014
    Posts:
    47
    Minecraft User:
    args
    I started just as the new API was released, so I thankfully haven't gone through this API relearning phase that seems to be confusing a lot of people :p

Share This Page

Advertisement