Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JusztPandaa authored Nov 24, 2020
1 parent ef85932 commit 585cb45
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
20 changes: 20 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: StealthPvPVanish
main: Panda\Vanish\Vanish
author: JusztPandaa
description: "StealthPvP Vanish plugin"
api: [3.0.0]
version: 2.0

commands:
vanish:
description: "Go into Vanish"
permission: vanish.use
v:
description: "Go into Vanish"
permission: vanish.use
unvanish:
description: "Come out of Vanish"
permission: vanish.use
unv:
description: "Come out of Vanish"
permission: vanish.use
84 changes: 84 additions & 0 deletions src/Panda/Vanish/Vanish.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

namespace Panda\Vanish;

use pocketmine\plugin\PluginBase;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\event\player\PlayerQuitEvent;

use pocketmine\Player;

use pocketmine\Server;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;

use pocketmine\event\Listener;

use pocketmine\utils\TextFormat;
use pocketmine\event\player\PlayerGameModeChangeEvent;

class Vanish extends PluginBase implements Listener{

public function onLoad(){
$this->getLogger()->info("StealthPvP vanish version 1.0 loading....");
}
public function onEnable(){
$this->getServer()->getPluginManager()->registerEvents($this, $this);
$this->getLogger()->info("StealthPvP vanish has been Enabled!");
}

public function onDisable(){
$this->getLogger()->info("StealthPvP vanish has been Disabled!");
}

public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool{
switch($cmd->getName()){
case "vanish":
if(!$sender instaceof Player){
sender->sendMessage("Use this command InGame!");
return false;
}
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§7[!] You have been put into vanish!");
$sender->sendTip("You are currently §cVANISHED");
$sender->setGamemode(3);
}
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§cUnkown command. Please use /help for a list of commands.");
}
break;

case "v":
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§7[!] You have been put into vanish!");
$sender->sendTip("You are currently §cVANISHED");
$sender->setGamemode(3);
}
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§cUnkown command. Please use /help for a list of commands.")
}
break;

case "unvanish":
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§7[!] You have been taken out of vanish");
$sender->setGamemode(2);
}
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§cUnkown command. Please use /help for a list of commands.")
}
break;

case "unv":
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§7[!] You have been taken out of vanish");
$sender->setGamemode(2);
}
if($sender->hasPermission("vanish.use")){
$sender->sendMessage("§cUnkown command. Please use /help for a list of commands.")
}
break;
}
return true;
}
}

0 comments on commit 585cb45

Please sign in to comment.