Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .poggit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/jasonwynn10/Other-Plugins
projects:
2vs2:
path: 2vs2/
AirSneakBoots:
path: AirSneakBoots/
BanClientId:
path: BanClientId/
BasketBall:
path: BasketBall/
BlockTypeCorrector:
path: BlockTypeCorrector/
BuildZone:
path: BuildZone/
ChunkLoaders:
path: ChunkLoaders/
CrateKeys:
path: CrateKeys/
Cratechest:
path: Cratechest/
CrossOnlineCount:
path: CrossOnlineCount/
libs:
- src: Falkirks/spoondetector/spoondetector
version: ^0.0.0
- src: jasonwynn10/libpmquery/libpmquery
version: ^0.0.1
CustomAlerts:
path: CustomAlerts/
Elytra:
path: Elytra/
ExplodableUnbreakables:
path: ExplodableUnbreakables/
Farms:
path: Farms/
GlowstoneCircleWorld:
path: GlowstoneCircleWorld/
HiddenUnHidden:
path: HiddenUnHidden/
HubTP:
path: HubTP/
Infinity-Stone:
path: Infinity-Stone/
LateCommands:
path: LateCommands/
MeteorRain:
path: MeteorRain/
MoreCommands:
path: MoreCommands/
Multi-Inv:
path: Multi-Inv/
NameTagMods:
path: NameTagMods/
NoPvpFlight:
path: NoPvpFlight/
PeacefulSpawn:
path: PeacefulSpawn/
PerWorldChat:
path: PerWorldChat/
PlayerResizer:
path: PlayerResizer/
PlayersLifetime:
path: PlayersLifetime/
PrizeCode:
path: PrizeCode/
PureChatExtras:
path: PureChatExtras/
RandomEnchant:
path: RandomEnchant/
SafeFly:
path: SafeFly/
Sleep4All:
path: Sleep4All/
TimeCommander:
path: TimeCommander/
UHC:
path: UHC/
VIPfly:
path: VIPfly/
ViperKits:
path: ViperKits/
WarpPads:
path: WarpPads/
WorldEdit:
path: WorldEdit/
WorldMerge:
path: WorldMerge/
WorldShift:
path: WorldShift/
...
2 changes: 1 addition & 1 deletion BanClientId/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ author: "jasonwynn10"
version: 0.1.0
api:
- 3.0.0
- 3.0.0-ALPHA7
- 3.0.0-ALPHA10
main: jasonwynn10\Main
description: "A plugin that allows banning client Ids"
commands:
Expand Down
8 changes: 4 additions & 4 deletions BanClientId/src/jasonwynn10/Bancid/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function onCommand(CommandSender $sender, Command $command, string $label
if (isset($args[0])) {
if(($player = $this->getServer()->getPlayer($args[0])) instanceof Player) {
$name = $player->getName();
$id = $player->getClientId();
$id = $player->getUniqueId();
$banned = $this->getConfig()->get("Banned", []);
$times = $this->getConfig()->get("Times", []);
$banned[$name] = $id;
Expand Down Expand Up @@ -71,7 +71,7 @@ public function onCommand(CommandSender $sender, Command $command, string $label
if(isset($args[0]) and isset($args[1])) {
if(($player = $this->getServer()->getPlayer($args[0])) instanceof Player and is_int($args[1])) {
$name = $player->getName();
$id = $player->getClientId();
$id = $player->getUniqueId();
$banned = $this->getConfig()->get("Banned", []);
$times = $this->getConfig()->get("Times", []);
$banned[$name] = $id;
Expand All @@ -95,12 +95,12 @@ public function onPreLogin(PlayerPreLoginEvent $ev) {
foreach($this->getConfig()->get("Banned", []) as $name => $id) {
foreach ($this->getConfig()->get("Times", []) as $key => $time) {
if($key === $id) {
if($p->getClientId() === $id) {
if($p->getUniqueId() === $id) {
$ev->setKickMessage("You are banned for {$time} more minutes!");
$ev->setCancelled();
}
}else{
if($p->getClientId() === $id) {
if($p->getUniqueId() === $id) {
$ev->setKickMessage("You have been banned!");
$ev->setCancelled();
}
Expand Down
3 changes: 2 additions & 1 deletion BlockTypeCorrector/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ author: "jasonwynn10"
version: 0.2.0
api:
- 3.0.0
- 3.0.0-ALPHA7
- 3.0.0-ALPHA9
- 3.0.0-ALPHA10
load: STARTUP
81 changes: 44 additions & 37 deletions BlockTypeCorrector/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
BlocksPerTick: 256
blocks:
"243:0": "3:2"
"2:0": "31:1"
"43:6": "43:7"
"44:6": "44:7"
"337:0": "82:0"
"405:0": "112:0"
"372:0": "115:0"
"126:0": "158:0"
"126:1": "158:1"
"126:8": "158:8"
"125:0": "157:0"
"85:1": "188:0"
"85:2": "189:0"
"85:3": "190:0"
"85:5": "191:0"
"85:4": "192:0"
"208:0": "198:0"
"240:0": "199:0"
"201:2": "202:0"
"44:7": "205:0"
"244:0": "207:0"
"198:0": "208:0"
"115:0": "214:0"
"466:0": "322:1"
"422:0": "410:0"
"457:0": "434:0"
"458:0": "435:0"
"459:0": "436:0"
"445:0": "450:0"
"143:1": "143:5"
"77:1": "77:5"
"77:4": "77:2"
"96:4": "96:15"
"96:5": "96:14"
"96:6": "96:13"
"96:7": "96:12"
"243:0": "3:2"
"2:0": "31:1"
"43:6": "43:7"
"44:6": "44:7"
"337:0": "82:0"
"405:0": "112:0"
"372:0": "115:0"
"126:0": "158:0"
"126:1": "158:1"
"126:8": "158:8"
"125:0": "157:0"
"85:1": "188:0"
"85:2": "189:0"
"85:3": "190:0"
"85:5": "191:0"
"85:4": "192:0"
"208:0": "198:0"
"240:0": "199:0"
"201:2": "202:0"
"44:7": "205:0"
"244:0": "207:0"
"198:0": "208:0"
"115:0": "214:0"
"466:0": "322:1"
"422:0": "410:0"
"457:0": "434:0"
"458:0": "435:0"
"459:0": "436:0"
"445:0": "450:0"
"143:1": "143:5"
"77:1": "77:5"
"77:4": "77:2"
"96:4": "96:15"
"96:5": "96:14"
"96:6": "96:13"
"96:7": "96:12"
"188:0": "85:1"
"95:0": "20:0"
"160:0": "102:0"
"188:0": "85:1"
"189:0": "85:2"
"190:0": "85:3"
"191:0": "85:5"
"192:0": "85:4"
52 changes: 0 additions & 52 deletions BlockTypeCorrector/src/jasonwynn10/corrector/Corrector.php

This file was deleted.

100 changes: 79 additions & 21 deletions BlockTypeCorrector/src/jasonwynn10/corrector/Main.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,89 @@
<?php
declare(strict_types=1);
namespace jasonwynn10\corrector;

use pocketmine\block\Block;
use pocketmine\event\level\ChunkLoadEvent;
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\math\Vector3;
use pocketmine\plugin\PluginBase;

class Main extends pluginBase implements Listener {
public function onEnable() {
$this->getServer()->getPluginManager()->registerEvents($this, $this);
$this->saveDefaultConfig();
foreach ($this->getServer()->getLevels() as $level) {
$this->getServer()->getScheduler()->scheduleTask(new Corrector($this, $level));
}
}
public function onTap(PlayerInteractEvent $ev) {
$this->getLogger()->info("TAPPED");
$block = $ev->getBlock();
$this->getLogger()->info("ID: ".$block->getId().":".$block->getDamage());
if(array_key_exists("{$block->getId()}:{$block->getDamage()}", $this->getConfig()->get("blocks", []))) {
$arr = explode(":", $this->getConfig()->get("blocks", [])["{$block->getId()}:{$block->getDamage()}"]);
$newBlock = Block::get((int)$arr[0], (int)$arr[1]);
$ev->getPlayer()->getLevel()->setBlock($block, $newBlock,false, true);
$this->getLogger()->info("FIXED");
$this->getLogger()->info("ID: ".$newBlock->getId().":".$newBlock->getDamage());
}else{
$this->getLogger()->info("KEY doesn't exist!");
}
}
/** @var string[] $blockTypes */
private $blockTypes = [];

public function onEnable() : void {
$this->getServer()->getPluginManager()->registerEvents($this, $this);
$this->saveDefaultConfig();
$this->blockTypes = $this->getConfig()->get("blocks", []);
}

/**
* @priority MONITOR
* @ignoreCancelled false
*
* @param ChunkLoadEvent $ev
*/
public function onChunkLoad(ChunkLoadEvent $ev) : void {
$chunk = $ev->getChunk();
if(isset($chunk->fixed))
return;
$level = $ev->getLevel();
for($x = 0; $x <= 16; $x++) {
for($z = 0; $z <= 16; $z++) {
for($y = 0; $y <= $chunk->getHeight(); $y++) {
$block = $level->getBlock(new Vector3(($chunk->getX() << 4) + $x, $y, ($chunk->getZ() << 4) + $z));
$key = "{$block->getId()}:{$block->getDamage()}";
if(array_key_exists($key, $this->blockTypes)) {
$arr = explode(":",$this->blockTypes[$key]);
$chunk->setBlock($x, $y, $z, (int)$arr[0], (int)($arr[1] ?? 0));
}
}
}
}
$chunk->setChanged();
$chunk->fixed = true;
}

/**
* @priority MONITOR
* @ignoreCancelled false
*
* @param PlayerInteractEvent $ev
*/
public function onTap(PlayerInteractEvent $ev) : void {
if($ev->getPlayer()->getName() !== "jasonwynn10")
return;
$this->getLogger()->info("TAPPED");
$block = $ev->getBlock();
$this->getLogger()->info("ID: ".$block->getId().":".$block->getDamage());
if(array_key_exists("{$block->getId()}:{$block->getDamage()}", $this->getConfig()->get("blocks", []))) {
$arr = explode(":", $this->getConfig()->get("blocks", [])["{$block->getId()}:{$block->getDamage()}"]);
$newBlock = Block::get((int)$arr[0], (int)$arr[1]);
$ev->getPlayer()->getLevel()->setBlock($block, $newBlock,false, false);
$this->getLogger()->info("FIXED");
$this->getLogger()->info("ID: ".$newBlock->getId().":".$newBlock->getDamage());
}else{
$this->getLogger()->info("KEY doesn't exist! Attempting backup method");
$this->fixBlockIds($block);
}
}

public function fixBlockIds(Block $block) : void {
$replace = null;
switch($block->getId()) {
case 126:
$replace = Block::get(Block::WOODEN_SLAB, $block->getDamage());
break;
case 125:
$replace = Block::get(Block::DOUBLE_WOODEN_SLAB, $block->getDamage());
break;
default:
break;
}
if(isset($replace)) {
$block->getLevel()->setBlock($block, $replace, false, false);
}
}
}
Loading