public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { if (strtolower($cmd->getName()) === "warn") { if (!(isset($args[0]) and isset($args[1]))) { $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /warn <player> < reason >"); return true; } else { $name = $args[0]; $player = $this->getServer()->getPlayer($name); $player_name = $player->getName(); $sender_name = $sender->getName(); $sender_display_name = $sender->getDisplayName(); unset($args[0]); $reason = implode(" ", $args); if ($player === null) { $sender->sendMessage(TF::RED . "Player " . $name . " could not be found."); return true; } else { $player->sendMessage(TF::RED . "You have been warned by " . $sender_name . " for " . $reason); $sender->sendMessage(TF::GREEN . "You have warned " . $player_name . " for " . $reason); $this->getServer()->broadcastMessage(TF::YELLOW . $player_name . " has been warned by " . $sender_name . " for " . $reason); return true; } } } }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { if (strtolower($cmd->getName()) === "report") { if (!isset($args[0])) { $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /report < problem >"); return true; } else { chdir($this->dataFolder()); $player_name = $sender->getName(); $player_display_name = $sender->getDisplayName(); $problem = implode(" ", $args); file_put_contents("reports.txt", $player_name . " || " . $problem . "\n", FILE_APPEND); $sender->sendMessage(TF::GREEN . "Successfully saved your report!"); return true; } } if (strtolower($cmd->getName()) === "reports") { chdir($this->dataFolder()); $reports = file("reports.txt"); foreach ($reports as $report) { $sender->sendMessage(TF::YELLOW . $report); } return true; } }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { if (strtolower($cmd->getName()) === "reporthacker") { if (!isset($args[0])) { $sender->sendMessage(TF::RED . "Error: Not Enough Parameters. Usage: /reporthacker <player>"); return true; } else { $sender_name = $sender->getName(); $sender_display_name = $sender->getDisplayName(); $name = $args[0]; $player = $this->getServer()->getPlayer($name); if ($player === null) { foreach ($this->getServer()->getOnlinePlayers() as $p) { if ($p->hasPermission("rh.admin")) { $p->sendMessage(TF::YELLOW . $sender_name . " reported " . $name . " for using hacks and/or mods!"); } } $sender->sendMessage(TF::GREEN . "The Report has Been Sent to All Online Administrators."); return true; } else { foreach ($this->getServer()->getOnlinePlayers() as $p) { if ($p->hasPermission("rh.admin")) { $p->sendMessage(TF::YELLOW . $sender_name . " reported " . $name . " for using hacks and/or mods!"); } } $player->sendMessage(TF::YELLOW . $sender_name . " has reported you for using hacks and/or mods!"); $sender->sendMessage(TF::GREEN . "The Report has Been Sent to All Online Administrators."); return true; } } } }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { if (strtolower($cmd->getName()) === "reporthacker") { if (!isset($args[0])) { $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /reporthacker <player>"); return true; } else { $sender_name = $sender->getName(); $sender_display_name = $sender->getDisplayName(); $name = $args[0]; $player = $this->getServer()->getPlayer($name); if ($player === null) { foreach ($this->getServer()->getOnlinePlayers() as $p) { if ($p->isOp()) { $p->sendMessage(TF::YELLOW . $sender_name . " reported " . $name . " for using hacks/mods!"); } } $sender->sendMessage(TF::GREEN . "Sent report to all op(s)."); return true; } else { foreach ($this->getServer()->getOnlinePlayers() as $p) { if ($p->isOp()) { $p->sendMessage(TF::YELLOW . $sender_name . " reported " . $name . " for using hacks/mods!"); } } $player->sendMessage(TF::YELLOW . $sender_name . " has reported you for using hacks/mods!"); $sender->sendMessage(TF::GREEN . "Sent report to all op(s)."); return true; } } } }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { $time = $this->data['nyanpass-Timelimit'] - (time() - $this->nyanpass['time']); if ($this->nyanpass['player'] !== $sender->getName() or $time <= 0) { $color = $this->data['nyanpass-color'][array_rand($this->data['nyanpass-color'])]; $message = ($sender instanceof Player ? $sender->getDisplayName() : $sender->getName()) . ": " . $color . "にゃんぱすー"; Server::getInstance()->broadcastTip($message); //プレイヤー側に表示 Server::getInstance()->getLogger()->info($message); //コンソール側に表示 $this->nyanpass = ['player' => $sender->getName(), 'time' => time()]; } else { $sender->sendMessage("あと" . $time . "秒待つか、ほかの人がにゃんぱすーするまでできないのん!"); } return true; }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { if (strtolower($cmd->getName()) === "reporthacker") { if (!isset($args[0])) { $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /reporthacker <player>"); return true; } else { $sender_name = $sender->getName(); $sender_display_name = $sender->getDisplayName(); $name = $args[0]; $player = $this->getServer()->getPlayer($name); if ($player === null) { $sender->sendMessage(TF::RED . $name . " was not found."); return true; } else { $this->getServer()->broadcastMessage(TF::YELLOW . $sender_name . " has reported " . $name . " for using hacks/mods/breaking rules!"); $player->sendMessage(TF::YELLOW . $sender_name . " has reported you for using hacks/mods/breaking rules!"); $sender->sendMessage(TF::GREEN . "Sent report to all staff online."); return true; } } } }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch ($command->getName()) { case 'nothing': return true; break; case 'rca': if (count($args) < 2) { $sender->sendMessage("Please enter a player and a command."); return false; } $player = $this->getServer()->getPlayer($tuv = array_shift($args)); if (!($player == null)) { $commandForSudo = trim(implode(" ", $args)); $this->getServer()->dispatchCommand($player, $commandForSudo); return true; break; } $sender->sendMessage(TextFormat::RED . "Player not found."); return true; break; case "slapper": if ($sender instanceof Player) { $name = trim(implode(" ", $args)); $defaultName = $sender->getDisplayName(); if ($name == null) { $name = $defaultName; } $senderSkin = $sender->getSkinData(); $IsSlim = $sender->isSkinSlim(); $playerX = $sender->getX(); $playerY = $sender->getY(); $playerZ = $sender->getZ(); $outX = round($playerX, 1); $outY = round($playerY, 1); $outZ = round($playerZ, 1); $playerLevel = $sender->getLevel()->getName(); $playerYaw = $sender->getYaw(); $playerPitch = $sender->getPitch(); $humanInv = $sender->getInventory(); $pHealth = $sender->getHealth(); $nbt = new Compound(); $motion = new Vector3(0, 0, 0); $nbt->Pos = new Enum("Pos", [new Double("", $playerX), new Double("", $playerY), new Double("", $playerZ)]); $nbt->Motion = new Enum("Motion", [new Double("", $motion->x), new Double("", $motion->y), new Double("", $motion->z)]); $nbt->Rotation = new Enum("Rotation", [new Float("", $playerYaw), new Float("", $playerPitch)]); $nbt->Health = new Short("Health", $pHealth); $nbt->Inventory = new Enum("Inventory", $humanInv); $nbt->NameTag = new String("name", $name); $nbt->Invulnerable = new Byte("Invulnerable", 1); $nbt->CustomTestTag = new Byte("CustomTestTag", 1); $nbt->Skin = new Compound("Skin", ["Data" => new String("Data", $senderSkin), "Slim" => new Byte("Slim", $IsSlim)]); $clonedHuman = Entity::createEntity("Human", $sender->getLevel()->getChunk($playerX >> 4, $playerZ >> 4), $nbt); $Inv = $clonedHuman->getInventory(); $sender->sendMessage(TextFormat::GREEN . "[" . TextFormat::YELLOW . "Slapper" . TextFormat::GREEN . "] " . "Human entity spawned with name " . TextFormat::WHITE . "\"" . TextFormat::BLUE . $name . TextFormat::WHITE . "\""); $pHelm = $humanInv->getHelmet(); $pChes = $humanInv->getChestplate(); $pLegg = $humanInv->getLeggings(); $pBoot = $humanInv->getBoots(); $Inv->setHelmet($pHelm); $Inv->setChestplate($pChes); $Inv->setLeggings($pLegg); $Inv->setBoots($pBoot); $clonedHuman->getInventory()->setHeldItemSlot($sender->getInventory()->getHeldItemSlot()); $clonedHuman->getInventory()->setItemInHand($sender->getInventory()->getItemInHand()); $clonedHuman->spawnToAll(); return true; } else { $sender->sendMessage("This command only works in game."); return true; } } }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch (strtolower($command->getName())) { case 'nothing': return true; break; case 'rca': if (count($args) < 2) { $sender->sendMessage("Please enter a player and a command."); return true; } $player = $this->getServer()->getPlayer(array_shift($args)); if (!($player === null)) { $this->getServer()->dispatchCommand($player, trim(implode(" ", $args))); return true; break; } $sender->sendMessage(TextFormat::RED . "Player not found."); return true; break; case "slapper": if ($sender instanceof Player) { $type = array_shift($args); $name = str_replace("{color}", "§", str_replace("{line}", "\n", trim(implode(" ", $args)))); if ($type === null || $type === "" || $type === " ") { return false; } $defaultName = $sender->getDisplayName(); if ($name == null) { $name = $defaultName; } $senderSkin = $sender->getSkinData(); $isSlim = $sender->isSkinSlim(); $playerX = $sender->getX(); $playerY = $sender->getY(); $playerZ = $sender->getZ(); $playerYaw = $sender->getYaw(); $playerPitch = $sender->getPitch(); $humanInv = $sender->getInventory(); $theOne = "Blank"; $nameToSay = "Human"; $didMatch = "No"; foreach (["Chicken", "ZombiePigman", "Pig", "Sheep", "Cow", "Mooshroom", "MushroomCow", "Wolf", "Enderman", "Spider", "Skeleton", "PigZombie", "Creeper", "Slime", "Silverfish", "Villager", "Zombie", "Human", "Player", "Squid", "Bat", "CaveSpider", "LavaSlime"] as $entityType) { if (strtolower($type) === strtolower($entityType)) { $didMatch = "Yes"; $theOne = $entityType; } } $typeToUse = "Nothing"; if ($theOne === "Human") { $typeToUse = "SlapperHuman"; } if ($theOne === "Player") { $typeToUse = "SlapperHuman"; } if ($theOne === "Pig") { $typeToUse = "SlapperPig"; } if ($theOne === "Bat") { $typeToUse = "SlapperBat"; } if ($theOne === "Cow") { $typeToUse = "SlapperCow"; } if ($theOne === "Sheep") { $typeToUse = "SlapperSheep"; } if ($theOne === "MushroomCow") { $typeToUse = "SlapperMushroomCow"; } if ($theOne === "Mooshroom") { $typeToUse = "SlapperMushroomCow"; } if ($theOne === "LavaSlime") { $typeToUse = "SlapperLavaSlime"; } if ($theOne === "Enderman") { $typeToUse = "SlapperEnderman"; } if ($theOne === "Zombie") { $typeToUse = "SlapperZombie"; } if ($theOne === "Creeper") { $typeToUse = "SlapperCreeper"; } if ($theOne === "Skeleton") { $typeToUse = "SlapperSkeleton"; } if ($theOne === "Silverfish") { $typeToUse = "SlapperSilverfish"; } if ($theOne === "Chicken") { $typeToUse = "SlapperChicken"; } if ($theOne === "Villager") { $typeToUse = "SlapperVillager"; } if ($theOne === "CaveSpider") { $typeToUse = "SlapperCaveSpider"; } if ($theOne === "Spider") { $typeToUse = "SlapperSpider"; } if ($theOne === "Squid") { $typeToUse = "SlapperSquid"; } if ($theOne === "Wolf") { $typeToUse = "SlapperWolf"; } if ($theOne === "Slime") { $typeToUse = "SlapperSlime"; } if ($theOne === "PigZombie") { $typeToUse = "SlapperPigZombie"; } if ($theOne === "MagmaCube") { $typeToUse = "SlapperLavaSlime"; } if ($theOne === "ZombiePigman") { $typeToUse = "SlapperPigZombie"; } if ($theOne === "PigZombie") { $typeToUse = "SlapperPigZombie"; } if (strtolower($theOne) === "remove") { if ($sender->hasPermission("slapper.remove")) { $this->hitSessions[$sender->getName()] = "on"; $sender->sendMessage(TextFormat::GREEN . "[" . TextFormat::YELLOW . "Slapper" . TextFormat::GREEN . "]" . "Hit an entity to remove it"); } } if (!($typeToUse === "Nothing") && !($theOne === "Blank")) { $nbt = $this->makeNBT($senderSkin, $isSlim, $name, $humanInv, $playerYaw, $playerPitch, $playerX, $playerY, $playerZ); $clonedHuman = Entity::createEntity($typeToUse, $sender->getLevel()->getChunk($playerX >> 4, $playerZ >> 4), $nbt); $sender->sendMessage(TextFormat::GREEN . "[" . TextFormat::YELLOW . "Slapper" . TextFormat::GREEN . "] " . $theOne . " entity spawned with name " . TextFormat::WHITE . "\"" . TextFormat::BLUE . $name . TextFormat::WHITE . "\""); } if ($typeToUse === "SlapperHuman") { $Inv = $clonedHuman->getInventory(); $pHelm = $humanInv->getHelmet(); $pChes = $humanInv->getChestplate(); $pLegg = $humanInv->getLeggings(); $pBoot = $humanInv->getBoots(); $Inv->setHelmet($pHelm); $Inv->setChestplate($pChes); $Inv->setLeggings($pLegg); $Inv->setBoots($pBoot); $clonedHuman->getInventory()->setHeldItemSlot($sender->getInventory()->getHeldItemSlot()); $clonedHuman->getInventory()->setItemInHand($sender->getInventory()->getItemInHand()); } if (!($theOne == "Blank")) { $clonedHuman->spawnToAll(); } if ($typeToUse === "Nothing" || $theOne === "Blank") { $sender->sendMessage("Invalid entity."); } return true; } else { $sender->sendMessage("This command only works in game."); return true; } } }