The Problem Of My Plugin is PvP is Not Enabling After the Countdown start can anyone help me?? CyberOn.php PHP: namespace MrjamesAndrewMC\Purges\Purge;use pocketmine\scheduler\PluginTask;use pocketmine\Server;use pocketmine\Player;use pocketmine\math\Vector3;use pocketmine\level\Position;use pocketmine\level\Level;use MrJamesAndrewMC\Purges\Main;use MrJamesAndrewMc\Purges\Purge\CyberOff;class CyberOn extends PluginTask { public $main; public function __construct(Main $main) { $this->main = $main; parent::__construct ( $main ); } public function onRun($t) { $this->main->getServer()->broadcastMessage("§4[PURGE]§2 PURGE STARTING NOW!!!!!!!!"); $this->main->purge = true; foreach ($this->main->getServer()->getOnlinePlayers() as $p){ $p->setHealth("50"); } $this->main->getServer()->getScheduler()->scheduleDelayedTask(new PurgeOff($this->main) , 20*60); //Schedule Purge Off }} CyberOff.php PHP: namespace MrJamesandrewMC\Purges\Purge;use pocketmine\scheduler\PluginTask;use pocketmine\Server;use pocketmine\Player;use pocketmine\math\Vector3;use pocketmine\level\Position;use pocketmine\level\Level;use MrJamesAndrewMC\Purges\Main;use MrJamesAndrewMc\Purges\Purge\StartPurge;class CyberOff extends PluginTask { private $main; public function __construct(Main $main) { $this->main = $main; parent::__construct ( $main ); } public function onRun($t) { $this->main->purge = false; $this->main->getServer()->broadcastMessage("§4[PURGE]§e The PURGE is Over! \n§4[PURGE]§f We Hope You Did Not Kill By Other Players"); } //put your code here} StartPurge.php PHP: namespace MrJamesAndrewMC\Purges\Purge;use pocketmine\scheduler\PluginTask;use pocketmine\Server;use pocketmine\Player;use pocketmine\math\Vector3;use pocketmine\level\Position;use pocketmine\level\Level;use MrJamesAndrewMC\Purges\Main;use MrJamesAndrewMc\Purges\Purge\CyberOn;class StartPurge extends PluginTask { public $main; private $time; public function __construct(Main $main, $time = null) { $this->main = $main; $this->time = $time; parent::__construct ( $main ); } public function onRun($t) { if ($this->time !== null && $this->time > 0){ $this->WarningSecs($this->time); } if ($this->time == -1){ $this->main->getServer()->getScheduler()->scheduleTask(new CyberOn($this->main)); } if ($this->time == null){ $this->main->getServer()->broadcastMessage("§4[PURGE]§c WARNING!!!!\n§4[PURGE]§d The Purge gonna start in 1 Minute!\n§4[PURGE]§dPVP WILL ACTIVE ANYWHERE"); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, 30) , 20*30); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, 15) , 20*45); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, 10) , 20*50); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, 5) , 20*55); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, 3) , 20*57); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, 2) , 20*58); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, 1) , 20*59); $this->main->getServer()->getScheduler()->scheduleDelayedTask(new StartPurge($this->main, -1) , 20*60); } } public function WarningSecs($time) { $this->main->getServer()->broadcastMessage("§4[PURGE]§d ".$time." Secs will start"); } public function StartPurge() { } public function StopPurge() { } //put your code here}[/PHPMain.php[PHP]namespace MrJamesAndrewMC\Purges;use pocketmine\Player;use pocketmine\Server;use pocketmine\event\Listener;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\plugin\PluginBase;use pocketmine\utils\Config;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\event\player\PlayerChatEvent;use pocketmine\event\player\PlayerQuitEvent;use pocketmine\event\block\BlockBreakEvent;use pocketmine\event\block\BlockPlaceEvent;use pocketmine\event\entity\EntityDamageEvent;use pocketmine\event\player\PlayerBucketEmptyEvent;use pocketmine\event\player\PlayerBucketEvent;use pocketmine\event\player\PlayerBucketFillEvent;use pocketmine\math\Vector3;use pocketmine\level\Position;use MrJamesAndrewMC\Purges\Purge\StartPurge;use pocketmine\event\player\PlayerDeathEvent;use pocketmine\event\player\PlayerMoveEvent;class Main extends PluginBase implements Listener{ public $purge; private $api; public function onEnable() { @mkdir($this->getDataFolder()); $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->faction = $this->getServer()->getPluginManager()->getPlugin("CyberPurge"); $this->getLogger()->info("LOADED"); $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new StartPurge($this), 20 * 60 * 2, 20 * 60 * 20); //30 Mins } public function onDisable() { $this->SaveYML(); $this->getLogger()->warning("DISABLED"); } public function onCommand(CommandSender $sender, Command $command, $label, array $args){ $player = $this->getServer()->getPlayerExact($sender->getName()); switch($command->getName()){ case "purge": if ($this->purge == false){ $this->getServer()->getScheduler()->scheduleTask(new StartPurge($this)); } }} public function onMove(PlayerMoveEvent $event){ if($event->getPlayer() instanceof Player and !$event->getPlayer()->isOp()){ $player = $event->getPlayer(); $block = $event->getPlayer()->getLevel()->getBlock(new Vector3($player->getX(),$player->getY()-1,$player->getZ())); if($block->getID() == 0){ if(!isset($this->flyers[$player->getName()])) $this->flyers[$player->getName()] = 0; $this->flyers[$player->getName()]++; if($this->flyers[$player->getName()] >= 180){ $this->AddTempBan($player->getName(), 15 , 0);$this->flyers[$player->getName()] = 0;} }else{ $this->flyers[$player->getName()] = 0; } } } public function OnPlayerDeath(PlayerDeathEvent $event) { $this->api->addMoney($event->getEntity()->getName(), "500"); } public function OnBlockBreak(BlockBreakEvent $block) { $player = $block->getPlayer(); if ($player->isOp()){ return true; }else{ if ($this->CheckIfProtechted($player->getX(), $player->getZ(), "edit")){ $block->setCancelled(); return true; }else{ return true; } } } public function OnBlockPlace(BlockPlaceEvent $block) { $player = $block->getPlayer(); if ($player->isOp()){ return true; }else{ if ($this->CheckIfProtechted($player->getX(), $player->getZ(), "edit")){ $block->setCancelled(); }else{ return true; } } } public function PlayerDamage(EntityDamageEvent $event) { if($event->getEntity() instanceof Player){ $player = $event->getEntity(); if ($this->CheckIfProtechted($player->getX(), $player->getZ(), "pvp") && $this->purge == false){ $event->setCancelled(); } } } public function CheckIfProtechted($x,$z,$damage) { if (!isset($this->yml['Areas'])){ return false; } foreach($this->yml['Areas'] as $a){ if ((min($a['x1'],$a['x2']) <= $x) && (max($a['x1'],$a['x2']) >= $x)){ if ((min($a['z1'],$a['z2']) <= $z) && (max($a['z1'],$a['z2']) >= $z)){ if ($a[$damage] == "false"){ return TRUE; }else{ return false; } } } } } } Can u guys help me fix this
The image isn't quite showing, your code is really hard to be red by the way, I'm not even sure if you can use ; if it's not the end of the line. Second, in your last code block you use case "purge"; but it has to be: case "purge":
actually, you've tons of ";". I would suggest you to use ``` $this->getLogger()->warning("Disabled"); or $this->getServer() = $server; ``` try to use "->" more to allow us to spot easily
the Code: thingy is kinda messy rn can you re post them on pastebin / ghostbin.com and re upload the image or crash log on pastebin / ghostbin.com?
should i change the pvp=off to pvp=on?? in server.properties?? Code: #Properties Config file #Sun Nov 13 18:47:36 CST 2016 motd=§l§bPlugin Testing server-port=19132 white-list=off announce-player-achievements=on spawn-protection=10 max-players=20 allow-flight=off spawn-animals=on spawn-mobs=on gamemode=0 force-gamemode=off hardcore=off pvp= difficulty=1 generator-settings= level-name=world level-seed= level-type=DEFAULT enable-query=on enable-rcon=off rcon.password= auto-save=on online-mode=off
Ok, I can't see anything wrong at the code, as there's couple issues with this site. Try turning on PVP in server.prop
my plugin description is: if the Purge Start the PvP will Allowed on any Protected area like spawn and then if Purge finish the pvp will disable and back to normal
Could you provide some screenshots of the place where you write your code? The code doesn't display correctly here. @dktapps, @Intyre, @SOFe, or someone else might want to look at this. (and try to fix it if possible) Or just share the code in a different way so we can properly look through the code.