Hello this is my TheBridge plugin and to join a match it does this. Code: $this->getGameParty($player); Is there any chance how you can do this is an another plugin like TNTTag and run this command and takes me to TheBridge match instead of TNTTag game? is it possible
I don't understand it very well but if you want to run this function with another plugin make sure that it is public and use PHP: $plugin = $this->getServer()->getPluginManager()->getPlugin("TheBridge"); //or name do pluginif($plugin instanceof PluginBase){ $party = $plugin->getGameParty($player);}
PHP: $level = $player->getLevel()->getFolderName(); $cause = $event->getCause(); $config = new Config($this->plugin->getDataFolder()."/config.yml", Config::YAML); $rule = $config->get($level."Game"); if($cause===EntityDamageEvent::CAUSE_ENTITY_ATTACK) { if($event instanceof EntityDamageByEntityEvent) { $damager = $event->getDamager(); $entity = $event->getEntity(); if($damager instanceof Player and $entity instanceof NPCSpeed) { $plugin = $this->getServer()->getPluginManager()->getPlugin("TheBridge"); //error here if($plugin instanceof PluginBase){ $party = $plugin->openMyForm($player); } $event->setCancelled(true); } if($damager instanceof Player and $entity instanceof Player) { $players2 = $this->plugin->manager->hasPlayers($level)== is_null(null) ? $this->plugin->manager->hasPlayers($level) : null; if(isset($players2[$player->getName()])) { $event->setCancelled(true); } } } } else if($cause===EntityDamageEvent::CAUSE_FALL) { $players2 = $this->plugin->manager->hasPlayers($level)== is_null(null) ? $this->plugin->manager->hasPlayers($level) : null; if(isset($players2[$player->getName()])) { $event->setCancelled(true); } } }
PHP: $plugin = $this->getServer()->getPluginManager()->getPlugin("TheBridge"); It says call to a undefined method on getServer
maybe the plugin name is incorrect, put an echo "this\n"; in the code to see if the function was executed
Maybe instead of getting plugin and run function I can use a command and that command runs a function. Just don’t know how
He told you to add a debugging message to see if the code is being executed because you said the code wasn’t doing anything
To make his point even more clearer for you, message after echo will send through console if the code is executed. If not, echo won’t be executed along with the code. This helps you to see what part of the code isn’t executed or has an error on. Example: PHP: // OMG idk where this code no execute! Pales Help!if ($player->isBruh()){$player->sendMessage(“BRUH”);}// Now let’s see what da heck is wrong with a debugging message!if ($player->isBruh()){echo ‘vruh!!!!’;}// Console: nothing L// vruh!!! What!!!??? Why no execute???// oh!!! Player wasn’t bruh!(isBruh())// New codeif (!$player->isBruh()){$player->sendMessage(“vruh”);}// Yes code work now!!
or simply have the output of the Player::isBruh function PHP: var_dump($player->isBruh()) # output: boolean(true)