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

main not found

Comments in 'Plugin Development' started by zombie_Power, Oct 11, 2015.

  1. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    hey, can someone please assist me...

    Code:
    ClassNotFoundException: "Class funPVP\main not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144
    while I don't have anything on line 144 o_O . My plugin finishes at about 80 lines

    Thanks for the help
  2. CavinMiana
    Offline

    CavinMiana Active Member

    Joined:
    Aug 26, 2015
    Posts:
    101
    Minecraft User:
    CavinMiana
    Make sure your:
    1. Plugin.yml main is correct
    2. Make sure you namespace is right
    3. Something might be in your code so yah

    That's all I can do :)
    Oh and the line 144 means something in the pocketmine-mp src.
  3. hoyinm14mc
    Offline

    hoyinm14mc Notable Member Plugin Developer

    Joined:
    Jun 4, 2014
    Posts:
    501
    Plugins:
    9
    Minecraft User:
    hoyinm14mc
    Check the case of the classes
    zombie_Power likes this.
  4. TonyDroide
    Offline

    TonyDroide Active Member Plugin Developer

    Joined:
    Jun 5, 2015
    Posts:
    122
    Plugins:
    1
    Minecraft User:
    TonyDroidd
    Check if your namespace is correct
  5. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    plugin.yml
    Code:
    name: funPVP
    main: Zombie_Power\funPVP\Main
    version: "1.0.0"
    api: [1.12.1]
    description: gives players a reward after killing another player
    author: Zombie_Power
    
    code
    Code:
    <?php
    namespace Zombie_Power\funPVP;
    
    use pocketmine\Player;
    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\level\Position;
    use pocketmine\event\player\PlayerDeathEvent;
    use pocketmine\utils\TextFormat;
  6. TonyDroide
    Offline

    TonyDroide Active Member Plugin Developer

    Joined:
    Jun 5, 2015
    Posts:
    122
    Plugins:
    1
    Minecraft User:
    TonyDroidd
    Rename the main code to Main (M in uppercase), not main (m in lowercase)
    zombie_Power likes this.
  7. hoyinm14mc
    Offline

    hoyinm14mc Notable Member Plugin Developer

    Joined:
    Jun 4, 2014
    Posts:
    501
    Plugins:
    9
    Minecraft User:
    hoyinm14mc
    zombie_Power likes this.
  8. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    PHP:
    class funPVP extends PluginBase implements Listener{
    ?
  9. TonyDroide
    Offline

    TonyDroide Active Member Plugin Developer

    Joined:
    Jun 5, 2015
    Posts:
    122
    Plugins:
    1
    Minecraft User:
    TonyDroidd
    zombie_Power likes this.
  10. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    here is what I am trying to make

    PHP:
    public function onPlayerdeath(PlayerDeathEvent $event) {
            
    $p $event->getEntity();
            if (
    $p instanceof Player) {
               
    $cause $event->getEntity()->getLastDamageCause();
                if (
    $cause instanceof EntityDamageByEntityEvent) {
                    
    $killer $cause->getEntity()->getLastDamageCause();
                    if (
    $killer instanceof Player) {
                        
    $name $killer->getName();
                        
    $p->sendMessage("You've been killed by " $name);
                        }
                      
    $items = array(Item::get(26403), Item::get(26604), Item::get(26505), Item::get(38802));
                      
    $event->setDrops($items);
                      return 
    $items[array_rand($items1)];
             
                          if(
    $causeId $p->getLastDamageCause()->getCause()) {
                        switch(
    $causeId){
    case 
    EntityDamageEvent::CAUSE_SUICIDE:
        
    $this->getServer()->broadcastMessage($p "suicided");
           break;
      case 
    EntityDamageEvent::CAUSE_CONTACT:
    if(
    $cause instanceof EntityDamageByItemEvent){
        
    $damager $cause->getDamager();
        if (
    $damager instanceof Item) {
                 if(
    $cause->$damager()->getId() === Item::DIAMOND_SWORD || $cause->$damager()->getId() === Item::GOLD_SWORD || $cause->$damager()->getId() === Item::IRON_SWORD || $cause->$damager()->getId() === Item::STONE_SWORD || $cause->$damager()->getId() === Item::WOODEN_SWORD){
                    
    $this->getServer()->broadcastMessage($killer "-[=|--------" $p);
                           }
                }
                break;
            }
    }      
            }
  11. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    It doesn't say line 144 in your plugin. Read it carefully, it says line 144 in the BaseClassLoader which is a part of pocketmine itself.
    And in your plugin.yml you have the main class named "Main", therefore
    PHP:
    Class Main extends PluginBase implements Listener {
    zombie_Power likes this.
  12. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    Thanks, I just figured it out before tony typed :)
    Hotshot_9930 likes this.
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The filenames are wrong.

Share This Page

Advertisement