├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── TODO.md ├── plugin.yml └── src └── ARCore ├── ARCore.php ├── AntiHack ├── AntiHack.php ├── AntiHackEventListener.php ├── AntiHackSuspicionTick.php └── AntiHackTick.php ├── AntiLagg └── AntiLaggSystem.php ├── Auth ├── Commands │ ├── ChangePasswordCommand.php │ ├── ForgotPasswordCommand.php │ ├── LoginCommand.php │ ├── LogoutCommand.php │ ├── PinCommand.php │ ├── RegisterCommand.php │ └── ResetPasswordCommand.php ├── EventListener.php └── Tasks │ ├── MessageTick.php │ ├── PopupTipTick.php │ └── TimeoutTask.php ├── ChatFilter ├── ChatFilter.php ├── ChatFilterTask.php └── chat │ ├── ChatClasser.php │ ├── WordList.php │ └── dict │ ├── advertising.csv │ ├── bad_english.csv │ ├── bad_german.csv │ ├── bad_spanish.csv │ ├── controversial.csv │ ├── dating.csv │ └── harmless.csv ├── Clans ├── FactionCommands.php └── FactionListener.php ├── Level └── LevelSystem.php ├── MovingCheck.php ├── MovingTask.php ├── Particle ├── ParticleManager.php ├── ParticleTask.php └── effects │ ├── LavaParticleEffect.php │ ├── ParticleEffect.php │ ├── PortalParticleEffect.php │ ├── RainbowParticleEffect.php │ └── RedstoneParticleEffect.php ├── Pets ├── BatPet.php ├── BlazePet.php ├── BlockPet.php ├── ChickenPet.php ├── CowPet.php ├── CreeperPet.php ├── EndermanPet.php ├── HuskPet.php ├── IronGolemPet.php ├── MagmaPet.php ├── OcelotPet.php ├── PetCommand.php ├── Pets.php ├── PigPet.php ├── RabbitPet.php ├── SheepPet.php ├── SilverfishPet.php ├── SpiderPet.php ├── WitchPet.php ├── WolfPet.php └── main.php ├── Vaults └── PrivateVaults.php ├── armorReductions.php └── swordDamages.php /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Issue description 2 | 7 | 8 | 9 | 10 | 11 | - Expected result: What were you expecting to happen? 12 | - Actual result: What actually happened? 13 | 14 | ### Steps to reproduce the issue 15 | 16 | 1. ... 17 | 2. ... 18 | 19 | ### OS and versions 20 | 27 | * ARCore Version: 28 | * Server Software: 29 | 30 | ### Plugins 31 | - Test on a clean server without __others__ plugins: is the issue reproducible without any __others__ plugins loaded? 32 | 33 | If the issue is **not** reproducible without __others__ plugins: 34 | - Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section 35 | - Paste your list of plugins here (use the 'plugins' command in PocketMine-MP) 36 | 37 | ### Crashdump, backtrace or other files 38 | - Do not paste crashdumps into an issue. Add links to your reports in the Crash Archive here. 39 | - Please use gist or anything else to add other files and add links here 40 | 41 | * ... 42 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | 4 | ### Relevant issues 5 | 6 | 12 | 13 | ## Changes 14 | ### API changes 15 | 16 | 17 | ### Behavioural changes 18 | 19 | 20 | ## Backwards compatibility 21 | 22 | 23 | ## Follow-up 24 | 25 | 26 | ## Tests 27 | 28 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at clossotruth@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## __Thank To Those Who Still Support ARCore!!__ 2 | #### Note From Me(HyGlobalHD): Please Read This Very Careful To Contribute! 3 | 4 | # To Supporters: 5 | - Try Make An Issues If There A Bugs. 6 | - Star The Project If You Like It! 7 | 8 | # To Contributer: 9 | - Try Make A Pull Request Before Trying To Merge Something To ARCore Project. 10 | - Test Every Progress And Find Any Bugs. 11 | 12 | # To Me: 13 | - Don't Be Weird... 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LICENSE OF NEUROBINDS PROJECT CORPERATIONS 2 | PLEASE READ ALL THE TEXT BELOW IF YOU ARE USING A PROJECT THAT UNDER OUR LICENSE 3 | 4 | LICENSE 5 | 6 | 7 | BY USING THIS PROJECT THE DEVELOPER OR AUTHORS OR MAKER OR CREATOR OR USER OR COMPANY OR COLLABRATOR ARE NOT REPONSIBLE FOR ANY DAMAGE OR LOST OR STOLEN OR UNSAFE OR BROKEN OR SCAM. 8 | 9 | ANYONE ARE WELCOME TO USE THIS PROJECT AS LONG AS THE PROJECT STILL BE CREDITS TO AUTHORS OR DEVELOPER OR COMPANY. 10 | 11 | YOU MAY SALE OR EDIT OR BUY OR COLLABRATE TO THIS PLUGIN AS LONG YOU GET YOUR PERMISSION. 12 | 13 | FEEL FREE TO USE THE PROJECT WITH YOUR OWN RISK. 14 | 15 | 16 | THIS PROJECT ARE SAFE FROM ANY EXPLOITS. 17 | 18 | COPYRIGHTS OF NEUROBINDS PROJECT CORPS. 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARCore 2 | #### Notice: You Can Find ARCore Website [__Here.__](https://backtoaction.github.io/ARCore/) 3 | #### Notice: Rewrite Is In Progress (NOT), I Will Update It In Github At [Here.](https://github.com/BackToAction/ARCore/tree/rewrite-arch-2) 4 | ##### Description: Used To Be Under Development Of [ArchRPG Organization](https://github.com/ArchRPG/) . Then Due To Certain Circumstances The Plugin Was Abandoned. 5 | 6 | 7 | ### Note: 8 | - This Plugin Will Be Update 'Not To Frequently' Due To I(HyGlobalHD) Can't Test The Plugin Cause I Use x86 Window And Pocketmine Not Support It Anymore. Note: Sobb Sobb Cry Cry :P 9 | - See [TODO](https://github.com/BackToAction/ARCore/blob/master/TODO.md) 10 | - **This Plugin Does Not Support Latest Pocketmine-MP Server Or Something Similiar.** 11 | 12 | ### NOTICE: 13 | - Please Read This For Contributers. [__Click Me.__](https://github.com/BackToAction/ARCore/blob/master/CONTRIBUTING.md) 14 | - Please Read [__Code Of Conduct.__](https://github.com/BackToAction/ARCore/blob/master/CODE_OF_CONDUCT.md) 15 | 16 | # Others :- 17 | - Get the old, unstable version and old API of ARCore [here](https://github.com/ArchRPG/ArchCoreSystem/tree/Old-Core). (P.S: It might be laggy :P) 18 | - Feel free to make pull requests to help us complete this plugin! 19 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # TODO: 2 | - [x] Custom Player Management 3 | - [x] Custom Server Management 4 | - [x] Server Name 5 | - [x] Custom Damage Management 6 | - [x] Simple Authentication System. 7 | - [x] Add Pets (with EconomyAPI support) 8 | - [x] Custom Currency (just base on EconomyAPI) 9 | - [x] Add Money For Killing 10 | - [x] Support for API 2.0.0 11 | - [x] Custom LevelUP System 12 | - [x] Clans System (with EconomyAPI support) 13 | - [x] AntiHack System [ Had Bugs ] 14 | - Will Be Disable Temporary 15 | - [ ] Re-Format 16 | - [x] Chat Filter 17 | - [x] Particle [Not Working Properly] 18 | - Will Be Disable Temporary 19 | - [ ] Re-Format 20 | - [ ] Custom Modified Entity 21 | - [ ] Entities With Specific Tag Will Hold Diff Purpose 22 | - [ ] Add Skill System. 23 | - [ ] Under Jobs/Class 24 | - [ ] Add Jobs/Class 25 | - [ ] Add Leaderboard, Achievement Rewards 26 | - [ ] Add Kits for each Class. 27 | - [ ] Add Translation 28 | - [ ] Custom NPC 29 | - [ ] Vaults 30 | - [ ] Pet Shop 31 | - [ ] Cosmetics 32 | - [ ] Custom Commands 33 | - [ ] Custom Enchants 34 | - [ ] Add AntiLagg System 35 | - [ ] Custom Enchantment API 36 | - [ ] Custom Accessories 37 | - [ ] Enchant Shop and Trade 38 | - [ ] Custom Backgrounds Sound 39 | - [ ] Using private database for players 40 | - [ ] Custom Inventory Management(bugs) 41 | - [ ] Add Auto-Updater 42 | - [ ] Custom Items. 43 | - [ ] Custom Craft Recipes 44 | - [ ] Custom Chat 45 | - [ ] Cusom Ranks (People Can Add Ranks Easily) 46 | -------------------------------------------------------------------------------- /plugin.yml: -------------------------------------------------------------------------------- 1 | name: ARCore 2 | authors: [HyGlobalHD,GamerXzavier,Adam1609,NeuroBinds,Skull3x] 3 | main: ARCore\ARCore 4 | api: [2.0.0] 5 | version: 0.0.3_2#UNSTABLE 6 | commands: 7 | c: 8 | description: "use /c help for all parameters" 9 | permission: f.command 10 | permissions: 11 | nofall.damage: 12 | default: true 13 | saver.inventory.switch: 14 | description: "Allows switching inventory on world change" 15 | default: true 16 | f.command: 17 | default: true 18 | description: "Allow use of all clans commands" 19 | 20 | -------------------------------------------------------------------------------- /src/ARCore/AntiHack/AntiHack.php: -------------------------------------------------------------------------------- 1 | getPluginManager()->registerEvents( 46 | new AntiHackEventListener(), $plugin 47 | ); 48 | 49 | Server::getInstance()->getScheduler()->scheduleRepeatingTask( 50 | new AntiHackTick(), 40 51 | ); 52 | Server::getInstance()->getScheduler()->scheduleRepeatingTask( 53 | new AntiHackSuspicionTick(), 20 * 60 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/ARCore/AntiHack/AntiHackEventListener.php: -------------------------------------------------------------------------------- 1 | plugin = AntiHack::getInstance(); 28 | } 29 | 30 | /** 31 | * @param EntityMotionEvent $event 32 | */ 33 | public function onEntityMotion(EntityMotionEvent $event){ 34 | $player = $event->getEntity(); 35 | if($player instanceof Player){ 36 | if(isset($this->movePlayers[$player->getId()])){ 37 | $this->movePlayers[$player->getId()]["freeze"] = 2; 38 | } 39 | 40 | } 41 | } 42 | 43 | /** 44 | * Look for flying and extraspeed players, increment their hack score 45 | * 46 | * @param PlayerMoveEvent $event 47 | */ 48 | public function onPLayerMove(PlayerMoveEvent $event) { 49 | //http://minecraft.gamepedia.com/Transportation 50 | $player = $event->getPlayer(); 51 | $dY = (int)(round($event->getTo()->getY() - $event->getFrom()->getY(), 3) * 1000); 52 | if($dY >= 0){ 53 | $maxY = $player->getLevel()->getHighestBlockAt(floor($event->getTo()->getX()), floor($event->getTo()->getZ())); 54 | if($event->getTo()->getY() - 5 > $maxY) { 55 | $score = ($event->getTo()->getY() - $maxY) / 5; 56 | if(isset($this->plugin->hackScore[$player->getId()])){ 57 | $this->plugin->hackScore[$player->getId()]["score"] += $score; 58 | if(!isset($this->plugin->hackScore[$player->getId()]["reason"]["Fly"])){ 59 | $this->plugin->hackScore[$player->getId()]["reason"]["Fly"] = "Fly"; 60 | } 61 | } else{ 62 | $this->plugin->hackScore[$player->getId()] = array(); 63 | $this->plugin->hackScore[$player->getId()]["score"] = $score; 64 | $this->plugin->hackScore[$player->getId()]["integral"] = 0; 65 | $this->plugin->hackScore[$player->getId()]["reason"] = array("Fly" => "Fly"); 66 | $this->plugin->hackScore[$player->getId()]["suspicion"] = 0; 67 | } 68 | } 69 | } 70 | 71 | //fly vertical speed 72 | 73 | if($dY > 0 && $dY % 375 == 0) { 74 | if(isset($this->flyPlayers[$player->getId()])){ 75 | $this->flyPlayers[$player->getId()]++; 76 | } else{ 77 | $this->flyPlayers[$player->getId()] = 1; 78 | } 79 | }else{ 80 | $this->flyPlayers[$player->getId()] = 0; 81 | } 82 | 83 | if($this->flyPlayers[$player->getId()] >= 3){ 84 | $flyPoint = $this->flyPlayers[$player->getId()]; 85 | $this->flyPlayers[$player->getId()] = 0; 86 | if(isset($this->plugin->hackScore[$player->getId()])){ 87 | $this->plugin->hackScore[$player->getId()]["score"] += $flyPoint; 88 | if(!isset($this->plugin->hackScore[$player->getId()]["reason"]["Vertical speed"])){ 89 | $this->plugin->hackScore[$player->getId()]["reason"]["Vertical speed"] = "Vertical speed"; 90 | } 91 | } else{ 92 | $this->plugin->hackScore[$player->getId()] = array(); 93 | $this->plugin->hackScore[$player->getId()]["score"] = $flyPoint; 94 | $this->plugin->hackScore[$player->getId()]["integral"] = 0; 95 | $this->plugin->hackScore[$player->getId()]["reason"] = array("Vertical speed" => "Vertical speed"); 96 | $this->plugin->hackScore[$player->getId()]["suspicion"] = 0; 97 | } 98 | } 99 | if(!isset($this->movePlayers[$player->getId()])){ 100 | $this->movePlayers[$player->getId()] = array(); 101 | $this->movePlayers[$player->getId()]["time"] = time(); 102 | $this->movePlayers[$player->getId()]["distance"] = 0; 103 | } 104 | if($this->movePlayers[$player->getId()]["time"] != time()){ 105 | if(!isset($this->movePlayers[$player->getId()]["freeze"]) || $this->movePlayers[$player->getId()]["freeze"] < 1){ 106 | if($this->movePlayers[$player->getId()]["distance"] > self::PLAYER_MAX_SPEED * 1.1){ 107 | if(isset($this->plugin->hackScore[$player->getId()])){ 108 | $this->plugin->hackScore[$player->getId()]["score"] += ($this->movePlayers[$player->getId()]["distance"] - 4) / 4; 109 | if(!isset($this->plugin->hackScore[$player->getId()]["reason"]["Speed"])){ 110 | $this->plugin->hackScore[$player->getId()]["reason"]["Speed"] = "Speed"; 111 | } 112 | } else{ 113 | $this->plugin->hackScore[$player->getId()] = array(); 114 | $this->plugin->hackScore[$player->getId()]["score"] =($this->movePlayers[$player->getId()]["distance"] - 4) / 4; 115 | $this->plugin->hackScore[$player->getId()]["integral"] = 0; 116 | $this->plugin->hackScore[$player->getId()]["reason"] = array("Speed" => "Speed"); 117 | $this->plugin->hackScore[$player->getId()]["suspicion"] = 0; 118 | } 119 | } 120 | } else{ 121 | $this->movePlayers[$player->getId()]["freeze"]--; 122 | } 123 | $this->movePlayers[$player->getId()]["time"] = time(); 124 | $this->movePlayers[$player->getId()]["distance"] = 0; 125 | } 126 | 127 | $oldPos= $event->getFrom(); 128 | $newPos = $event->getTo(); 129 | $this->movePlayers[$player->getId()]["distance"] += sqrt(($newPos->getX() - $oldPos->getX()) ** 2 + ($newPos->getZ() - $oldPos->getZ()) ** 2); 130 | } 131 | 132 | /** 133 | * remove player from class data fields 134 | * 135 | * @param PlayerQuitEvent $event 136 | */ 137 | public function onPlayerQuit(PlayerQuitEvent $event) { 138 | $player = $event->getPlayer(); 139 | unset($this->movePlayers[$player->getId()]); 140 | unset($this->flyPlayers[$player->getId()]); 141 | unset($this->plugin->hackScore[$player->getId()]); 142 | } 143 | 144 | /** 145 | * Cancel cause of lava pour men 146 | * 147 | * @param PlayerBucketFillEvent $event 148 | */ 149 | public function onPlayerBucketFill(PlayerBucketFillEvent $event) { 150 | $event->setCancelled(true); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/ARCore/AntiHack/AntiHackSuspicionTick.php: -------------------------------------------------------------------------------- 1 | plugin = AntiHack::getInstance(); 17 | } 18 | 19 | /** 20 | * @param $currentTick 21 | */ 22 | public function onRun($currentTick) { 23 | foreach ($this->plugin->hackScore as $playerId => $data){ 24 | if($data["suspicion"] > 0){ 25 | $this->plugin->hackScore[$playerId]["suspicion"] --; 26 | } 27 | } 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /src/ARCore/AntiHack/AntiHackTick.php: -------------------------------------------------------------------------------- 1 | plugin = AntiHack::getInstance(); 24 | $this->serverIp = Server::getInstance()->getIp(); 25 | $this->serverName = "server"; 26 | $this->path = Server::getInstance()->getDataPath() . "logs/"; 27 | } 28 | 29 | /** 30 | * Kick player if his hack score is maximum, 31 | * or unset hack score for honest players 32 | * 33 | * @param $currentTick 34 | */ 35 | public function onRun($currentTick) { 36 | $players = Server::getInstance()->getDefaultLevel()->getPlayers(); 37 | foreach ($this->plugin->hackScore as $playerId => $data){ 38 | $this->plugin->hackScore[$playerId]["integral"] += $data["score"] - 1; 39 | if($this->plugin->hackScore[$playerId]["integral"] < 0) { 40 | $this->plugin->hackScore[$playerId]["integral"] = 0; 41 | } 42 | if($data["score"] >= 3) { 43 | $this->plugin->hackScore[$playerId]["suspicion"]++; 44 | } 45 | $log = str_pad(date("G:i"), 12) . str_pad($players[$playerId]->getName(), 20) . str_pad("SCORE: " . round($this->plugin->hackScore[$playerId]["score"], 2), 20) . str_pad("HINT: " . round($this->plugin->hackScore[$playerId]["integral"], 2), 20) . str_pad("SUS: " . $this->plugin->hackScore[$playerId]["suspicion"], 20) . "REASON: " . implode("/", $this->plugin->hackScore[$playerId]["reason"]) . "\n"; 46 | $filename = $this->path . date('Y.m.d') . '_' . $this->serverName . '_hack.txt'; 47 | if(!file_exists($filename)) { 48 | $title = "#Hacking Log File\n#HINT = Hacking Integration\n#SCORE = Hacking score\n#SUS = How much they are supected of hacking.\n" 49 | . str_pad("Time (UTC)", 12) . str_pad("Player Name", 20) . str_pad("Hacking Score", 20) . str_pad("Hacking Integration", 20) . str_pad("Suspicion Count", 20) ."Reason\n"; 50 | @file_put_contents($filename, $title, FILE_APPEND | LOCK_EX); 51 | } 52 | if($this->plugin->hackScore[$playerId]["integral"] > 0) { 53 | @file_put_contents($filename, $log, FILE_APPEND | LOCK_EX); 54 | } 55 | 56 | $scoreToKick = 5; 57 | if($this->plugin->hackScore[$playerId]["suspicion"] >= 8){ 58 | $scoreToKick = 3; 59 | } elseif($this->plugin->hackScore[$playerId]["suspicion"] >= 4 ){ 60 | $scoreToKick = 4; 61 | } 62 | 63 | if($players[$playerId]->hackingFlag) { 64 | $scoreToKick--; 65 | } 66 | if(strpos($players[$playerId]->getName(), 'hack') !== false || strpos($players[$playerId]->getName(), 'hqck') !== false) { 67 | $scoreToKick--; 68 | } 69 | 70 | if($this->plugin->hackScore[$playerId]["integral"] > $scoreToKick){ 71 | $log = str_pad(date("G:i"), 12) . str_pad($players[$playerId]->getName(), 20) . str_pad("", 20) . str_pad("HINT: " . round($this->plugin->hackScore[$playerId]["integral"], 2), 20) . str_pad("SUS: " . $this->plugin->hackScore[$playerId]["suspicion"], 20) . "Player kicked \n"; 72 | //$log = date("G:i") . " " . str_pad($players[$playerId]->getName(), 20) . " HINT: " . round($this->plugin->hackScore[$playerId]["integral"], 2) . " SUS: " . $this->plugin->hackScore[$playerId]["suspicion"] . " Player kicked \n"; 73 | @file_put_contents($filename, $log, FILE_APPEND | LOCK_EX); 74 | $players[$playerId]->kick("Cheating is not permitted here. Sorry!"); 75 | } elseif($this->plugin->hackScore[$playerId]["integral"] <= 0 && $this->plugin->hackScore[$playerId]["suspicion"] <= 0){ 76 | unset($this->plugin->hackScore[$playerId]); 77 | } else{ 78 | $this->plugin->hackScore[$playerId]["score"] = 0; 79 | $this->plugin->hackScore[$playerId]["reason"] = array(); 80 | } 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /src/ARCore/AntiLagg/AntiLaggSystem.php: -------------------------------------------------------------------------------- 1 | ", ["changepw", "changepwd", "cpw", "changepassword"]); 11 | $this->setPermission("auth.command.changepassword"); 12 | $this->plugin = $plugin; 13 | } 14 | 15 | public function execute(CommandSender $sender, $currentAlias, array $args) { 16 | if(!$this->testPermission($sender)) { 17 | return true; 18 | } 19 | if(!$sender instanceof Player) { 20 | $sender->sendMessage("§cYou must use the command in-game."); 21 | return false; 22 | } 23 | if(!isset($args[1])) { 24 | $sender->sendMessage("/cpwd "); 25 | return false; 26 | } 27 | $this->plugin->changepassword($sender, $args[0], $args[1]); 28 | return true; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Commands/ForgotPasswordCommand.php: -------------------------------------------------------------------------------- 1 | ", ["forgetpassword", "forgotpw", "forgetpw", "forgotpwd", "forgetpwd", "fpw", "forgotpassword"]); 11 | $this->setPermission("auth.command.forgotpassword"); 12 | $this->plugin = $plugin; 13 | } 14 | 15 | public function execute(CommandSender $sender, $currentAlias, array $args) { 16 | if(!$this->testPermission($sender)) { 17 | return true; 18 | } 19 | if(!$sender instanceof Player) { 20 | $sender->sendMessage("§cYou must use the command in-game."); 21 | return false; 22 | } 23 | if(!isset($args[1])) { 24 | $sender->sendMessage("/forgotpassword "); 25 | return false; 26 | } 27 | $this->plugin->forgotpassword($sender, $args[0], $args[1]); 28 | return true; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Commands/LoginCommand.php: -------------------------------------------------------------------------------- 1 | ", ["login"]); 11 | $this->setPermission("auth.command.log"); 12 | $this->plugin = $plugin; 13 | } 14 | 15 | public function execute(CommandSender $sender, $currentAlias, array $args) { 16 | if(!$this->testPermission($sender)) { 17 | return true; 18 | } 19 | if(!$sender instanceof Player) { 20 | $sender->sendMessage("§cYou must use the command in-game."); 21 | return false; 22 | } 23 | if(!isset($args[0])) { 24 | $sender->sendMessage("/log "); 25 | return false; 26 | } 27 | $this->plugin->login($sender, $args[0]); 28 | return true; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Commands/LogoutCommand.php: -------------------------------------------------------------------------------- 1 | setPermission("auth.command.logout"); 12 | $this->plugin = $plugin; 13 | } 14 | 15 | public function execute(CommandSender $sender, $currentAlias, array $args) { 16 | if(!$this->testPermission($sender)) { 17 | return true; 18 | } 19 | if(!$sender instanceof Player) { 20 | $sender->sendMessage("§cYou must use the command in-game."); 21 | return false; 22 | } 23 | $this->plugin->logout($sender, false); 24 | return true; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Commands/PinCommand.php: -------------------------------------------------------------------------------- 1 | setPermission("auth.command.pin"); 12 | $this->plugin = $plugin; 13 | } 14 | 15 | public function execute(CommandSender $sender, $currentAlias, array $args) { 16 | if(!$this->testPermission($sender)) { 17 | return true; 18 | } 19 | if(!$sender instanceof Player) { 20 | $sender->sendMessage("§cYou must use the command in-game."); 21 | return false; 22 | } 23 | $sender->sendMessage(str_replace("{pin}", $this->plugin->getPin($sender), $this->plugin->auth->get("pin"))); 24 | return true; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Commands/RegisterCommand.php: -------------------------------------------------------------------------------- 1 | ", ["register"]); 11 | $this->setPermission("auth.command.reg"); 12 | $this->plugin = $plugin; 13 | } 14 | 15 | public function execute(CommandSender $sender, $currentAlias, array $args) { 16 | if(!$this->testPermission($sender)) { 17 | return true; 18 | } 19 | if(!$sender instanceof Player) { 20 | $sender->sendMessage("§cYou must use the command in-game."); 21 | return false; 22 | } 23 | if(!isset($args[1])) { 24 | $sender->sendMessage("/reg "); 25 | return false; 26 | } 27 | $this->plugin->register($sender, $args[0], $args[1]); 28 | return true; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Commands/ResetPasswordCommand.php: -------------------------------------------------------------------------------- 1 | ", ["resetpw", "resetpwd", "rpw", "resetpassword"]); 11 | $this->setPermission("auth.command.resetpassword"); 12 | $this->plugin = $plugin; 13 | } 14 | 15 | public function execute(CommandSender $sender, $currentAlias, array $args) { 16 | if(!$this->testPermission($sender)) { 17 | return true; 18 | } 19 | if(!isset($args[0])) { 20 | $sender->sendMessage("/rpwd "); 21 | return false; 22 | } 23 | $this->plugin->resetpassword($args[0], $sender); 24 | return true; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/ARCore/Auth/EventListener.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 30 | } 31 | 32 | public function onBreak(BlockBreakEvent $event) { 33 | $player = $event->getPlayer(); 34 | if(!$this->plugin->isAuthenticated($player)) { 35 | $event->setCancelled(); 36 | } 37 | } 38 | 39 | public function onPlace(BlockPlaceEvent $event) { 40 | $player = $event->getPlayer(); 41 | if(!$this->plugin->isAuthenticated($player)) { 42 | $event->setCancelled(); 43 | } 44 | } 45 | 46 | public function onDamage(EntityDamageEvent $event) { 47 | $entity = $event->getEntity(); 48 | if($entity instanceof Player && !$this->plugin->isAuthenticated($entity)) { 49 | $event->setCancelled(); 50 | } 51 | if($event instanceof EntityDamageByEntityEvent) { 52 | $damager = $event->getDamager(); 53 | if($damager instanceof Player && !$this->plugin->isAuthenticated($damager)) { 54 | $event->setCancelled(); 55 | } 56 | } 57 | } 58 | 59 | public function onPickupArrow(InventoryPickupArrowEvent $event) { 60 | $player = $event->getInventory()->getHolder(); 61 | if($player instanceof Player && !$this->plugin->isAuthenticated($player)) { 62 | $event->setCancelled(); 63 | } 64 | } 65 | 66 | public function onPickupItem(InventoryPickupItemEvent $event) { 67 | $player = $event->getInventory()->getHolder(); 68 | if($player instanceof Player && !$this->plugin->isAuthenticated($player)) { 69 | $event->setCancelled(); 70 | } 71 | } 72 | 73 | public function onChat(PlayerChatEvent $event) { 74 | $player = $event->getPlayer(); 75 | $message = $event->getMessage(); 76 | $recipients = array(); 77 | if(!$this->plugin->isAuthenticated($player)) { 78 | if($this->plugin->auth->get("chat-login")) { 79 | if($this->plugin->isRegistered($player->getName())) { 80 | $this->plugin->login($player, $message); 81 | } else { 82 | if(!isset($this->plugin->confirmPassword[strtolower($player->getName())])) { 83 | $this->plugin->confirmPassword[strtolower($player->getName())] = $message; 84 | $player->sendMessage($this->plugin->auth->get("confirm-password")); 85 | } else { 86 | if($this->plugin->confirmPassword[strtolower($player->getName())] == $message) { 87 | $this->plugin->register($player, $message, $message); 88 | unset($this->plugin->confirmPassword[strtolower($player->getName())]); 89 | } else { 90 | $player->sendMessage($this->plugin->auth->get("password-not-match")); 91 | unset($this->plugin->confirmPassword[strtolower($player->getName())]); 92 | } 93 | } 94 | } 95 | } 96 | $event->setCancelled(); 97 | } else { 98 | if($this->plugin->isCorrectPassword($player, $message)) { 99 | $player->sendMessage($this->plugin->auth->get("dont-say-password")); 100 | $event->setCancelled(); 101 | } 102 | } 103 | if(!$this->plugin->auth->get("see-messages")) { 104 | foreach($event->getRecipients() as $recipient) { 105 | if(!$recipient instanceof Player || $this->plugin->isAuthenticated($recipient)) { 106 | array_push($recipients, $recipient); 107 | } 108 | } 109 | $event->setRecipients($recipients); 110 | } 111 | } 112 | 113 | public function onCommandPreprocess(PlayerCommandPreprocessEvent $event) { 114 | $player = $event->getPlayer(); 115 | $message = strtolower($event->getMessage()); 116 | $args = explode(" ", $message); 117 | $forgotpasswordaliases = array( 118 | "/forgotpassword", 119 | "/forgetpassword", 120 | "/forgotpw", 121 | "/forgetpw", 122 | "/forgotpwd", 123 | "/forgetpwd", 124 | "/fpw", 125 | "/fpwd", 126 | "/forgot"); 127 | if(!$this->plugin->isAuthenticated($player)) { 128 | if($message[0] == "/") { 129 | if(!in_array($args[0], $forgotpasswordaliases) && $args[0] !== "/log" && $args[0] !== "/reg") { 130 | $event->setCancelled(); 131 | } 132 | } 133 | } 134 | } 135 | 136 | public function onDrop(PlayerDropItemEvent $event) { 137 | $player = $event->getPlayer(); 138 | if(!$this->plugin->isAuthenticated($player)) { 139 | $event->setCancelled(); 140 | } 141 | } 142 | 143 | public function onExhaust(PlayerExhaustEvent $event) { 144 | $player = $event->getPlayer(); 145 | if(!$this->plugin->isAuthenticated($player)) { 146 | $event->setCancelled(); 147 | } 148 | } 149 | 150 | public function onInteract(PlayerInteractEvent $event) { 151 | $player = $event->getPlayer(); 152 | if(!$this->plugin->isAuthenticated($player)) { 153 | $event->setCancelled(); 154 | } 155 | } 156 | 157 | public function onConsume(PlayerItemConsumeEvent $event) { 158 | $player = $event->getPlayer(); 159 | if(!$this->plugin->isAuthenticated($player)) { 160 | $event->setCancelled(); 161 | } 162 | } 163 | 164 | public function onJoin(PlayerJoinEvent $event) { 165 | $player = $event->getPlayer(); 166 | $player->sendMessage($this->plugin->auth->get("join-message")); 167 | $this->plugin->messagetick[strtolower($player->getName())] = 0; 168 | if($this->plugin->isRegistered($player->getName())) { 169 | $player->sendMessage($this->plugin->auth->get("login")); 170 | } else { 171 | $player->sendMessage($this->plugin->auth->get("register")); 172 | } 173 | if($this->plugin->auth->get("invisible")) { 174 | $player->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, true); 175 | $player->setDataProperty(Entity::DATA_SHOW_NAMETAG, Entity::DATA_TYPE_BYTE, 0); 176 | } 177 | if($this->plugin->auth->get("blindness")) { 178 | $effect = Effect::getEffect(15); 179 | $effect->setAmplifier(99); 180 | $effect->setDuration(999999); 181 | $effect->setVisible(false); 182 | $player->addEffect($effect); 183 | $effect = Effect::getEffect(16); 184 | $effect->setAmplifier(99); 185 | $effect->setDuration(999999); 186 | $effect->setVisible(false); 187 | $player->addEffect($effect); 188 | } 189 | if($this->plugin->auth->get("auto-authentication")) { 190 | $data = $this->plugin->getPlayer($player->getName()); 191 | if(!is_null($data)) { 192 | if($player->getUniqueId()->toString() == $data["uuid"]) { 193 | $this->plugin->force($player); 194 | return true; 195 | } 196 | } 197 | } 198 | $this->plugin->getServer()->getScheduler()->scheduleDelayedTask(new TimeoutTask($this->plugin, $player), $this->plugin->auth->get("timeout") * 20); 199 | } 200 | 201 | public function onMove(PlayerMoveEvent $event) { 202 | $player = $event->getPlayer(); 203 | if(!$this->plugin->isAuthenticated($player)) { 204 | if(!$this->plugin->auth->get("allow-movement")) { 205 | $event->setCancelled(); 206 | } 207 | } 208 | } 209 | 210 | public function onPrelogin(PlayerPreLoginEvent $event) { 211 | $player = $event->getPlayer(); 212 | if($this->plugin->auth->get("single-session")) { 213 | if(!is_null($p = $this->plugin->getServer()->getPlayerExact($player->getName())) && $this->plugin->isAuthenticated($p)) { 214 | $player->close("", "Already logged in!"); 215 | $event->setCancelled(); 216 | } 217 | } 218 | } 219 | 220 | public function onQuit(PlayerQuitEvent $event) { 221 | $player = $event->getPlayer(); 222 | $this->plugin->logout($player); 223 | } 224 | 225 | } 226 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Tasks/MessageTick.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 13 | } 14 | 15 | public function onRun($currentTick) { 16 | foreach($this->plugin->getServer()->getOnlinePlayers() as $player) { 17 | if(!$this->plugin->isAuthenticated($player) && !isset($this->plugin->confirmPassword[strtolower($player->getName())]) && isset($this->plugin->messagetick[strtolower($player->getName())])) { 18 | if($this->plugin->messagetick[strtolower($player->getName())] == $this->plugin->auth->get("seconds-til-next-message")) { 19 | $this->plugin->messagetick[strtolower($player->getName())] = 0; 20 | if($this->plugin->isRegistered($player->getName())) { 21 | $player->sendMessage($this->plugin->auth->get("login")); 22 | } else { 23 | $player->sendMessage($this->plugin->auth->get("register")); 24 | } 25 | } else { 26 | $this->plugin->messagetick[strtolower($player->getName())] += 1; 27 | } 28 | } 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Tasks/PopupTipTick.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 10 | } 11 | 12 | public function onRun($currentTick) { 13 | foreach($this->plugin->getServer()->getOnlinePlayers() as $player) { 14 | if(!$this->plugin->isAuthenticated($player) && !isset($this->plugin->confirmPassword[strtolower($player->getName())])) { 15 | if($this->plugin->auth->get("popup")) { 16 | if($this->plugin->isRegistered($player->getName())) { 17 | $player->sendPopup($this->plugin->auth->get("login-popup")); 18 | } else { 19 | $player->sendPopup($this->plugin->auth->get("register-popup")); 20 | } 21 | } 22 | } 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/ARCore/Auth/Tasks/TimeoutTask.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 10 | $this->player = $player; 11 | } 12 | 13 | public function onRun($currentTick) { 14 | if(!$this->plugin->isAuthenticated($this->player)) { 15 | $this->player->kick($this->plugin->auth->get("timeout-message")); 16 | } 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/ChatFilter.php: -------------------------------------------------------------------------------- 1 | profanityChecker = new ChatClasser(); 24 | $this->enableMessageFrequency = $enableMsgFrequency; 25 | } 26 | 27 | /** 28 | * Clears the recent chat filter (for spam protection) 29 | * 30 | * @return null 31 | */ 32 | public function clearRecentChat() { 33 | $this->recentChat = array(); 34 | } 35 | 36 | /** 37 | * Check for valid message 38 | * 39 | * @param LbPlayer $player 40 | * @param string $message 41 | * @param boolean $needCheck 42 | * @return boolean 43 | */ 44 | public function check($player, $message, $needCheck = true) { 45 | // Check the message and log the result. 46 | $checkResult = $this->profanityChecker->check($message); 47 | 48 | $errorMessage = $this->getErrorMessage($message, $player); 49 | if (!empty($errorMessage)) { 50 | $player->sendMessage($errorMessage); 51 | return false; 52 | } 53 | if($needCheck){ 54 | if ($this->enableMessageFrequency) { 55 | $this->recentChat[$player->getID()] = true; 56 | } 57 | $this->recentMessages[$player->getID()] = $message; 58 | } 59 | return true; 60 | } 61 | 62 | /** 63 | * Get message with suitable error 64 | * 65 | * @param string $message 66 | * @param Player $player 67 | * @return string 68 | */ 69 | private function getErrorMessage($message, $player) { 70 | $errorMsg = ''; 71 | 72 | if (strlen($message) === 0) { 73 | $errorMsg = TextFormat::RED . ' That message is too short.'; 74 | } elseif (isset($this->recentChat[$player->getID()])) { 75 | /* player already posted message in last 3 seconds */ 76 | $errorMsg = TextFormat::RED . ' You are messaging too fast.'; 77 | } elseif (isset($this->recentMessages[$player->getID()]) && 78 | $this->recentMessages[$player->getID()] === $message) { 79 | /* player's message repeated his previous message */ 80 | $errorMsg = TextFormat::RED . ' You repeated that message.'; 81 | } elseif ($this->profanityChecker->getIsProfane()) { 82 | $errorMsg = TextFormat::RED . ' That\'s an inappropriate message.'; 83 | } elseif ($this->profanityChecker->getIsDating()) { 84 | $errorMsg = TextFormat::RED . ' No dating.'; 85 | } elseif ($this->profanityChecker->getIsAdvertising()) { 86 | $errorMsg = TextFormat::RED . ' No advertising'; 87 | } 88 | 89 | return $errorMsg; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/ChatFilterTask.php: -------------------------------------------------------------------------------- 1 | owner = $owner; 23 | } 24 | 25 | /** 26 | * When the task is ran 27 | * 28 | * @param integer $currentTick The current tick 29 | * @return null Nothing 30 | */ 31 | public function onRun($currentTick) { 32 | $this->getOwner()->filter->clearRecentChat(); 33 | } 34 | } -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/ChatClasser.php: -------------------------------------------------------------------------------- 1 | sepChars = '(\'|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\-|\=| '; // Top row of a Qwerty keyboard, in order, AND SPACE 53 | $this->sepChars .= '|\{|\}|\||\[|\]|\\\\|\:|\"|\;|\'|\<|\>|\?|\,|\.|\/|\"'; // Right side of keyboard, working our way down 54 | $this->sepChars .= '|\~|\`|\´|\d'; // remaining two in the upper left, and the number one. 55 | $this->sepChars .= ')+'; // Closing of regex group, and quantifier (zero to unlimited times) 56 | // Version of this that will match at zero or more of the separators. (Separators Optional). 57 | $this->sepCharsOpt = rtrim($this->sepChars,'+')."*"; 58 | 59 | 60 | // Build our word lists from files. 61 | $this->badWords = new WordList(__DIR__ . "/dict/bad_english.csv"); 62 | $this->badWords->addToList(__DIR__ . "/dict/bad_spanish.csv"); 63 | $this->badWords->addToList(__DIR__ . "/dict/bad_german.csv"); 64 | // $this->badWords->dump(); // Enable to verify the list is properly constructed. 65 | $this->harmlessWords = new WordList(__DIR__ . "/dict/harmless.csv", false); // never need to check leet. 66 | $this->datingWords = new WordList(__DIR__ . "/dict/dating.csv"); 67 | //$this->datingWords->dump(); 68 | $this->advertisingWords = new WordList(__DIR__ . "/dict/advertising.csv"); 69 | $this->controversialWords = new WordList(__DIR__ . "/dict/controversial.csv"); 70 | } 71 | 72 | public function getIsBad() { 73 | return $this->isBad; 74 | } 75 | 76 | public function getIsProfane() { 77 | return $this->isProfane; 78 | } 79 | 80 | public function getIsDating() { 81 | return $this->isDating; 82 | } 83 | 84 | public function getIsAdvertising() { 85 | return $this->isAdvertising; 86 | } 87 | 88 | public function getIsControversial() { 89 | return $this->isControversial; 90 | } 91 | 92 | public function getIsSpam(){ 93 | return $this->isSpam; 94 | } 95 | 96 | public function getTexToCheck() { 97 | return $this->textToCheck; 98 | } 99 | 100 | public function getTextPreprocessed() { 101 | return $this->textPreProcessed; 102 | } 103 | 104 | public function getTextHarmlessGone() { 105 | return $this->textHarmlessGone; 106 | } 107 | 108 | public function getNHarmless() { 109 | return $this->numberHarmlessRemoved; 110 | } 111 | 112 | public function getTextNoWhite() { 113 | return $this->textToCheckNoWhiteSpace; 114 | } 115 | 116 | public function getReason() { 117 | return $this->reason; 118 | } 119 | 120 | public function getTerseReason() { 121 | return $this->terseReason; 122 | } 123 | 124 | public function getProcessingMicroseconds() { 125 | return $this->processingTimeMicroseconds; 126 | } 127 | 128 | ////////////////////////////////////////// Check the incoming text /////////////////////////////////////////////// 129 | /** 130 | * Check the incoming text for profanity./ 131 | * It does not stop checking on the first thing it finds, because we might want to make use of the classification of offense. 132 | * Also, we expect the majority of things to pass, so a first-possible exit would not save us much time anyway. 133 | * Mostly this is a check against the word lists we set up in constructor. 134 | * @param $inString text to check. 135 | * @return bool true if it is bac. 136 | */ 137 | public function check($inString) { 138 | $this->resetToDefaultState(); 139 | 140 | $ETStart = microtime(); 141 | 142 | // Do a check on the raw input string, for flexibility. 143 | // Most of the real detection is later, by comparssion against the word lists. 144 | // This is here because we can always add a regex expression to get rid of seomthine 145 | // we need to get rid of. 146 | $this->textToCheck = $inString; 147 | $this->checkRaw($this->textToCheck); 148 | 149 | // Whitelist 150 | // Get rid of stuff we know is harmless. This reduces false positives, and 151 | // shortens the length of the string we need to process later. 152 | // We shift to lowercase before comparisson, so we do not need case insensitive 153 | // comparisons later. 154 | $this->textToCheck = strtolower($this->textToCheck); 155 | $this->textHarmlessGone = $this->harmlessWords->replaceFromList($this->textToCheck); 156 | 157 | // Detect special cases that for one reason or another are not found by regular 158 | // detection. This is also not the main filtering, but a backup. 159 | $this->detectSpecialProfane($this->textHarmlessGone); 160 | $this->detectSpecialDating($this->textHarmlessGone); 161 | $this->detectSpecialAdvertising($this->textHarmlessGone); 162 | 163 | // Also leet stuff that only maps to a single letter is converted here. 164 | $this->textHarmlessGone = $this->unleet($this->textHarmlessGone); 165 | 166 | // Get rid of white space to prevent people from getting around filter by adding extra spaces. 167 | $this->textToCheckNoWhiteSpace = $this->removeAllWhiteSpace($this->textHarmlessGone); 168 | 169 | // Now do the filtering 170 | $this->checkBannedLists( $this->textToCheckNoWhiteSpace); 171 | 172 | // Spam detection is done without processing 173 | $this->detectSpam($inString); 174 | 175 | $ETEnd = microtime(); 176 | $this->processingTimeMicroseconds = 1000000 * ($ETEnd - $ETStart); 177 | return $this->isBad; 178 | } 179 | 180 | ///////////////////////////////// REGULAR FILTERING ////////////////////////////////////////////////////////// 181 | // Run through the regular checks 182 | protected function checkBannedLists( $inString ){ 183 | // Run tests for the various categories-- the main filtering. 184 | // If any of them find any of the offenses we are looking for, it will set isBad, the appropriate flag, 185 | // and add to the reason. 186 | 187 | if ($this->badWords->checkLeet($inString)) { 188 | $this->isProfane = true; 189 | $this->isBad = true; 190 | $this->reason .= " PROFANE " . $this->badWords->reason; 191 | $this->terseReason .= 'P'; 192 | } 193 | if ($this->datingWords->checkLeet($inString)) { 194 | $this->isDating = true; 195 | $this->isBad = true; 196 | $this->reason .= " DATING " . $this->datingWords->reason; 197 | $this->terseReason .= 'D'; 198 | } 199 | if ($this->advertisingWords->checkLeet($inString)) { 200 | $this->isAdvertising = true; 201 | $this->isBad = true; 202 | $this->reason .= " ADV " . $this->advertisingWords->reason; 203 | $this->terseReason .= 'A'; 204 | } 205 | if ($this->controversialWords->checkLeet($inString)) { 206 | $this->isControversial = true; 207 | $this->isBad = true; 208 | $this->reason .= " CONTROVERSY " . $this->controversialWords->reason; 209 | $this->terseReason .= 'C'; 210 | } 211 | } 212 | 213 | ////////////////////////////////////////// CHECK RAW INPUT /////////////////////////////////////////////////////// 214 | /** 215 | * Check before all preprocessing. This is here to give us a way to get rid of things people slip through our 216 | * other defenses. Will set isBad and the reason if there is a failure of this. 217 | * @param $inString 218 | * @return bool 219 | */ 220 | protected function checkRaw($inString) { 221 | $inString = ' ' . $inString . ' '; // Add to the ends so things looking for a terminator after a word can work 222 | 223 | $patternList = array(// Reason this is hard to detect: 224 | // [[:punct:]] will look for any punctuation. The double square brackets are needed. 225 | // And look also for double letters. 226 | // Note that the trailing 'i' makes this case insensitive 227 | // Each should be: description of what we are looking for => [ regex pattern, why ] 228 | 'fu' => array("/".$this->sepChars."f".$this->sepCharsOpt."u/i", "Profane"), // Note that you is whitelisted 229 | 'fu' => array("/".$this->sepChars."ef+".$this->sepCharsOpt."u/i", "Profane"), // Note that you is whitelisted 230 | 'ef you' => array("/".$this->sepChars."ef+".$this->sepCharsOpt."you/i", "Profane"), 231 | ' bch ' => array('/ bch /i', 'Profane'), 232 | 's=x' => array('/s=x/i', 'Profane'), // 233 | 'se*' => array('/se\*/i', 'Profane'), 234 | ' s/x ' => array('/s[[:punct:]]x/i', 'Profane'), 235 | ' b* ' => array('/ b(\*|=) /', 'Dating'), 236 | ' gir/' => array('/ gir(\*|\\\|\/) /', 'Dating'), 237 | ' g* ' => array('/ g(\*|=) /', 'Dating'), 238 | ' ag.friend ' => array('/ a(b|g)[[:punct:]]friend/', 'Dating'), 239 | ' ag.f ' => array('/ a(b|g)[[:punct:]]f /', 'Dating'), 240 | // '.com' => array('/[[:punct:]]+c+o+m+/i', 'Advertising'), 241 | // 'spaced .com' => array('/\s+[[:punct:]]+\s+c+o+m+/i', 'Advertising'), // As above but with spaces before and after the punctuation 242 | // '.net' => array('/[[:punct:]]+n+e+t+/i', 'Advertising'), 243 | // 'spaced .net' => array('/\s+[[:punct:]]+\s+n+e+t+/i', 'Advertising'), 244 | 'inpvp' => array('/inpvp/i', 'Advertising'), // Look for this particular server directly. 245 | '8==D' => array('/8=+(D|>)/i', 'Profane'), // Penis sign 246 | '.|.' => array('/\.\|\./i', 'Profane'), // Penis sign 247 | 'o|o' => array('/o\|o/i', 'Profane'), // Penis sign 248 | '(.)(.)' => array('/\(\.\)\s*\(\.\)/','Profane') // boobs sign 249 | ); 250 | 251 | foreach ($patternList as $badCombo => $patternAndReason) { 252 | if (preg_match($patternAndReason[0], $inString, $matches)) { 253 | if ($patternAndReason[1] == 'Advertising') { 254 | $this->reason .= " ADV checkRaw found: $badCombo. Matched: " . $matches[0]; 255 | $this->terseReason .= 'A'; 256 | $this->isAdvertising = true; 257 | $this->isBad = true; 258 | } 259 | if ($patternAndReason[1] == 'Profane') { 260 | $this->reason .= " PROFANE checkRaw found: $badCombo. Matched: " . $matches[0]; 261 | $this->terseReason .= 'P'; 262 | $this->isProfane = true; 263 | $this->isBad = true; 264 | } 265 | if ($patternAndReason[1] == 'Dating') { 266 | $this->reason .= " DATING checkRaw found: $badCombo. Matched: " . $matches[0]; 267 | $this->terseReason .= 'D'; 268 | $this->isDating = true; 269 | $this->isBad = true; 270 | } 271 | } 272 | } 273 | } 274 | 275 | /////////////////////////////////////// DETECT SPECIAL CASES /////////////////////////////////////////// 276 | /** 277 | * Special cases are checked after removal of harmless. 278 | * Looks for special cases that for one reason or another are hard to detect in the regular word list, 279 | * or might cause false positives if included in a regular word list. 280 | * This is also a line of defense if someone figures out a way through our regular filters, add to this. 281 | * @param $inString 282 | * @return bool 283 | */ 284 | protected function detectSpecialProfane($inString) { 285 | $inString = ' ' . $inString . ' '; // Add to the ends so things looking for a terminator after a word can work 286 | 287 | $patternList = array(// Reason this is hard to detect: 288 | 'eff u' => '/ ef+ u/', 289 | 'tit' => '/ tit+ /', // Word end in t, followed by it. Also word "title" 290 | 'tits' => '/ tit+s/', 291 | 't i t' => '/ t i t /', 292 | 't it' => '/ t it /', 293 | 'ass' => '/ ass /', 294 | ' sx' => '/ sx/', 295 | 'a s s' => '/ a s s/' 296 | ); 297 | 298 | // foreach ( $patternList as $key => $value ){echo( "$key => $value
"); } 299 | 300 | foreach ($patternList as $badCombo => $pattern) { 301 | if (preg_match($pattern, $inString, $matches)) { 302 | $this->reason = "Special Profane Found: $badCombo. Matched: " . $matches[0]; 303 | $this->terseReason .= 'P'; 304 | $this->isProfane = true; 305 | $this->isBad = true; 306 | return true; 307 | } 308 | } 309 | return false; 310 | } 311 | 312 | protected function detectSpecialDating($inString) { 313 | $inString = ' ' . $inString . ' '; // Add to the ends so things looking for a terminator after a word can work 314 | 315 | $patternList = array(// Reason this is hard to detect: 316 | ' g|b f ' => "/".$this->sepChars."(g+|b+)".$this->sepCharsOpt."f/", 317 | ' s*x' => "/".$this->sepChars."(s+)".$this->sepChars."x+/", 318 | ' u r hot' => "/".$this->sepChars."u+".$this->sepChars."r+".$this->sepChars.'hot/', 319 | ' u r so hot' => "/".$this->sepChars."u+".$this->sepChars."r+".$this->sepChars.'so'.$this->sepChars.'hot/' 320 | ); 321 | 322 | foreach ($patternList as $badCombo => $pattern) { 323 | if (preg_match($pattern, $inString, $matches)) { 324 | $this->reason = "Special Dating Found: $badCombo. Matched: " . $matches[0]; 325 | $this->terseReason .= 'D'; 326 | $this->isDating = true; 327 | $this->isBad = true; 328 | return true; 329 | } 330 | } 331 | return false; 332 | } 333 | 334 | protected function detectSpecialAdvertising($inString) { 335 | $inString = ' ' . $inString . ' '; // Add to the ends so things looking for a terminator after a word can work 336 | $patternList = array(// Reason this is hard to detect: 337 | 'dotnet' => '/\.net/' // dot net 338 | ); 339 | foreach ($patternList as $badCombo => $pattern) { 340 | if (preg_match($pattern, $inString, $matches)) { 341 | $this->reason = "Special Advertising Found: $badCombo. Matched: " . $matches[0]; 342 | $this->terseReason .= 'P'; 343 | $this->isAdvertising = true; 344 | $this->isBad = true; 345 | return true; 346 | } 347 | } 348 | return false; 349 | } 350 | 351 | public function dump() { 352 | $this->badWords->dump(); 353 | } 354 | 355 | /////////////////////////////////////////////////////// STRING PROCESSING ///////////////////////////////////////////////////////////////////////////////////// 356 | 357 | /** 358 | * Change letters with umlauts and other decorations to their normal letters. 359 | * Use this only for things that unaruably may be interpreted as a particulat letter. 360 | * For example, ö => 0. 361 | * You still need to later leet check for things like 3 => e. 362 | * @param $inString 363 | * @return mixed 364 | */ 365 | function unleet($inString) { 366 | $outstring = $inString; 367 | $outstring = preg_replace('/Á|á|À|Â|à|Â|â|Ä|ä|Ã|ã|Å|å|α|Δ|Λ|λ/', 'a', $outstring); 368 | // $outstring = preg_replace('/ß|Β|β/', 'b', $outstring); 369 | $outstring = preg_replace( '/Ç|ç|¢|©/', 'c', $outstring); 370 | $outstring = preg_replace('/Þ|þ|Ð|ð/', 'd', $outstring); 371 | $outstring = preg_replace('/€|È|è|É|é|Ê|ê|∑|£|€/', 'e', $outstring); 372 | $outstring = preg_replace('/ƒ/', 'f', $outstring); 373 | // $outstring = preg_replace( '//', 'g', $outstring); 374 | // $outstring = preg_replace( '//', 'h', $outstring); 375 | $outstring = preg_replace( '/Ì|Í|Î|Ï|ì|í|î|ï/', 'i', $outstring); 376 | // $outstring = preg_replace( '//', 'j', $outstring); 377 | $outstring = preg_replace('/Κ|κ/', 'k', $outstring); 378 | $outstring = preg_replace('/£/', 'l', $outstring); 379 | //$outstring = preg_replace( '//', 'm', $outstring); 380 | $outstring = preg_replace('/η|ñ|Ν|Π/', 'n', $outstring); 381 | $outstring = preg_replace('/Ο|○|ο|Φ|¤|°|ø|ö|ó/', 'o', $outstring); 382 | $outstring = preg_replace('/ρ|Ρ|¶|þ/', 'p', $outstring); 383 | //$outstring = preg_replace( '//', 'q', $outstring); 384 | $outstring = preg_replace('/®/', 'r', $outstring); 385 | //$outstring = preg_replace('/\$/', 's', $outstring); // Note that $ must be escapted 386 | $outstring = preg_replace('/Τ|τ/', 't', $outstring); 387 | $outstring = preg_replace('/υ|µ/', 'u', $outstring); 388 | $outstring = preg_replace('/ν/', 'v', $outstring); 389 | $outstring = preg_replace('/ω|ψ|Ψ/', 'w', $outstring); 390 | $outstring = preg_replace('/Χ|χ|×/', 'x', $outstring); 391 | $outstring = preg_replace('/¥|γ|ÿ|ý|Ÿ|Ý/', 'y', $outstring); 392 | // $outstring = preg_replace( '//', 'z', $outstring); 393 | return $outstring; 394 | } 395 | 396 | function removeAllWhiteSpace($inString) { 397 | $outString = preg_replace('/\s+/', "", $inString); 398 | // Condense multiple = to singles, also for speed of processing. 399 | $outString = preg_replace('/=+/', '=', $outString); 400 | return $outString; 401 | } 402 | 403 | private function resetToDefaultState() { 404 | $this->isProfane = false; 405 | $this->isDating = false; 406 | $this->isAdvertising = false; 407 | $this->isControversial = false; 408 | $this->isBad = false; 409 | $this->reason = ""; 410 | $this->terseReason = ''; 411 | $this->replacementText = ""; 412 | } 413 | 414 | ///////////////////////////////////////////// SPAM DETECTION ////////////////////// 415 | // Some basic spam detection. 416 | // Spaces are normally 18% of English. So, if space frequency drops below 9%, it is almost certainly spam. 417 | protected function detectSpam($inString) { 418 | 419 | 420 | // Block if this is a line of text without enough spaces 421 | $lengthOfInput = strlen( $inString); 422 | if ($lengthOfInput <= 1) return false; // not spam if a single letter. 423 | $NSpaces = substr_count( $inString, ' ' ); 424 | $spaceFrequency = $NSpaces / $lengthOfInput; 425 | // echo( "Length: $lengthOfInput Spaces: $NSpaces Space Frequency: $spaceFrequency
"); 426 | 427 | if ( $lengthOfInput > 22 ){ 428 | 429 | if ($spaceFrequency < 0.09 ) { 430 | $this->isBad = true; 431 | $this->isSpam = true; 432 | return true; 433 | } 434 | } 435 | 436 | return false; 437 | } 438 | 439 | } 440 | ?> 441 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/WordList.php: -------------------------------------------------------------------------------- 1 | isLeet = $makeLeet; 30 | $this->wordList = $this->csvToArray($filename); 31 | 32 | if ($this->isLeet) { 33 | // var_dump( $this->wordList); 34 | $this->wordListLeet = $this->makeListLeet( $this->wordList); 35 | } 36 | 37 | // echo "
*************************** List upon consturction:
"; 38 | // foreach( $this->wordList as $word) { echo $word."
";} 39 | } 40 | 41 | /** 42 | * Add to the word list, given a csv file. 43 | * @param $filename 44 | */ 45 | function addToList( $filename ){ 46 | // echo "Adding filename:".$filename."
"; 47 | // echo "
*************** List before add:
"; 48 | // foreach( $this->wordList as $word) { echo $word."
";} 49 | 50 | $wordsToAdd = $this->csvToArray( $filename ); 51 | //var_dump($wordsToAdd); 52 | 53 | $this->wordList = array_merge( $this->wordList, $wordsToAdd); 54 | if ($this->isLeet){ 55 | $wordsToAddLeet = $this->makeListLeet($wordsToAdd); 56 | $this->wordListLeet =array_merge( $this->wordListLeet, $wordsToAddLeet); 57 | } 58 | 59 | // echo "********** List after adding:
"; 60 | // foreach( $this->wordList as $word) { echo $word."
";} 61 | } 62 | 63 | /** 64 | * Given a word list, replace all the characters in it with regular expressions that search for leat. 65 | * Do this in preparation for later leet searches. 66 | * This utility may be used by other objects as well. 67 | * @param $wordListIn 68 | */ 69 | public function makeListLeet(array $wordListIn) { 70 | $returnWordList = array(); 71 | 72 | // Separator Characters. 73 | // The matcher will permit an unlimited number of any of these characters between 74 | // characters of the word we are trying to match. 75 | // This is to get rid of words like "p_o_o_p". 76 | //$sepChars = '(_|\||-|\+|\(|\)|\[|\]|\{|\}|\*|\.|\,|\\|\+|\<|\>|\^|\?|\=|\:|\;|\#|\@|\%|\!|\&|\$|\"|\')*'; 77 | 78 | // This is a really confusing one to edit, so build the expresson a little at a time in an orderly fassion: 79 | // Programming fact: To match a literal backslash using PHP’s preg_match() function you must use 4 backslashes. 80 | // It must be done like this because every backslash in a C-like string must be escaped by a backslash. 81 | // That would give us a regular expression with 2 backslashes, as you might have assumed at first. 82 | // However, each backslash in a regular expression must be escaped by a backslash, too. 83 | // This is the reason that we end up with 4 backslashes. 84 | // This pattern is to properly escape a single quote: \\\' 85 | $sepChars = '(\'|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\-|\='; // Top row of a Qwerty keyboard, in order. 86 | $sepChars .= '|\{|\}|\||\[|\]|\\\\|\:|\"|\;|\'|\<|\>|\?|\,|\.|\/|\"'; // Right side of keyboard, working our way down 87 | $sepChars .= '|\~|\`|\´|\d'; // remaining two in the upper left, some special German apostrophy, and number 1. Any digit 88 | $sepChars .= ')*'; // Closing of regex group, and quantifier (zero to unlimited times) 89 | 90 | // In a preg expression, '(x|y|z)' will trigger on x, y, or z. 91 | // This will also match any letter doubled. 92 | $leet_replace['a'] = '(a+|4|@|q)'; 93 | $leet_replace['b'] = '(b+|8|ß|Β|β)'; 94 | $leet_replace['c'] = '(c+)'; 95 | $leet_replace['d'] = '(d+)'; 96 | $leet_replace['e'] = '(e+|3)'; 97 | $leet_replace['f'] = '(f+|ph)'; // ph as phonetic replacement for f 98 | $leet_replace['g'] = '(g+|6|9)'; 99 | $leet_replace['h'] = '(h+)'; 100 | $leet_replace['i'] = '(i+|1|\!)'; 101 | $leet_replace['j'] = '(j+)'; 102 | $leet_replace['k'] = '(k+)'; 103 | $leet_replace['l'] = '(l+|1)'; 104 | $leet_replace['m'] = '(m+|nn)'; 105 | $leet_replace['n'] = '(n+)'; 106 | $leet_replace['o'] = '(o+|0)'; 107 | $leet_replace['p'] = '(p+)'; 108 | $leet_replace['q'] = '(q+)'; 109 | $leet_replace['r'] = '(r+|®)'; 110 | $leet_replace['s'] = '(s+|5|z|\$)'; // z a replacement for s in making plurals 111 | $leet_replace['t'] = '(t+|7)'; 112 | $leet_replace['u'] = '(u+|v)'; 113 | $leet_replace['v'] = '(v+|u)'; 114 | $leet_replace['w'] = '(w+)'; 115 | $leet_replace['x'] = '(x+|\&|\>\<|\)\()'; 116 | $leet_replace['y'] = '(y+)'; 117 | $leet_replace['z'] = '(z+|s)'; 118 | 119 | //echo( "The leet_replace array
"); 120 | //foreach ( $leet_replace as $key => $value ){ 121 | // echo( "$key => $value
"); 122 | //} 123 | 124 | // Build a word list with all of the individual letters replaced with regular expressions to match leet equivalents. 125 | // Note that the str_replace function does NOT work right for this! It will replace the letters it just added, recursively 126 | // with their equivalents! (This took hours to find.) 127 | // So, use loops as explicitly replace each: 128 | for($wordIndex = 0;$wordIndex < count($wordListIn);$wordIndex++) { 129 | //$returnWordList[] = '/' . str_ireplace(array_keys($leet_replace), array_values($leet_replace), $wordListIn[$index]) . '/'; 130 | $word = $wordListIn[$wordIndex]; 131 | $wordReplacer = ''; 132 | // Loop through the word in question one character at a time. 133 | for ($letterIndex=0; $letterIndex < strlen($word); $letterIndex++){ 134 | $char = substr( $word, $letterIndex, 1); 135 | if ( array_key_exists( $char, $leet_replace)){ 136 | $charReplacer = $leet_replace[$char]; 137 | $wordReplacer .= $charReplacer.$sepChars; 138 | } else { 139 | $wordReplacer .= $char.$sepChars; 140 | } 141 | } 142 | $returnWordList[] = '/'.$wordReplacer.'/'; 143 | //echo('
'.$wordListIn[$wordIndex].' => '.$returnWordList[$wordIndex].'
'); 144 | } 145 | return $returnWordList; 146 | } 147 | 148 | ///////////////////////////////// CHECK IF IN LIST /////////////////////////////////////////////////////// 149 | /** 150 | * See if the $inString contains leet version of any of the words on the object's list (which are bad words.) 151 | * Will set this->rejectReason to a meaningful reason if it is. Also sets $this->isProfane 152 | * @param $inString text to be tested. 153 | * @return bool true if the $inString contains a word on the list. 154 | */ 155 | function checkLeet($inString) 156 | { 157 | if (!$this->isLeet) return false; 158 | $matches = array(); 159 | try { 160 | for ($index = 0; $index < count($this->wordListLeet); $index++) { 161 | if (preg_match($this->wordListLeet[$index], $inString, $matches)) { 162 | $this->reason = "Found:" . $this->wordList[$index] . " Match: " . $matches[0]; 163 | $this->foundMatch = true; 164 | return true; 165 | } 166 | } 167 | } catch (\Exception $e){ 168 | return false; 169 | } 170 | $this->reason = ""; 171 | return false; 172 | } 173 | 174 | /** 175 | * Check to see if the input string contains one of the words. Plain old match, not looking for leet. 176 | * 177 | * @param $inString 178 | */ 179 | function checkPlain($inString) { 180 | for($index = 0;$index < count($this->wordList);$index++) { 181 | // echo($index." ".$this->wordList[ $index] ."
"); 182 | $found = strstr($inString, $this->wordList[$index]); 183 | if($found != "") { 184 | $this->reason = "Found word: $found"; 185 | $this->foundMatch = true; 186 | return true; 187 | } 188 | } 189 | $this->reason = ""; 190 | return false; 191 | } 192 | 193 | /////////////////////////////////// REPLACE FROM LIST /////////////////////////////////////////////////// 194 | /** 195 | * Given an input strring, if any words (or phrases) on the wordList appear in the input string, 196 | * replace them with a placeholder character: ‡ 197 | * This can be used for detecting harmless words. 198 | * It will also check for the word plus and 's' on the end, because that is also almost certainly harmless. 199 | * It only considers them harmless with a space on the left, and a space, period, question mark, or 200 | * exclaimation point on the right. 201 | * The placeholder prevents the filter from falsely catching this: "po happy op" 202 | * Because of the place holder, this becomes: "po ‡ op" or after spaces removed, po‡op. Not caught. 203 | * Without the placeholder it would become "poop', which would be a false positive. 204 | * Yes, that means people could use this character to trick us as a separator. So keep it quiet! 205 | * @param $inString 206 | * @param $replacementString 207 | * 208 | * @return mixed|string 209 | */ 210 | public function replaceFromList( $inString ){ 211 | $outString = ' '.$inString.' '; // add space on both sides so we only get complete words 212 | $NSwapped = 0; 213 | for( $index = 0; $index < count($this->wordList); $index++){ 214 | $count = 0; 215 | // Form regex expression for space - word - space or separator 216 | $matchPattern = '/ '.$this->wordList[$index].'[ .?!]/'; 217 | $outString = preg_replace($matchPattern, " ‡ ", $outString, -1, $count); 218 | // Form regex expression for space - word - letter 's' - space or separator 219 | $matchPattern = '/ '.$this->wordList[$index].'s[ .?!]/'; 220 | // echo( $matchPattern."
"); 221 | $outString = preg_replace($matchPattern, " ‡ ", $outString, -1, $count); 222 | $NSwapped += $count; 223 | } 224 | // Now for efficiency we do not need more than one placeholder in a row. 225 | // This will replace repeated separators with a single one. 226 | $outString = preg_replace('/( ‡(\s*‡\s*)+)/',' ‡ ', $outString); 227 | 228 | $outString = trim($outString); 229 | 230 | //echo "Number of swaps: ".$NSwapped." in ".$outString."
"; 231 | return $outString; 232 | } 233 | 234 | // This is a test function to display the contents of the input list against the leet replacement. 235 | // Useful for debugging, as well as making tables for analysis of how people are getting around 236 | // the filter. 237 | function dump() { 238 | // var_dump($this->wordList); 239 | // var_dump($this->wordListLeet); 240 | 241 | echo("
Word Entry => Leet Replacer Pattern
"); 242 | for($index = 0;$index < count($this->wordList);$index++) { 243 | // Uses non thread-safe echo, but this function only called for testing. 244 | echo("
".$index." ".$this->wordList[$index] . " =>
" . $this->wordListLeet[$index] . "
"); 245 | } 246 | } 247 | 248 | ////////////////////////////////////////// CSV TO ARRAY /////////////////////////////////////////////////////// 249 | /** 250 | * Given a csv file, return an array of strings. 251 | * Anything after a semicolon is a comment. 252 | * Multiple entries may be made on a line, separated by comments. 253 | * If a single entry has spaces between words they are preserved. 254 | * 255 | * @param $filename 256 | * 257 | * @return array 258 | */ 259 | public function csvToArray($filename) { 260 | // var_dump($filename); 261 | $outputArray = array(); 262 | 263 | // If no file exists best to return empty array, rather than crash. 264 | if(!file_exists($filename)) { 265 | return $outputArray; 266 | } 267 | 268 | $rows = file($filename); 269 | foreach($rows as $row) { 270 | if($row[0] != ';') { // First column = ';' means a comment. 271 | $row = strtok($row, ';'); // Get rid of comments 272 | $row = trim($row); 273 | $rowArray = explode(',', $row); 274 | $rowArray = array_filter($rowArray); // Removes empty elements, which would cause crash later. 275 | $outputArray = array_merge($outputArray, $rowArray); 276 | } 277 | } 278 | // Now trim off any white space picked up in this process 279 | $outputArray = array_map('trim', $outputArray); 280 | // Get rid of any empty elements: 281 | $outputArray = array_filter($outputArray); 282 | // echo ("CSV Conversion:
"); 283 | // var_dump($outputArray); 284 | return $outputArray; 285 | 286 | } 287 | } 288 | ?> 289 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/dict/advertising.csv: -------------------------------------------------------------------------------- 1 | ; Other servers and advertising 2 | ; Most of these are the names of competitive servers 3 | blocksandgold 4 | dgpocket 5 | blazecraft 6 | brodycraft 7 | cookiebuild 8 | ; Note that the space remover will also get rid of dot com 9 | 19132 10 | dotcom, dotnet, dotorg 11 | drpvp 12 | dyndns 13 | eleet 14 | explosivepe 15 | flexcraftpe 16 | gotpvp 17 | highspirit 18 | hostingitall 19 | hypixel, hipixel 20 | imcpe 21 | immortalfantasy, imortalfantasy 22 | jdcraft 23 | kingdomscraft 24 | ldxcraft 25 | lemmoncloud 26 | mineplex 27 | minicraft 28 | noip 29 | peepzcraft 30 | pigraid 31 | playmcmx 32 | pocketserver 33 | rumbencraft 34 | snooblife 35 | superfuntime 36 | teamcraft 37 | thedestinymc 38 | timelesspvp 39 | ubermc 40 | velocitymc 41 | www 42 | xenoncraft 43 | zapto 44 | leetcc 45 | leet 46 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/dict/bad_english.csv: -------------------------------------------------------------------------------- 1 | ; Bad word list 2 | ; Each line may have several entries with commas between. Semicolon comments. 3 | ; 4 | ; All spaces are taken out of the text under text before comparison with this, so entries here should have spaces. 5 | ; 6 | ; 7 | ; No need to double up on entries that will be caught by other entries. 8 | ; If a longer version will be caught by the shorter, use only the shorter. 9 | ; Faster to have fewer entries and take advantage of supersets. 10 | ; e.g. 'bullshit' is caught by shit. 11 | ; 12 | ; Comment out the duplicates, but do not delete. We know that we considered them. 13 | 14 | ; Shorten a fraction of a word that has no other purpose, e.g. "masturb', 'asshol' 15 | ; 16 | ; Enter alternative spellings you can thing of. 17 | ; 18 | ; When you can, use the fact the leet will replace some things to avoid similar entries. 19 | ; The leet replace will try substituting: 20 | ; original subsitute 21 | ; s z 22 | ; f ph 23 | ; 24 | ; 25 | poop ;keep easy test work at the top of the list. 26 | abortion,aborshun 27 | anal,aynal,aynel,anus 28 | arse 29 | ; ass -- would cause too many false positives (compass, as sure as soon) 30 | 69, sixtynine 31 | asshol 32 | asswipe 33 | ; baby 34 | balls ; ballz caught by leet check. 35 | bang 36 | bastard,basturd 37 | beastiality,bestiality 38 | bimbo,bihmbo 39 | bitch,bich 40 | blow, blojob 41 | ;body 42 | bollocks 43 | boner,boener 44 | boob, bewb, bube 45 | bugger 46 | bukkake 47 | bullshit 48 | cex 49 | chay 50 | chode 51 | clit,clitoris 52 | cock,kock,cawk 53 | coon 54 | condom, condim, condem, kondom, kondem 55 | cornhole 56 | coitus 57 | copulate 58 | crap, 59 | cum 60 | cunt,kunt 61 | dafuq 62 | damn,dammit 63 | dick,dik, diq, dck 64 | ;die 65 | dildo 66 | doggystyle 67 | dong 68 | douche, doosh, dusche, dewsh 69 | dyke,dike 70 | effin, effen, efin, efen 71 | fag, faggot,fagot, feg, fgt ;ph substitutions are caught by leet checker. 72 | fanny, 73 | fart 74 | fatass 75 | foreskin 76 | fornicate 77 | fuck, fuk, phuk, fuc, phuc, fck, fcker, fckr,fcku, fcuk, fucker, fuckr, fuct, fuq, fks, fak 78 | fcuk ; Any ph replacements for f are caught by leet check. 79 | frekin, freakin 80 | fuggin 81 | gtfo 82 | gay 83 | gangbang 84 | genital, genitalia 85 | gloryhole 86 | gook 87 | goddam 88 | hardon 89 | handjob,hanjob 90 | hell 91 | homo,hohmo 92 | horny, horney, horni 93 | idgaf,idgad,iwtfu,iwtfy,iwu,iwthswy,iwthswu,iwyb,iwythmb,iw2f,isfly 94 | jew 95 | jizz,jiz 96 | kill 97 | kike 98 | kkk 99 | labia 100 | lesbian, lesbain, lesbo, lesbyan, lisbian, leasben 101 | lmfao 102 | lick, liq 103 | masturb, masterba 104 | milf 105 | moan 106 | molest 107 | moron 108 | motherf, mutha 109 | muff,muph 110 | naked, nayked 111 | nazi 112 | negro,nigger,nigga, niger, nig 113 | nude, nudie, nudy 114 | nutsack 115 | orgasm 116 | pecker 117 | pedofile,pedophile,paedo,paedophile 118 | penis, penus 119 | perv, prv 120 | pimp 121 | piss 122 | poof 123 | porn, pron 124 | prick, prik 125 | prostitute, prostat, prostit 126 | pube, pewb, pubic 127 | pussy, pusy, pssy 128 | queer,quear,qweer, kweer 129 | rape,raip, rapist 130 | rectal,rectum,rektum 131 | rimjob 132 | screw 133 | scrotum, scrotem 134 | semen 135 | stfu 136 | sax ; apologies to all who play this fine instrument. 137 | sex,seks, secs 138 | sexy 139 | shag 140 | shemale 141 | shit,schit, shite, tish 142 | shiz 143 | slag 144 | slut 145 | smd 146 | spastic 147 | spaz 148 | sperm 149 | spick 150 | spoo 151 | spooge 152 | spunk 153 | strip 154 | suck, suk 155 | swallow 156 | tart 157 | ; Cannot look for this because too many false positives tit, tits, 158 | titties 159 | throat, 160 | thong 161 | turd, terd 162 | twat, twot 163 | twerk, twerc, twurk 164 | uterus,uteris,uteres 165 | vagina,vajina, vag 166 | vibrator, vybrator, vibrat 167 | vulva 168 | wank,wanker 169 | weed 170 | wetback, wetbak 171 | whore, hore, hoar 172 | wtf, wdf 173 | xxx 174 | ;------------------ Phrases ---------------- 175 | shutup 176 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/dict/bad_german.csv: -------------------------------------------------------------------------------- 1 | ; German bad word list 2 | ; Special characters (like ä) are replaced with plain characters 3 | ; because we do that before comparison. 4 | abtreibung 5 | ; adoption 6 | vergewalt 7 | arsch, popo 8 | arschloch 9 | eier 10 | spast 11 | hure 12 | hurensohn 13 | missgeburt, misset 14 | fehlgeburt 15 | wichser, wixxer 16 | kondom, lummeltute ; 17 | schwanz, dodel, glied, latte, pimmel, eichel, stander 18 | muschi, mose, scheide, lustgrotte, fotz 19 | titten, bruste, busen, mopse, brust, hupen 20 | transe 21 | prostituiert, nutte 22 | ;scheiß, kack, kot 23 | ;dumm 24 | fett, dick 25 | fick, bums, befrucht, popp, knall, rammel, vogeln 26 | hoden ;sack - false positive in English 27 | wichs, wix 28 | ; pups -- too many English false positives 29 | kotz 30 | schimmel 31 | ; puff 32 | fresse 33 | schwul 34 | lesb 35 | blas, blaser 36 | schlag 37 | kehle 38 | messer 39 | schwarzer 40 | spritz 41 | pedo 42 | nackt, nackig 43 | feucht 44 | tanga 45 | peitsche 46 | schlampe, flittchen, luder 47 | stohnen 48 | lecken 49 | holle 50 | hasslig, hasslich 51 | hass -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/dict/bad_spanish.csv: -------------------------------------------------------------------------------- 1 | ; Spanish Bad word list 2 | ; Each line may have several entries with commas between. Semicolon comments. 3 | ; 4 | ; All spaces are taken out of the text under text before comparison with this, so entries here should have spaces. 5 | ; 6 | ; No need to double up on entries that will be caught by other entries. 7 | ; If a longer version will be caught by the shorter, use only the shorter. 8 | ; Faster to have fewer entries and take advantage of supersets. 9 | ; e.g. 'bullshit' is caught by shit. 10 | ; 11 | ; Comment out the duplicates, but do not delete. We know that we considered them. 12 | ; Shorten a fraction of a word that has no other purpose, e.g. "masturb', 'asshol' 13 | ; 14 | ; Enter alternative spellings you can thing of. 15 | ; 16 | ; When you can, use the fact the leet will replace some things to avoid similar entries. 17 | ; The leet replace will try substituting: 18 | ; original subsitute 19 | ; s z 20 | ; f ph 21 | ; 22 | ; Do not include any of the special characters of Spanish, as the un-leet will 23 | ; convert things like ó to o. 24 | bollera ; Lesbian 25 | cabron ; Dickhead 26 | ;cabrona ; Dickhead (feminine) 27 | cabronazo ; Bastard 28 | capull;a ; Asshole (feminine) 29 | ;capullo ; Asshole 30 | chichi ; Pussy 31 | chocho ; Pussy 32 | cojon ; Testicle (slang) 33 | ;cojones ; Testicles (slang) 34 | comepollas ; Cocksucker 35 | cono ; Cunt 36 | ;coño ; Cunt 37 | culo ; Ass 38 | follar ; Fuck 39 | follen ; Go fuck 40 | furcia ; Whore 41 | gilipollas ; Jerk 42 | hijaput;a ; Son of a bitch (feminine) 43 | ;hijo puta ; Son of a bitch 44 | ;hijoputa ; Son of a bitch 45 | hostia ; Bastard shit to hit 46 | joder ; Fuck 47 | jodete ; Go fuck yourself 48 | joputa ; Abbreviation of "hijo de puta" (son of a bitch) 49 | mamada ; Blowjob 50 | mamon ; Sucker 51 | mamona ; Sucker (feminine) 52 | marica ; Faggy 53 | maricon ; Faggot 54 | ;maricón ; Faggot 55 | maricona ; Drag queen lesbian 56 | ;mariconazo ; Faggot 57 | ojete ; Anus (slang) 58 | ostia ; Abbreviation of "hostia" (bastard shit to hit) 59 | pajillero ; Wanker 60 | pendon ; Slob 61 | ;pendón ; Slob 62 | picha ; Dick 63 | polla ; Dick 64 | pollon ; Dick 65 | polvo ; To ejaculate 66 | potorro ; Vagina 67 | puta ; Bitch/whore 68 | puto ; Bitch/whore (masculine) faggot 69 | puton ; Bitch/whore 70 | ;putón ; Bitch/whore 71 | tortillera ; Lesbian 72 | zorron ; To be/act slutty 73 | ; 74 | ;----------------- Ramennoodles contributions, thanks! 75 | cachondo ; Horny 76 | cago ; Shit 77 | carajo ; Damn or hell 78 | chingar ; Fuck 79 | chingada ; Fucking hell 80 | chingate ; Fuck yourself 81 | guey ; Asshole 82 | maldito ; Damn you 83 | maldita ; Damn you (feminine) 84 | joto ; Gay 85 | mierda ; Shit 86 | nalgona ; Big ass 87 | pendejo ; Asshole 88 | panocha ; Pussy 89 | pendeja ; Asshole (feminine) 90 | pito ; Dick 91 | pinche ; Fucking 92 | toto ; Verga 93 | verga ; Dick (edited) -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/dict/controversial.csv: -------------------------------------------------------------------------------- 1 | ; Topics we would rather keep off our servers 2 | ; Each line may have several entries with commas between. Semicolon comments. 3 | republican 4 | democrat 5 | president 6 | trump 7 | obama 8 | hillary 9 | hilary 10 | sanders 11 | huckabee 12 | ;kill, killed taking off the list, too many false positives 13 | hater, hate 14 | ugly 15 | hitler 16 | heil 17 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/dict/dating.csv: -------------------------------------------------------------------------------- 1 | ; Each line may have several entries with commas between. Semicolon comments. 2 | ; Words that mean someone is probably dating 3 | babe 4 | bimbo 5 | boy 6 | bof ; blocking b()f, which is bof 7 | boyfriend, bfreind, bfriend, bofriend, bofreind, bofrnd 8 | chick 9 | dame 10 | date, dating 11 | doll 12 | foxy 13 | ;gf would cause too many false positives. 14 | girl, gurl 15 | girlfriend, grf, gfreind, gfriend, grfrnd, gfrend, gerlfriend 16 | hookup 17 | hot 18 | hump 19 | husband 20 | intimat 21 | kiss 22 | makeout 23 | ;ravish 24 | wife 25 | affair 26 | ;------------------ Phrases ---------------- 27 | foolaround 28 | getlaid 29 | getlucky, getluky 30 | goingatit 31 | gotobed 32 | haveanaffair 33 | haverelations 34 | laywith 35 | letsdothenasty 36 | getiton 37 | makebab 38 | makelove 39 | makinbacon 40 | pinav, pinv ;penis in a vagina 41 | sleepw 42 | youarehot,urhot,areyouhot,ruhot 43 | ;------------------ Spanish Here ------------------------ 44 | novia, nobia 45 | novio, nobio 46 | ;------------------ German Here ------------------------ 47 | schatz 48 | weib 49 | kuss, küssen 50 | heiß 51 | süß 52 | tussi, chica 53 | liebe 54 | affäre 55 | bistgeil 56 | lassficken 57 | rummachen 58 | knutschen 59 | abschleppen 60 | hinreißen 61 | -------------------------------------------------------------------------------- /src/ARCore/ChatFilter/chat/dict/harmless.csv: -------------------------------------------------------------------------------- 1 | ; Harmless Words 2 | ; Each line may have several entries with commas between. Semicolon comments. 3 | ; No special characters here! Just a-z, 0-9. 4 | ; Period is okay (for web addresses). 5 | ; 6 | ; List of words we take out before searching for bad words. 7 | ; Minimum of three letters for these words, or we risk taking defeating our later filters. 8 | ; No words should be here that we might want to look for later with any rule. So, if they are there, comment them out, 9 | ; Other words are here for other specific purposes, as noted. 10 | ; 11 | ; EXCLUDED 12 | ; boy - Dating 13 | ; find - Dating 14 | ; girl - Dating 15 | ; hit - Blocks shit 16 | ; look - Dating 17 | ; pick - Dating 18 | ; chick - Dating 19 | ; child - Dating / kid safety 20 | ; chick - Dating 21 | ; children - Dating / kid safety 22 | ; hot - Dating 23 | ; wall our game type, but blocks swallow 24 | ; 25 | ; SPECIAL NOTES 26 | 27 | ;------------------------------------------------------------------------------------- 28 | ; SPECIFICALLY ALLOWED PHRASES 29 | ; These can include spaces. (Compare is done before removal of spaces) 30 | ; Purpose is so that if we learn of false positives, we can add them. 31 | ; 32 | blow up 33 | mother for ; To prevent false motherf 34 | mother fi 35 | mother from 36 | ne find ; Prevent false efin trip. (removes someone, one, anyone...) 37 | s excited ; okay as long as the space is there. 38 | s extreme 39 | you guys ; Okay usage of guys 40 | the guy 41 | other guy 42 | some guy 43 | u guys 44 | scunth ; So we can pass tests 45 | function ; Avoid tripping fu searches 46 | mandate ; Here to prevent tripping dating filter 47 | candidate ; Here to prevent tripping dating filter 48 | accommodate ; Here to prevent tripping dating filter: 49 | 50 | ;------------------------------------------------------------------------------------ 51 | ; WHITELIST OUR GAME SERVERS AND OTHER 52 | ; So they do not trip the advertising getter. 53 | lbsg.net 54 | sg.lbsg.net 55 | fl.lbsg.net 56 | bh.lbsg.net 57 | tm.lbsg.net 58 | sm.lbsg.net 59 | sw.lbsg.ent 60 | sp.lbsg.net 61 | ctf.lbsg.net 62 | wl.lbsg.net 63 | www.hydreon.com 64 | hydreon.com 65 | twitch.com 66 | mobcrush.com 67 | 68 | ;-------------------------------------------------------------------------------------- 69 | ; NOT WHITELISTED 70 | ; List of things that are not whitelisted here, and why not: 71 | ; back block wetback 72 | ; ball 73 | ; bat blocks masturbate 74 | ; blow 75 | ; bone blocks boner 76 | ; corn blocks cornhole 77 | ; date 78 | ; hand blocks handjob 79 | ; hard not harmless 80 | ; hole blocks several bad words 81 | ; hot 82 | ; job 83 | ; low 84 | ; master blocks mastserbate 85 | ; men blocks semen 86 | ; mother 87 | ; six because sixtynine is blocked 88 | ; skin not harmless 89 | ;bit blocks bitch 90 | ;body 91 | ;east blocks beastiality 92 | ;got blocks faggot 93 | ;nine because sixty nine is blocked 94 | ;-------------------------------------------------------------------------------------- 95 | ; INTERNET ACRONYMS 96 | ack 97 | afaik 98 | afk 99 | aka 100 | btt 101 | btw 102 | cu 103 | diy 104 | faq 105 | fwiw 106 | fyi 107 | hth 108 | idc 109 | imo 110 | imho 111 | iow 112 | lol 113 | noyb 114 | pov 115 | rsvp 116 | tba 117 | tyt 118 | ttyl 119 | 120 | ;------------------------------------------------------------------------------------- 121 | able 122 | about 123 | above 124 | act 125 | add 126 | afraid 127 | after 128 | again 129 | against 130 | age 131 | ago 132 | agree 133 | air 134 | all 135 | allow 136 | also 137 | always 138 | among 139 | and 140 | anger 141 | animal 142 | answer 143 | any 144 | anybody 145 | appear 146 | apple 147 | archer 148 | are 149 | area 150 | arm 151 | arrange 152 | arrive 153 | ask 154 | assist, assisted 155 | assinine ; yes it's a misspelling 156 | assume, assumes, assumed 157 | assure, assurance, assurence, assured, assures 158 | athlete, athletic 159 | attitude 160 | atom 161 | baby 162 | bad 163 | band 164 | bank 165 | bar 166 | base 167 | basic 168 | be 169 | bear 170 | beat 171 | beautiful 172 | beauty 173 | bed 174 | being 175 | been 176 | before 177 | began 178 | begin 179 | behind 180 | believe 181 | bell 182 | best 183 | better 184 | between 185 | big 186 | bird 187 | black 188 | block 189 | blood 190 | blue 191 | biome 192 | board 193 | boat 194 | book 195 | born 196 | both 197 | bottom 198 | bought 199 | box 200 | boycott, boycot 201 | branch 202 | brawl, brawler 203 | bread 204 | break 205 | bright 206 | british 207 | bring 208 | broad 209 | broke 210 | brother 211 | brought 212 | brown 213 | build 214 | burn 215 | busy 216 | but 217 | buy 218 | call 219 | came 220 | camp 221 | can 222 | candidate 223 | capital 224 | captain 225 | car 226 | card 227 | care 228 | carry 229 | case 230 | cat 231 | catch 232 | caught 233 | cause 234 | cell 235 | cent 236 | center 237 | century 238 | certain 239 | chair 240 | chance 241 | change 242 | character 243 | charge 244 | chart 245 | check 246 | chief 247 | chicken 248 | choose 249 | chord 250 | circle 251 | city 252 | claim 253 | class, classic, classification, classed 254 | clean 255 | clear 256 | climb 257 | clock 258 | close 259 | clothe 260 | cloud 261 | coast 262 | coat 263 | cold 264 | collect 265 | colony 266 | color 267 | column 268 | come 269 | common 270 | company 271 | compare 272 | compete, competitive, competition 273 | complete 274 | connor 275 | condition 276 | confuse 277 | confusion 278 | connect 279 | consider 280 | consonant 281 | contain 282 | continent 283 | continue 284 | control 285 | cook 286 | cool 287 | copy 288 | corner 289 | correct 290 | cost 291 | cotton 292 | could 293 | count 294 | country 295 | course 296 | cover 297 | cow 298 | crease 299 | create 300 | creep, creeper 301 | crop 302 | cross 303 | crowd 304 | cry 305 | current 306 | cut 307 | dad 308 | dance 309 | danger 310 | dark 311 | day 312 | dead 313 | deal 314 | dear 315 | death 316 | decide 317 | decimal 318 | deep 319 | defend 320 | defence 321 | defender 322 | degree 323 | depend 324 | describe 325 | desert 326 | design 327 | determine 328 | develop 329 | dictionary 330 | did 331 | die 332 | differ 333 | difficult 334 | direct 335 | discuss 336 | distant 337 | divide 338 | division 339 | doctor 340 | does 341 | dog 342 | dollar 343 | don't 344 | done 345 | door 346 | double 347 | down 348 | draw 349 | dream 350 | dress 351 | drink 352 | drive 353 | drop 354 | dry 355 | duck 356 | during 357 | each 358 | ear 359 | early 360 | earth 361 | ease 362 | eat 363 | edge 364 | effect 365 | effingham ; A city in IL 366 | effington ; Ben Folds Five lyrics 367 | egg 368 | eight 369 | either 370 | electric 371 | element 372 | else 373 | end 374 | enemy 375 | energy 376 | engine 377 | enough 378 | enter 379 | entity 380 | equal 381 | equate 382 | especially 383 | even 384 | evening 385 | event 386 | ever 387 | every 388 | everybody 389 | exact 390 | example 391 | except ; The words that might cause a false positive with sex 392 | excite 393 | exercise 394 | expect 395 | experience 396 | experiment 397 | explain 398 | explore, explorer 399 | eye 400 | face 401 | fact 402 | fair 403 | fake, fakes 404 | fall 405 | family 406 | famous 407 | far 408 | farm 409 | fast 410 | fat 411 | father 412 | favor 413 | fear 414 | feed 415 | feel 416 | feet 417 | fell 418 | felt 419 | few 420 | field 421 | fig 422 | fight 423 | figure 424 | fill 425 | final 426 | find 427 | fine 428 | finger 429 | finish 430 | fire 431 | first 432 | fish 433 | fit 434 | five 435 | flat 436 | floor 437 | flow 438 | flower 439 | fly 440 | follow 441 | food 442 | foot 443 | for 444 | force 445 | forest 446 | form 447 | forward 448 | found 449 | four 450 | fraction 451 | free 452 | fresh 453 | ;friend 454 | from 455 | front 456 | fruit 457 | fuel 458 | full 459 | fun 460 | fund 461 | funeral 462 | fur 463 | furniture 464 | further 465 | future 466 | game 467 | garden 468 | gas 469 | gather 470 | gave 471 | general 472 | gentle 473 | ; get block get it on get lucky 474 | give 475 | glad 476 | glass 477 | gold 478 | gone 479 | good 480 | govern 481 | grand 482 | grass 483 | gray 484 | great 485 | green 486 | grew 487 | ground 488 | group 489 | grow 490 | guess 491 | guide 492 | gun 493 | guy 494 | had 495 | hair 496 | half 497 | happen 498 | happy 499 | has 500 | hassle 501 | hat 502 | have 503 | head 504 | hear 505 | heard 506 | heart 507 | heat 508 | heavy 509 | held 510 | hello 511 | help 512 | here 513 | high 514 | hill 515 | him 516 | his 517 | history 518 | hit, hitting 519 | hold 520 | home 521 | hope 522 | horse 523 | ; hot -- Too much dating 524 | hour 525 | house 526 | how 527 | huge 528 | human 529 | hundred 530 | hunt 531 | hurry 532 | ice 533 | idea 534 | identity, identify 535 | if ; We might need to take this out again 536 | is ; Might need to take out again. 537 | imagine 538 | inch 539 | include 540 | indicate 541 | industry 542 | insect 543 | instant 544 | instrument 545 | interest 546 | invent 547 | into 548 | iron 549 | island 550 | join 551 | joy 552 | jump 553 | just 554 | keep 555 | kept 556 | key 557 | kill 558 | kind 559 | king 560 | knew 561 | knight 562 | know 563 | lady 564 | lag, laggy, lagging 565 | lake 566 | land 567 | language 568 | large 569 | last 570 | late 571 | laugh 572 | law 573 | lay 574 | lead 575 | learn 576 | least 577 | leave 578 | led 579 | left 580 | leg 581 | length 582 | less 583 | let 584 | letter 585 | level 586 | lie 587 | life 588 | lift 589 | light 590 | like 591 | line 592 | liquid 593 | list 594 | listen 595 | little 596 | live 597 | locate 598 | log 599 | look 600 | lone 601 | long 602 | lost 603 | lot 604 | loud 605 | love 606 | lumber, lumberman, lumberjack 607 | machine 608 | made 609 | magnet 610 | main 611 | major 612 | make 613 | man 614 | many 615 | map 616 | mark 617 | market 618 | mass 619 | match 620 | material 621 | matter 622 | may 623 | mean 624 | meant 625 | measure 626 | meat 627 | meet 628 | met 629 | melody 630 | metal 631 | method 632 | midas 633 | middle 634 | might 635 | mile 636 | milk 637 | million 638 | mind 639 | mine 640 | minute 641 | miss 642 | mix 643 | mob, mobs 644 | mod, mods 645 | modern 646 | molecule 647 | mom 648 | moment 649 | money 650 | month 651 | moon 652 | more 653 | morning 654 | most 655 | mother 656 | motion 657 | mount 658 | mountain 659 | mouth 660 | move 661 | much 662 | mucho ; Spanish, prevent false positives on hot 663 | muffin 664 | multiply 665 | music 666 | must 667 | my 668 | name 669 | nation 670 | natural 671 | nature 672 | near 673 | necessary 674 | neck 675 | need 676 | neighbor 677 | never 678 | new 679 | next 680 | night, nights 681 | noise 682 | noon 683 | nor 684 | north 685 | nose 686 | not 687 | note 688 | nothing 689 | notice 690 | noun 691 | now 692 | number 693 | numeral 694 | object 695 | observe 696 | occur 697 | ocean 698 | off 699 | offer 700 | office 701 | often 702 | oil 703 | old 704 | once 705 | one 706 | only 707 | open 708 | operate 709 | opposite 710 | order 711 | organ 712 | original 713 | other 714 | our 715 | out 716 | over 717 | own 718 | oxygen 719 | page 720 | paint 721 | pair 722 | paper 723 | paragraph 724 | parent 725 | part 726 | particular 727 | party 728 | pass 729 | past 730 | path 731 | pattern 732 | pay 733 | people 734 | perhaps 735 | period 736 | person 737 | phrase 738 | pick, picks, picked 739 | picture 740 | piece 741 | pitch 742 | pizza 743 | place 744 | plain 745 | plan 746 | plane 747 | planet 748 | plant 749 | play, playing, players 750 | please 751 | plural 752 | poem 753 | point 754 | poor 755 | populate 756 | port 757 | pose 758 | position 759 | possible 760 | post 761 | pound 762 | power 763 | practice 764 | prepare 765 | present 766 | press 767 | pretty 768 | print 769 | probable 770 | problem 771 | process 772 | produce 773 | product 774 | proper 775 | property 776 | prospect, prospecter, prospector 777 | protect 778 | prove 779 | provide 780 | pull 781 | push 782 | put 783 | quart 784 | question 785 | quick 786 | quiet 787 | quite 788 | quotient 789 | race 790 | radio 791 | rail 792 | rain 793 | raise 794 | ran 795 | range 796 | rather 797 | reach 798 | read 799 | ready 800 | real 801 | reason 802 | receive 803 | record 804 | red 805 | refugee 806 | refuse 807 | region 808 | remember 809 | repeat 810 | reply 811 | represent 812 | require 813 | rest 814 | result 815 | rich 816 | ride 817 | right 818 | ring 819 | rise 820 | river 821 | road 822 | rock 823 | roll 824 | room 825 | root 826 | rope 827 | rose 828 | round 829 | row 830 | rub 831 | rule 832 | run 833 | safe 834 | said 835 | sail 836 | salt 837 | same 838 | sand 839 | sat 840 | save 841 | saw 842 | say 843 | scale 844 | school 845 | science 846 | score 847 | scunthorp ; To pass test! 848 | scunthorpe 849 | sea 850 | search 851 | season 852 | seat 853 | second 854 | section 855 | see 856 | seed 857 | seem 858 | segment 859 | select 860 | self 861 | sell 862 | send 863 | sense 864 | sent 865 | sentry 866 | sentence 867 | separate 868 | serve 869 | set 870 | settle 871 | seven 872 | several 873 | shall 874 | shape 875 | share 876 | sharp 877 | she 878 | sheet 879 | shell 880 | shine 881 | ship 882 | shitake 883 | shoe 884 | shop 885 | shore 886 | short 887 | shot 888 | shots 889 | should 890 | shoulder 891 | shout 892 | show 893 | side 894 | sight 895 | sign 896 | silent 897 | silver 898 | similar 899 | simple 900 | since 901 | sing 902 | single 903 | sister 904 | sit 905 | size 906 | skill 907 | sky 908 | slave 909 | sleep 910 | slip 911 | slow 912 | small 913 | smell 914 | smile 915 | snow 916 | soft 917 | soil 918 | soldier 919 | solution 920 | solve 921 | some 922 | somebody 923 | someone 924 | son 925 | song 926 | soon 927 | sound 928 | south 929 | space 930 | sparse 931 | speak 932 | special 933 | speech 934 | speed 935 | spell 936 | spend 937 | spleef 938 | spook, spooky 939 | spoke 940 | spot 941 | spread 942 | spring 943 | square 944 | stand 945 | star 946 | start, started 947 | state 948 | station 949 | stay 950 | stead 951 | steam 952 | steel 953 | step 954 | stick 955 | still 956 | stone 957 | stood 958 | stop 959 | store 960 | story 961 | straight 962 | strange 963 | stream 964 | street 965 | stretch 966 | string 967 | strong 968 | student 969 | study 970 | subject 971 | substance 972 | subtract 973 | success 974 | such 975 | sudden 976 | suffix 977 | sugar 978 | suggest 979 | suit 980 | summer 981 | sun 982 | supply 983 | support 984 | sure 985 | surface 986 | surprise 987 | swim 988 | sword 989 | syllable 990 | symbol 991 | system 992 | table 993 | tail 994 | take 995 | talk 996 | tall 997 | teach 998 | team 999 | teeth 1000 | teleport, teleporter, teleports 1001 | tell 1002 | temperature 1003 | ten 1004 | term 1005 | test 1006 | than 1007 | thank 1008 | that 1009 | the 1010 | their 1011 | them 1012 | then 1013 | there 1014 | these 1015 | they 1016 | thick 1017 | thin 1018 | thing 1019 | think 1020 | third 1021 | this 1022 | those 1023 | though 1024 | thought 1025 | thousand 1026 | three 1027 | through 1028 | throw 1029 | thus 1030 | tie 1031 | time 1032 | tiny 1033 | tire 1034 | title 1035 | to 1036 | together 1037 | told 1038 | tone 1039 | tonight 1040 | too 1041 | took 1042 | tool 1043 | top 1044 | total 1045 | touch 1046 | toward 1047 | town 1048 | track 1049 | trade 1050 | train 1051 | trap, trapped 1052 | travel 1053 | tree 1054 | triangle 1055 | trip 1056 | trouble 1057 | truck 1058 | true 1059 | try 1060 | tube 1061 | turn 1062 | twenty 1063 | two 1064 | type 1065 | uk ; fine as long as you meant the country! 1066 | under 1067 | unit 1068 | until 1069 | update 1070 | use 1071 | usual 1072 | valley 1073 | value 1074 | vary 1075 | verb 1076 | very 1077 | view 1078 | village 1079 | visit 1080 | voice 1081 | vowel 1082 | wait 1083 | walk 1084 | wall 1085 | want 1086 | war 1087 | warrior, warior 1088 | warm 1089 | was 1090 | wash 1091 | watch 1092 | water 1093 | wave 1094 | way 1095 | wear 1096 | weather 1097 | week 1098 | weight 1099 | well 1100 | went 1101 | were 1102 | west 1103 | what 1104 | whatever 1105 | wheel 1106 | when 1107 | where 1108 | whether 1109 | which 1110 | while 1111 | white 1112 | who ;blocks whore 1113 | whole 1114 | whose 1115 | why 1116 | wide 1117 | wife 1118 | wild 1119 | will 1120 | win 1121 | wind 1122 | window 1123 | wing 1124 | winter 1125 | wire 1126 | wish 1127 | with 1128 | woman 1129 | women 1130 | won't 1131 | wonder 1132 | wood 1133 | word 1134 | work 1135 | world 1136 | would 1137 | write 1138 | written 1139 | wrong 1140 | wrote 1141 | yard 1142 | year 1143 | yellow 1144 | yes 1145 | yet 1146 | you 1147 | young 1148 | your 1149 | ;-------------------------------------------------------------------- 1150 | ; GERMAN also want to prevent a few needless false positives 1151 | der, die, das 1152 | und 1153 | zu 1154 | ich 1155 | sie 1156 | von 1157 | nicht 1158 | du 1159 | auch 1160 | auf 1161 | dass 1162 | hatte 1163 | ;--------------------------------------------------------- 1164 | ; Spanish 1165 | como 1166 | haber 1167 | tener 1168 | todo 1169 | pero 1170 | otro 1171 | decir 1172 | porque 1173 | cuando 1174 | vez 1175 | sobre 1176 | alguno 1177 | mismo 1178 | hasta 1179 | dos 1180 | donde 1181 | dada 1182 | cada 1183 | nuevo -------------------------------------------------------------------------------- /src/ARCore/Clans/FactionListener.php: -------------------------------------------------------------------------------- 1 | plugin = $pg; 28 | } 29 | 30 | public function factionChat(PlayerChatEvent $PCE) { 31 | 32 | $player = strtolower($PCE->getPlayer()->getName()); 33 | //MOTD Check 34 | //TODO Use arrays instead of database for faster chatting? 35 | 36 | if($this->plugin->motdWaiting($player)) { 37 | if(time() - $this->plugin->getMOTDTime($player) > 30) { 38 | $PCE->getPlayer()->sendMessage($this->plugin->formatMessage("Timed out. Please use /c motd again.")); 39 | $this->plugin->db->query("DELETE FROM motdrcv WHERE player='$player';"); 40 | $PCE->setCancelled(true); 41 | return true; 42 | } else { 43 | $motd = $PCE->getMessage(); 44 | $faction = $this->plugin->getPlayerFaction($player); 45 | $this->plugin->setMOTD($faction, $player, $motd); 46 | $PCE->setCancelled(true); 47 | $PCE->getPlayer()->sendMessage($this->plugin->formatMessage("§6- §aSuccessfully updated Clan message of the day!", true)); 48 | } 49 | return true; 50 | } 51 | 52 | //Member 53 | if($this->plugin->isInFaction($PCE->getPlayer()->getName()) && $this->plugin->isMember($PCE->getPlayer()->getName())) { 54 | $message = $PCE->getMessage(); 55 | $player = $PCE->getPlayer()->getName(); 56 | $faction = $this->plugin->getPlayerFaction($player); 57 | $number_of_players = $this->plugin->getNumberOfPlayers($faction); 58 | 59 | $PCE->setFormat("[$faction] $player: $message"); 60 | return true; 61 | } 62 | //Officer 63 | elseif($this->plugin->isInFaction($PCE->getPlayer()->getName()) && $this->plugin->isOfficer($PCE->getPlayer()->getName())) { 64 | $message = $PCE->getMessage(); 65 | $player = $PCE->getPlayer()->getName(); 66 | $faction = $this->plugin->getPlayerFaction($player); 67 | $faction = $this->plugin->getPlayerFaction($player); 68 | $number_of_players = $this->plugin->getNumberOfPlayers($faction); 69 | 70 | $PCE->setFormat("*[$faction] $player: $message"); 71 | return true; 72 | } 73 | //Leader 74 | elseif($this->plugin->isInFaction($PCE->getPlayer()->getName()) && $this->plugin->isLeader($PCE->getPlayer()->getName())) { 75 | $message = $PCE->getMessage(); 76 | $player = $PCE->getPlayer()->getName(); 77 | $faction = $this->plugin->getPlayerFaction($player); 78 | $faction = $this->plugin->getPlayerFaction($player); 79 | $number_of_players = $this->plugin->getNumberOfPlayers($faction); 80 | 81 | $PCE->setFormat("**[$faction] $player: $message"); 82 | return true; 83 | //Not in faction 84 | }else { 85 | $message = $PCE->getMessage(); 86 | $player = $PCE->getPlayer()->getName(); 87 | $PCE->setFormat("$player: $message"); 88 | } 89 | } 90 | 91 | public function factionPVP(EntityDamageEvent $factionDamage) { 92 | if($factionDamage instanceof EntityDamageByEntityEvent) { 93 | if(!($factionDamage->getEntity() instanceof Player) or !($factionDamage->getDamager() instanceof Player)) { 94 | return true; 95 | } 96 | if(($this->plugin->isInFaction($factionDamage->getEntity()->getPlayer()->getName()) == false) or ($this->plugin->isInFaction($factionDamage->getDamager()->getPlayer()->getName()) == false)) { 97 | return true; 98 | } 99 | if(($factionDamage->getEntity() instanceof Player) and ($factionDamage->getDamager() instanceof Player)) { 100 | $player1 = $factionDamage->getEntity()->getPlayer()->getName(); 101 | $player2 = $factionDamage->getDamager()->getPlayer()->getName(); 102 | $f1 = $this->plugin->getPlayerFaction($player1); 103 | $f2 = $this->plugin->getPlayerFaction($player2); 104 | if($this->plugin->sameFaction($player1, $player2) == true or $this->plugin->areAllies($f1,$f2)) { 105 | $factionDamage->setCancelled(true); 106 | } 107 | } 108 | } 109 | } 110 | public function factionBlockBreakProtect(BlockBreakEvent $event) { 111 | if($this->plugin->isInPlot($event->getPlayer())) { 112 | if($this->plugin->inOwnPlot($event->getPlayer())) { 113 | return true; 114 | } else { 115 | $event->setCancelled(true); 116 | $event->getPlayer()->sendMessage($this->plugin->formatMessage("§6- §cYou cannot break blocks here. This is already a property of a Clan. Type /c pos for details.")); 117 | return true; 118 | } 119 | } 120 | } 121 | 122 | public function factionBlockPlaceProtect(BlockPlaceEvent $event) { 123 | if($this->plugin->isInPlot($event->getPlayer())) { 124 | if($this->plugin->inOwnPlot($event->getPlayer())) { 125 | return true; 126 | } else { 127 | $event->setCancelled(true); 128 | $event->getPlayer()->sendMessage($this->plugin->formatMessage("§6- §cYou cannot place blocks here. This is already a property of a Clan. Type /c pos for details.")); 129 | return true; 130 | } 131 | } 132 | } 133 | public function onKill(PlayerDeathEvent $event){ 134 | $cause = $event->getEntity()->getLastDamageCause(); 135 | if($cause instanceof EntityDamageByEntityEvent){ 136 | $killer = $cause->getDamager(); 137 | if($killer instanceof Player){ 138 | $p = strtoupper($killer->getPlayer()->getName()); 139 | if($this->plugin->isInFaction($p)){ 140 | $f = $this->plugin->getPlayerFaction($p); 141 | $e = $this->plugin->prefs->get("PowerGainedPerKillingAnEnemy"); 142 | $this->plugin->addFactionPower($f,$e); 143 | } 144 | } 145 | } 146 | } 147 | public function onDeath(PlayerDeathEvent $event) { 148 | $victim = $event->getPlayer(); 149 | $cause = $victim->getLastDamageCause(); 150 | if($cause instanceof EntityDamageByEntityEvent) { 151 | $killer = $cause->getDamager(); 152 | if($victim instanceof Player) { 153 | $q = strtoupper($victim->getPlayer()->getName()); 154 | if($this->plugin->isInFaction($q)){ 155 | $a = $this->plugin->getPlayerFaction($q); 156 | $b = $this->plugin->prefs->get("PowerReducedPerDeathByAnEnemy"); 157 | $this->plugin->subtractFactionPower($a,$b); 158 | } 159 | 160 | } 161 | } 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /src/ARCore/Level/LevelSystem.php: -------------------------------------------------------------------------------- 1 | getServer()->getPluginManager()->registerEvents($this, $this); 34 | if (!file_exists($this->getDataFolder())) { 35 | mkdir($this->getDataFolder(), 0744, true); 36 | $this->exps = new Config($this->getDataFolder() . "exps.json", Config::JSON, array()); 37 | } 38 | $this->exps = new Config($this->getDataFolder() . "exps.json", Config::JSON, array()); 39 | } 40 | 41 | public function onCommand(CommandSender $sender, Command $command, $label, array $args) { 42 | return false; 43 | } 44 | public function onJoin(PlayerJoinEvent $event) { 45 | $name = $event->getPlayer()->getName(); 46 | if (!$this->exps->exists($name)) { 47 | $this->exps->set($name, 0); 48 | $this->exps->save(); 49 | } 50 | } 51 | public function onPlayerDeath(PlayerDeathEvent $event) { 52 | $ev = $event->getEntity()->getLastDamageCause(); 53 | if ($ev instanceof EntityDamageByEntityEvent) { 54 | $killer = $ev->getDamager(); 55 | if ($killer instanceof Player) { 56 | $exp = $this->exps->get($killer->getName()); 57 | $exp = intval($exp) + 8; //?o?±?l 58 | $killer->sendMessage("§b【Level】 Recieve 8 points of experience!"); 59 | $killer->sendMessage("§b【Level】 Current experiences: ".$exp." points"); 60 | $killer->sendPopUp("§b【Level】 Recieve 8 points of experience!"); 61 | $killer->sendPopUp("§b【Level】 Exp: ".$exp." points"); 62 | $this->exps->set($killer->getName(), $exp); 63 | $this->exps->save(); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/ARCore/MovingCheck.php: -------------------------------------------------------------------------------- 1 | vars = $vars; 15 | } 16 | 17 | public function runMovingChecks(Player $p, Location $to, Location $from, $yd, $xs, $zs, $movedata, $up, $inwater, $onladder, $lg){ 18 | 19 | $jumped = ($movedata->wasonground != $p->isOnGround()); 20 | 21 | if (!$jumped) { 22 | 23 | if (((time() * 1000) - $movedata->groundtime) < 600 && !$inwater) { 24 | 25 | $jumped = true; 26 | 27 | } 28 | 29 | } 30 | 31 | //****************Start Impossible Moving****************** 32 | 33 | //Prevents bypass of packet sneak and enforcement of blocking 34 | 35 | //****************End Impossible Moving****************** 36 | 37 | // 38 | if ($yd != 0) {//Actually move on the y axis 39 | 40 | if ($up && $onladder) { 41 | 42 | if ($yd > (($p->getAllowFlight() || ($jumped) ? 0.424 : 0.118))) { 43 | 44 | if ($this->vars->issueViolation($p, CheckType::VERTICAL_SPEED)) { 45 | 46 | return 1; 47 | 48 | } 49 | 50 | } 51 | 52 | } 53 | 54 | if ($up) { 55 | 56 | if ($yd > $this->getMaxVertical($p, $inwater, $up)) {//Moving up only 57 | 58 | if ($this->vars->issueViolation(p, CheckType::VERTICAL_SPEED)) { 59 | 60 | return 1; 61 | 62 | } 63 | 64 | } 65 | 66 | } 67 | 68 | } 69 | // 70 | 71 | //****************Start Survival Fly****************** 72 | 73 | if ($p->isOnGround() || $p->isInsideVehicle() || $inwater || ($p->isFlying()) || $onladder) { 74 | 75 | $this->vars->lastGround->put($p->getName(), new XYZ($from)); 76 | 77 | } else { 78 | 79 | if (!$p->getAllowFlight() && !$inwater && !$onladder) {//Ignore users that are allowed to fly. Doesn't count for the hack fly! 80 | 81 | if ($up) { 82 | 83 | $ydis = abs($lg->y - $to->getY()); 84 | 85 | if ($ydis > $this->getMaxHight($p, $movedata)) { 86 | 87 | if ($this->vars->issueViolation($p, CheckType::FLY)) { 88 | 89 | //I've discovered this trick on mineplex 90 | $p->setAllowFlight(false); 91 | 92 | return 3; 93 | 94 | } 95 | 96 | } 97 | 98 | } 99 | 100 | } 101 | 102 | } 103 | 104 | //****************End Survival Fly****************** 105 | 106 | //****************Start Horizontal Speed****************** 107 | if (((time() * 1000) - $movedata->lastmounting) > 200) { 108 | 109 | $ydis = abs($lg->y - $to->getY()); 110 | 111 | if ($xs > 0 || $zs > 0) { 112 | 113 | $mxs = 0; 114 | 115 | $csneak = $p->isSneaking(); 116 | 117 | if ($csneak) { 118 | 119 | if (!$movedata->wassneaking) { 120 | 121 | $diff = ((time() * 1000) - $movedata->sneaktime); 122 | 123 | if ($diff < 501) {//There is a known bypass....gonna fix it sometime 124 | 125 | $csneak = false; 126 | 127 | } 128 | 129 | } 130 | 131 | } 132 | 133 | $csprint = $p->isSprinting(); 134 | 135 | if (!$csprint) { 136 | 137 | if (((time() * 1000) - $movedata->sprinttime) < 1001) { 138 | 139 | $csprint = true; 140 | 141 | } 142 | 143 | } 144 | 145 | $cfly = $p->isFlying(); 146 | 147 | if (!$cfly) { 148 | 149 | if (((time() * 1000) - $movedata->flytime) < 2001) { 150 | 151 | $cfly = true; 152 | 153 | } 154 | 155 | } 156 | 157 | if ($cfly) { 158 | 159 | $mxs = ($p->getFlySpeed() * 5.457); 160 | 161 | } else if ($csprint){ 162 | 163 | if ($jumped) {//Player is jumping/landing 164 | 165 | $mxs = ($p->speed / 0.3); 166 | 167 | } else { 168 | 169 | $mxs = ($p->speed / 0.71); 170 | 171 | } 172 | 173 | } else if ($csneak) { 174 | 175 | if ($jumped) { 176 | 177 | $mxs = ($p->speed / 1.7);//Lucky 7! 178 | 179 | } else { 180 | 181 | $mxs = ($p->speed / 2); 182 | 183 | } 184 | 185 | } else { 186 | 187 | if ($jumped) { 188 | 189 | $mxs = ($p->speed / 0.60); 190 | 191 | } else { 192 | 193 | $mxs = ($p->speed / 0.85); 194 | 195 | } 196 | 197 | } 198 | 199 | if ($p->hasEffect(Effect::SPEED)) { 200 | 201 | $level = $p->getEffect(Effect::SPEED)->getAmplifier(); 202 | 203 | if ($level > 0) { 204 | 205 | $mxs = ($mxs * ((($level * 20) * 0.011) + 1)); 206 | 207 | } 208 | 209 | } 210 | 211 | if ($xs > $mxs || $zs > $mxs) { 212 | 213 | if ($this->vars->issueViolation($p, CheckType::HORIZONTAL_SPEED)) { 214 | 215 | return 1; 216 | 217 | } 218 | 219 | } 220 | 221 | } 222 | 223 | if (!$p->isOnGround() && !$p->getAllowFlight() && !$inwater && !$onladder) { 224 | 225 | $mdis = $this->getXZDistance($to->getX(), $lg->x, $to->getZ(), $lg->z); 226 | 227 | if ($mdis > $this->getMaxMD($inwater, $p->isOnGround(), $p, $ydis, $movedata)) { 228 | 229 | //if ($this->vars->issueViolation($p, CheckType::GLIDE)) { 230 | 231 | return 1; 232 | 233 | //} 234 | 235 | } 236 | 237 | } 238 | 239 | } 240 | //****************End Horizontal Speed****************** 241 | 242 | //****************Start NoFall***************** 243 | //If flying, ignore this check 244 | if (!$p->isFlying()) { 245 | 246 | //Prevent bypassing fly checks when moving in an horiztonal motion 247 | if (!$inwater && !$p->getAllowFlight() && $p->isOnGround() && !$jumped && !$onladder) {//User is allowed to fly, why check it! 248 | 249 | //There needs to be a waaaaaaaay more efficient way to calculate this 250 | 251 | $m = null; 252 | 253 | $bx = $to->getBlockX(); 254 | $by = $to->getBlockY(); 255 | $bz = $to->getBlockZ(); 256 | 257 | if ($bx != $from->getBlockX() || $bz != $from->getBlockZ()) { 258 | 259 | $boy = $by + 1; 260 | 261 | $oy = $boy; 262 | 263 | $con = true; 264 | 265 | while ($con) { 266 | 267 | $boy--; 268 | 269 | $m = $from->getBlock()->getRelative(0, (($oy - $boy) * -1) + 1, 0)->getType(); 270 | 271 | if ($m.isSolid()) { 272 | 273 | $con = false; 274 | break; 275 | 276 | } 277 | 278 | if ($boy < 0) { 279 | 280 | $con = false;//Safe check for flying over bedrock...which should be impossible 281 | break; 282 | 283 | } 284 | 285 | } 286 | 287 | $dis = ($oy - $boy); 288 | 289 | if ($dis > 2) {//Prevent bypassing fly checks when moving in an horiztonal motion 290 | 291 | $nearblock = false; 292 | 293 | //Make sure they are not standing at the end of a block 294 | for ($x = $bx - 1; $x < $bx + 1; $x++) { 295 | 296 | for ($z = $bz - 1; $z < $bz + 1; $z++) { 297 | 298 | if ($p->getLevel()->getBlockAt($x, ($to->getBlockY() - 1), $z)->getType()->isSolid()) { 299 | 300 | $nearblock = true; 301 | break; 302 | 303 | } 304 | 305 | } 306 | 307 | } 308 | 309 | if (!$nearblock) { 310 | 311 | //if ($this->vars->issueViolation($p, CheckType::FLY)) { 312 | 313 | return 1; 314 | 315 | //} 316 | 317 | } 318 | } 319 | 320 | } 321 | 322 | } 323 | 324 | //Start nofall & fly check 325 | if (!$p->getAllowFlight()) { 326 | 327 | if ($to->getBlockY() != $from->getBlockY()) { 328 | 329 | if ($up && $p->isOnGround() && !$inwater) { 330 | 331 | if ($p->getVelocity()->getY() < 0) {//Moving up when velocity says to go down...seems legit 332 | 333 | $m = $from->getBlock()->getType(); 334 | 335 | if ($m != Material::CHEST && $m != Material::TRAPPED_CHEST) { 336 | 337 | //if (this.vars.issueViolation(p, CheckType.NOFALL)) { 338 | 339 | return 1; 340 | 341 | //} 342 | 343 | } 344 | 345 | } 346 | 347 | } 348 | 349 | } 350 | 351 | } 352 | //End nofall & fly check 353 | 354 | if (!$up && $yd > 0.25 && $p->isOnGround()) { //Falling while onground? I DON'T THINK SO 355 | 356 | //if (this.vars.issueViolation(p, CheckType.NOFALL)) { 357 | 358 | return 4; 359 | 360 | //} 361 | 362 | } 363 | 364 | } 365 | 366 | //****************End NoFall****************** 367 | 368 | //****************Start Timer****************** 369 | /* if ($to->getX() != $from->getX() || $to->getY() != $from->getY() || $to->getZ() != $from->getZ()) { 370 | 371 | if (((time() * 1000) - $movedata->getTimeStart()) > 500) { 372 | 373 | $max = 0; 374 | 375 | $max = round((Utils.getPing($p) / 100)); 376 | 377 | if (max < 0) { 378 | 379 | max = 0; 380 | 381 | } 382 | 383 | max = max + Settings.maxpacket; 384 | 385 | if (movedata.getAmount() > max) { 386 | 387 | //Maybe block the checkpoint exploit? 388 | //double xzdis = Utils.getXZDistance(movedata.lastloc.x, to.getX(), movedata.lastloc.z, to.getZ()); 389 | 390 | if (this.vars.issueViolation(p, CheckType.TIMER)) { 391 | 392 | if (movedata.getAmount() > 50) { 393 | 394 | p.kickPlayer("Too many packets! Are you (or the server) lagging badly?"); 395 | 396 | } else { 397 | 398 | p.teleport(movedata.lastloc.toLocation(to.getPitch(), to.getYaw()), TeleportCause.UNKNOWN); 399 | 400 | } 401 | 402 | movedata.reset(movedata.lastloc); 403 | 404 | } 405 | 406 | } else { 407 | 408 | movedata.reset(new XYZ(from)); 409 | 410 | } 411 | 412 | } else { 413 | 414 | movedata.setAmount(movedata.getAmount() + 1); 415 | 416 | } 417 | 418 | this.vars.setMoveData(p.getName(), movedata); 419 | 420 | }*/ 421 | //****************End Timer****************** 422 | 423 | return 0; 424 | } 425 | 426 | //****************API METHODS********************* 427 | private function getMaxHight(Player $p, MoveData $md) { 428 | 429 | $d = 0; 430 | 431 | if ($p->hasEffect(Effect::JUMP)) { 432 | 433 | $level = $p->getEffect(Effect::JUMP)->getAmplifier(); 434 | 435 | if ($level == 1) { 436 | 437 | $d = 1.9; 438 | 439 | } else if ($level == 2) { 440 | 441 | $d = 2.7; 442 | 443 | } else if ($level == 3) { 444 | 445 | $d = 3.36; 446 | 447 | } else if ($level == 4) { 448 | 449 | $d = 4.22; 450 | 451 | } else if ($level == 5) { 452 | 453 | $d = 5.16; 454 | 455 | } else if ($level == 6) { 456 | 457 | $d = 6.19; 458 | 459 | } else if ($level == 7) { 460 | 461 | $d = 7.31; 462 | 463 | } else if ($level == 8) { 464 | 465 | $d = 8.5; 466 | 467 | } else if ($level == 9) { 468 | 469 | $d = 9.76; 470 | 471 | } else if ($level == 10) { 472 | 473 | $d = 11.1; 474 | 475 | } else { 476 | 477 | $d = ($level) + 1; 478 | 479 | } 480 | 481 | $d = $d + 1.35; 482 | 483 | } else { 484 | 485 | $d = 1.35; 486 | 487 | } 488 | 489 | if ($md->yda != 0 && ((time() * 1000) < $md->velexpirey)) { 490 | 491 | $d = $d + $md->yda; 492 | 493 | } 494 | 495 | return $d; 496 | 497 | } 498 | 499 | private function getMaxVertical(Player $p, $inwater, $up) { 500 | 501 | $d = 0.5; 502 | 503 | if ($p->hasEffect(Effect::JUMP)) { 504 | 505 | $d = $d + ($p->getEffect(Effect::JUMP)->getAmplifier() * 0.11); 506 | 507 | } 508 | 509 | if ($inwater && !$p->getAllowFlight()) { 510 | 511 | if ($up) { 512 | 513 | $d = 0.3401; 514 | 515 | } else { 516 | 517 | $d = abs($p->getMotion()->getY()); 518 | 519 | } 520 | 521 | } 522 | 523 | if ($p->getMotion()->getY() > 0) { 524 | 525 | $d = $d + ($p->getMotion()->getY()); 526 | 527 | } 528 | 529 | return $d; 530 | 531 | } 532 | 533 | private function getMaxMD($inwater, $onground, Player $p, $ydis, MoveData $md) { 534 | 535 | $d = 0; 536 | 537 | $csneak = $p->isSneaking(); 538 | $csprint = $p->isSprinting(); 539 | 540 | $now = time() * 1000; 541 | 542 | 543 | if (!$csneak) { 544 | 545 | if (($now - $md->sneaktime) <= 1000) { 546 | 547 | $csneak = true; 548 | 549 | } 550 | 551 | } else { 552 | 553 | if (!$onground) { 554 | 555 | if (($now - $md->sneaktime) <= 1000) { 556 | 557 | $csneak = false; 558 | 559 | } 560 | 561 | } 562 | 563 | } 564 | 565 | if (!$csprint) { 566 | 567 | if (($now - $md->sprinttime) <= 1000) { 568 | 569 | $csprint = true; 570 | 571 | } 572 | 573 | } 574 | 575 | //TODO Account jump effect 576 | 577 | /*if ($p->isFlying()) { 578 | 579 | $d = 1.30; 580 | 581 | }*/ if ($csprint) { 582 | 583 | $d = (18.3 + $d) + (8 * $ydis); 584 | 585 | } else if ($csneak) { 586 | 587 | if ($onground) { 588 | 589 | $d = 0.065; 590 | 591 | } else { 592 | 593 | $d = 0.67; 594 | 595 | } 596 | 597 | } else { 598 | 599 | $d = (5.6 + $d) + (3 * $ydis); 600 | 601 | } 602 | 603 | if ($md->mda != 0 && ((time() * 1000) < $md->velexpirex)) { 604 | 605 | $d = $d + $md->mda; 606 | 607 | } 608 | 609 | return $d; 610 | 611 | } 612 | 613 | private function getXZDistance($x1, $x2, $z1, $z2) { 614 | 615 | $a1 = ($x2 - $x1); 616 | 617 | $a2 = ($z2 - $z1); 618 | 619 | return (($a1 * ($a1)) + ($a2 * $a2)); 620 | 621 | } 622 | 623 | } 624 | -------------------------------------------------------------------------------- /src/ARCore/MovingTask.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 23 | } 24 | 25 | public function onRun($currentTick){ 26 | foreach($this->plugin->cheatData as $name => $data){ 27 | $p = $this->plugin->players[$name]; 28 | if($p->isOnGround()){ 29 | $data["lastGround"] = $p->getPosition(); 30 | $data["airTime"] = 0; 31 | $data["jump"] = false; 32 | }else{ 33 | $pos = $p->getPosition(); 34 | $data["airtime"]++; 35 | if($pos->y >= $data["lastPos"]->y && $data["airtime"] >= 3){ 36 | $p->teleport($data["lastPos"]); 37 | return; 38 | } 39 | } 40 | $this->checkSpeed($data, $p); 41 | } 42 | } 43 | 44 | private function getMaxDistance(Player $p) { 45 | // Speed potions? 46 | $effects = $p->getEffects(); 47 | 48 | $amplifier = 0; 49 | 50 | // Check for speed potions. 51 | if(!empty($effects)) { 52 | foreach($effects as $effect) { 53 | if($effect->getId() == Effect::SPEED) { 54 | 55 | // In-case there is more than one speed effect on a player, get the max. 56 | if(($a = $effect->getAmplifier()) > $amplifier) { 57 | $amplifier = $a; 58 | } 59 | } 60 | } 61 | } 62 | $speed = self::WALKING_SPEED; 63 | 64 | if($p->isSprinting()) $speed = self::SPRINTING_SPEED; 65 | elseif($p->isSneaking()) $speed = self::SNEAKING_SPEED; 66 | 67 | $distance = $speed + ($amplifier != 0) ? ($speed / (0.2 * $amplifier)) : 0; 68 | 69 | return $distance; 70 | } 71 | 72 | public function checkSpeed($data, Player $p){ 73 | $prev = $data["lastPos"]; 74 | $current = $p->getPosition(); 75 | if(!($prev instanceof Position)) { 76 | return; 77 | } 78 | if($prev->getLevel() != $current->getLevel()) { 79 | return; 80 | } 81 | $maxDistance = $this->getMaxDistance($p); 82 | // Ignore Y values (in case of jump boosts etc) 83 | $actualDistance = sqrt(abs(($prev->getX() - $current->getX()) * ($prev->getZ() - $current->getZ()))); 84 | $diff = $maxDistance - $actualDistance; 85 | if($diff > 0) { 86 | // I CALL HAX! 87 | $p->teleport($prev); 88 | } 89 | // Store current variables for the next tick 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/ARCore/Particle/ParticleManager.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 78 | $this->task = new ParticleTask($this->plugin); 79 | $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask($this->task, 3); 80 | } 81 | 82 | /** 83 | * Set's the players particle effect 84 | * 85 | * @param Player $player The player to apply the effect to 86 | * @param ParticleEffect $effect The particle effect 87 | */ 88 | public function setPlayerParticleEffect($player, ParticleEffect $effect) { 89 | $this->task->setPlayerParticleEffect($player, $effect); 90 | 91 | return $effect; 92 | } 93 | 94 | /** 95 | * Remove the particle effect from the player 96 | * 97 | * @param Player $player The player to remove the effect from 98 | * @return null 99 | */ 100 | public function removeEffect($player) { 101 | $this->task->removeEffect($player); 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /src/ARCore/Particle/ParticleTask.php: -------------------------------------------------------------------------------- 1 | plugin = $plugin; 35 | } 36 | 37 | /** 38 | * Sets a particle effect to a player object 39 | * 40 | * @param Player $player The player to give the effect to 41 | * @param ParticleEffect $effect The effect to apply 42 | */ 43 | public function setPlayerParticleEffect($player, ParticleEffect $effect) { 44 | $this->effects[$player->getId()] = [$player, $effect]; 45 | } 46 | 47 | /** 48 | * Plugin that runs when the task updates 49 | * 50 | * @param integer $currentTick The current tick 51 | * @return null 52 | */ 53 | public function onRun($currentTick) { 54 | foreach ($this->effects as $id => $data) { 55 | 56 | $player = $data[0]; 57 | $effect = $data[1]; 58 | 59 | if ($player->closed) { 60 | unset($this->effects[$id]); 61 | continue; 62 | } 63 | 64 | $showTo = $player->getViewers(); 65 | $showTo[] = $player; 66 | $effect->tick($currentTick, $player, $showTo); 67 | } 68 | } 69 | 70 | /** 71 | * Removes the effect from a player 72 | * 73 | * @param Player $player The player to remove the effect from 74 | * @return null 75 | */ 76 | public function removeEffect($player) { 77 | unset($this->effects[$player->getId()]); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/ARCore/Particle/effects/LavaParticleEffect.php: -------------------------------------------------------------------------------- 1 | getLevel()->addParticle(new LavaParticle($player->add(0, 1 + lcg_value(), 0)), $showTo); 23 | 24 | $distance = -0.5 + lcg_value(); 25 | $yaw = $player->yaw * M_PI / 180; 26 | $x = $distance * cos($yaw); 27 | $z = $distance * sin($yaw); 28 | $player->getLevel()->addParticle(new LavaDripParticle($player->add($x, 0.2, $z)), $showTo); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/ARCore/Particle/effects/ParticleEffect.php: -------------------------------------------------------------------------------- 1 | getLevel()->addParticle(new DustParticle($player->add(-0.5 + lcg_value(), 1.5 + lcg_value() / 2, -0.5 + lcg_value()), 255, 0, 255), $showTo); 23 | $player->getLevel()->addParticle(new PortalParticle($player->add(-0.5 + lcg_value(), 0.5 + lcg_value(), -0.5 + lcg_value())), $showTo); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/ARCore/Particle/effects/RainbowParticleEffect.php: -------------------------------------------------------------------------------- 1 | hsv2rgb($n * 2, 100, 100, $r, $g, $b); 73 | 74 | if ($player->lastUpdate < $currentTick - 5) { 75 | 76 | $v = 2 * M_PI / 120 * ($n % 120); 77 | $i = 2 * M_PI / 60 * ($n % 60); 78 | $x = cos($i); 79 | $y = cos($v) * 0.5; 80 | $z = sin($i); 81 | 82 | $player->getLevel()->addParticle(new DustParticle($player->add($x, 2 - $y, -$z), $r, $g, $b), $showTo); 83 | $player->getLevel()->addParticle(new DustParticle($player->add(-$x, 2 - $y, $z), $r, $g, $b), $showTo); 84 | } else { 85 | 86 | for ($i = 0; $i < 2; $i++) { 87 | $distance = -0.5 + lcg_value(); 88 | $yaw = $player->yaw * M_PI / 180 + (-0.5 + lcg_value()) * 90; 89 | $x = $distance * cos($yaw); 90 | $z = $distance * sin($yaw); 91 | $y = lcg_value() * 0.4 + 0.5; 92 | $player->getLevel()->addParticle(new DustParticle($player->add($x, $y, $z), $r, $g, $b), $showTo); 93 | } 94 | } 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/ARCore/Particle/effects/RedstoneParticleEffect.php: -------------------------------------------------------------------------------- 1 | lastUpdate < $currentTick - 5) { 22 | 23 | $v = 2 * M_PI / 120 * ($n % 120); 24 | $i = 2 * M_PI / 70 * ($n % 70); 25 | $x = cos($i); 26 | $y = cos($v); 27 | $z = sin($i); 28 | 29 | $player->getLevel()->addParticle(new RedstoneParticle($player->add($x, 1 - $y, -$z)), $showTo); 30 | $player->getLevel()->addParticle(new RedstoneParticle($player->add(-$x, 1 - $y, $z)), $showTo); 31 | } else { 32 | $distance = -0.5 + lcg_value(); 33 | $yaw = $player->yaw * M_PI / 180; 34 | $x = $distance * cos($yaw); 35 | $z = $distance * sin($yaw); 36 | $y = lcg_value() * 0.4; 37 | $player->getLevel()->addParticle(new RedstoneParticle($player->add($x, $y, $z)), $showTo); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/ARCore/Pets/BatPet.php: -------------------------------------------------------------------------------- 1 | main = $main; 14 | $this->setPermission("pets.command"); 15 | $this->setAliases(array("pet")); 16 | } 17 | public function execute(CommandSender $sender, $currentAlias, array $args) { 18 | 19 | if (!isset($args[0])) { 20 | if($sender->hasPermission('pets.command')){ 21 | $sender->sendMessage("Please Use /pets help"); 22 | return true; 23 | }else{ 24 | $sender->sendMessage(TextFormat::RED."You do not have permission to use this command"); 25 | return true; 26 | } 27 | } 28 | if($args[0] == "help"){ 29 | if($sender->hasPermission('pets.command.help')){ 30 | $sender->sendMessage("§e======PetHelp======"); 31 | $sender->sendMessage("§b/pets list - To See Pets List"); 32 | $sender->sendMessage("§b/pets buy [type]"); 33 | $sender->sendMessage("§b/pets setname [name]"); 34 | return true; 35 | }else{$sender->sendMessage(TextFormat::RED."You do not have permission to use this command"); 36 | } 37 | return true; 38 | } 39 | if($args[0] == "setname"){ 40 | if($sender->hasPermission("pets.command.name")){ 41 | if (isset($args[1])){ 42 | $petname = $args[1]; 43 | $pet = $this->main->getPet($sender->getName()); 44 | $pet->setNameTag("§8".$petname); 45 | $sender->sendMessage(TextFormat::BLUE."Your pets name has been changed to ".$petname.""); 46 | $data = new Config($this->main->getDataFolder() . "PetPlayer/" . strtolower($sender->getName()) . ".yml", Config::YAML); 47 | $data->set("name", "§8$petname"); 48 | $data->save(); 49 | } 50 | }else{ 51 | $sender->sendMessage(TextFormat::RED."You do not have permission to use this command"); 52 | } 53 | } 54 | $blazeprices = $this->main->PetPrices->get("BlazePrices"); 55 | $pigprices = $this->main->PetPrices->get("PigPrices"); 56 | $chickenprices = $this->main->PetPrices->get("ChickenPrices"); 57 | $wolfprices = $this->main->PetPrices->get("WolfPrices"); 58 | $rabbitprices = $this->main->PetPrices->get("RabbitPrices"); 59 | $magmaprices = $this->main->PetPrices->get("MagmaPrices"); 60 | $batprices = $this->main->PetPrices->get("BatPrices"); 61 | $silverfishprices = $this->main->PetPrices->get("SilverfishPrices"); 62 | $spiderprices = $this->main->PetPrices->get("SpiderPrices"); 63 | $cowprices = $this->main->PetPrices->get("CowPrices"); 64 | $creeperprices = $this->main->PetPrices->get("CreeperPrices"); 65 | $irongolemprices = $this->main->PetPrices->get("IronGolemPrices"); 66 | $huskprices = $this->main->PetPrices->get("HuskPrices"); 67 | $endermanprices = $this->main->PetPrices->get("EndermanPrices"); 68 | $sheepprices = $this->main->PetPrices->get("SheepPrices"); 69 | $witchprices = $this->main->PetPrices->get("WitchPrices"); 70 | $blockprices = $this->main->PetPrices->get("BlockPrices"); 71 | 72 | if(strtolower($args[0]) == "list"){ 73 | if(!isset($args[1]) || $args[1] == 1){ 74 | $sender->sendMessage("=== Pets List ==="); 75 | $sender->sendMessage("blaze : Price = ". $blazeprices); 76 | $sender->sendMessage("pig : Price = ". $pigprices); 77 | $sender->sendMessage("chicken : Price = ". $chickenprices); 78 | $sender->sendMessage("wolf : Price = ". $wolfprices); 79 | $sender->sendMessage("rabbit : Price = ". $rabbitprices); 80 | $sender->sendMessage("magma : Price = ". $magmaprices); 81 | return true; 82 | }else{ 83 | $sender->sendMessage("Usage: /pets list [1 Until 3]"); 84 | return true; 85 | } 86 | if($args[1] == 2){ 87 | $sender->sendMessage("=== Pets List ==="); 88 | $sender->sendMessage("bat : Price = ". $batprices); 89 | $sender->sendMessage("silverfish : Price = ". $silverfishprices); 90 | $sender->sendMessage("spider : Price = ". $spiderprices); 91 | $sender->sendMessage("cow : Price = ". $cowprices); 92 | $sender->sendMessage("creeper : Price = ". $creeperprices); 93 | $sender->sendMessage("irongolem : Price = ". $irongolemprices); 94 | return true; 95 | }else{ 96 | $sender->sendMessage("Usage: /pets list [1 Until 3]"); 97 | return true; 98 | } 99 | if($args[1] == 3){ 100 | $sender->sendMessage("=== Pets List ==="); 101 | $sender->sendMessage("husk : Price = ". $huskprices); 102 | $sender->sendMessage("enderman : Price = ". $endermanprices); 103 | $sender->sendMessage("sheep : Price = ". $sheepprices); 104 | $sender->sendMessage("witch : Price = ". $witchprices); 105 | $sender->sendMessage("block : Price = ". $blockprices); 106 | return true; 107 | }else{ 108 | $sender->sendMessage("Usage: /pets list [1 Until 3]"); 109 | return true; 110 | } 111 | } 112 | 113 | //Trying Something Bleh 114 | 115 | if($args[0] == "buy"){ 116 | if(isset($args[1])){ 117 | if($args[1] == "blaze"){ 118 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $blazeprices)){ 119 | $this->main->changePet($sender, "BlazePet"); 120 | $sender->sendMessage("Succesfully Buy Blaze!"); 121 | }else{ 122 | switch($economys){ 123 | case EconomyAPI::RET_INVALID: 124 | $sender->sendMessage("You Unable To Buy Blaze Due To Not Enough Coins"); 125 | break; 126 | case EconomyAPI::RET_CANCELLED: 127 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 128 | break; 129 | case EconomyAPI::RET_NO_ACCOUNT: 130 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 131 | break; 132 | } 133 | } 134 | } 135 | if($args[1] == "pig"){ 136 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $pigprices)){ 137 | $this->main->changePet($sender, "PigPet"); 138 | $sender->sendMessage("Succesfully Buy Pig!"); 139 | }else{ 140 | switch($economys){ 141 | case EconomyAPI::RET_INVALID: 142 | $sender->sendMessage("You Unable To Buy Pig Due To Not Enough Coins"); 143 | break; 144 | case EconomyAPI::RET_CANCELLED: 145 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 146 | break; 147 | case EconomyAPI::RET_NO_ACCOUNT: 148 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 149 | break; 150 | } 151 | } 152 | } 153 | if($args[1] == "chicken"){ 154 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $chickenprices)){ 155 | $this->main->changePet($sender, "ChickenPet"); 156 | $sender->sendMessage("Succesfully Buy Chicken!"); 157 | }else{ 158 | switch($economys){ 159 | case EconomyAPI::RET_INVALID: 160 | $sender->sendMessage("You Unable To Buy Chicken Due To Not Enough Coins"); 161 | break; 162 | case EconomyAPI::RET_CANCELLED: 163 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 164 | break; 165 | case EconomyAPI::RET_NO_ACCOUNT: 166 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 167 | break; 168 | } 169 | } 170 | } 171 | if($args[1] == "wolf"){ 172 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $wolfprices)){ 173 | $this->main->changePet($sender, "WolfPet"); 174 | $sender->sendMessage("Succesfully Buy Wolf!"); 175 | }else{ 176 | switch($economys){ 177 | case EconomyAPI::RET_INVALID: 178 | $sender->sendMessage("You Unable To Buy Wolf Due To Not Enough Coins"); 179 | break; 180 | case EconomyAPI::RET_CANCELLED: 181 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 182 | break; 183 | case EconomyAPI::RET_NO_ACCOUNT: 184 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 185 | break; 186 | } 187 | } 188 | } 189 | if($args[1] == "rabbit"){ 190 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $rabbitprices)){ 191 | $this->main->changePet($sender, "RabbitPet"); 192 | $sender->sendMessage("Succesfully Buy Rabbit!"); 193 | }else{ 194 | switch($economys){ 195 | case EconomyAPI::RET_INVALID: 196 | $sender->sendMessage("You Unable To Buy Rabbit Due To Not Enough Coins"); 197 | break; 198 | case EconomyAPI::RET_CANCELLED: 199 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 200 | break; 201 | case EconomyAPI::RET_NO_ACCOUNT: 202 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 203 | break; 204 | } 205 | } 206 | } 207 | if($args[1] == "magma"){ 208 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $magmaprices)){ 209 | $this->main->changePet($sender, "MagmaPet"); 210 | $sender->sendMessage("Succesfully Buy Blaze!"); 211 | }else{ 212 | switch($economys){ 213 | case EconomyAPI::RET_INVALID: 214 | $sender->sendMessage("You Unable To Buy Magma Due To Not Enough Coins"); 215 | break; 216 | case EconomyAPI::RET_CANCELLED: 217 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 218 | break; 219 | case EconomyAPI::RET_NO_ACCOUNT: 220 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 221 | break; 222 | } 223 | } 224 | } 225 | if($args[1] == "bat"){ 226 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $batrices)){ 227 | $this->main->changePet($sender, "BatPet"); 228 | $sender->sendMessage("Succesfully Buy Bat!"); 229 | }else{ 230 | switch($economys){ 231 | case EconomyAPI::RET_INVALID: 232 | $sender->sendMessage("You Unable To Buy Bat Due To Not Enough Coins"); 233 | break; 234 | case EconomyAPI::RET_CANCELLED: 235 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 236 | break; 237 | case EconomyAPI::RET_NO_ACCOUNT: 238 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 239 | break; 240 | } 241 | } 242 | } 243 | if($args[1] == "silverfish"){ 244 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $silverfishprices)){ 245 | $this->main->changePet($sender, "SilverfishPet"); 246 | $sender->sendMessage("Succesfully Buy Silverfish!"); 247 | }else{ 248 | switch($economys){ 249 | case EconomyAPI::RET_INVALID: 250 | $sender->sendMessage("You Unable To Buy Silverfish Due To Not Enough Coins"); 251 | break; 252 | case EconomyAPI::RET_CANCELLED: 253 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 254 | break; 255 | case EconomyAPI::RET_NO_ACCOUNT: 256 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 257 | break; 258 | } 259 | } 260 | } 261 | if($args[1] == "spider"){ 262 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $spiderprices)){ 263 | $this->main->changePet($sender, "SpiderPet"); 264 | $sender->sendMessage("Succesfully Buy Spider!"); 265 | }else{ 266 | switch($economys){ 267 | case EconomyAPI::RET_INVALID: 268 | $sender->sendMessage("You Unable To Buy Spider Due To Not Enough Coins"); 269 | break; 270 | case EconomyAPI::RET_CANCELLED: 271 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 272 | break; 273 | case EconomyAPI::RET_NO_ACCOUNT: 274 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 275 | break; 276 | } 277 | } 278 | } 279 | if($args[1] == "cow"){ 280 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $cowprices)){ 281 | $this->main->changePet($sender, "CowPet"); 282 | $sender->sendMessage("Succesfully Buy Cow!"); 283 | }else{ 284 | switch($economys){ 285 | case EconomyAPI::RET_INVALID: 286 | $sender->sendMessage("You Unable To Buy Cow Due To Not Enough Coins"); 287 | break; 288 | case EconomyAPI::RET_CANCELLED: 289 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 290 | break; 291 | case EconomyAPI::RET_NO_ACCOUNT: 292 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 293 | break; 294 | } 295 | } 296 | } 297 | if($args[1] == "Creeper"){ 298 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $creeperprices)){ 299 | $this->main->changePet($sender, "CreeperPet"); 300 | $sender->sendMessage("Succesfully Buy Creeper!"); 301 | }else{ 302 | switch($economys){ 303 | case EconomyAPI::RET_INVALID: 304 | $sender->sendMessage("You Unable To Buy Creeper Due To Not Enough Coins"); 305 | break; 306 | case EconomyAPI::RET_CANCELLED: 307 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 308 | break; 309 | case EconomyAPI::RET_NO_ACCOUNT: 310 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 311 | break; 312 | } 313 | } 314 | } 315 | if($args[1] == "irongolem"){ 316 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $irongolemprices)){ 317 | $this->main->changePet($sender, "IronGolemPet"); 318 | $sender->sendMessage("Succesfully Buy Iron Golem!"); 319 | }else{ 320 | switch($economys){ 321 | case EconomyAPI::RET_INVALID: 322 | $sender->sendMessage("You Unable To Buy Iron Golem Due To Not Enough Coins"); 323 | break; 324 | case EconomyAPI::RET_CANCELLED: 325 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 326 | break; 327 | case EconomyAPI::RET_NO_ACCOUNT: 328 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 329 | break; 330 | } 331 | } 332 | } 333 | if($args[1] == "husk"){ 334 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $huskprices)){ 335 | $this->main->changePet($sender, "HuskPet"); 336 | $sender->sendMessage("Succesfully Buy Husk!"); 337 | }else{ 338 | switch($economys){ 339 | case EconomyAPI::RET_INVALID: 340 | $sender->sendMessage("You Unable To Buy Husk Due To Not Enough Coins"); 341 | break; 342 | case EconomyAPI::RET_CANCELLED: 343 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 344 | break; 345 | case EconomyAPI::RET_NO_ACCOUNT: 346 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 347 | break; 348 | } 349 | } 350 | } 351 | if($args[1] == "enderman"){ 352 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $endermanprices)){ 353 | $this->main->changePet($sender, "EndermanPet"); 354 | $sender->sendMessage("Succesfully Buy Enderman!"); 355 | }else{ 356 | switch($economys){ 357 | case EconomyAPI::RET_INVALID: 358 | $sender->sendMessage("You Unable To Buy Enderman Due To Not Enough Coins"); 359 | break; 360 | case EconomyAPI::RET_CANCELLED: 361 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 362 | break; 363 | case EconomyAPI::RET_NO_ACCOUNT: 364 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 365 | break; 366 | } 367 | } 368 | } 369 | if($args[1] == "sheep"){ 370 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $sheepprices)){ 371 | $this->main->changePet($sender, "SheepPet"); 372 | $sender->sendMessage("Succesfully Buy Sheep!"); 373 | }else{ 374 | switch($economys){ 375 | case EconomyAPI::RET_INVALID: 376 | $sender->sendMessage("You Unable To Buy Sheep Due To Not Enough Coins"); 377 | break; 378 | case EconomyAPI::RET_CANCELLED: 379 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 380 | break; 381 | case EconomyAPI::RET_NO_ACCOUNT: 382 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 383 | break; 384 | } 385 | } 386 | } 387 | if($args[1] == "witch"){ 388 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $witchprices)){ 389 | $this->main->changePet($sender, "WitchPet"); 390 | $sender->sendMessage("Succesfully Buy Witch!"); 391 | }else{ 392 | switch($economys){ 393 | case EconomyAPI::RET_INVALID: 394 | $sender->sendMessage("You Unable To Buy Witch Due To Not Enough Coins"); 395 | break; 396 | case EconomyAPI::RET_CANCELLED: 397 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 398 | break; 399 | case EconomyAPI::RET_NO_ACCOUNT: 400 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 401 | break; 402 | } 403 | } 404 | } 405 | if($args[1] == "block"){ 406 | if($economys = EconomyAPI::getInstance()->reduceMoney($sender, $blockprices)){ 407 | $this->main->changePet($sender, "BlockPet"); 408 | $sender->sendMessage("Succesfully Buy Block!"); 409 | }else{ 410 | switch($economys){ 411 | case EconomyAPI::RET_INVALID: 412 | $sender->sendMessage("You Unable To Buy Block Due To Not Enough Coins"); 413 | break; 414 | case EconomyAPI::RET_CANCELLED: 415 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 416 | break; 417 | case EconomyAPI::RET_NO_ACCOUNT: 418 | $sender->sendMessage($this->plugin->formatMessage("§6-ERROR!")); 419 | break; 420 | } 421 | } 422 | } 423 | } 424 | }//e530a7d7aea37#8828888passwordhash2112dwbLCEcorps011900121 425 | /* 426 | if($args[0] == "type"){ 427 | if (isset($args[1])){ 428 | if($args[1] == "wolf"){ 429 | if ($sender->hasPermission("pets.type.wolf")){ 430 | $this->main->changePet($sender, "WolfPet"); 431 | $sender->sendMessage("Your pet has changed to Wolf!"); 432 | return true; 433 | }else{ 434 | $sender->sendMessage("You do not have permission for dog pet!"); 435 | return true; 436 | } 437 | } 438 | if($args[1] == "chicken"){ 439 | if ($sender->hasPermission("pets.type.chicken")){ 440 | $this->main->changePet($sender, "ChickenPet"); 441 | $sender->sendMessage("Your pet has changed to Chicken!"); 442 | return true; 443 | }else{ 444 | $sender->sendMessage("You do not have permission for chicken pet!"); 445 | return true; 446 | } 447 | } 448 | if($args[1] == "pig"){ 449 | if ($sender->hasPermission("pets.type.pig")){ 450 | $this->main->changePet($sender, "PigPet"); 451 | $sender->sendMessage("Your pet has changed to Pig!"); 452 | return true; 453 | }else{ 454 | $sender->sendMessage("You do not have permission for pig pet!"); 455 | return true; 456 | } 457 | } 458 | if($args[1] == "blaze"){ 459 | if ($sender->hasPermission("pets.type.blaze")){ 460 | $this->main->changePet($sender, "BlazePet"); 461 | $sender->sendMessage("Your pet has changed to Blaze!"); 462 | return true; 463 | }else{ 464 | $sender->sendMessage("You do not have permission for blaze pet!"); 465 | return true; 466 | } 467 | } 468 | if($args[1] == "magma"){ 469 | if ($sender->hasPermission("pets.type.magma")){ 470 | $this->main->changePet($sender, "MagmaPet"); 471 | $sender->sendMessage("Your pet has changed to Magma!"); 472 | return true; 473 | }else{ 474 | $sender->sendMessage("You do not have permission for blaze pet!"); 475 | return true; 476 | } 477 | } 478 | if($args[1] == "rabbit"){ 479 | if ($sender->hasPermission("pets.type.rabbit")){ 480 | $this->main->changePet($sender, "RabbitPet"); 481 | $sender->sendMessage("Your pet has changed to Rabbit!"); 482 | return true; 483 | }else{ 484 | $sender->sendMessage("You do not have permission for rabbit pet!"); 485 | return true; 486 | } 487 | } 488 | if($args[1] == "bat"){ 489 | if ($sender->hasPermission("pets.type.bat")){ 490 | $this->main->changePet($sender, "BatPet"); 491 | $sender->sendMessage("Your pet has changed to Bat!"); 492 | return true; 493 | }else{ 494 | $sender->sendMessage("You do not have permission for bat pet!"); 495 | return true; 496 | } 497 | } 498 | if($args[1] == "silverfish"){ 499 | if ($sender->hasPermission("pets.type.silverfish")){ 500 | $this->main->changePet($sender, "SilverfishPet"); 501 | $sender->sendMessage("Your pet has changed to Siverfish!"); 502 | return true; 503 | }else{ 504 | $sender->sendMessage("You do not have permission for Silverfish pet!"); 505 | return true; 506 | } 507 | 508 | } 509 | if($args[1] == "spider"){ 510 | if ($sender->hasPermission("pets.type.spider")){ 511 | $this->main->changePet($sender, "SpiderPet"); 512 | $sender->sendMessage("Your pet has changed to Spider!"); 513 | return true; 514 | }else{ 515 | $sender->sendMessage("You do not have permission for spider pet!"); 516 | return true; 517 | } 518 | } 519 | if($args[1] == "cow"){ 520 | if ($sender->hasPermission("pets.type.cow")){ 521 | $this->main->changePet($sender, "CowPet"); 522 | $sender->sendMessage("Your pet has changed to Cow!"); 523 | return true; 524 | }else{ 525 | $sender->sendMessage("You do not have permission for cow pet!"); 526 | return true; 527 | } 528 | } 529 | if($args[1] == "creeper"){ 530 | if ($sender->hasPermission("pets.type.creeper")){ 531 | $this->main->changePet($sender, "CreeperPet"); 532 | $sender->sendMessage("Your pet has changed to Creeper!"); 533 | return true; 534 | }else{ 535 | $sender->sendMessage("You do not have permission for creeper pet!"); 536 | return true; 537 | } 538 | } 539 | if($args[1] == "irongolem"){ 540 | if ($sender->hasPermission("pets.type.irongolem")){ 541 | $this->main->changePet($sender, "IronGolemPet"); 542 | $sender->sendMessage("Your pet has changed to Iron Golem!"); 543 | return true; 544 | }else{ 545 | $sender->sendMessage("You do not have permission for Iron Golem pet!"); 546 | return true; 547 | } 548 | } 549 | if($args[1] == "husk"){ 550 | if ($sender->hasPermission("pets.type.husk")){ 551 | $this->main->changePet($sender, "HuskPet"); 552 | $sender->sendMessage("Your pet has changed to Husk!"); 553 | return true; 554 | }else{ 555 | $sender->sendMessage("You do not have permission for Husk pet!"); 556 | return true; 557 | } 558 | } 559 | if($args[1] == "enderman"){ 560 | if ($sender->hasPermission("pets.type.enderman")){ 561 | $this->main->changePet($sender, "EndermanPet"); 562 | $sender->sendMessage("Your pet has changed to Enderman!"); 563 | return true; 564 | }else{ 565 | $sender->sendMessage("You do not have permission for Enderman pet!"); 566 | return true; 567 | } 568 | } 569 | if($args[1] == "sheep"){ 570 | if ($sender->hasPermission("pets.type.sheep")){ 571 | $this->main->changePet($sender, "SheepPet"); 572 | $sender->sendMessage("Your pet has changed to Sheep!"); 573 | return true; 574 | }else{ 575 | $sender->sendMessage("You do not have permission for Sheep pet!"); 576 | return true; 577 | } 578 | } 579 | if($args[1] == "witch"){ 580 | if ($sender->hasPermission("pets.type.witch")){ 581 | $this->main->changePet($sender, "WitchPet"); 582 | $sender->sendMessage("Your pet has changed to Witch!"); 583 | return true; 584 | }else{ 585 | $sender->sendMessage("You do not have permission for Witch pet!"); 586 | return true; 587 | } 588 | } 589 | if($args[1] == "block"){ 590 | if ($sender->hasPermission("pets.type.block")){ 591 | $this->main->changePet($sender, "BlockPet"); 592 | $sender->sendMessage("Your pet has changed to Block!"); 593 | return true; 594 | }else{ 595 | $sender->sendMessage("You do not have permission for Block pet!"); 596 | return true; 597 | } 598 | } 599 | } 600 | 601 | 602 | }*/ 603 | } 604 | } 605 | 606 | -------------------------------------------------------------------------------- /src/ARCore/Pets/Pets.php: -------------------------------------------------------------------------------- 1 | owner = $player; 25 | } 26 | public function spawnTo(Player $player) { 27 | if(!$this->closed ) { 28 | if (!isset($this->hasSpawned[$player->getId()]) && isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])) { 29 | $pk = new AddEntityPacket(); 30 | $pk->eid = $this->getID(); 31 | $pk->type = static::NETWORK_ID; 32 | $pk->x = $this->x; 33 | $pk->y = $this->y; 34 | $pk->z = $this->z; 35 | 36 | $pk->speedX = 0; 37 | $pk->speedY = 0; 38 | $pk->speedZ = 0; 39 | $pk->yaw = $this->yaw; 40 | $pk->pitch = $this->pitch; 41 | $pk->metadata = $this->dataProperties; 42 | if (static::NETWORK_ID == 66){ 43 | $pk->metadata = [ 44 | 15 => [0,1], 45 | 20 => [2,86] 46 | ]; 47 | $pk->y = $this->y + 0.6; 48 | } 49 | $player->dataPacket($pk); 50 | $this->hasSpawned[$player->getId()] = $player; 51 | } 52 | } 53 | } 54 | public function updateMovement() { 55 | if ( 56 | $this->lastX !== $this->x || $this->lastY !== $this->y || $this->lastZ !== $this->z || $this->lastYaw !== $this->yaw || $this->lastPitch !== $this->pitch 57 | ) { 58 | $this->lastX = $this->x; 59 | $this->lastY = $this->y; 60 | $this->lastZ = $this->z; 61 | $this->lastYaw = $this->yaw; 62 | $this->lastPitch = $this->pitch; 63 | } 64 | $this->level->addEntityMovement($this->chunk->getX(), $this->chunk->getZ(), $this->id, $this->x, $this->y, $this->z, $this->yaw, $this->pitch); 65 | } 66 | public function attack($damage, EntityDamageEvent $source) { 67 | 68 | } 69 | public function move($dx, $dy, $dz) { 70 | $this->boundingBox->offset($dx, 0, 0); 71 | $this->boundingBox->offset(0, 0, $dz); 72 | $this->boundingBox->offset(0, $dy, 0); 73 | $this->setComponents($this->x + $dx, $this->y + $dy, $this->z + $dz); 74 | return true; 75 | } 76 | public function getSpeed() { 77 | return 1; 78 | } 79 | public function updateMove() { 80 | if(is_null($this->closeTarget)) { 81 | $x = $this->owner->x - $this->x; 82 | $z = $this->owner->z - $this->z; 83 | } else { 84 | $x = $this->closeTarget->x - $this->x; 85 | $z = $this->closeTarget->z - $this->z; 86 | } 87 | if ($x ** 2 + $z ** 2 < 4) { 88 | $this->motionX = 0; 89 | $this->motionZ = 0; 90 | $this->motionY = 0; 91 | if(!is_null($this->closeTarget)) { 92 | $this->close(); 93 | } 94 | return; 95 | } else { 96 | $diff = abs($x) + abs($z); 97 | $this->motionX = $this->getSpeed() * 0.15 * ($x / $diff); 98 | $this->motionZ = $this->getSpeed() * 0.15 * ($z / $diff); 99 | } 100 | $this->yaw = -atan2($this->motionX, $this->motionZ) * 180 / M_PI; 101 | if(is_null($this->closeTarget)) { 102 | $y = $this->owner->y - $this->y; 103 | } else { 104 | $y = $this->closeTarget->y - $this->y; 105 | } 106 | $this->pitch = $y == 0 ? 0 : rad2deg(-atan2($y, sqrt($x ** 2 + $z ** 2))); 107 | $dx = $this->motionX; 108 | $dz = $this->motionZ; 109 | $newX = Math::floorFloat($this->x + $dx); 110 | $newZ = Math::floorFloat($this->z + $dz); 111 | $block = $this->level->getBlock(new Vector3($newX, Math::floorFloat($this->y), $newZ)); 112 | if (!($block instanceof Air) && !($block instanceof Liquid)) { 113 | $block = $this->level->getBlock(new Vector3($newX, Math::floorFloat($this->y + 1), $newZ)); 114 | if (!($block instanceof Air) && !($block instanceof Liquid)) { 115 | $this->motionY = 0; 116 | if(is_null($this->closeTarget)) { 117 | $this->returnToOwner(); 118 | return; 119 | } 120 | } else { 121 | if (!$block->canBeFlowedInto) { 122 | $this->motionY = 1.1; 123 | } else { 124 | $this->motionY = 0; 125 | } 126 | } 127 | } else { 128 | $block = $this->level->getBlock(new Vector3($newX, Math::floorFloat($this->y - 1), $newZ)); 129 | if (!($block instanceof Air) && !($block instanceof Liquid)) { 130 | $blockY = Math::floorFloat($this->y); 131 | if ($this->y - $this->gravity * 4 > $blockY) { 132 | $this->motionY = -$this->gravity * 4; 133 | } else { 134 | $this->motionY = ($this->y - $blockY) > 0 ? ($this->y - $blockY) : 0; 135 | } 136 | } else { 137 | $this->motionY -= $this->gravity * 4; 138 | } 139 | } 140 | $dy = $this->motionY; 141 | $this->move($dx, $dy, $dz); 142 | $this->updateMovement(); 143 | } 144 | public function onUpdate($currentTick) { 145 | if(!($this->owner instanceof Player) || $this->owner->closed) { 146 | $this->fastClose(); 147 | return false; 148 | } 149 | 150 | if($this->getHealth() == 0){ 151 | return false; 152 | } 153 | 154 | if(!$this->isAlive()){ 155 | return false; 156 | } 157 | 158 | if($this->closed){ 159 | return false; 160 | } 161 | $tickDiff = $currentTick - $this->lastUpdate; 162 | $this->lastUpdate = $currentTick; 163 | if (is_null($this->closeTarget) && $this->distance($this->owner) > 40) { 164 | $this->returnToOwner(); 165 | } 166 | $this->entityBaseTick($tickDiff); 167 | $this->updateMove(); 168 | $this->checkChunks(); 169 | return true; 170 | } 171 | public function returnToOwner() { 172 | $len = rand(2, 6); 173 | $x = (-sin(deg2rad( $this->owner->yaw))) * $len + $this->owner->getX(); 174 | $z = cos(deg2rad( $this->owner->yaw)) * $len + $this->owner->getZ(); 175 | $this->x = $x; 176 | $this->y = $this->owner->getY() + 1; 177 | $this->z = $z; 178 | } 179 | 180 | public function fastClose() { 181 | parent::close(); 182 | } 183 | public function close(){ 184 | if(!($this->owner instanceof Player) || $this->owner->closed) { 185 | $this->fastClose(); 186 | return; 187 | } 188 | if(is_null($this->closeTarget)) { 189 | // $len = rand(12, 15); 190 | // $x = (-sin(deg2rad( $this->owner->yaw + 20))) * $len + $this->owner->getX(); 191 | // $z = cos(deg2rad( $this->owner->yaw + 20)) * $len + $this->owner->getZ(); 192 | // $this->closeTarget = new Vector3($x, $this->owner->getY() + 1, $z); 193 | $this->kill(); 194 | $this->despawnFromAll(); 195 | $this->setHealth(0); 196 | } else { 197 | if (isset(main::$pet[$this->owner->getName()])) { 198 | $this->kill(); 199 | $this->despawnFromAll(); 200 | $this->setHealth(0); 201 | } 202 | } 203 | } 204 | 205 | /** 206 | * Return interval from started to current time in minutes 207 | * 208 | * @param string $started 209 | * @return float 210 | */ 211 | public static function getTimeInterval($started) { 212 | return round((strtotime(date('Y-m-d H:i:s')) - strtotime($started)) /60); 213 | } 214 | 215 | } 216 | -------------------------------------------------------------------------------- /src/ARCore/Pets/PigPet.php: -------------------------------------------------------------------------------- 1 | getCommandMap()->register('pets', new PetCommand($this,"pets")); 34 | Entity::registerEntity(ChickenPet::class); 35 | Entity::registerEntity(WolfPet::class); 36 | Entity::registerEntity(PigPet::class); 37 | Entity::registerEntity(BlazePet::class); 38 | Entity::registerEntity(MagmaPet::class); 39 | Entity::registerEntity(RabbitPet::class); 40 | Entity::registerEntity(BatPet::class); 41 | Entity::registerEntity(SilverfishPet::class); 42 | Entity::registerEntity(SpiderPet::class); 43 | Entity::registerEntity(CowPet::class); 44 | Entity::registerEntity(CreeperPet::class); 45 | Entity::registerEntity(IronGolemPet::class); 46 | Entity::registerEntity(HuskPet::class); 47 | Entity::registerEntity(EndermanPet::class); 48 | Entity::registerEntity(SheepPet::class); 49 | Entity::registerEntity(WitchPet::class); 50 | Entity::registerEntity(BlockPet::class); 51 | //$server->getScheduler()->scheduleRepeatingTask(new task\PetsTick($this), 20*60);//run each minute for random pet messages 52 | //$server->getScheduler()->scheduleRepeatingTask(new task\SpawnPetsTick($this), 20); 53 | 54 | } 55 | 56 | public function create($player,$type, Position $source, ...$args) { 57 | $chunk = $source->getLevel()->getChunk($source->x >> 4, $source->z >> 4, true); 58 | $nbt = new CompoundTag("", [ 59 | "Pos" => new ListTag("Pos", [ 60 | new DoubleTag("", $source->x), 61 | new DoubleTag("", $source->y), 62 | new DoubleTag("", $source->z) 63 | ]), 64 | "Motion" => new ListTag("Motion", [ 65 | new DoubleTag("", 0), 66 | new DoubleTag("", 0), 67 | new DoubleTag("", 0) 68 | ]), 69 | "Rotation" => new ListTag("Rotation", [ 70 | new FloatTag("", $source instanceof Location ? $source->yaw : 0), 71 | new FloatTag("", $source instanceof Location ? $source->pitch : 0) 72 | ]), 73 | ]); 74 | $pet = Entity::createEntity($type, $chunk, $nbt, ...$args); 75 | $pet->setOwner($player); 76 | $pet->spawnToAll(); 77 | $pet->setNameTag(TF::BLUE."".$player->getName()."'s Pet"); 78 | return $pet; 79 | } 80 | 81 | public function createPet(Player $player, $type, $holdType = "") { 82 | if (isset($this->pet[$player->getName()]) != true) { 83 | $len = rand(8, 12); 84 | $x = (-sin(deg2rad($player->yaw))) * $len + $player->getX(); 85 | $z = cos(deg2rad($player->yaw)) * $len + $player->getZ(); 86 | $y = $player->getLevel()->getHighestBlockAt($x, $z); 87 | 88 | $source = new Position($x , $y + 2, $z, $player->getLevel()); 89 | if (isset(self::$type[$player->getName()])){ 90 | $type = self::$type[$player->getName()]; 91 | } 92 | switch ($type){ 93 | case "WolfPet": 94 | break; 95 | case "ChickenPet": 96 | break; 97 | case "PigPet": 98 | break; 99 | case "BlazePet": 100 | 101 | break; 102 | case "MagmaPet": 103 | 104 | break; 105 | case "RabbitPet": 106 | 107 | break; 108 | case "BatPet": 109 | 110 | break; 111 | case "SilverfishPet": 112 | 113 | break; 114 | case "SpiderPet": 115 | 116 | break; 117 | case "CowPet": 118 | 119 | break; 120 | case "CreeperPet": 121 | 122 | break; 123 | case "IronGolemPet": 124 | 125 | break; 126 | case "HuskPet": 127 | 128 | break; 129 | case "EndermanPet": 130 | 131 | break; 132 | case "SheepPet": 133 | 134 | break; 135 | case "WitchPet": 136 | 137 | break; 138 | case "BlockPet": 139 | 140 | break; 141 | default: 142 | $pets = array("ChickenPet", "PigPet", "WolfPet", "BlazePet", "RabbitPet", "BatPet","SilverfishPet","SpiderPet","CowPet","CreeperPet","IronGolemPet","HuskPet","EndermanPet","SheepPet","WitchPet","BlockPet"); 143 | $type = $pets[rand(0, 3)]; 144 | } 145 | $pet = $this->create($player,$type, $source); 146 | return $pet; 147 | } 148 | } 149 | 150 | public function onPlayerQuit(PlayerQuitEvent $event) { 151 | $player = $event->getPlayer(); 152 | $pet = $player->getPet(); 153 | if (!is_null($pet)) { 154 | $this->disablePet($player); 155 | } 156 | } 157 | 158 | /** 159 | * Get last damager name if it's another player 160 | * 161 | * @param PlayerDeathEvent $event 162 | */ 163 | public function onPlayerDeath(PlayerDeathEvent $event) { 164 | $player = $event->getEntity(); 165 | $attackerEvent = $player->getLastDamageCause(); 166 | if ($attackerEvent instanceof EntityDamageByEntityEvent) { 167 | $attacker = $attackerEvent->getDamager(); 168 | if ($attacker instanceof Player) { 169 | $player->setLastDamager($attacker->getName()); 170 | } 171 | } 172 | } 173 | 174 | //new Pets API By BalAnce cause LIFEBOAT's WAS SHIT! 175 | //still probably buggy idk worked fine for me 176 | 177 | public function togglePet(Player $player){ 178 | if (isset(self::$pet[$player->getName()])){ 179 | self::$pet[$player->getName()]->close(); 180 | unset(self::$pet[$player->getName()]); 181 | $this->disablePet($player); 182 | $player->sendMessage("Pet Disapeared"); 183 | 184 | return; 185 | } 186 | self::$pet[$player->getName()] = $this->createPet($player, ""); 187 | $player->sendMessage("Enabled Pet!"); 188 | } 189 | 190 | public function disablePet(Player $player){ 191 | if (isset(self::$pet[$player->getName()])){ 192 | self::$pet[$player->getName()]->fastClose(); 193 | unset(self::$pet[$player->getName()]); 194 | } 195 | } 196 | 197 | public function changePet(Player $player, $newtype){ 198 | $type = $newtype; 199 | $this->disablePet($player); 200 | self::$pet[$player->getName()] = $this->createPet($player, $newtype); 201 | } 202 | 203 | public function getPet($player) { 204 | return self::$pet[$player]; 205 | } 206 | 207 | // public function getPetState($player){ 208 | // if(isset(self::$petState[$player]['state'])) { 209 | // if(self::$petState[$player]['delay'] > 0){ 210 | // self::$petState[$player]['delay']--; 211 | // return false; 212 | // } 213 | // return self::$petState[$player]; 214 | // } 215 | // return false; 216 | // } 217 | 218 | // public static function setPetState($state,$player, $petType = "", $delay = 2) { 219 | // self::$petState[$player] = array( 220 | // 'state' => $state, 221 | // 'petType' => $petType, 222 | // 'delay' => $delay 223 | // ); 224 | // } 225 | } 226 | -------------------------------------------------------------------------------- /src/ARCore/Vaults/PrivateVaults.php: -------------------------------------------------------------------------------- 1 | getDescription()->getAuthors()) != "5b4879476c6f62616c48442c47616d6572587a61766965722c4164616d313630392c4e6575726f42696e64732c536b756c6c33785d") { 58 | $this->setEnabled(false); 59 | } 60 | } 61 | 62 | public function onEnable() { 63 | $this->getServer()->getPluginManager()->registerEvents($this, $this); 64 | @mkdir($this->getDataFolder()); 65 | @mkdir($this->getDataFolder() . "players/"); 66 | for($i = 0; $i < 51; $i++) { 67 | $pvperms = new Permission("pv.vault." . $i, "PrivateVaults permission", "op"); 68 | $this->getServer()->getPluginManager()->addPermission($pvperms); 69 | } 70 | } 71 | 72 | public function onJoin(PlayerJoinEvent $event) { 73 | $this->using[strtolower($event->getPlayer()->getName())] = null; 74 | } 75 | 76 | public function hasPrivateVault($player) { 77 | if($player instanceof Player) { 78 | $player = $player->getName(); 79 | } 80 | $player = strtolower($player); 81 | return is_file($this->getDataFolder() . "players/" . $player . ".yml"); 82 | } 83 | 84 | public function createVault($player, $number) { 85 | if($player instanceof Player) { 86 | $player = $player->getName(); 87 | } 88 | $player = strtolower($player); 89 | $cfg = new Config($this->getDataFolder() . "players/" . $player . ".yml", Config::YAML); 90 | $cfg->set("items", array()); 91 | for ($i = 0; $i < 26; $i++) { 92 | $cfg->setNested("$number.items." . $i, array(0, 0, 0, array())); 93 | } 94 | $cfg->save(); 95 | } 96 | 97 | public function loadVault(Player $player, $number) { 98 | $itemblock = Item::fromString("chest"); 99 | $block = $itemblock->getBlock(); 100 | $player->getLevel()->setBlock(new Vector3($player->getX(), 128, $player->getZ()), $block); 101 | $nbt = new CompoundTag("", [ 102 | new ListTag("Items", []), 103 | new StringTag("id", Tile::CHEST), 104 | new IntTag("x", $player->getX()), 105 | new IntTag("y", $player->getY()), 106 | new IntTag("z", $player->getZ()) 107 | ]); 108 | $nbt->Items->setTagType(NBT::TAG_Compound); 109 | $tile = Tile::createTile("Chest", $player->getLevel()->getChunk($player->getX() >> 4, $player->getZ() >> 4), $nbt); 110 | if($player instanceof Player) { 111 | $player = $player->getName(); 112 | } 113 | $player = strtolower($player); 114 | $cfg = new Config($this->getDataFolder() . "players/" . $player . ".yml", Config::YAML); 115 | $tile->getInventory()->clearAll(); 116 | for ($i = 0; $i < 26; $i++) { 117 | $ite = $cfg->getNested("$number.items." . $i); 118 | $item = Item::get($ite[0]); 119 | $item->setDamage($ite[1]); 120 | $item->setCount($ite[2]); 121 | foreach ($ite[3] as $key => $en) { 122 | $enchantment = Enchantment::getEnchantment($en[0]); 123 | $enchantment->setLevel($en[1]); 124 | $item->addEnchantment($enchantment); 125 | } 126 | $tile->getInventory()->setItem($i, $item); 127 | } 128 | return $tile->getInventory(); 129 | } 130 | 131 | public function onInventoryClose(InventoryCloseEvent $event) { 132 | $inventory = $event->getInventory(); 133 | $player = $event->getPlayer(); 134 | if($inventory instanceof ChestInventory) { 135 | if($this->using[strtolower($player->getName())] !== null) { 136 | if($player instanceof Player) { 137 | $player = $player->getName(); 138 | } 139 | $player = strtolower($player); 140 | $cfg = new Config($this->getDataFolder() . "players/" . $player . ".yml", Config::YAML); 141 | for ($i = 0; $i < 26; $i++) { 142 | $item = $inventory->getItem($i); 143 | $id = $item->getId(); 144 | $damage = $item->getDamage(); 145 | $count = $item->getCount(); 146 | $enchantments = $item->getEnchantments(); 147 | $ens = array(); 148 | foreach ($enchantments as $en) { 149 | $ide = $en->getId(); 150 | $level = $en->getLevel(); 151 | array_push($ens, array($ide, $level)); 152 | } 153 | $number = $this->using[strtolower($event->getPlayer()->getName())]; 154 | $cfg->setNested("$number.items." . $i, array($id, $damage, $count, $ens)); 155 | $cfg->save(); 156 | } 157 | $realChest = $inventory->getHolder(); 158 | $event->getPlayer()->getLevel()->setBlock(new Vector3($realChest->getX(), 128, $realChest->getZ()), Block::get(Block::AIR)); 159 | $this->using[strtolower($event->getPlayer()->getName())] = null; 160 | } 161 | } 162 | } 163 | 164 | public function saveVault($player, $inventory, $number) { 165 | if($player instanceof Player) { 166 | $player = $player->getName(); 167 | } 168 | $player = strtolower($player); 169 | 170 | if($inventory instanceof ChestInventory) { 171 | $cfg = new Config($this->getDataFolder() . "players/" . $player . ".yml", Config::YAML); 172 | for ($i = 0; $i < 26; $i++) { 173 | $item = $inventory->getItem($i); 174 | $id = $item->getId(); 175 | $damage = $item->getDamage(); 176 | $count = $item->getCount(); 177 | $enchantments = $item->getEnchantments(); 178 | $ens = array(); 179 | 180 | foreach ($enchantments as $en) { 181 | $id = $en->getId(); 182 | $level = $en->getLevel(); 183 | array_push($ens, array($id, $level)); 184 | } 185 | 186 | $cfg->setNested("$number.items." . $i, array($id, $damage, $count, $ens)); 187 | $cfg->save(); 188 | } 189 | 190 | $realChest = $inventory->getHolder(); 191 | $realChest->getLevel()->setBlock(new Vector3($realChest->getX(), 128, $realChest->getZ()), Block::get(Block::AIR)); 192 | } 193 | } 194 | 195 | public function onQuit(PlayerQuitEvent $event) { 196 | if($this->using[strtolower($event->getPlayer()->getName())] !== null) { 197 | $chest = $event->getPlayer()->getLevel()->getTile(new Position($event->getPlayer()->x, $event->getPlayer()->y, $event->getPlayer()->z)); 198 | if($chest instanceof Chest) { 199 | $inv = $chest->getInventory(); 200 | $this->saveVault($event->getPlayer(), $inv, $this->using[strtolower($event->getPlayer()->getName())]); 201 | unset($this->using[strtolower($event->getPlayer()->getName())]); 202 | } 203 | } 204 | } 205 | 206 | public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { 207 | if($sender instanceof Player) { 208 | switch ($cmd->getName()) { 209 | case "pv": 210 | if(!empty($args[0])) { 211 | if($args[0] === "about") { 212 | $sender->sendMessage("§6PrivateVaults§7>> Made by §bCraftYourBukkit"); 213 | $sender->sendMessage("§6PrivateVaults§7>> §bTwitter: @CraftYourBukkit"); 214 | return true; 215 | } 216 | } 217 | 218 | if($this->hasPrivateVault($sender)) { 219 | if(empty($args[0])) { 220 | if($sender->hasPermission("pv.vault.1")) { 221 | $args[0] = 1; 222 | $sender->addWindow($this->loadVault($sender, 1)); 223 | $sender->sendMessage("§6PrivateVaults§7>> Please run /pv again to open the Vault."); 224 | $this->using[strtolower($sender->getName())] = (int)$args[0]; 225 | return true; 226 | }else { 227 | $sender->sendMessage("§6PrivateVault§7>> §cYou do not have permission to open that vault."); 228 | return true; 229 | } 230 | }else { 231 | if($args[0] < 1 || $args[0] > 50) { 232 | $sender->sendMessage("§6PrivateVault§7>> Usage: /pv [0-50]"); 233 | return true; 234 | }else { 235 | if($sender->hasPermission("pv.vault." . $args[0])) { 236 | $sender->addWindow($this->loadVault($sender, $args[0])); 237 | $sender->sendTip("§aOpening Vault..."); 238 | $this->using[strtolower($sender->getName())] = (int)$args[0]; 239 | return true; 240 | }else { 241 | $sender->sendMessage("§6PrivateVault§7>> §cYou do not have permission to open that vault."); 242 | return true; 243 | } 244 | } 245 | } 246 | }else { 247 | $sender->sendMessage("§6PrivateVault§7>> Creating Vault..."); 248 | for($i = 0; $i < 51; $i++) { 249 | $this->createVault($sender, $i); 250 | } 251 | $sender->sendMessage("§6PrivateVault§7>> Vault created, run the command again to open it!"); 252 | return true; 253 | } 254 | } 255 | } 256 | return true; 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /src/ARCore/armorReductions.php: -------------------------------------------------------------------------------- 1 | 0, 9 | "LEATHER" => 1, 10 | "GOLD" => 2, 11 | "CHAIN" => 2, 12 | "IRON" => 2, 13 | "DIAMOND" => 3 14 | ); 15 | const MATERIAL_VALUES_CHEST = array( 16 | "NONE" => 0, 17 | "LEATHER" => 3, 18 | "GOLD" => 5, 19 | "CHAIN" => 5, 20 | "IRON" => 6, 21 | "DIAMOND" => 8 22 | ); 23 | const MATERIAL_VALUES_LEGGINGS = array( 24 | "NONE" => 0, 25 | "LEATHER" => 2, 26 | "GOLD" => 3, 27 | "CHAIN" => 4, 28 | "IRON" => 5, 29 | "DIAMOND" => 6 30 | ); 31 | const MATERIAL_VALUES_BOOTS = array( 32 | "NONE" => 0, 33 | "LEATHER" => 1, 34 | "GOLD" => 1, 35 | "CHAIN" => 1, 36 | "IRON" => 2, 37 | "DIAMOND" => 3 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /src/ARCore/swordDamages.php: -------------------------------------------------------------------------------- 1 | 5, 10 | "AXE" => 4, 11 | "PICKAXE" => 3, 12 | "SHOVEL" => 2, 13 | "OTHER" => 1 14 | ); 15 | const MATERIAL_VALUES = array( 16 | "WOOD" => 0, 17 | "GOLD" => 0, 18 | "STONE" => 1, 19 | "IRON" => 2, 20 | "DIAMOND" => 3 21 | ); 22 | } 23 | --------------------------------------------------------------------------------