Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Simple Plugin Help

clethrillclethrill ✭✭
edited March 2013 in Vanilla 2.0 - 2.8

Yes, another person wanting help to make a plugin. I have looked at the documentation, and unfortunately, I am a teenager and the lack of pictures bores me. I sort of understand how the things work but can't get something to work.

This is to be a simple plugin to check if a minecraft server is online or not. I got the if statement from the web and added the rest to go with vanilla.

So simply I just want to put this in the Panel

< div class="Box MCServer">
<?php
$mc_host=C('MCServer.Host');
$mc_port=C('MCServer.Port'); 
?>
    < ul class="PanelInfo">
    < h4><?php echo T("Server Status:"); ?>< /h4>
    
       <?php
       echo $mc_host.':'.$mc_port;
       ?>
       < /li>
       < li>
       <?php 
       if (! $sock = @fsockopen($mc_host, $mc_port, $num, $error, 3)) 
          echo '< font color="red">Offline< /font>'; 
       else{ 
          echo '< font color="green">Online< /font>'; 
          fclose($sock); 
       } 
       ?>
       < /li>
   < /ul>
< /div>

With an option in the dashboard to set the minecraft server's ip/domain and it's port.

Um, yeah, I think that is it. While waiting for answers I am going to have a look at some plugins and see if I can figure it out.

PS I can never get this markdown stuff to do what I want, I want HTML back!

Best Answer

Answers

  • 422422 MVP
    edited January 2012

    Wrap your code in pre or pre and code tags

    Pre.
    < pre> hello< /pre>

    Pre and code
    < pre>< code>hello< /code>< /pre>

    I think

    There was an error rendering this rich post.

  • 422 said:
    Wrap your code in pre or pre and code tags

    Thankyou, wikipedia says otherwise

  • Did it work lol

    There was an error rendering this rich post.

  • hbfhbf MVP
    Answer ✓

    @clethrill

    try looking at a plugin that adds an item to the panel, such as the who's online plugin. that should give you the info you need regarding hooks to add something.

  • Okay it works! First time I copied the TopPosters plugin and just deleted what I thought was superfluous (love that word) but kept getting bonks, and although changing in the config debug to true it wouldn't show the debug so I just went back looked over it couldn't find the problem and decided to go on a different path.

    This time I jsut copied the TopPosters plugin replaces all TopPosters with MCServer and replaced the TopPosters div box with my one, and voila! Now all I need to do is slowly delete what I think is superfluous. Merci beaucoup pour l'écoute tous les!

  • this is quite an extensive plugin idea, and i love that you pointed out how to get it work, that rocks an i think we are all able to learn from it, thumbs up!

  • RedTwentyFour said:
    this is quite an extensive plugin idea, and i love that you pointed out how to get it work, that rocks an i think we are all able to learn from it, thumbs up!

    @RedTwentyFour
    That is a very meaningful compliment to me, as will be explained in this brief rant.

    I am do dislike people that go 'HELPZZZ!!! NOW PLZ ????!!!!' and want a plugin and then they go, sorry I am so noob at php.

    I love learning and ever expanding my knowledge of things, albeit am very lazy which will override occasionally. I only know some PHP and learn more as I need it. I am not that familiar with the workings of garden and learn more as I need it. But the thing is that I like to tackle a nice problem. I start of by just making tweaks to other peoples plugins and themes and by having other peoples examples of how they tackled their problems I can see what they were trying to do there and how they did it and then copy and incorporate it into my own. As I get more and more confident I start improving on there methods where I see it, and that is how I become a more knowledgeable person. And that is how I think all people should strive to be.

Sign In or Register to comment.