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

Command control.

Comments in 'Plugin Development' started by Hypozonic, May 12, 2016.

  1. Hypozonic
    Offline

    Hypozonic New Member

    Joined:
    Apr 30, 2016
    Posts:
    7
    Minecraft User:
    Hypozonic
    I have build a maze on my server and I want too be able too disallow commands namely /sethome within the maze. I didn't think about building it in a different world, which would have made more sense. It's in my main world.
    Is it possible to restrict the usage of /sethome in a specified area? Just like the way you can use iProtect to allow disallow PvP in the designated area...

    Thanks
  2. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Yes but you must use the PlayerCommandPreprocessEvent and check if the player is in the mace
    PHP:
    $cmd1 strtolower($event->getMessage());
    $player $event->getPlayer();
    if(
    $cmd1[0] == "/"){
    $command substr($cmd11);
    $cmd explode(" "$command);
    if(
    $cmd[0] == "sethome"){
    $event->setCancelled();
    }
  3. ImSilencer
    Offline

    ImSilencer New Member

    Joined:
    Feb 5, 2016
    Posts:
    13
    Minecraft User:
    ImSilencer
    U know, your code is quite good when I checked again. But I'm not sure that he can code plugins using your codes xD

    You should post your thread in Plugins Requirement place idk. Try to surf on internet to find your needed plugin or request dev teams to make that plugin.
  4. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Why explode the command later? Why not explode the command BEFORE checking what it is? It would be easier, and make more sense(in my opinion), plus it's just un-needed code.
    PHP:
    $cmd explode(" "strtolower($event->getMessage()));

    if(
    $cmd[0] == "/sethome")
    {

      
    // Do stuff..

    }
    And, your code only cancels the event no matter what. Not if the player is in a certain area.
    Vaivez66 likes this.
  5. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    He can rewrite the part and can make it so that it cancels the command if the player is in the area
  6. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Okay mum :(
  7. ImSilencer
    Offline

    ImSilencer New Member

    Joined:
    Feb 5, 2016
    Posts:
    13
    Minecraft User:
    ImSilencer
    Lol I'm your dad, not mum xD
  8. Jazzwhistle
    Offline

    Jazzwhistle Notable Member

    Joined:
    Dec 27, 2014
    Posts:
    364
    Minecraft User:
    Awzaw
    You could try using my Parkour plugin for this at https://github.com/jazzwhistle/Parkour, currently awaiting approval (rejection?) here. If you put a parkour start sign at the entrance to the maze and one at the end that should work, give rewards, record the best time and prevent cheating, depending on how you built the maze... players can't go to homes or teleport, warp etc while playing. You could also change the config files so your signs are titled "MAZE" instead of parkour.
    applqpak likes this.
  9. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    He asked how to do it in a certain area, therefor making your code example useless, and completely not what he wanted.
  10. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    the code need to check if it is in bound of the "maze" and only if it is yes then cancle
  11. Jazzwhistle
    Offline

    Jazzwhistle Notable Member

    Joined:
    Dec 27, 2014
    Posts:
    364
    Minecraft User:
    Awzaw
    Does the OP really wants to learn how to write the code to restrict players commands/events in a given area, or just needs his/her maze to work and prevent cheating?

    There's not much point in forbidding players to use commands in the maze area - two players could just run commands to gm/tp/effects/etc each other, for example.

    If you want to make a good maze game then it would be better to use events for players who are actually playing the maze.
    Last edited: May 14, 2016
  12. Hypozonic
    Offline

    Hypozonic New Member

    Joined:
    Apr 30, 2016
    Posts:
    7
    Minecraft User:
    Hypozonic
    Sorry not being ignorant forgot I asked a question.
    I'll give that parkour checkpoint a try.

    Also, I don't use a PC for my server building I use my phone and wife's ipad.
    I use a server host, ServerPro, and use ClearSky primarily down to the fact it's the only server type out of the 4 they offer which has been updated to 0.14.2.
    I can even use they're version of PM as it's only at 0.13.2.

    Kind of irrelevant but what the heLloyd, thought I'd share.
  13. Hypozonic
    Offline

    Hypozonic New Member

    Joined:
    Apr 30, 2016
    Posts:
    7
    Minecraft User:
    Hypozonic
    Right, I am absolutely terrible at getting around github.
    I can't find the .phar on the page, downloaded the zip but there is no phar file. There is a possibility I am being stupid, obviously, but could this also be because I'm using clearsky? Or is the phar file essential?

    Sorry for noob questions. I'm still working my stuff out. Usually can work things out for myself, but this whole things has me stumped!
  14. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    You need to compile to PHAR at pmt.mcpe.me. Also, don't use third parties if you want proper help.
  15. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    He just said he wants to ban commands in the maze..
  16. Jazzwhistle
    Offline

    Jazzwhistle Notable Member

    Joined:
    Dec 27, 2014
    Posts:
    364
    Minecraft User:
    Awzaw
    Here it is, unofficially available... Parkour 1.0.5. This version doesn't guard against effects, I'm still testing that out on a busy server to see if it lags.

    Attached Files:

    applqpak likes this.

Share This Page

Advertisement