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

Commands do nothing

Comments in 'Plugin Development' started by Comedyman937, Aug 14, 2014.

  1. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Try using a command structure like EssentialsPE it's easier ;) (it's the same has the default PocketMine-MP command structure...)
  2. DA_Swagnemite
    Offline

    DA_Swagnemite Notable Member Plugin Developer

    Joined:
    Nov 17, 2013
    Posts:
    386
    Plugins:
    7
    Minecraft User:
    DA_SWAGNEMITE
    Ill try it (Hopefully it works .-.)
  3. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    it's easy once you got it ;)
  4. DA_Swagnemite
    Offline

    DA_Swagnemite Notable Member Plugin Developer

    Joined:
    Nov 17, 2013
    Posts:
    386
    Plugins:
    7
    Minecraft User:
    DA_SWAGNEMITE
    Now its not registering the commands at all :eek:
  5. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Look, you need to register the permissions in plugin.yml but the commands doesn't need to be on that file too, you can register them like we do with
    PHP:
    $this->getServer()->getCommandMap()->register($fallBackPrefix, new Command_Class);
    or
    PHP:
    $this->getServer()->getCommandMap()->registerAll($fallBackPrefix, array(new Command1, new Command2));
    Tuff likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Use the SubcommandMap structure in WorldEditArt :D it is the best
    64FF00 likes this.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is for events, not commands.
  8. PluginMastered
    Offline

    PluginMastered Active Member

    Joined:
    Mar 1, 2014
    Posts:
    161
    Minecraft User:
    Flexa33
    Did you run the commands in-game?
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    He should just add a line right at the beginning of the function body:
    $this->getLogger()->debug("Command ".$cmd->getName()." triggered! Arguments: ".implode(",", $args)); // or info() if you like

    Then we can locate the actual problem, whether the function is at all called.
    PluginMastered likes this.
  10. MCG76
    Offline

    MCG76 New Member

    Joined:
    Aug 3, 2014
    Posts:
    8
    Minecraft User:
    MCG76
    I tried run your code in PM 1.4 Beta4... the all two command works except there is a crash happen /tpw [worldname]

    23:41:47 [INFO] mcpad19 joined the game
    23:45:32 [ERROR] An E_WARNING error happened: "Missing argument 1 for pocketmine\Server::getLevel(), called in E:\Dev\PocketMine-MP\plugins\MCG76_MultiversePE_v1.0\src\MultiversePE\Main.php on line 47 and defined" in "/src/pocketmine/Server" at line 849
    23:45:32 [NOTICE] An E_NOTICE error happened: "Undefined variable: levelId" in "/src/pocketmine/Server" at line 850

    Fatal error: Call to a member function getName() on a non-object in E:\Dev\PocketMine-MP\plugins\MCG76_MultiversePE_v1.0\src\MultiversePE\Main.php on line 47
    23:45:32 [EMERGENCY] An unrecoverable error has occurred and the server has crashed. Creating a crash dump
    23:45:32 [EMERGENCY] Please submit the "E:\Dev\PocketMine-MP\CrashDump_Fri_Aug_22-23.45.32-UTC_2014.log" file to the Bug Reporting page. Give as much info as you can.

    and the dump looks like this

    PocketMine-MP Crash Dump Fri Aug 22 23:45:32 UTC 2014

    Error: Call to a member function getName() on a non-object
    File: /MCG76_MultiversePE_v1.0/src/MultiversePE/Main
    Line: 47
    Type: E_ERROR

    THIS CRASH WAS CAUSED BY A PLUGIN
    BAD PLUGIN: MultiversePE v1.0.0

    Code:
    [38] case "tpw" :
    [39] if (! ($sender instanceof Player)) {
    [40] $sender->sendMessage ( "[MultiversePE] You can only use this command in-game!" );
    [41] return true;
    [42] } else {
    [43] if (! (isset ( $args [0] ))) {
    [44] $sender->sendMessage ( "[MultiversePE] You must specify a world!" );
    [45] return true;
    [46] } else {
    [47] $level = $sender->getServer ()->getLevel ()->getName ( $args [0] );
    [48] $pos = new Position ( $level->getSafeX (), $level->getSafeY (), $level->getSafeZ (), $level );
    [49] $sender->teleport ( $pos );
    [50] $sender->sendMessage ( "[MultiversePE] Teleported you to " . $level . "!" );
    [51] return true;
    [52] }
    [53] }
    [54] break;
    [55] }
    [56] }
    [57] public function onDisable() {
  11. DA_Swagnemite
    Offline

    DA_Swagnemite Notable Member Plugin Developer

    Joined:
    Nov 17, 2013
    Posts:
    386
    Plugins:
    7
    Minecraft User:
    DA_SWAGNEMITE
    I've given up on this... No matter what I try, it doesn't want to do what its supposed to...
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Similar hopelessness on WorldEditArt... But the community put pressure on me to continue debugging it.
    Comedyman937 likes this.
  13. Kagehis4
    Offline

    Kagehis4 New Member

    Joined:
    Aug 20, 2014
    Posts:
    44
    Minecraft User:
    Kagehis4
    Here, tested and working..

    Code:
    04:36:54 [INFO] [MultiversePE] Need help? Use /multiversepe help
    multiversepe help
    04:37:02 [INFO] Command list for MultiversePE
    04:37:02 [INFO] /multiversepe help - MultiversePE Help
    04:37:02 [INFO] /multiversepe create - Create a new world
    04:37:02 [INFO] /tpw <world> - Teleport to a world
    multiversepe tpw
    04:37:45 [INFO] Usage: /multiversepe <create>
    tpw world2
    04:38:06 [INFO] [MultiversePE] You can only use this command in-game!
    
    I have attached it..
    it possibly caused by your plugin.yml file..

    Attached Files:

    Last edited: Aug 23, 2014
    Comedyman937 likes this.
  14. DA_Swagnemite
    Offline

    DA_Swagnemite Notable Member Plugin Developer

    Joined:
    Nov 17, 2013
    Posts:
    386
    Plugins:
    7
    Minecraft User:
    DA_SWAGNEMITE
    Did you have to change anything? What was wrong with it that caused it to not work?
  15. Kagehis4
    Offline

    Kagehis4 New Member

    Joined:
    Aug 20, 2014
    Posts:
    44
    Minecraft User:
    Kagehis4
    spaces in plugin.yml, possible... also i removed implement CommandExecutor.. dunno which one actualy fixed it..
    DA_Swagnemite likes this.
  16. XxMisteryGamerxX
    Offline

    XxMisteryGamerxX New Member

    Joined:
    Mar 19, 2015
    Posts:
    10
    Minecraft User:
    THEPROGAMER
    PLZ GIVE ME THE PLUGIN THANKS

Share This Page

Advertisement