Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php echo 'Phar compiled on https://pmt.mcpe.fun.'; __HALT_COMPILER(); ?> H # ..
Decoded Output download
<?php echo 'Phar compiled on https://pmt.mcpe.fun.'; __HALT_COMPILER(); ?>
H # a:9:{s:4:"name";s:8:"SkyBlock";s:4:"main";s:13:"MyPlot\MyPlot";s:7:"version";d:2;s:4:"load";s:7:"STARTUP";s:3:"api";s:5:"2.0.0";s:6:"author";s:17:"Wies and Exxarion";s:11:"description";s:26:"Plot and protection plugin";s:10:"softdepend";a:2:{i:0;s:10:"EconomyAPI";i:1;s:11:"PocketMoney";}s:11:"permissions";a:3:{s:14:"myplot.command";a:3:{s:11:"description";s:35:"Allows users to use myplot features";s:7:"default";s:2:"op";s:8:"children";a:17:{s:19:"myplot.command.help";a:2:{s:11:"description";s:35:"Displays all the available commands";s:7:"default";b:1;}s:20:"myplot.command.claim";a:2:{s:11:"description";s:23:"Gives the claim command";s:7:"default";b:1;}s:19:"myplot.command.info";a:2:{s:11:"description";s:22:"Gives the info command";s:7:"default";b:1;}s:23:"myplot.command.generate";a:2:{s:11:"description";s:26:"Gives the generate command";s:7:"default";s:2:"op";}s:24:"myplot.command.addhelper";a:2:{s:11:"description";s:27:"Gives the addhelper command";s:7:"default";b:1;}s:27:"myplot.command.removehelper";a:2:{s:11:"description";s:30:"Gives the removehelper command";s:7:"default";b:1;}s:19:"myplot.command.auto";a:2:{s:11:"description";s:22:"Gives the auto command";s:7:"default";b:1;}s:19:"myplot.command.play";a:2:{s:11:"description";s:12:"Play command";s:7:"default";b:1;}s:20:"myplot.command.clear";a:2:{s:11:"description";s:23:"Gives the clear command";s:7:"default";b:1;}s:22:"myplot.command.dispose";a:2:{s:11:"description";s:25:"Gives the dispose command";s:7:"default";b:1;}s:20:"myplot.command.reset";a:2:{s:11:"description";s:23:"Gives the reset command";s:7:"default";b:1;}s:20:"myplot.command.biome";a:2:{s:11:"description";s:23:"Gives the biome command";s:7:"default";b:1;}s:19:"myplot.command.home";a:2:{s:11:"description";s:22:"Gives the home command";s:7:"default";b:1;}s:20:"myplot.command.homes";a:2:{s:11:"description";s:23:"Gives the homes command";s:7:"default";b:1;}s:19:"myplot.command.name";a:2:{s:11:"description";s:22:"Gives the name command";s:7:"default";b:1;}s:19:"myplot.command.give";a:2:{s:11:"description";s:22:"Gives the give command";s:7:"default";b:1;}s:19:"myplot.command.warp";a:2:{s:11:"description";s:22:"Gives the warp command";s:7:"default";b:1;}}}s:12:"myplot.admin";a:3:{s:11:"description";s:26:"Grant administrator powers";s:7:"default";s:2:"op";s:8:"children";a:9:{s:18:"myplot.admin.clear";a:2:{s:11:"description";s:33:"Allow clear command on every plot";s:7:"default";s:2:"op";}s:20:"myplot.admin.dispose";a:2:{s:11:"description";s:35:"Allow dispose command on every plot";s:7:"default";s:2:"op";}s:18:"myplot.admin.reset";a:2:{s:11:"description";s:33:"Allow reset command on every plot";s:7:"default";s:2:"op";}s:22:"myplot.admin.addhelper";a:2:{s:11:"description";s:37:"Allow addhelper command on every plot";s:7:"default";s:2:"op";}s:25:"myplot.admin.removehelper";a:2:{s:11:"description";s:40:"Allow removehelper command on every plot";s:7:"default";s:2:"op";}s:18:"myplot.admin.build";a:3:{s:11:"description";s:43:"Allow player to build outside his own plots";s:7:"default";s:2:"op";s:8:"children";a:2:{s:23:"myplot.admin.build.plot";a:2:{s:11:"description";s:34:"Allow player to build on all plots";s:7:"default";s:2:"op";}s:23:"myplot.admin.build.road";a:2:{s:11:"description";s:33:"Allow player to build on the road";s:7:"default";s:2:"op";}}}s:17:"myplot.admin.name";a:2:{s:11:"description";s:46:"Allows player to change the name of every plot";s:7:"default";s:2:"op";}s:17:"myplot.admin.warp";a:2:{s:11:"description";s:39:"Allow player to warp to unclaimed plots";s:7:"default";s:2:"op";}s:18:"myplot.admin.biome";a:2:{s:11:"description";s:50:"Allow player to use the biome command on all plots";s:7:"default";s:2:"op";}}}s:17:"myplot.claimplots";a:3:{s:11:"description";s:31:"Allows players to claim X plots";s:7:"default";b:0;s:8:"children";a:2:{s:19:"myplot.claimplots.2";a:2:{s:11:"description";s:29:"Allow player to claim 2 plots";s:7:"default";b:1;}s:27:"myplot.claimplots.unlimited";a:2:{s:11:"description";s:37:"Allow player to claim unlimited plots";s:7:"default";s:2:"op";}}}}} src/MyPlot/Commands.php HY - ! src/MyPlot/task/ClearPlotTask.phpQ HYQ Em - src/MyPlot/subcommand/AddHelperSubCommand.php HY ( src/MyPlot/subcommand/HelpSubCommand.php HY S-I ) src/MyPlot/subcommand/HomesSubCommand.php HY wc ( src/MyPlot/subcommand/PlaySubCommand.php HY U ( src/MyPlot/subcommand/WarpSubCommand.php HY 7 ( src/MyPlot/subcommand/HomeSubCommand.php HY f: ( src/MyPlot/subcommand/GiveSubCommand.php4 HY4 QD ( src/MyPlot/subcommand/NameSubCommand.phpH HYH & ) src/MyPlot/subcommand/ClaimSubCommand.phpf HYf *&4 , src/MyPlot/subcommand/GenerateSubCommand.php HY s ( src/MyPlot/subcommand/AutoSubCommand.php HY Y%K 0 src/MyPlot/subcommand/RemoveHelperSubCommand.php HY f ( src/MyPlot/subcommand/InfoSubCommand.php HY cg + src/MyPlot/subcommand/DisposeSubCommand.php HY d $ src/MyPlot/subcommand/SubCommand.php HY CA src/MyPlot/Plot.php HY rEZ src/MyPlot/SkyBlockStructure.phpE HYE src/MyPlot/MyPlotGenerator.phpX HYX src/MyPlot/PlotLevelSettings.php HY 'q $ src/MyPlot/provider/DataProvider.php HY { + src/MyPlot/provider/PocketMoneyProvider.php/ HY/ *3sR * src/MyPlot/provider/SQLiteDataProvider.php HY 4`4 ' src/MyPlot/provider/EconomyProvider.php HY s ( src/MyPlot/provider/EconomySProvider.php HY 4 src/MyPlot/MyPlot.php/ HY/ S{, src/MyPlot/EventListener.php HY >n
plugin.yml
HY
2
resources/lang-it.ymlK HYK HB$ resources/nl.iniy HYy Qq; resources/vi.iniW HYW /; resources/config.ymlH HYH 3 resources/eng.ini HY % resources/lang-pol.yml HY C <?php
namespace MyPlot;
use pocketmine\utils\TextFormat;
use MyPlot\subcommand\SubCommand;
use MyPlot\subcommand\AddHelperSubCommand;
use MyPlot\subcommand\ClaimSubCommand;
use MyPlot\subcommand\DisposeSubCommand;
use MyPlot\subcommand\GenerateSubCommand;
use MyPlot\subcommand\HelpSubCommand;
use MyPlot\subcommand\HomeSubCommand;
use MyPlot\subcommand\InfoSubCommand;
use MyPlot\subcommand\HomesSubCommand;
use pocketmine\command\PluginCommand;
use pocketmine\command\CommandSender;
use MyPlot\subcommand\RemoveHelperSubCommand;
use MyPlot\subcommand\AutoSubCommand;
use MyPlot\subcommand\PlaySubCommand;
use MyPlot\subcommand\NameSubCommand;
use MyPlot\subcommand\GiveSubCommand;
use MyPlot\subcommand\WarpSubCommand;
use pocketmine\event\Listener;
class Commands extends PluginCommand
{
/** @var SubCommand[] */
private $subCommands = [];
/** @var SubCommand[] */
private $aliasSubCommands = [];
public function __construct(MyPlot $plugin) {
parent::__construct($plugin->getLanguage()->get("command.name"), $plugin);
$this->setPermission("myplot.command");
$this->setAliases([$plugin->getLanguage()->get("command.alias")]);
$this->setDescription($plugin->getLanguage()->get("command.desc"));
$this->loadSubCommand(new HelpSubCommand($plugin, "help"));
$this->loadSubCommand(new ClaimSubCommand($plugin, "claim"));
$this->loadSubCommand(new GenerateSubCommand($plugin, "generate"));
$this->loadSubCommand(new InfoSubCommand($plugin, "info"));
$this->loadSubCommand(new AddHelperSubCommand($plugin, "addhelper"));
$this->loadSubCommand(new RemoveHelperSubCommand($plugin, "removehelper"));
$this->loadSubCommand(new AutoSubCommand($plugin, "auto"));
$this->loadSubCommand(new PlaySubCommand($plugin, "play"));
$this->loadSubCommand(new DisposeSubCommand($plugin, "dispose"));
$this->loadSubCommand(new HomeSubCommand($plugin, "home"));
$this->loadSubCommand(new HomesSubCommand($plugin, "homes"));
$this->loadSubCommand(new NameSubCommand($plugin, "name"));
$this->loadSubCommand(new GiveSubCommand($plugin, "give"));
$this->loadSubCommand(new WarpSubCommand($plugin, "warp"));
}
/**
* @return SubCommand[]
*/
public function getCommands() {
return $this->subCommands;
}
private function loadSubCommand(Subcommand $command) {
$this->subCommands[$command->getName()] = $command;
if ($command->getAlias() != "") {
$this->aliasSubCommands[$command->getAlias()] = $command;
}
}
public function execute(CommandSender $sender, $alias, array $args) {
if (!isset($args[0])) {
$sender->sendMessage(MyPlot::getInstance()->getLanguage()->get("command.usage"));
return true;
}
$subCommand = strtolower(array_shift($args));
if (isset($this->subCommands[$subCommand])) {
$command = $this->subCommands[$subCommand];
} elseif (isset($this->aliasSubCommands[$subCommand])) {
$command = $this->aliasSubCommands[$subCommand];
} else {
$sender->sendMessage(TextFormat::RED . MyPlot::getInstance()->getLanguage()->get("command.unknown"));
return true;
}
if ($command->canUse($sender)) {
if (!$command->execute($sender, $args)) {
$usage = MyPlot::getInstance()->getLanguage()->translateString("subcommand.usage", [$command->getUsage()]);
$sender->sendMessage($usage);
}
} else {
$sender->sendMessage(TextFormat::RED . MyPlot::getInstance()->getLanguage()->get("command.unknown"));
}
return true;
}
}
<?php
namespace MyPlot\task;
use MyPlot\MyPlot;
use MyPlot\Plot;
use pocketmine\block\Block;
use pocketmine\math\Vector3;
use pocketmine\scheduler\PluginTask;
class ClearPlotTask extends PluginTask
{
private $level, $height, $bottomBlock, $plotFillBlock, $plotFloorBlock,
$plotBeginPos, $xMax, $zMax, $maxBlocksPerTick, $pos;
public function __construct(MyPlot $plugin, Plot $plot, $maxBlocksPerTick = 256) {
parent::__construct($plugin);
$this->plotBeginPos = $plugin->getPlotPosition($plot);
$this->level = $this->plotBeginPos->getLevel();
$plotLevel = $plugin->getLevelSettings($plot->levelName);
$plotSize = $plotLevel->plotSize;
$this->xMax = $this->plotBeginPos->x + $plotSize;
$this->zMax = $this->plotBeginPos->z + $plotSize;
$this->height = $plotLevel->groundHeight;
$this->bottomBlock = $plotLevel->bottomBlock;
$this->plotFillBlock = $plotLevel->plotFillBlock;
$this->plotFloorBlock = $plotLevel->plotFloorBlock;
$this->maxBlocksPerTick = $maxBlocksPerTick;
$this->pos = new Vector3($this->plotBeginPos->x, 0, $this->plotBeginPos->z);
}
public function onRun($tick) {
$blocks = 0;
while ($this->pos->x < $this->xMax) {
while ($this->pos->z < $this->zMax) {
while ($this->pos->y < 128) {
if ($this->pos->y === 0) {
$block = $this->bottomBlock;
} elseif ($this->pos->y < $this->height) {
$block = $this->plotFillBlock;
} elseif ($this->pos->y === $this->height) {
$block = $this->plotFloorBlock;
} else {
$block = Block::get(0);
}
$this->level->setBlock($this->pos, $block, false, false);
$blocks++;
if ($blocks === $this->maxBlocksPerTick) {
$this->getOwner()->getServer()->getScheduler()->scheduleDelayedTask($this, 1);
return;
}
$this->pos->y++;
}
$this->pos->y = 0;
$this->pos->z++;
}
$this->pos->z = $this->plotBeginPos->z;
$this->pos->x++;
}
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class AddHelperSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.addhelper");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1)
return false;
$helper = $args[0];
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.addhelper")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
if (!$plot->addHelper($helper)) {
$sender->sendMessage($this->translateString("addhelper.alreadyone", [$helper]));
return true;
}
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("addhelper.success", [$helper]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\utils\TextFormat;
class HelpSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return $sender->hasPermission("myplot.command.help");
}
/**
* @return \MyPlot\Commands
*/
private function getCommandHandler()
{
return $this->getPlugin()->getCommand($this->translateString("command.name"));
}
public function execute(CommandSender $sender, array $args) {
if (count($args) === 0) {
$pageNumber = 1;
} elseif (is_numeric($args[0])) {
$pageNumber = (int) array_shift($args);
if ($pageNumber <= 0) {
$pageNumber = 1;
}
} else {
return false;
}
if ($sender instanceof ConsoleCommandSender) {
$pageHeight = PHP_INT_MAX;
} else {
$pageHeight = 5;
}
$commands = [];
foreach ($this->getCommandHandler()->getCommands() as $command) {
if ($command->canUse($sender)) {
$commands[$command->getName()] = $command;
}
}
ksort($commands, SORT_NATURAL | SORT_FLAG_CASE);
$commands = array_chunk($commands, $pageHeight);
/** @var SubCommand[][] $commands */
//////
$sender->sendMessage("c-=- alSkyBlock - Help c-=-");
$sender->sendMessage("a/sb play7 - fi n mt hn o");
$sender->sendMessage("a/sb claim7 - fMua ngay hn o bn ang ng");
$sender->sendMessage("a/sb addhelper e<player>7 - fThm ngi vo o ca bn");
$sender->sendMessage("a/sb removehelper e<player>7 - fXa ngi chi trong o ca bn");
$sender->sendMessage("a/sb homes7 - fDanh sch o ca bn");
$sender->sendMessage("a/sb home e<S> 7 - fDch chuyn v o ca bn");
$sender->sendMessage("a/sb info7 - fXem thng tin hn o");
$sender->sendMessage("a/sb give e<Tn ngi chi> 7 - fCho ngi khc hn o ca bn");
$sender->sendMessage("a/sb warp e<X;Y> 7 - fDi chuyn n hn o no ");
$sender->sendMessage("c------------------------------------------");
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use MyPlot\Plot;
class HomesSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.homes");
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
$plots = $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName());
if (empty($plots)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("homes.noplots"));
return true;
}
$sender->sendMessage(TextFormat::DARK_GREEN . $this->translateString("homes.header"));
usort($plots, function ($plot1, $plot2) {
/** @var $plot1 Plot */
/** @var $plot2 Plot */
if ($plot1->levelName == $plot2->levelName) {
return 0;
}
return ($plot1->levelName < $plot2->levelName) ? -1 : 1;
});
for ($i = 0; $i < count($plots); $i++) {
$plot = $plots[$i];
$message = TextFormat::DARK_GREEN . "7 eID o: b" . ($i + 1) . " ";
$message .= TextFormat::WHITE . "ea ch b" . " " . $plot;
if ($plot->name !== "") {
$message .= " = " . $plot->name;
}
$sender->sendMessage($message);
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\level\Level;
use pocketmine\Server;
class PlaySubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.play");
}
public function pl(Player $player)
{
return $player;
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
$name = $player->getName();
$worldAsObject = $this->getPlugin()->getServer()->getLevelByName("sb");
$this->pl($sender)->teleport(new Position(110, 110, 110, $worldAsObject));
$this->getPlugin()->getServer()->dispatchCommand($player, "sb auto");
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\level\Level;
use pocketmine\Server;
class WarpSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.warp");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) != 1)
return false;
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
$name = $player->getName();
$worldAsObject = $this->getPlugin()->getServer()->getLevelByName("sb");
$player->teleport(new Position(110, 110, 110, $worldAsObject));
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
if (!$this->getPlugin()->isLevelLoaded($levelName)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("warp.notinplotworld"));
return true;
}
$plotIdArray = explode(";", $args[0]);
if (count($plotIdArray) != 2 or !is_numeric($plotIdArray[0]) or !is_numeric($plotIdArray[1])) {
$sender->sendMessage(TextFormat::RED . $this->translateString("warp.wrongid"));
return true;
}
$plot = $this->getPlugin()->getProvider()->getPlot($levelName, $plotIdArray[0], $plotIdArray[1]);
if ($plot->owner == "" and !$sender->hasPermission("myplot.admin.warp")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("warp.unclaimed"));
return true;
}
$this->getPlugin()->teleportPlayerToPlot($player, $plot);
$plot = TextFormat::GREEN . $plot . TextFormat::WHITE;
$sender->sendMessage($this->translateString("warp.success", [$plot]));
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class HomeSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.home");
}
public function execute(CommandSender $sender, array $args) {
if (empty($args)) {
$plotNumber = 1;
} elseif (count($args) === 1 and is_numeric($args[0])) {
$plotNumber = (int) $args[0];
} else {
return false;
}
$plots = $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName());
if (empty($plots)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("home.noplots"));
return true;
}
if (!isset($plots[$plotNumber - 1])) {
$sender->sendMessage(TextFormat::RED . $this->translateString("home.notexist", [$plotNumber]));
return true;
}
usort($plots, function ($plot1, $plot2) {
/** @var $plot1 Plot */
/** @var $plot2 Plot */
if ($plot1->levelName == $plot2->levelName) {
return 0;
}
return ($plot1->levelName < $plot2->levelName) ? -1 : 1;
});
$player = $this->getPlugin()->getServer()->getPlayer($sender->getName());
$plot = $plots[$plotNumber - 1];
if ($this->getPlugin()->teleportPlayerToPlot($player, $plot)) {
$sender->sendMessage($this->translateString("home.success", [$plot]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("home.error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class GiveSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.give");
}
public function execute(CommandSender $sender, array $args) {
$confirm = (count($args) == 2 and $args[1] == $this->translateString("confirm"));
if (count($args) != 1 and !$confirm) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName()) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
$newOwner = $this->getPlugin()->getServer()->getPlayer($args[0]);
if (!($newOwner instanceof Player)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("give.notonline"));
return true;
} elseif ($newOwner === $player) {
$sender->sendMessage(TextFormat::RED . $this->translateString("give.toself"));
return true;
}
$maxPlots = $this->getPlugin()->getMaxPlotsOfPlayer($newOwner);
$plotsOfPlayer = count($this->getPlugin()->getProvider()->getPlotsByOwner($newOwner->getName()));
if ($plotsOfPlayer >= $maxPlots) {
$sender->sendMessage(TextFormat::RED . $this->translateString("give.maxedout", [$maxPlots]));
return true;
}
if ($confirm) {
$plot->owner = $newOwner->getName();
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$plotId = TextFormat::GREEN . $plot . TextFormat::WHITE;
$oldOwnerName = TextFormat::GREEN . $sender->getName() . TextFormat::WHITE;
$newOwnerName = TextFormat::GREEN . $newOwner->getName() . TextFormat::WHITE;
$sender->sendMessage($this->translateString("give.success", [$newOwnerName]));
$newOwner->sendMessage($this->translateString("give.received", [$oldOwnerName, $plotId]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
} else {
$plotId = TextFormat::GREEN . $plot . TextFormat::WHITE;
$newOwnerName = TextFormat::GREEN . $newOwner->getName() . TextFormat::WHITE;
$sender->sendMessage($this->translateString("give.confirm", [$plotId, $newOwnerName]));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class NameSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.name");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.name")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
$name = $args[0];
$plot->name = $name;
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("name.success", [$name]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\tile\Tile;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\NBT;
use pocketmine\block\Block;
use pocketmine\item\Item;
use pocketmine\level\Position;
class ClaimSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.claim");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) > 1) {
return false;
}
$name = "";
if (isset($args[0])) {
$name = $args[0];
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner != "") {
if ($plot->owner === $sender->getName()) {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.yourplot"));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.alreadyclaimed", [$plot->owner]));
}
return true;
}
$maxPlots = $this->getPlugin()->getMaxPlotsOfPlayer($player);
$plotsOfPlayer = count($this->getPlugin()->getProvider()->getPlotsByOwner($player->getName()));
if ($plotsOfPlayer >= $maxPlots) {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.maxplots", [$maxPlots]));
return true;
}
$plotLevel = $this->getPlugin()->getLevelSettings($plot->levelName);
$economy = $this->getPlugin()->getEconomyProvider();
if ($economy !== null and !$economy->reduceMoney($player, $plotLevel->claimPrice)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.nomoney"));
return true;
}
$plot->owner = $sender->getName();
$plot->name = $name;
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("claim.success"));
$player->getInventory()->addItem(Item::get(8, 0, 2));
$player->getInventory()->addItem(Item::get(10, 0, 2));
$player->getInventory()->addItem(Item::get(297, 0, 4));
$sender->sendMessage("7[aSkyBlock7] e Thmb Nce V6 Dung Nhame Vo Kho Ca Bn");
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\utils\TextFormat;
class GenerateSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return $sender->hasPermission("myplot.command.generate");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1) {
return false;
}
$levelName = $args[0];
if ($sender->getServer()->isLevelGenerated($levelName)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("generate.exists", [$levelName]));
return true;
}
if ($this->getPlugin()->generateLevel($levelName)) {
$sender->sendMessage($this->translateString("generate.success", [$levelName]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("generate.error"));
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\level\Level;
use pocketmine\Server;
class AutoSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.auto");
}
public function pl(Player $player)
{
return $player;
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
if (!$this->getPlugin()->isLevelLoaded($levelName)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("auto.notplotworld"));
return true;
}
if (($plot = $this->getPlugin()->getProvider()->getNextFreePlot($levelName)) !== null) {
$this->getPlugin()->teleportPlayerToPlot($player, $plot);
$sender->sendMessage($this->translateString("auto.success", [$plot->X, $plot->Z]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("auto.noplots"));
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class RemoveHelperSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.removehelper");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1) {
return false;
}
$helper = $args[0];
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.removehelper")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
if (!$plot->removeHelper($helper)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("removehelper.notone", [$helper]));
return true;
}
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("removehelper.success", [$helper]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class InfoSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.info");
}
public function getAliases() {
return [];
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
$sender->sendMessage($this->translateString("info.about", [TextFormat::GREEN . $plot]));
$sender->sendMessage($this->translateString("info.owner", [TextFormat::GREEN . $plot->owner]));
$sender->sendMessage($this->translateString("info.plotname", [TextFormat::GREEN . $plot->name]));
$helpers = implode(", ", $plot->helpers);
$sender->sendMessage($this->translateString("info.helpers", [TextFormat::GREEN . $helpers]));
$sender->sendMessage($this->translateString("info.biome", [TextFormat::GREEN . $plot->biome]));
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class DisposeSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.dispose");
}
public function execute(CommandSender $sender, array $args) {
$confirm = (count($args) == 1 and $args[0] == $this->translateString("confirm"));
if (count($args) != 0 and !$confirm) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.dispose")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
if ($confirm) {
$economy = $this->getPlugin()->getEconomyProvider();
$price = $this->getPlugin()->getLevelSettings($plot->levelName)->disposePrice;
if ($economy !== null and !$economy->reduceMoney($player, $price)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("dispose.nomoney"));
return true;
}
if ($this->getPlugin()->disposePlot($plot)) {
$sender->sendMessage($this->translateString("dispose.success"));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
} else {
$plotId = TextFormat::GREEN . $plot . TextFormat::WHITE;
$sender->sendMessage($this->translateString("dispose.confirm", [$plotId]));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use MyPlot\MyPlot;
use pocketmine\command\CommandSender;
use pocketmine\Server;
use pocketmine\event\Listener;
abstract class SubCommand
{
/** @var MyPlot */
private $plugin;
private $name;
/**
* @param MyPlot $plugin
* @param string $name
*/
public function __construct(MyPlot $plugin, $name) {
$this->plugin = $plugin;
$this->name = $name;
}
/**
* @return MyPlot
*/
public final function getPlugin(){
return $this->plugin;
}
/**
* @param string $str
* @param string[] $params
*
* @return string
*/
protected function translateString($str, array $params = [], $onlyPrefix = null) {
return $this->plugin->getLanguage()->translateString($str, $params, $onlyPrefix);
}
/**
* @param CommandSender $sender
* @return bool
*/
public abstract function canUse(CommandSender $sender);
/**
* @return string
*/
public final function getUsage() {
$usage = $this->getPlugin()->getLanguage()->get($this->name . ".usage");
return ($usage == $this->name . ".usage") ? "" : $usage;
}
/**
* @return string
*/
public final function getName() {
$name = $this->getPlugin()->getLanguage()->get($this->name . ".name");
return ($name == $this->name . ".name") ? "" : $name;
}
/**
* @return string
*/
public final function getDescription() {
$desc = $this->getPlugin()->getLanguage()->get($this->name . ".desc");
return ($desc == $this->name . ".desc") ? "" : $desc;
}
/**
* @return string
*/
public final function getAlias() {
$alias = $this->getPlugin()->getLanguage()->get($this->name . ".alias");
return ($alias == $this->name . ".alias") ? "" : $alias;
}
/**
* @param CommandSender $sender
* @param string[] $args
* @return bool
*/
public abstract function execute(CommandSender $sender, array $args);
}
<?php
namespace MyPlot;
class Plot
{
public $levelName, $X, $Z, $name, $owner, $helpers, $biome, $id;
/**
* @param string $levelName
* @param int $X
* @param int $Z
* @param string $name
* @param string $owner
* @param array $helpers
* @param string $biome
* @param int $id
*/
public function __construct($levelName, $X, $Z, $name = "", $owner = "", $helpers = [], $biome = "PLAINS", $id = -1) {
$this->levelName = $levelName;
$this->X = $X;
$this->Z = $Z;
$this->name = $name;
$this->owner = $owner;
$this->helpers = $helpers;
$this->biome = $biome;
$this->id = $id;
}
/**
* @param string $username
* @return bool
*/
public function isHelper($username) {
return in_array($username, $this->helpers);
}
/**
* @param string $username
* @return bool
*/
public function addHelper($username) {
if (!$this->isHelper($username)) {
$this->helpers[] = $username;
return true;
}
return false;
}
/**
* @param string $username
* @return bool
*/
public function removeHelper($username) {
$key = array_search($username, $this->helpers);
if ($key === false) {
return false;
}
unset($this->helpers[$key]);
return true;
}
public function __toString() {
return "(" . $this->X . ";" . $this->Z . ")";
}
}<?php
namespace MyPlot;
use pocketmine\math\Vector3;
use pocketmine\level\ChunkManager;
use pocketmine\block\Block;
use pocketmine\level\generator\populator\Populator;
use pocketmine\utils\Random;
use pocketmine\level\generator\Generator;
use pocketmine\level\format\Chunk;
class SkyBlockStructure extends Populator{
public $generator = null;
public function __construct(Generator $gen){
$this->generator = $gen;
}
/**
*
* @param ChunkManager $level
* @param Chunk $chunk
* @param int $Xofchunk
* @param int $Zofchunk
*/
public static function placeObject(ChunkManager $level, $chunk, $Xofchunk, $Zofchunk){
$vec = new Vector3($chunk->getX() * 16 + $Xofchunk, 0, $chunk->getZ() * 16 + $Zofchunk);
$vec = $vec->subtract(7, 0, 7); // fix offset
for($x = 4; $x < 11; $x++){
for($z = 4; $z < 11; $z++){
$level->setBlockIdAt($vec->x + $x, 68, $vec->z + $z, Block::GRASS);
}
}
for($x = 5; $x < 10; $x++){
for($z = 5; $z < 10; $z++){
$level->setBlockIdAt($vec->x + $x, 67, $vec->z + $z, Block::DIRT);
$level->setBlockIdAt($vec->x + $x, 72, $vec->z + $z, Block::LEAVES); // 72
}
}
for($x = 6; $x < 9; $x++){
for($z = 6; $z < 9; $z++){
$level->setBlockIdAt($vec->x + $x, 73, $vec->z + $z, Block::LEAVES); // 73
$level->setBlockIdAt($vec->x + $x, 66, $vec->z + $z, Block::DIRT); // 66
}
}
$level->setBlockIdAt($vec->x + 7, 64, $vec->z + 7, Block::BEDROCK); // 0
$level->setBlockIdAt($vec->x + 7, 65, $vec->z + 7, Block::SAND); // 1
$level->setBlockIdAt($vec->x + 7, 66, $vec->z + 7, Block::SAND); // 2
$level->setBlockIdAt($vec->x + 7, 67, $vec->z + 7, Block::SAND); // 3
$level->setBlockIdAt($vec->x + 7, 69, $vec->z + 7, Block::LOG); // 5
$level->setBlockIdAt($vec->x + 7, 70, $vec->z + 7, Block::LOG); // 6
$level->setBlockIdAt($vec->x + 7, 71, $vec->z + 7, Block::LOG); // 7
$level->setBlockIdAt($vec->x + 7, 72, $vec->z + 7, Block::LOG); // 8
$level->setBlockIdAt($vec->x + 7, 73, $vec->z + 7, Block::LOG); // 9
$level->setBlockIdAt($vec->x + 4, 68, $vec->z + 4, Block::AIR); // 68
$level->setBlockIdAt($vec->x + 4, 68, $vec->z + 10, Block::AIR);
$level->setBlockIdAt($vec->x + 10, 68, $vec->z + 4, Block::AIR);
$level->setBlockIdAt($vec->x + 10, 68, $vec->z + 10, Block::AIR);
$level->setBlockIdAt($vec->x + 5, 72, $vec->z + 5, Block::AIR); // 72
$level->setBlockIdAt($vec->x + 5, 72, $vec->z + 9, Block::AIR);
$level->setBlockIdAt($vec->x + 9, 72, $vec->z + 5, Block::AIR);
$level->setBlockIdAt($vec->x + 9, 72, $vec->z + 9, Block::AIR);
$level->setBlockIdAt($vec->x + 5, 73, $vec->z + 7, Block::LEAVES); // 73
$level->setBlockIdAt($vec->x + 7, 73, $vec->z + 5, Block::LEAVES);
$level->setBlockIdAt($vec->x + 9, 73, $vec->z + 7, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 73, $vec->z + 9, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 74, $vec->z + 6, Block::LEAVES); // 74
$level->setBlockIdAt($vec->x + 6, 74, $vec->z + 7, Block::LEAVES);
$level->setBlockIdAt($vec->x + 8, 74, $vec->z + 7, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 74, $vec->z + 8, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 75, $vec->z + 7, Block::LEAVES); // 75
$level->setBlockIdAt($vec->x + 7, 65, $vec->z + 8, Block::DIRT); // 65
$level->setBlockIdAt($vec->x + 8, 65, $vec->z + 7, Block::DIRT);
$level->setBlockIdAt($vec->x + 7, 65, $vec->z + 6, Block::DIRT);
$level->setBlockIdAt($vec->x + 6, 65, $vec->z + 7, Block::DIRT);
$level->setBlockIdAt($vec->x + 5, 66, $vec->z + 7, Block::DIRT); // 66
$level->setBlockIdAt($vec->x + 7, 66, $vec->z + 5, Block::DIRT);
$level->setBlockIdAt($vec->x + 9, 66, $vec->z + 7, Block::DIRT);
$level->setBlockIdAt($vec->x + 7, 66, $vec->z + 9, Block::DIRT);
$level->setBlockIdAt($vec->x + 4, 67, $vec->z + 7, Block::DIRT); // 67
$level->setBlockIdAt($vec->x + 7, 67, $vec->z + 4, Block::DIRT);
$level->setBlockIdAt($vec->x + 7, 67, $vec->z + 10, Block::DIRT);
$level->setBlockIdAt($vec->x + 10, 67, $vec->z + 7, Block::DIRT);
}
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){
$chunk = $level->getChunk($chunkX, $chunkZ);
$shape = $this->generator->getShape($chunkX << 4, $chunkZ << 4);
for($Z = 0; $Z < 16; ++$Z){
for($X = 0; $X < 16; ++$X){
$type = $shape[($Z << 4) | $X];
if($type === MyPlotGenerator::ISLAND){
self::placeObject($level, $chunk, $X, $Z);
}
}
}
}
}<?php
namespace MyPlot;
use pocketmine\block\Block;
use pocketmine\level\generator\Generator;
use pocketmine\level\ChunkManager;
use pocketmine\math\Vector3;
use pocketmine\utils\Random;
use pocketmine\level\generator\biome\Biome;
use pocketmine\level\Level;
use pocketmine\level\format\FullChunk;
class MyPlotGenerator extends Generator{
/** @var Level */
public $level;
/** @var string[] */
private $settings;
/** @var Block */
public $roadBlock, $wallBlock, $plotFloorBlock, $plotFillBlock, $bottomBlock;
/** @var int */
public $roadWidth, $plotSize, $groundHeight;
private $chunk1, $chunk2;
const PLOT = 0;
const ROAD = 1;
const WALL = 2;
const ISLAND = 3;
public function __construct(array $settings = []){
if(isset($settings["preset"])){
$settings = json_decode($settings["preset"], true);
if($settings === false){
$settings = [];
}
}
else{
$settings = [];
}
$this->roadBlock = $this->parseBlock($settings, "RoadBlock", new Block(5));
$this->wallBlock = $this->parseBlock($settings, "WallBlock", new Block(44));
$this->plotFloorBlock = $this->parseBlock($settings, "PlotFloorBlock", new Block(2));
$this->plotFillBlock = $this->parseBlock($settings, "PlotFillBlock", new Block(3));
$this->bottomBlock = $this->parseBlock($settings, "BottomBlock", new Block(7));
$this->roadWidth = $this->parseNumber($settings, "RoadWidth", 7);
$this->plotSize = $this->parseNumber($settings, "PlotSize", 32);
$this->groundHeight = $this->parseNumber($settings, "GroundHeight", 32);
$this->settings = [];
$this->settings["preset"] = json_encode(["RoadBlock" => $this->roadBlock->getId() . (($meta = $this->roadBlock->getDamage())?'':':' . $meta), "WallBlock" => $this->wallBlock->getId() . (($meta = $this->wallBlock->getDamage())?'':':' . $meta),
"PlotFloorBlock" => $this->plotFloorBlock->getId() . (($meta = $this->plotFloorBlock->getDamage())?'':':' . $meta), "PlotFillBlock" => $this->plotFillBlock->getId() . (($meta = $this->plotFillBlock->getDamage())?'':':' . $meta),
"BottomBlock" => $this->bottomBlock->getId() . (($meta = $this->bottomBlock->getDamage())?'':':' . $meta), "RoadWidth" => $this->roadWidth, "PlotSize" => $this->plotSize, "GroundHeight" => $this->groundHeight]);
}
private function parseBlock(&$array, $key, $default){
if(isset($array[$key])){
$id = $array[$key];
if(is_numeric($id)){
$block = new Block($id);
}
else{
$split = explode(":", $id);
if(count($split) === 2 and is_numeric($split[0]) and is_numeric($split[1])){
$block = new Block($split[0], $split[1]);
}
else{
$block = $default;
}
}
}
else{
$block = $default;
}
return $block;
}
private function parseNumber(&$array, $key, $default){
if(isset($array[$key]) and is_numeric($array[$key])){
return $array[$key];
}
else{
return $default;
}
}
public function getName(){
return "skyblock";
}
public function getSettings(){
return $this->settings;
}
public function init(ChunkManager $level, Random $random){
$this->level = $level;
$this->random = $random;
}
public function generateChunk($chunkX, $chunkZ){
$shape = $this->getShape($chunkX << 4, $chunkZ << 4);
$chunk = $this->level->getChunk($chunkX, $chunkZ);
$chunk->setGenerated();
$bottomBlockId = $this->bottomBlock->getId();
$bottomBlockMeta = $this->bottomBlock->getDamage();
$plotFillBlockId = $this->plotFillBlock->getId();
$plotFillBlockMeta = $this->plotFillBlock->getDamage();
$plotFloorBlockId = $this->plotFloorBlock->getId();
$plotFloorBlockMeta = $this->plotFloorBlock->getDamage();
$roadBlockId = $this->roadBlock->getId();
$roadBlockMeta = $this->roadBlock->getDamage();
$wallBlockId = $this->wallBlock->getId();
$wallBlockMeta = $this->wallBlock->getDamage();
$groundHeight = $this->groundHeight;
for($Z = 0; $Z < 16; ++$Z){
for($X = 0; $X < 16; ++$X){
$chunk instanceof FullChunk;
}
}
$chunk->setX($chunkX);
$chunk->setZ($chunkZ);
$this->level->setChunk($chunkX, $chunkZ, $chunk);
$this->populateChunk($chunkX, $chunkZ);
}
public function getShape($x, $z){
$totalSize = $this->plotSize + $this->roadWidth;
if($x >= 0){
$X = $x % $totalSize;
}
else{
$X = $totalSize - abs($x % $totalSize);
}
if($z >= 0){
$Z = $z % $totalSize;
}
else{
$Z = $totalSize - abs($z % $totalSize);
}
$startX = $X;
$shape = new \SplFixedArray(256);
for($z = 0; $z < 16; $z++, $Z++){
if($Z === $totalSize){
$Z = 0;
}
if($Z < $this->plotSize){
$typeZ = self::PLOT;
}
else{
$typeZ = self::ROAD;
}
for($x = 0, $X = $startX; $x < 16; $x++, $X++){
if($X === $totalSize) $X = 0;
if($X < $this->plotSize){
$typeX = self::PLOT;
}
else{
$typeX = self::ROAD;
}
if($typeX === $typeZ){
$type = $typeX;
}
elseif($typeX === self::PLOT){
$type = $typeZ;
}
elseif($typeZ === self::PLOT){
$type = $typeX;
}
else{
$type = self::ROAD;
}
if($X == floor($this->plotSize / 2) && $Z == floor($this->plotSize / 2)){
$type = self::ISLAND;
}
$shape[($z << 4) | $x] = $type;
}
}
return $shape;
}
public function populateChunk($chunkX, $chunkZ){
$island = new SkyBlockStructure($this);
$island->populate($this->level, $chunkX, $chunkZ, $this->random);
}
public function getSpawn(){
return new Vector3(0, $this->groundHeight, 0);
}
}<?php
namespace MyPlot;
use pocketmine\block\Block;
class PlotLevelSettings
{
/** @var string */
public $name;
/** @var Block */
public $roadBlock, $wallBlock, $plotFloorBlock, $plotFillBlock, $bottomBlock;
/** @var int */
public $roadWidth, $plotSize, $groundHeight, $maxPlotsPerPlayer, $claimPrice, $clearPrice,
$disposePrice, $resetPrice;
public $restrictEntityMovement;
public function __construct($name, $settings = []) {
$this->name = $name;
if (!empty($settings)) {
$this->roadBlock = self::parseBlock($settings, "RoadBlock", new Block(5));
$this->wallBlock = self::parseBlock($settings, "WallBlock", new Block(44));
$this->plotFloorBlock = self::parseBlock($settings, "PlotFloorBlock", new Block(2));
$this->plotFillBlock = self::parseBlock($settings, "PlotFillBlock", new Block(3));
$this->bottomBlock = self::parseBlock($settings, "BottomBlock", new Block(7));
$this->roadWidth = self::parseNumber($settings, "RoadWidth", 7);
$this->plotSize = self::parseNumber($settings, "PlotSize", 22);
$this->groundHeight = self::parseNumber($settings, "GroundHeight", 64);
$this->maxPlotsPerPlayer = self::parseNumber($settings, "MaxPlotsPerPlayer", 2);
$this->claimPrice = self::parseNumber($settings, "ClaimPrice", 0);
$this->clearPrice = self::parseNumber($settings, "ClearPrice", 0);
$this->disposePrice = self::parseNumber($settings, "DisposePrice", 0);
$this->resetPrice = self::parseNumber($settings, "ResetPrice", 0);
$this->restrictEntityMovement = self::parseBool($settings, "RestrictEntityMovement", true);
}
}
private static function parseBlock(&$array, $key, $default) {
if (isset($array[$key])) {
$id = $array[$key];
if (is_numeric($id)) {
$block = new Block($id);
} else {
$split = explode(":", $id);
if (count($split) === 2 and is_numeric($split[0]) and is_numeric($split[1])) {
$block = new Block($split[0], $split[1]);
} else {
$block = $default;
}
}
} else {
$block = $default;
}
return $block;
}
private static function parseNumber(&$array, $key, $default) {
if (isset($array[$key]) and is_numeric($array[$key])) {
return $array[$key];
} else {
return $default;
}
}
private static function parseBool(&$array, $key, $default) {
if (isset($array[$key]) and is_bool($array[$key])) {
return $array[$key];
} else {
return $default;
}
}
}<?php
namespace MyPlot\provider;
use MyPlot\MyPlot;
use MyPlot\Plot;
abstract class DataProvider
{
/** @var Plot[] */
private $cache = [];
/** @var int */
private $cacheSize;
/** @var MyPlot */
protected $plugin;
public function __construct(MyPlot $plugin, $cacheSize = 0) {
$this->plugin = $plugin;
$this->cacheSize = $cacheSize;
}
protected final function cachePlot(Plot $plot) {
if ($this->cacheSize > 0) {
$key = $plot->levelName . ';' . $plot->X . ';' . $plot->Z;
if (isset($this->cache[$key])) {
unset($this->cache[$key]);
} elseif($this->cacheSize <= count($this->cache)) {
array_pop($this->cache);
}
$this->cache = array_merge(array($key => clone $plot), $this->cache);
}
}
protected final function getPlotFromCache($levelName, $X, $Z) {
if ($this->cacheSize > 0) {
$key = $levelName . ';' . $X . ';' . $Z;
if (isset($this->cache[$key])) {
return $this->cache[$key];
}
}
return null;
}
/**
* @param Plot $plot
* @return bool
*/
public abstract function savePlot(Plot $plot);
/**
* @param Plot $plot
* @return bool
*/
public abstract function deletePlot(Plot $plot);
/**
* @param string $levelName
* @param int $X
* @param int $Z
* @return Plot
*/
public abstract function getPlot($levelName, $X, $Z);
/**
* @param string $owner
* @param string $levelName
* @return Plot[]
*/
public abstract function getPlotsByOwner($owner, $levelName = "");
/**
* @param string $levelName
* @param int $limitXZ
* @return Plot|null
*/
public abstract function getNextFreePlot($levelName, $limitXZ = 0);
public abstract function close();
}<?php
namespace MyPlot\provider;
use pocketmine\Player;
use PocketMoney\PocketMoney;
class PocketMoneyProvider implements EconomyProvider
{
private $plugin;
public function __construct(PocketMoney $plugin) {
$this->plugin = $plugin;
}
public function reduceMoney(Player $player, $amount) {
$money = $this->plugin->getMoney($player->getName());
if ($money === false or ($money - $amount) < 0) {
return false;
}
return $this->plugin->setMoney($player->getName(), $money - $amount);
}
}<?php
namespace MyPlot\provider;
use MyPlot\MyPlot;
use MyPlot\Plot;
use SQLite3;
use SQLite3Stmt;
class SQLiteDataProvider extends DataProvider
{
/** @var SQLite3 */
private $db;
/** @var SQLite3Stmt */
private $sqlGetPlot, $sqlSavePlot, $sqlSavePlotById, $sqlRemovePlot,
$sqlRemovePlotById, $sqlGetPlotsByOwner, $sqlGetPlotsByOwnerAndLevel,
$sqlGetExistingXZ;
public function __construct(MyPlot $plugin, $cacheSize = 0) {
parent::__construct($plugin, $cacheSize);
$this->db = new SQLite3($this->plugin->getDataFolder() . "plots.db");
$this->db->exec(
"CREATE TABLE IF NOT EXISTS plots
(id INTEGER PRIMARY KEY AUTOINCREMENT, level TEXT, X INTEGER, Z INTEGER, name TEXT,
owner TEXT, helpers TEXT, biome TEXT)"
);
$this->sqlGetPlot = $this->db->prepare(
"SELECT id, name, owner, helpers, biome FROM plots WHERE level = :level AND X = :X AND Z = :Z"
);
$this->sqlSavePlot = $this->db->prepare(
"INSERT OR REPLACE INTO plots (id, level, X, Z, name, owner, helpers, biome) VALUES
((select id from plots where level = :level AND X = :X AND Z = :Z),
:level, :X, :Z, :name, :owner, :helpers, :biome);"
);
$this->sqlSavePlotById = $this->db->prepare(
"UPDATE plots SET name = :name, owner = :owner, helpers = :helpers, biome = :biome WHERE id = :id"
);
$this->sqlRemovePlot = $this->db->prepare(
"DELETE FROM plots WHERE level = :level AND X = :X AND Z = :Z"
);
$this->sqlRemovePlotById = $this->db->prepare("DELETE FROM plots WHERE id = :id");
$this->sqlGetPlotsByOwner = $this->db->prepare("SELECT * FROM plots WHERE owner = :owner");
$this->sqlGetPlotsByOwnerAndLevel = $this->db->prepare(
"SELECT * FROM plots WHERE owner = :owner AND level = :level"
);
$this->sqlGetExistingXZ = $this->db->prepare(
"SELECT X, Z FROM plots WHERE (
level = :level
AND (
(abs(X) == :number AND abs(Z) <= :number) OR
(abs(Z) == :number AND abs(X) <= :number)
)
)"
);
}
public function close() {
$this->db->close();
}
public function savePlot(Plot $plot) {
$helpers = implode(",", $plot->helpers);
if ($plot->id >= 0) {
$stmt = $this->sqlSavePlotById;
$stmt->bindValue(":id", $plot->id, SQLITE3_INTEGER);
} else {
$stmt = $this->sqlSavePlot;
$stmt->bindValue(":level", $plot->levelName, SQLITE3_TEXT);
$stmt->bindValue(":X", $plot->X, SQLITE3_INTEGER);
$stmt->bindValue(":Z", $plot->Z, SQLITE3_INTEGER);
}
$stmt->bindValue(":name", $plot->name, SQLITE3_TEXT);
$stmt->bindValue(":owner", $plot->owner, SQLITE3_TEXT);
$stmt->bindValue(":helpers", $helpers, SQLITE3_TEXT);
$stmt->bindValue(":biome", $plot->biome, SQLITE3_TEXT);
$stmt->reset();
$result = $stmt->execute();
if ($result === false) {
return false;
}
$this->cachePlot($plot);
return true;
}
public function deletePlot(Plot $plot) {
if ($plot->id >= 0) {
$stmt = $this->sqlRemovePlotById;
$stmt->bindValue(":id", $plot->id, SQLITE3_INTEGER);
} else {
$stmt = $this->sqlRemovePlot;
$stmt->bindValue(":level", $plot->levelName, SQLITE3_TEXT);
$stmt->bindValue(":X", $plot->X, SQLITE3_INTEGER);
$stmt->bindValue(":Z", $plot->Z, SQLITE3_INTEGER);
}
$stmt->reset();
$result = $stmt->execute();
if ($result === false) {
return false;
}
$plot = new Plot($plot->levelName, $plot->X, $plot->Z);
$this->cachePlot($plot);
return true;
}
public function getPlot($levelName, $X, $Z) {
if ($plot = $this->getPlotFromCache($levelName, $X, $Z)) {
return $plot;
}
$this->sqlGetPlot->bindValue(":level", $levelName, SQLITE3_TEXT);
$this->sqlGetPlot->bindValue(":X", $X, SQLITE3_INTEGER);
$this->sqlGetPlot->bindValue(":Z", $Z, SQLITE3_INTEGER);
$this->sqlGetPlot->reset();
$result = $this->sqlGetPlot->execute();
if ($val = $result->fetchArray(SQLITE3_ASSOC)) {
if ($val["helpers"] === null or $val["helpers"] === "") {
$helpers = [];
} else {
$helpers = explode(",", (string)$val["helpers"]);
}
$plot = new Plot($levelName, $X, $Z, (string)$val["name"], (string)$val["owner"],
$helpers, (string)$val["biome"], (int)$val["id"]);
} else {
$plot = new Plot($levelName, $X, $Z);
}
$this->cachePlot($plot);
return $plot;
}
public function getPlotsByOwner($owner, $levelName = "") {
if ($levelName === "") {
$stmt = $this->sqlGetPlotsByOwner;
} else {
$stmt = $this->sqlGetPlotsByOwnerAndLevel;
$stmt->bindValue(":level", $levelName, SQLITE3_TEXT);
}
$stmt->bindValue(":owner", $owner, SQLITE3_TEXT);
$plots = [];
$stmt->reset();
$result = $stmt->execute();
while ($val = $result->fetchArray(SQLITE3_ASSOC)) {
$helpers = explode(",", (string)$val["helpers"]);
$plots[] = new Plot((string)$val["level"], (int)$val["X"], (int)$val["Z"], (string)$val["name"],
(string)$val["owner"], $helpers, (string)$val["biome"], (int)$val["id"]);
}
usort($plots, function ($plot1, $plot2) {
/** @var Plot $plot1 */
/** @var Plot $plot2 */
return strcmp($plot1->levelName, $plot2->levelName);
});
return $plots;
}
public function getNextFreePlot($levelName, $limitXZ = 0) {
$this->sqlGetExistingXZ->bindValue(":level", $levelName, SQLITE3_TEXT);
$i = 0;
$this->sqlGetExistingXZ->bindParam(":number", $i, SQLITE3_INTEGER);
for (; $limitXZ <= 0 or $i < $limitXZ; $i++) {
$this->sqlGetExistingXZ->reset();
$result = $this->sqlGetExistingXZ->execute();
$plots = [];
while ($val = $result->fetchArray(SQLITE3_NUM)) {
$plots[$val[0]][$val[1]] = true;
}
if (count($plots) === max(1, 8 * $i)) {
continue;
}
if ($ret = self::findEmptyPlotSquared(0, $i, $plots)) {
list($X, $Z) = $ret;
$plot = new Plot($levelName, $X, $Z);
$this->cachePlot($plot);
return $plot;
}
for ($a = 1; $a < $i; $a++) {
if ($ret = self::findEmptyPlotSquared($a, $i, $plots)) {
list($X, $Z) = $ret;
$plot = new Plot($levelName, $X, $Z);
$this->cachePlot($plot);
return $plot;
}
}
if ($ret = self::findEmptyPlotSquared($i, $i, $plots)) {
list($X, $Z) = $ret;
$plot = new Plot($levelName, $X, $Z);
$this->cachePlot($plot);
return $plot;
}
}
return null;
}
private static function findEmptyPlotSquared($a, $b, &$plots) {
if (!isset($plots[$a][$b])) return array($a, $b);
if (!isset($plots[$b][$a])) return array($b, $a);
if ($a !== 0) {
if (!isset($plots[-$a][$b])) return array(-$a, $b);
if (!isset($plots[$b][-$a])) return array($b, -$a);
}
if ($b !== 0) {
if (!isset($plots[-$b][$a])) return array(-$b, $a);
if (!isset($plots[$a][-$b])) return array($a, -$b);
}
if ($a | $b === 0) {
if (!isset($plots[-$a][-$b])) return array(-$a, -$b);
if (!isset($plots[-$b][-$a])) return array(-$b, -$a);
}
return null;
}
}<?php
namespace MyPlot\provider;
use pocketmine\Player;
interface EconomyProvider
{
/**
* @param Player $player
* @param int $amount
* @return bool
*/
public function reduceMoney(Player $player, $amount);
}<?php
namespace MyPlot\provider;
use onebone\economyapi\EconomyAPI;
use pocketmine\Player;
class EconomySProvider implements EconomyProvider
{
public function reduceMoney(Player $player, $amount) {
if ($amount == 0) {
return true;
} elseif ($amount < 0) {
$ret = EconomyAPI::getInstance()->addMoney($player, -$amount, true);
} else {
$ret = EconomyAPI::getInstance()->reduceMoney($player, $amount, true);
}
return ($ret === EconomyAPI::RET_SUCCESS);
}
}<?php
namespace MyPlot;
use MyPlot\provider\EconomySProvider;
use MyPlot\provider\PocketMoneyProvider;
use MyPlot\task\ClearPlotTask;
use pocketmine\event\level\LevelLoadEvent;
use pocketmine\event\Listener;
use pocketmine\lang\BaseLang;
use pocketmine\level\generator\biome\Biome;
use pocketmine\level\Position;
use pocketmine\permission\Permission;
use pocketmine\plugin\PluginBase;
use pocketmine\level\generator\Generator;
use pocketmine\Player;
use MyPlot\provider\DataProvider;
use pocketmine\level\Level;
use MyPlot\provider\SQLiteDataProvider;
use MyPlot\provider\EconomyProvider;
class MyPlot extends PluginBase implements Listener
{
/** @var MyPlot */
private static $instance;
/** @var PlotLevelSettings[] */
private $levels = [];
/** @var DataProvider */
private $dataProvider = null;
/** @var EconomyProvider */
private $economyProvider = null;
/** @var BaseLang */
private $baseLang = null;
/**
* @api
* @return MyPlot
*/
public static function getInstance() {
return self::$instance;
}
/**
* @api
* @return BaseLang
*/
public function getLanguage() {
return $this->baseLang;
}
/**
* Returns the DataProvider that is being used
*
* @api
* @return DataProvider
*/
public function getProvider() {
return $this->dataProvider;
}
/**
* Returns the EconomyProvider that is being used
*
* @api
* @return EconomyProvider
*/
public function getEconomyProvider() {
return $this->economyProvider;
}
/**
* Returns a PlotLevelSettings object which contains all the settings of a level
*
* @api
* @param string $levelName
* @return PlotLevelSettings|null
*/
public function getLevelSettings($levelName) {
if (isset($this->levels[$levelName])) {
return $this->levels[$levelName];
}
return null;
}
/**
* Checks if a plot level is loaded
*
* @api
* @param string $levelName
* @return bool
*/
public function isLevelLoaded($levelName) {
return isset($this->levels[$levelName]);
}
/**
* Generate a new plot level with optional settings
*
* @api
* @param string $levelName
* @param array $settings
* @return bool
*/
public function generateLevel($levelName, $settings = []) {
if ($this->getServer()->isLevelGenerated($levelName) === true) {
return false;
}
if (empty($settings)) {
$settings = $this->getConfig()->get("DefaultWorld");
}
$settings = [
"preset" => json_encode($settings)
];
return $this->getServer()->generateLevel($levelName, null, MyPlotGenerator::class, $settings);
}
/**
* Saves provided plot if changed
*
* @api
* @param Plot $plot
* @return bool
*/
public function savePlot(Plot $plot) {
return $this->dataProvider->savePlot($plot);
}
/**
* Get all the plots a player owns (in a certain level if $levelName is provided)
*
* @api
* @param string $username
* @param string $levelName
* @return Plot[]
*/
public function getPlotsOfPlayer($username, $levelName = "") {
return $this->dataProvider->getPlotsByOwner($username, $levelName);
}
/**
* Get the next free plot in a level
*
* @api
* @param string $levelName
* @param int $limitXZ
* @return Plot|null
*/
public function getNextFreePlot($levelName, $limitXZ = 0) {
return $this->dataProvider->getNextFreePlot($levelName, $limitXZ);
}
/**
* Finds the plot at a certain position or null if there is no plot at that position
*
* @api
* @param Position $position
* @return Plot|null
*/
public function getPlotByPosition(Position $position) {
$x = $position->x;
$z = $position->z;
$levelName = $position->level->getName();
$plotLevel = $this->getLevelSettings($levelName);
if ($plotLevel === null) {
return null;
}
$plotSize = $plotLevel->plotSize;
$roadWidth = $plotLevel->roadWidth;
$totalSize = $plotSize + $roadWidth;
if ($x >= 0) {
$X = floor($x / $totalSize);
$difX = $x % $totalSize;
} else {
$X = ceil(($x - $plotSize + 1) / $totalSize);
$difX = abs(($x - $plotSize + 1) % $totalSize);
}
if ($z >= 0) {
$Z = floor($z / $totalSize);
$difZ = $z % $totalSize;
} else {
$Z = ceil(($z - $plotSize + 1) / $totalSize);
$difZ = abs(($z - $plotSize + 1) % $totalSize);
}
if (($difX > $plotSize - 1) or ($difZ > $plotSize - 1)) {
return null;
}
return $this->dataProvider->getPlot($levelName, $X, $Z);
}
/**
* Get the begin position of a plot
*
* @api
* @param Plot $plot
* @return Position|null
*/
public function getPlotPosition(Plot $plot) {
$plotLevel = $this->getLevelSettings($plot->levelName);
if ($plotLevel === null) {
return null;
}
$plotSize = $plotLevel->plotSize;
$roadWidth = $plotLevel->roadWidth;
$totalSize = $plotSize + $roadWidth;
$x = $totalSize * $plot->X;
$z = $totalSize * $plot->Z;
$level = $this->getServer()->getLevelByName($plot->levelName);
return new Position($x, $plotLevel->groundHeight, $z, $level);
}
/**
* Teleport a player to a plot
*
* @api
* @param Player $player
* @param Plot $plot
* @return bool
*/
public function teleportPlayerToPlot(Player $player, Plot $plot) {
$plotLevel = $this->getLevelSettings($plot->levelName);
if ($plotLevel === null) {
return false;
}
$pos = $this->getPlotPosition($plot);
$plotSize = $plotLevel->plotSize;
$pos->x += floor($plotSize / 2);
$pos->z -= -88;
$pos->y += 5;
$player->teleport($pos);
return true;
}
/**
* Reset all the blocks inside a plot
*
* @api
* @param Plot $plot
* @param int $maxBlocksPerTick
* @return bool
*/
public function clearPlot(Plot $plot, $maxBlocksPerTick = 256) {
if (!$this->isLevelLoaded($plot->levelName)) {
return false;
}
$task = new ClearPlotTask($this, $plot, $maxBlocksPerTick);
$task->onRun(0);
return true;
}
/**
* Delete the plot data
*
* @param Plot $plot
* @return bool
*/
public function disposePlot(Plot $plot) {
return $this->dataProvider->deletePlot($plot);
}
/**
* Clear and dispose a plot
*
* @param Plot $plot
* @param int $maxBlocksPerTick
* @return bool
*/
public function resetPlot(Plot $plot, $maxBlocksPerTick = 256) {
if ($this->disposePlot($plot)) {
return $this->clearPlot($plot, $maxBlocksPerTick);
}
return false;
}
/**
* Changes the biome of a plot
*
* @api
* @param Plot $plot
* @param Biome $biome
* @return bool
*/
public function setPlotBiome(Plot $plot, Biome $biome) {
$plotLevel = $this->getLevelSettings($plot->levelName);
if ($plotLevel === null) {
return false;
}
$level = $this->getServer()->getLevelByName($plot->levelName);
$pos = $this->getPlotPosition($plot);
$plotSize = $plotLevel->plotSize;
$xMax = $pos->x + $plotSize;
$zMax = $pos->z + $plotSize;
$chunkIndexes = [];
for ($x = $pos->x; $x < $xMax; $x++) {
for ($z = $pos->z; $z < $zMax; $z++) {
$index = Level::chunkHash($x >> 4, $z >> 4);
if (!in_array($index, $chunkIndexes)) {
$chunkIndexes[] = $index;
}
$color = $biome->getColor();
$R = $color >> 16;
$G = ($color >> 8) & 0xff;
$B = $color & 0xff;
$level->setBiomeColor($x, $z, $R, $G, $B);
}
}
foreach ($chunkIndexes as $index) {
Level::getXZ($index, $X, $Z);
$chunk = $level->getChunk($X, $Z);
foreach ($level->getChunkPlayers($X, $Z) as $player) {
$player->onChunkChanged($chunk);
}
}
$plot->biome = $biome->getName();
$this->dataProvider->savePlot($plot);
return true;
}
/**
* Returns the PlotLevelSettings of all the loaded levels
*
* @api
* @return string[]
*/
public function getPlotLevels() {
return $this->levels;
}
/**
* Get the maximum number of plots a player can claim
*
* @param Player $player
* @return int
*/
public function getMaxPlotsOfPlayer(Player $player) {
if ($player->hasPermission("myplot.claimplots.unlimited"))
return PHP_INT_MAX;
/** @var Permission[] $perms */
$perms = array_merge($this->getServer()->getPluginManager()->getDefaultPermissions($player->isOp()),
$player->getEffectivePermissions());
$perms = array_filter($perms, function ($name) {
return (substr($name, 0, 18) === "myplot.claimplots.");
}, ARRAY_FILTER_USE_KEY);
if (count($perms) == 0)
return 0;
krsort($perms);
foreach ($perms as $name => $perm) {
$maxPlots = substr($name, 18);
if (is_numeric($maxPlots)) {
return $maxPlots;
}
}
return 0;
}
/* -------------------------- Non-API part -------------------------- */
public function onEnable() {
$this->getServer()->getPluginManager()->registerEvents($this, $this);
$this->getLogger()->info("Loading MyPlot");
self::$instance = $this;
$this->saveDefaultConfig();
$this->reloadConfig();
@mkdir($this->getDataFolder());
@mkdir($this->getDataFolder() . "worlds");
Generator::addGenerator(MyPlotGenerator::class, "myplot");
$lang = $this->getConfig()->get("language", BaseLang::FALLBACK_LANGUAGE);
$this->baseLang = new BaseLang($lang, $this->getFile() . "resources/");
// Initialize DataProvider
$cacheSize = $this->getConfig()->get("PlotCacheSize");
switch (strtolower($this->getConfig()->get("DataProvider"))) {
case "sqlite":
default:
$this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
break;
}
// Initialize EconomyProvider
if ($this->getConfig()->get("UseEconomy") == true) {
if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
$this->economyProvider = new EconomySProvider();
} elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
$this->economyProvider = new PocketMoneyProvider($plugin);
}
}
$eventListener = new EventListener($this);
$this->getServer()->getPluginManager()->registerEvents($eventListener, $this);
foreach($this->getServer()->getLevels() as $level) {
$eventListener->onLevelLoad(new LevelLoadEvent($level));
}
$this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
}
public function addLevelSettings($levelName, PlotLevelSettings $settings) {
$this->levels[$levelName] = $settings;
}
public function unloadLevelSettings($levelName) {
if (isset($this->levels[$levelName])) {
unset($this->levels[$levelName]);
return true;
}
return false;
}
public function onDisable() {
if ($this->dataProvider !== null) {
$this->dataProvider->close();
}
}
}
<?php
namespace MyPlot;
use pocketmine\block\Sapling;
use pocketmine\event\player\PlayerMoveEvent;
use pocketmine\Player;
use pocketmine\event\block\BlockUpdateEvent;
use pocketmine\event\entity\EntityExplodeEvent;
use pocketmine\event\entity\EntityMotionEvent;
use pocketmine\event\Listener;
use pocketmine\event\level\LevelLoadEvent;
use pocketmine\event\level\LevelUnloadEvent;
use pocketmine\utils\Config;
use pocketmine\event\block\BlockPlaceEvent;
use pocketmine\event\block\BlockBreakEvent;
use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\utils\TextFormat;
use pocketmine\block\Lava;
use pocketmine\block\Water;
class EventListener implements Listener
{
/** @var MyPlot */
private $plugin;
public function __construct(MyPlot $plugin){
$this->plugin = $plugin;
$plugin->getServer()->getPluginManager()->registerEvents($this, $plugin);
}
public function onLevelLoad(LevelLoadEvent $event) {
if ($event->getLevel()->getProvider()->getGenerator() === "myplot") {
$settings = $event->getLevel()->getProvider()->getGeneratorOptions();
if (isset($settings["preset"]) === false or $settings["preset"] === "") {
return;
}
$settings = json_decode($settings["preset"], true);
if ($settings === false) {
return;
}
$levelName = $event->getLevel()->getName();
$filePath = $this->plugin->getDataFolder() . "worlds/" . $levelName . ".yml";
$config = $this->plugin->getConfig();
$default = [
"MaxPlotsPerPlayer" => $config->getNested("DefaultWorld.MaxPlotsPerPlayer"),
"RestrictEntityMovement" => $config->getNested("DefaultWorld.RestrictEntityMovement"),
"ClaimPrice" => $config->getNested("DefaultWorld.ClaimPrice"),
"ClearPrice" => $config->getNested("DefaultWorld.ClearPrice"),
"DisposePrice" => $config->getNested("DefaultWorld.DisposePrice"),
"ResetPrice" => $config->getNested("DefaultWorld.ResetPrice"),
];
$config = new Config($filePath, Config::YAML, $default);
foreach (array_keys($default) as $key) {
$settings[$key] = $config->get($key);
}
$this->plugin->addLevelSettings($levelName, new PlotLevelSettings($levelName, $settings));
}
}
public function onLevelUnload(LevelUnloadEvent $event) {
$levelName = $event->getLevel()->getName();
$this->plugin->unloadLevelSettings($levelName);
}
public function onBlockPlace(BlockPlaceEvent $event) {
$this->onEventOnBlock($event);
}
public function onBlockBreak(BlockBreakEvent $event) {
$this->onEventOnBlock($event);
}
public function onPlayerInteract(PlayerInteractEvent $event) {
$this->onEventOnBlock($event);
}
public function onExplosion(EntityExplodeEvent $event) {
$levelName = $event->getEntity()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName))
return;
$plot = $this->plugin->getPlotByPosition($event->getPosition());
if ($plot === null) {
$event->setCancelled(true);
return;
}
$beginPos = $this->plugin->getPlotPosition($plot);
$endPos = clone $beginPos;
$plotSize = $this->plugin->getLevelSettings($levelName)->plotSize;
$endPos->x += $plotSize;
$endPos->z += $plotSize;
$blocks = array_filter($event->getBlockList(), function($block) use($beginPos, $endPos) {
if ($block->x >= $beginPos->x and $block->z >= $beginPos->z and $block->x < $endPos->x and $block->z < $endPos->z) {
return true;
}
return false;
});
$event->setBlockList($blocks);
}
/**
* @param BlockPlaceEvent|BlockBreakEvent|PlayerInteractEvent $event
*/
private function onEventOnBlock($event) {
$levelName = $event->getBlock()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName)) {
return;
}
$plot = $this->plugin->getPlotByPosition($event->getBlock());
if ($plot !== null) {
$username = $event->getPlayer()->getName();
if ($plot->owner == $username or $plot->isHelper($username) or $event->getPlayer()->hasPermission("myplot.admin.build.plot")) {
if (!($event instanceof PlayerInteractEvent and $event->getBlock() instanceof Sapling))
return;
/*
* Prevent growing a tree near the edge of a plot
* so the leaves won't go outside the plot
*/
$block = $event->getBlock();
$maxLengthLeaves = (($block->getDamage() & 0x07) == Sapling::SPRUCE) ? 3 : 2;
$beginPos = $this->plugin->getPlotPosition($plot);
$endPos = clone $beginPos;
$beginPos->x += $maxLengthLeaves;
$beginPos->z += $maxLengthLeaves;
$plotSize = $this->plugin->getLevelSettings($levelName)->plotSize;
$endPos->x += $plotSize - $maxLengthLeaves;
$endPos->z += $plotSize - $maxLengthLeaves;
if ($block->x >= $beginPos->x and $block->z >= $beginPos->z and $block->x < $endPos->x and $block->z < $endPos->z) {
return;
}
}
} elseif ($event->getPlayer()->hasPermission("myplot.admin.build.road")) {
return;
}
$event->setCancelled(true);
}
public function onEntityMotion(EntityMotionEvent $event) {
$levelName = $event->getEntity()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName))
return;
$settings = $this->plugin->getLevelSettings($levelName);
if ($settings->restrictEntityMovement and !($event->getEntity() instanceof Player)) {
$event->setCancelled(true);
}
}
public function onPlayerMove(PlayerMoveEvent $event) {
if (!$this->plugin->getConfig()->get("ShowPlotPopup", true))
return;
$levelName = $event->getPlayer()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName))
return;
$plot = $this->plugin->getPlotByPosition($event->getTo());
if ($plot !== null and $plot !== $this->plugin->getPlotByPosition($event->getFrom())) {
$plotName = TextFormat::GREEN . $plot;
$popup = $this->plugin->getLanguage()->translateString("popup", [$plotName]);
if ($plot->owner != "") {
$owner = TextFormat::GREEN . $plot->owner;
$ownerPopup = $this->plugin->getLanguage()->translateString("popup.owner", [$owner]);
$paddingSize = floor((strlen($popup) - strlen($ownerPopup)) / 2);
$paddingPopup = str_repeat(" ", max(0, -$paddingSize));
$paddingOwnerPopup = str_repeat(" ", max(0, $paddingSize));
$popup = TextFormat::WHITE . $paddingPopup . $popup . "\n" .
TextFormat::WHITE . $paddingOwnerPopup . $ownerPopup;
} else {
$ownerPopup = $this->plugin->getLanguage()->translateString("popup.available");
$paddingSize = floor((strlen($popup) - strlen($ownerPopup)) / 2);
$paddingPopup = str_repeat(" ", max(0, -$paddingSize));
$paddingOwnerPopup = str_repeat(" ", max(0, $paddingSize));
$popup = TextFormat::WHITE . $paddingPopup . $popup . "\n" .
TextFormat::WHITE . $paddingOwnerPopup . $ownerPopup;
}
$event->getPlayer()->sendMessage($popup);
}
}
}
name: SkyBlock
main: MyPlot\MyPlot
version: 2.0
load: STARTUP
api: 2.0.0
author: Wies and Exxarion
description: Plot and protection plugin
softdepend: [EconomyAPI, PocketMoney]
permissions:
myplot.command:
description: Allows users to use myplot features
default: op
children:
myplot.command.help:
description: Displays all the available commands
default: true
myplot.command.claim:
description: Gives the claim command
default: true
myplot.command.info:
description: Gives the info command
default: true
myplot.command.generate:
description: Gives the generate command
default: op
myplot.command.addhelper:
description: Gives the addhelper command
default: true
myplot.command.removehelper:
description: Gives the removehelper command
default: true
myplot.command.auto:
description: Gives the auto command
default: true
myplot.command.play:
description: Play command
default: true
myplot.command.clear:
description: Gives the clear command
default: true
myplot.command.dispose:
description: Gives the dispose command
default: true
myplot.command.reset:
description: Gives the reset command
default: true
myplot.command.biome:
description: Gives the biome command
default: true
myplot.command.home:
description: Gives the home command
default: true
myplot.command.homes:
description: Gives the homes command
default: true
myplot.command.name:
description: Gives the name command
default: true
myplot.command.give:
description: Gives the give command
default: true
myplot.command.warp:
description: Gives the warp command
default: true
myplot.admin:
description: Grant administrator powers
default: op
children:
myplot.admin.clear:
description: Allow clear command on every plot
default: op
myplot.admin.dispose:
description: Allow dispose command on every plot
default: op
myplot.admin.reset:
description: Allow reset command on every plot
default: op
myplot.admin.addhelper:
description: Allow addhelper command on every plot
default: op
myplot.admin.removehelper:
description: Allow removehelper command on every plot
default: op
myplot.admin.build:
description: Allow player to build outside his own plots
default: op
children:
myplot.admin.build.plot:
description: Allow player to build on all plots
default: op
myplot.admin.build.road:
description: Allow player to build on the road
default: op
myplot.admin.name:
description: Allows player to change the name of every plot
default: op
myplot.admin.warp:
description: Allow player to warp to unclaimed plots
default: op
myplot.admin.biome:
description: Allow player to use the biome command on all plots
default: op
myplot.claimplots:
description: Allows players to claim X plots
default: false
children:
myplot.claimplots.2:
description: Allow player to claim 2 plots
default: true
myplot.claimplots.unlimited:
description: Allow player to claim unlimited plots
default: oplanguage: "it"
#Italian language pack created by AryToNeX
#Follow him on Twitter: @AryToNeX :D
#############################
# Messages for commands
#############################
messages:
# Add helper
addhelper-desc: "Aggiungi un aiutante in un lotto"
addhelper-alias: addh
addhelper-usage: "/p addhelper <nome giocatore>"
addhelper-notinplot: "Non sei dentro un lotto"
addhelper-notowner: "Non sei il proprietario di questo lotto"
addhelper-alreadyone: " e gi un aiutante di questo lotto"
addhelper-success: " adesso un aiutante di questo lotto"
addhelper-error: "Impossibile aggiungere un aiutante"
# Remove Helper
removehelper-desc: "Rimuovi un aiutante da un lotto"
removehelper-alias: delh
removehelper-notinplot: "Non sei dentro un lotto"
removehelper-notowner: "Non sei il proprietario di questo lotto"
removehelper-notone: " non un aiutante di questo lotto"
removehelper-success: " stato rimosso dagli aiutanti di questo lotto"
removehelper-error: "Impossibile rimuovere un aiutante"
# Claim
claim-desc: "Prendi propriet del lotto su cui sei sopra"
claim-alias: c
claim-notinplot: "Non sei dentro un lotto"
claim-notowner: "Non sei il proprietario di questo lotto"
claim-already: "Questo lotto gi stato preso da "
claim-max: "Hai gi raggiunto il numero massimo di lotti che puoi avere"
claim-money: "Non hai abbastanza soldi per comprare questo lotto"
claim-success: "Lotto privatizzato"
claim-error: "Impossibile privatizzare il lotto"
# Auto
auto-desc: "Teletrasporta nel prossimo lotto libero"
auto-alias: a
auto-notinworld: "Non sei in un mondo lotti"
auto-success: "Teletrasportato a "
auto-error: "Non sono disponibili lotti aperti qui"
# Dispose
dispose-desc: "Dispone il tuo lotto; ci lo rende privatizzabile da altri"
dispose-alias: d
dispose-notinplot: "Non sei dentro un lotto"
dispose-notowner: "Non sei il proprietario di questo lotto"
dispose-money: "Non hai abbastanza soldi per disporre questo lotto"
dispose-success: "Lotto disposto"
dispose-error: "Impossibile disporre il lotto"
# Reset
reset-desc: "Pulisce e dispone il tuo lotto"
reset-alias: r
reset-notinplot: "Non sei dentro un lotto"
reset-notowner: "Non sei il proprietario di questo lotto"
reset-money: "Non hai abbastanza soldi per resettare questo lotto"
reset-success: "Lotto resettato"
reset-error: "Impossibile resettare il lotto"
# Clear
clear-desc: "Pulisce il tuo lotto"
clear-alias: cl
clear-notinplot: "Non sei dentro un lotto"
clear-notowner: "Non sei il proprietario di questo lotto"
clear-money: "Non hai abbastanza soldi per pulire il lotto"
clear-success: "Lotto pulito"
clear-error: "Impossibile pulire il lotto"
# Biome
biome-desc: "Cambia il bioma del lotto"
biome-alias: a
biome-notinplot: "Non sei dentro un lotto"
biome-notowner: "Non sei il proprietario di questo lotto"
biome-success: "Bioma del lotto cambiato"
biome-invalid: "Quel bioma non esiste"
biome-possible: "I possibili biomi sono: "
biome-error: "Impossibile cambiare il bioma del lotto"
# Name
name-desc: "Imposta o cambia il nome del lotto"
name-alias: n
name-notinplot: "Non sei dentro un lotto"
name-notowner: "Non sei il proprietario di questo lotto"
name-success: "Il nome del lotto stato cambiato in "
name-error: "Impossibile cambiare il nome del lotto"
# Home
home-desc: "Vai al tuo lotto"
home-alias: h
home-noplots: "Non possiedi alcun lotto"
home-notexist: "Non possiedi alcun lotto con numero "
home-success: "Teletrasportato al tuo lotto "
home-error: "Impossibile teletrasportarti nel tuo lotto"
# Info
info-desc: "Mostra informazioni su un lotto"
info-alias: i
info-notinplot: "Non sei dentro un lotto"
info-about: "Info su "
info-name: "Nome: "
info-owner: "Proprietario: "
info-helpers: "Aiutanti: "
info-biome: "Bioma: "
# List
list-desc: "Lista i tuoi lotti"
list-alias: l
list-noplots: "Non possiedi alcun lotto"
list-plots: "Lotti che possiedi"
# Dutch language pack for MyPlot
# Created by Wiez
# Popup when entering a plot
popup=Dit is plot {%0}
popup.owner=Van {%0}
# /p info
command.name=plot
command.alias=p
command.desc=Beheer uw plots
command.usage=Gebruik: /plot <help|sub-cmd> [opties]
command.unknown=Onbekend commando. Gebruik /p help voor een lijst van alle commandos
subcommand.usage=Gebruik: {%0}
# Errors that are displayed when the player does something wrong, or the plugin screws up.
error=Oeps! Er is iets verkeerd gelopen
notinplot=Je staat niet in een plot
notowner=Dit is niet jouw plot
confirm=confirm
#The /p help Subcommand
help.name=help
help.desc=Toont het help menu
help.usage=/p help [pagina]
help.header=--- MyPlot help pagina {%0} van de {%1} ---
#The /p addhelper Subcommand
addhelper.name=addhelper
addhelper.alias=addh
addhelper.desc=Voeg een helper toe aan jouw plot
addhelper.usage=/p addhelper <speler>
addhelper.alreadyone={%0} is al een helper van jouw plot
addhelper.success={%0} is nu een helper van jouw plot
#The /p removehelper Subcommand
removehelper.name=removehelper
removehelper.alias=delh
removehelper.desc=Verwijder een helper van jouw plot
removehelper.usage=/p removehelper <player>
removehelper.notone={%0} is geen helper
removehelper.success={%0} is verwijderd als helper
#The /p claim Subcommand
claim.name=claim
claim.desc=Bemachtig het stukje land waar je op staat
claim.usage=/p claim [naam]
claim.yourplot=Dit is jouw plot al
claim.alreadyclaimed=Dit plot is al van {%0}
claim.maxplots=Je hebt de limiet bereikt van {%0} plots per speler
claim.nomoney=Je hebt niet genoeg geld om deze plot te bemachtigen
claim.success=Dit is nu jouw stukje land
#The /p auto Subcommand
auto.name=auto
auto.alias=a
auto.desc=Teleporteer naar de volgende vrije plot
auto.usage=/p auto
auto.notplotworld=Je bent niet in een plot wereld
auto.success=Je bent geteleporteerd naar plot ({%0}, {%1})
auto.noplots=Er zijn geen vrije plots gevonden
#The /p dispose Subcommand
dispose.name=dispose
dispose.desc=Doe afstand van deze plot
dispose.usage=/p dispose
dispose.confirm=Ben je zeker dat je niet meer de eigenaar wil zijn van plot {%0} ? Doe dan /p dispose confirm
dispose.nomoney=Je hebt hiervoor niet genoeg geld
dispose.success=Je bent niet meer de eigenaar van deze plot
#The /p reset Subcommand
reset.name=reset
reset.desc=Herstel een plot naar zijn begin toestand en doe er afstand van
reset.usage=/p reset
reset.confirm=Ben je zeker dat je plot {%0} wil resetten? Doe dan /p reset confirm
reset.nomoney=Je hebt niet genoeg geld om deze plot te resetten
reset.success=De plot is gereset
#The /p clear Subcommand
clear.name=clear
clear.desc=Herstelt deze plot naar zijn begin toestand
clear.usage=/p clear
clear.confirm=Ben je zeker dat je plot {%0} wil herstellen? Doe dan /p clear confirm
clear.nomoney=Je hebt niet genoeg geld om deze plot te herstellen
clear.success=De plot is hersteld
#The /p biome Subcommand
biome.name=biome
biome.desc=Verandert de biome in een ander type
biome.usage=/p biome [type]
biome.success=De biome van deze plot is veranderd naar {%0}
biome.invalid=Dat type bestaat niet
biome.possible=De mogelijke biome types zijn: {%0}
#The /p name Subcommand
name.name=name
name.desc=Verandert de naam van deze plot
name.usage=/p name <naam>
name.success=Deze plot noemt nu {%0}
#The /p home Subcommand
home.name=home
home.alias=h
home.desc=Ga naar een van je plots
home.usage=/p home [nummer]
home.noplots=Je hebt geen plots
home.notexist=Je hebt geen plot met nummer {%0}. Gebruik /p homes om al je plots te bekijken
home.success=Je bent geteleporteerd naar plot {%0}
home.error=Er is iets mis gegaan bij het teleporteren
#The /p homes Subcommand
homes.name=homes
homes.desc=Geeft een lijst van al jouw plots
homes.usage=/p homes
homes.noplots=Je hebt geen plots
homes.header=Jouw plots:
#The /p info Subcommand
info.name=info
info.alias=i
info.desc=Toont informatie over een plot
info.usage=/p info
info.about=Info van plot {%0}
info.plotname=Naam: {%0}
info.owner=Eigenaar: {%0}
info.helpers=Helpers: {%0}
info.biome=Biome: {%0}
#The /p generate Subcommand - Can only be used by OPs or players with the myplot.command.generate permission
generate.name=generate
generate.alias=gen
generate.desc=Genereert een nieuwe plot wereld
generate.usage=/p generate <naam>
generate.exists=Er bestaat al een wereld met naam {%0}
generate.success=De nieuwe plot wereld {%0} is gegenereerd
generate.error=De wereld kon niet gegenereerd worden
#The /p give Subcommand
give.name=give
give.desc=Geef je plot aan iemand anders
give.usage=/p give [speler]
give.notonline=Die speler is niet online
give.maxedout=Die speler heeft de maximale plot limiet bereikt
give.toself=Je kan de plot niet aan jezelf geven
give.confirm=Ben je zeker dat je plot {%0} wil geven aan {%1}? Doe dan /p give {%1} confirm
give.success=Je hebt jouw plot gegeven aan {%0}
give.received={%0} heeft plot {%1} aan jouw gegeven
# The /p warp Subcommand
warp.name=warp
warp.desc=Teleporteer naar een plot
warp.usage=/p warp <x;z>
warp.wrongid=De plot nummer moet in het formaat X;Z zijn
warp.notinplotworld=Je bent niet in een plot wereld
warp.unclaimed=Je kan niet naar een leeg plot teleporteren
warp.success=Je bent geteleporteerd naar {%0}
# Vietnamese language pack for MyPlot
# Created by Parroted - an old guy and QuangDo - play.fcavn.net
# Popup when entering a plot
popup=Bn vo o {%0}
popup.owner=S hu bi {%0}
popup.available=o ny cha c ch! Dng /sb claim
# /sb info
command.name=skyblock
command.alias=sb
command.desc=Nhn v qun l o
command.usage=Usage: /sb help
command.unknown=C g sai sai. Hy nhp /sb help xem cc lnh
subcommand.usage=Cch dng: {%0}
#Errors that are displayed when the player does something wrong, or the plugin screws up.
error=! C g khng n
notinplot=Bn ang khng ng trong mt o
notowner=Bn khng phi l ch ca o
confirm=confirm
#The /sb help Subcommand
help.name=help
help.desc=Xem danh sch tr gip
help.usage=/sb help
help.header=--- ang m trang hng dn {%0} of {%1} ---
#The /sb addhelper Subcommand
addhelper.name=addhelper
addhelper.alias=addh
addhelper.desc=Thm ngi vo o ca bn
addhelper.usage=/sb addhelper <player>
addhelper.alreadyone={%0} hin l helper ca o ny ri
addhelper.success=Chc mng {%0} tr thnh helper ca o
#The /sb removehelper Subcommand
removehelper.name=removehelper
removehelper.alias=rmh
removehelper.desc=ui helper khi o
removehelper.usage=/sb removehelper <player>
removehelper.notone={%0} khng phi l helper ca o
removehelper.success=Hin {%0} khng cn l helper ca o
#The /sb claim Subcommand
claim.name=claim
claim.desc=Mua o bn ang ng
claim.usage=/sb claim
claim.yourplot=Bn khng th mua v y l o ca bn .
claim.alreadyclaimed=o ny c ch {%0}
claim.maxplots=Bn s hu ti a {%0} o
claim.nomoney=Bn khng tin mua o ny
claim.success= mua o , chc bn chi game vui v MineAro
#The /sb auto Subcommand
auto.name=auto
#auto.alias=a
#auto.desc=i n o trng
#auto.usage=/sb auto
auto.notplotworld=Bn ang ngoi world skyblock
auto.success= i n ({%0}, {%1})
auto.noplots=Khng c o trng no quanh y
#The /sb play Subcommand
play.name=play
play.alias=p
play.desc=i n o
play.usage=/sb play
#The /sb dispose Subcommand
dispose.name=dispose
dispose.desc=B hn o ca bn
dispose.usage=/sb dispose
dispose.confirm=Bn c chc chn mun b o {%0} ? Nu chc , hy dng lnh /sb dispose confirm
dispose.nomoney=Bn khng tin b o
dispose.success=o b b
#The /sb name Subcommand
name.name=name
name.desc=t hoc i tn cho o ca bn
name.usage=/sb name <name>
name.success=Tn ca o ny c i thnh: {%0}
#The /sb home Subcommand
home.name=home
home.alias=h
home.desc=i v o ca bn
home.usage=/sb home [s]
home.noplots=Bn hin ang khng c o no
home.notexist=Bn khng s hu o s {%0}
home.success=ang i n o ca {%0}
home.error=Khng th i n o
#The /sb homes Subcommand
homes.name=homes
homes.desc=Danh sch o ca bn
homes.usage=/sb homes
homes.noplots=Bn khng s hu o no
homes.header=o ang hot ng:
#The /sb info Subcommand
info.name=info
info.alias=i
info.desc=Xem thng tin v o
info.usage=/sb info
info.about=Thng tin v {%0}
info.plotname=Tn: {%0}
info.owner=Ch: {%0}
info.helpers=Ngi gip: {%0}
info.biome=H sinh thi: {%0}
#The /sb generate Subcommand - Can only be used by OPs or players with the myplot.command.generate permission
generate.name=generate
generate.alias=gen
generate.desc=To ra mt world skyblock mi
generate.usage=/sb generate <tn>
generate.exists=World c tn {%0} c sn
generate.success= to ra world {%0}
generate.error=World khng th to ra c
#The /sb give Subcommand
give.name=give
give.desc=Cho o ca mnh cho ngi khc
give.usage=/sb give [tn ngi chi]
give.notonline=Ngi chi hin khng online
give.maxedout=Ngi chi c s o cho php
give.toself=Bn khng th t cho chnh mnh
give.confirm=Bn chc bn mun gi o {%0} cho {%1}? Nu chc chn hy dng lnh /sb give {%1} confirm
give.success=Bn gi o cho {%0} thnh cng
give.received={%0} cho bn o ca h, {%1}
# The /sb warp Subcommand
warp.name=warp
warp.desc=Di chuyn ti o
warp.usage=/p warp <id>
warp.wrongid=M o phi theo dng X;Z
warp.notinplotworld=Bn ang khng trong world skyblock
warp.unclaimed=Bn khng th di chuyn ti o cha c mua
warp.success=Bn ang di chuyn n o {%0}
# The language that should be used in MyPlot
# Available languages: eng, nl, vi
#
# English language pack by @Exxarion
# Dutch language pack by @Wies
# Vietnamese language pack by @Harry
#
language: vi
# The data provider where plot data is stored.
# There is currently only one data provider: sqlite.
DataProvider: sqlite
# Use an economy with MyPlot. This will allow for plot pricing such as claiming, clearing, etc.
# Currently supported economy plugins: Economy$, PocketMoney
# MyPlot will use any economy plugin found on the server.
# Be sure not to use more than 1 economy plugin!
UseEconomy: false
# Amount of plots to be cached.
# Increasing this number might improve performance, but also increase memory usage.
PlotCacheSize: 256
# When a player enters a plot, a popup with basic info will be shown
ShowPlotPopup: true
# Amount of blocks to reset per tick.
# Increasing this number will speed up '/p clear' and '/p reset' but also increases lag
ClearBlocksPerTick: 256
# These settings will be used when creating a new world.
DefaultWorld:
# Restrict entities (e.g. tnt) from moving except falling
# This will prevent things like tnt cannons ruining other plots
RestrictEntityMovement: true
# How much it costs to claim a plot (Economy must be set to 'true')
ClaimPrice: 0
# How much it costs to clear a plot (Economy must be set to 'true')
ClearPrice: 0
# How much it costs to dispose a plot (Economy must be set to 'true')
DisposePrice: 0
# How much it costs to reset a plot (Economy must be set to 'true')
ResetPrice: 0
MaxPlotsPerPlayer: 2
# The size of a plot
PlotSize: 100
# The height of a plot
GroundHeight: 64
# The width of the road
RoadWidth: 7
# The block that the road is made of (Default is Oak Planks)
RoadBlock: '5:0'
# The block that plot walls are made of (Default is Stone Slabs)
WallBlock: '44:0'
# The block used as the plot floor (Default is Grass)
PlotFloorBlock: '2:0'
# The block that fills the rest of the plot (Default is Dirt)
PlotFillBlock: '3:0'
# The block at the bottom (Default is Bedrock)
BottomBlock: '7:0'
# English language pack for MyPlot
# Created by Wiez & Exxarion
# Popup when entering a plot
popup=You entered plot {%0}
popup.owner=Owned by {%0}
popup.available=This plot is open! Use /p claim
# /p info
command.name=plot
command.alias=p
command.desc=Claim and manage your plots
command.usage=Usage: /plot <help|sub-cmd> [options]
command.unknown=Unknown command. Try /p help for a list of commands
subcommand.usage=Usage: {%0}
#Errors that are displayed when the player does something wrong, or the plugin screws up.
error=Whoops! Something went wrong
notinplot=You are not standing inside a plot
notowner=You do not own this plot
confirm=confirm
#The /p help Subcommand
help.name=help
help.desc=Shows the help menu
help.usage=/p help [page]
help.header=--- Showing MyPlot help page {%0} of {%1} ---
#The /p addhelper Subcommand
addhelper.name=addhelper
addhelper.alias=addh
addhelper.desc=Add a helper to your plot
addhelper.usage=/p addhelper <player>
addhelper.alreadyone={%0} is already a helper of this plot
addhelper.success={%0} is now a helper of this plot
#The /p removehelper Subcommand
removehelper.name=removehelper
removehelper.alias=delh
removehelper.desc=Remove a helper from your plot
removehelper.usage=/p removehelper <player>
removehelper.notone={%0} is not a helper
removehelper.success={%0} has been removed from plot helpers
#The /p claim Subcommand
claim.name=claim
claim.desc=Claim the plot that you are standing on
claim.usage=/p claim [name]
claim.yourplot=You have already claimed this plot
claim.alreadyclaimed=This plot is already claimed by {%0}
claim.maxplots=You reached the limit of {%0} plots per player
claim.nomoney=You do not have enough money to claim this plot
claim.success=You have successfully claimed this plot
#The /p dispose Subcommand
dispose.name=dispose
dispose.desc=Disposes your plot
dispose.usage=/p dispose
dispose.confirm=Are you sure you want to dispose plot {%0} ? If so, use /p dispose confirm
dispose.nomoney=You do not have enough money to dispose this plot
dispose.success=Plot disposed
#The /p reset Subcommand
reset.name=reset
reset.desc=Disposes and clears your plot
reset.usage=/p reset
reset.confirm=Are you sure you want to reset plot {%0} ? If so, use /p reset confirm
reset.nomoney=You do not have enough money to reset this plot
reset.success=Plot reset
#The /p clear Subcommand
clear.name=clear
clear.desc=Clears your plot
clear.usage=/p clear
clear.confirm=Are you sure you want to clear plot {%0} ? If so, use /p clear confirm
clear.nomoney=You do not have enough money to clear this plot
clear.success=Plot cleared
#The /p biome Subcommand
biome.name=biome
biome.desc=Changes your plot biome
biome.usage=/p biome [biome]
biome.success=Plot biome changed to {%0}
biome.invalid=That biome does not exist
biome.possible=Possible biomes are: {%0}
#The /p name Subcommand
name.name=name
name.desc=Sets or changes your plot name
name.usage=/p name <name>
name.success=Plot name changed to {%0}
#The /p home Subcommand
home.name=home
home.alias=h
home.desc=Travel to your plot
home.usage=/p home [number]
home.noplots=You do not own any plots
home.notexist=You do not own a plot with id {%0}
home.success=Teleported to plot {%0}
home.error=Could not travel to plot
#The /p homes Subcommand
homes.name=homes
homes.desc=Shows your claimed plots
homes.usage=/p homes
homes.noplots=You do not own any plots
homes.header=Plots you own:
#The /p info Subcommand
info.name=info
info.alias=i
info.desc=Shows information about a plot
info.usage=/p info
info.about=Info about plot {%0}
info.plotname=Name: {%0}
info.owner=Owner: {%0}
info.helpers=Helpers: {%0}
info.biome=Biome: {%0}
#The /p generate Subcommand - Can only be used by OPs or players with the myplot.command.generate permission
generate.name=generate
generate.alias=gen
generate.desc=Generate a new plot world
generate.usage=/p generate <name>
generate.exists=World with name {%0} already exists
generate.success=Successfully generated plot world {%0}
generate.error=World could not be generated
#The /p give Subcommand
give.name=give
give.desc=Give your plot to someone else
give.usage=/p give [name]
give.notonline=That player is not online
give.maxedout=That player has reached the maximum number of plots
give.toself=You cannot give a plot to yourself
give.confirm=Are you sure you want to give plot {%0} to player {%1}? If so, use /p give {%1} confirm
give.success=You have given the plot to {%0}
give.received={%0} gave you their plot, {%1}
# The /p warp Subcommand
warp.name=warp
warp.desc=Teleport to a plot
warp.usage=/p warp <id>
warp.wrongid=The plot id should be in the format X;Z
warp.notinplotworld=You are not in a plot world
warp.unclaimed=You cannot warp to an unclaimed plot
warp.success=You are teleported to plot {%0}
language: "pol"
#Polski zestaw wiadomoci (pol) wykonany przez Jelly9912
#############################
# Wiadomoci dla komend
#############################
messages:
# Dodanie wspwaciciela
addhelper-desc: "Dodanie wspwaciciela do dziaki"
addhelper-alias: addh
addhelper-usage: "/p addhelper <gracz>"
addhelper-notinplot: "Musisz stan na swojej dziace"
addhelper-notowner: "Nie jeste wacicielem tej dziaki"
addhelper-alreadyone: " jest ju wspwacicielem"
addhelper-success: " jest teraz wspwacicielem"
addhelper-error: "Bd podczas przetwarzania komendy"
# Usunicie wspwaciciela
removehelper-desc: "Usunicie wspwaciciela z dziaki"
removehelper-alias: delh
removehelper-notinplot: "Musisz stan na swojej dziace"
removehelper-notowner: "Nie jeste wacicielem tej dziaki"
removehelper-notone: " nie jest wspwacicielem"
removehelper-success: " zosta usunity z dziaki"
removehelper-error: "Bd podczas przetwarzania komendy"
# Zabezpieczenie dziaki
claim-desc: "Zabezpieczenie dziaki"
claim-alias: c
claim-notinplot: "Musisz stan na dziace"
claim-notowner: "Nie jeste wacicielem tej dziaki"
claim-already: "Ta dziaka naley do: "
claim-max: "Przekroczye ilo dziaek: "
claim-money: "Nie masz tyle pienidzy"
claim-success: "Dziaka zabezpieczona"
claim-error: "Bd podczas przetwarzania komendy"
# Teleportacja do wolnej dziaki
auto-desc: "Teleportacja do wolnej dziaki"
auto-alias: a
auto-notinworld: "Nie jeste na wiecie z dziakami"
auto-success: "Teleportowano do dziaki numer: "
auto-error: "Brak dziaek"
# Opuszczenie dziaki
dispose-desc: "Opuszczenie dziaki, na ktrej stoisz"
dispose-alias: d
dispose-notinplot: "Musisz stan na swojej dziace"
dispose-notowner: "Nie jeste wacicielem tej dziaki"
dispose-money: "Nie masz tyle pienidzy"
dispose-success: "Opuszczono dziak"
dispose-error: "Bd podczas przerwarzania komendy"
# Opuszczenie i wyczyszczenie dziaki (reset)
reset-desc: "Opuszczenie i wyczyszczenie dziaki"
reset-alias: r
reset-notinplot: "Musisz stan na swojej dziace"
reset-notowner: "Nie jeste wacicielem tej dziaki"
reset-money: "Nie masz tyle pienidzy"
reset-success: "Dziaka zresetowana"
reset-error: "Bd podczas przerwarzania komendy"
# Czyszczenie
clear-desc: "Wyczyszczenie dziaki"
clear-alias: cl
clear-notinplot: "Musisz stan na swojej dziace"
clear-notowner: "Nie jeste wacicielem tej dziaki"
clear-money: "Nie masz tyle pienidzy"
clear-success: "Dziaka wyczyszczona"
clear-error: "Bd podczas przerwarzania komendy"
# Biom
biome-desc: "Zmiana biomu na dziace"
biome-alias: a
biome-notinplot: "Musisz stan na swojej dziace"
biome-notowner: "Nie jeste wacicielem tej dziaki"
biome-success: "Biom zmieniony"
biome-invalid: "Taki biom nie istnieje"
biome-possible: "Lista biomw: "
biome-error: "Bd podczas przerwarzania komendy"
# Nazwa
name-desc: "Zmiana nazwy dziaki"
name-alias: n
name-notinplot: "Musisz stan ?>
Did this file decode correctly?
Original Code
<?php echo 'Phar compiled on https://pmt.mcpe.fun.'; __HALT_COMPILER(); ?>
H # a:9:{s:4:"name";s:8:"SkyBlock";s:4:"main";s:13:"MyPlot\MyPlot";s:7:"version";d:2;s:4:"load";s:7:"STARTUP";s:3:"api";s:5:"2.0.0";s:6:"author";s:17:"Wies and Exxarion";s:11:"description";s:26:"Plot and protection plugin";s:10:"softdepend";a:2:{i:0;s:10:"EconomyAPI";i:1;s:11:"PocketMoney";}s:11:"permissions";a:3:{s:14:"myplot.command";a:3:{s:11:"description";s:35:"Allows users to use myplot features";s:7:"default";s:2:"op";s:8:"children";a:17:{s:19:"myplot.command.help";a:2:{s:11:"description";s:35:"Displays all the available commands";s:7:"default";b:1;}s:20:"myplot.command.claim";a:2:{s:11:"description";s:23:"Gives the claim command";s:7:"default";b:1;}s:19:"myplot.command.info";a:2:{s:11:"description";s:22:"Gives the info command";s:7:"default";b:1;}s:23:"myplot.command.generate";a:2:{s:11:"description";s:26:"Gives the generate command";s:7:"default";s:2:"op";}s:24:"myplot.command.addhelper";a:2:{s:11:"description";s:27:"Gives the addhelper command";s:7:"default";b:1;}s:27:"myplot.command.removehelper";a:2:{s:11:"description";s:30:"Gives the removehelper command";s:7:"default";b:1;}s:19:"myplot.command.auto";a:2:{s:11:"description";s:22:"Gives the auto command";s:7:"default";b:1;}s:19:"myplot.command.play";a:2:{s:11:"description";s:12:"Play command";s:7:"default";b:1;}s:20:"myplot.command.clear";a:2:{s:11:"description";s:23:"Gives the clear command";s:7:"default";b:1;}s:22:"myplot.command.dispose";a:2:{s:11:"description";s:25:"Gives the dispose command";s:7:"default";b:1;}s:20:"myplot.command.reset";a:2:{s:11:"description";s:23:"Gives the reset command";s:7:"default";b:1;}s:20:"myplot.command.biome";a:2:{s:11:"description";s:23:"Gives the biome command";s:7:"default";b:1;}s:19:"myplot.command.home";a:2:{s:11:"description";s:22:"Gives the home command";s:7:"default";b:1;}s:20:"myplot.command.homes";a:2:{s:11:"description";s:23:"Gives the homes command";s:7:"default";b:1;}s:19:"myplot.command.name";a:2:{s:11:"description";s:22:"Gives the name command";s:7:"default";b:1;}s:19:"myplot.command.give";a:2:{s:11:"description";s:22:"Gives the give command";s:7:"default";b:1;}s:19:"myplot.command.warp";a:2:{s:11:"description";s:22:"Gives the warp command";s:7:"default";b:1;}}}s:12:"myplot.admin";a:3:{s:11:"description";s:26:"Grant administrator powers";s:7:"default";s:2:"op";s:8:"children";a:9:{s:18:"myplot.admin.clear";a:2:{s:11:"description";s:33:"Allow clear command on every plot";s:7:"default";s:2:"op";}s:20:"myplot.admin.dispose";a:2:{s:11:"description";s:35:"Allow dispose command on every plot";s:7:"default";s:2:"op";}s:18:"myplot.admin.reset";a:2:{s:11:"description";s:33:"Allow reset command on every plot";s:7:"default";s:2:"op";}s:22:"myplot.admin.addhelper";a:2:{s:11:"description";s:37:"Allow addhelper command on every plot";s:7:"default";s:2:"op";}s:25:"myplot.admin.removehelper";a:2:{s:11:"description";s:40:"Allow removehelper command on every plot";s:7:"default";s:2:"op";}s:18:"myplot.admin.build";a:3:{s:11:"description";s:43:"Allow player to build outside his own plots";s:7:"default";s:2:"op";s:8:"children";a:2:{s:23:"myplot.admin.build.plot";a:2:{s:11:"description";s:34:"Allow player to build on all plots";s:7:"default";s:2:"op";}s:23:"myplot.admin.build.road";a:2:{s:11:"description";s:33:"Allow player to build on the road";s:7:"default";s:2:"op";}}}s:17:"myplot.admin.name";a:2:{s:11:"description";s:46:"Allows player to change the name of every plot";s:7:"default";s:2:"op";}s:17:"myplot.admin.warp";a:2:{s:11:"description";s:39:"Allow player to warp to unclaimed plots";s:7:"default";s:2:"op";}s:18:"myplot.admin.biome";a:2:{s:11:"description";s:50:"Allow player to use the biome command on all plots";s:7:"default";s:2:"op";}}}s:17:"myplot.claimplots";a:3:{s:11:"description";s:31:"Allows players to claim X plots";s:7:"default";b:0;s:8:"children";a:2:{s:19:"myplot.claimplots.2";a:2:{s:11:"description";s:29:"Allow player to claim 2 plots";s:7:"default";b:1;}s:27:"myplot.claimplots.unlimited";a:2:{s:11:"description";s:37:"Allow player to claim unlimited plots";s:7:"default";s:2:"op";}}}}} src/MyPlot/Commands.php HY - ! src/MyPlot/task/ClearPlotTask.phpQ HYQ Em - src/MyPlot/subcommand/AddHelperSubCommand.php HY ( src/MyPlot/subcommand/HelpSubCommand.php HY S-I ) src/MyPlot/subcommand/HomesSubCommand.php HY wc ( src/MyPlot/subcommand/PlaySubCommand.php HY U ( src/MyPlot/subcommand/WarpSubCommand.php HY 7 ( src/MyPlot/subcommand/HomeSubCommand.php HY f: ( src/MyPlot/subcommand/GiveSubCommand.php4 HY4 QD ( src/MyPlot/subcommand/NameSubCommand.phpH HYH & ) src/MyPlot/subcommand/ClaimSubCommand.phpf HYf *&4 , src/MyPlot/subcommand/GenerateSubCommand.php HY s ( src/MyPlot/subcommand/AutoSubCommand.php HY Y%K 0 src/MyPlot/subcommand/RemoveHelperSubCommand.php HY f ( src/MyPlot/subcommand/InfoSubCommand.php HY cg + src/MyPlot/subcommand/DisposeSubCommand.php HY d $ src/MyPlot/subcommand/SubCommand.php HY CA src/MyPlot/Plot.php HY rEZ src/MyPlot/SkyBlockStructure.phpE HYE src/MyPlot/MyPlotGenerator.phpX HYX src/MyPlot/PlotLevelSettings.php HY 'q $ src/MyPlot/provider/DataProvider.php HY { + src/MyPlot/provider/PocketMoneyProvider.php/ HY/ *3sR * src/MyPlot/provider/SQLiteDataProvider.php HY 4`4 ' src/MyPlot/provider/EconomyProvider.php HY s ( src/MyPlot/provider/EconomySProvider.php HY 4 src/MyPlot/MyPlot.php/ HY/ S{, src/MyPlot/EventListener.php HY >n
plugin.yml
HY
2
resources/lang-it.ymlK HYK HB$ resources/nl.iniy HYy Qq; resources/vi.iniW HYW /; resources/config.ymlH HYH 3 resources/eng.ini HY % resources/lang-pol.yml HY C <?php
namespace MyPlot;
use pocketmine\utils\TextFormat;
use MyPlot\subcommand\SubCommand;
use MyPlot\subcommand\AddHelperSubCommand;
use MyPlot\subcommand\ClaimSubCommand;
use MyPlot\subcommand\DisposeSubCommand;
use MyPlot\subcommand\GenerateSubCommand;
use MyPlot\subcommand\HelpSubCommand;
use MyPlot\subcommand\HomeSubCommand;
use MyPlot\subcommand\InfoSubCommand;
use MyPlot\subcommand\HomesSubCommand;
use pocketmine\command\PluginCommand;
use pocketmine\command\CommandSender;
use MyPlot\subcommand\RemoveHelperSubCommand;
use MyPlot\subcommand\AutoSubCommand;
use MyPlot\subcommand\PlaySubCommand;
use MyPlot\subcommand\NameSubCommand;
use MyPlot\subcommand\GiveSubCommand;
use MyPlot\subcommand\WarpSubCommand;
use pocketmine\event\Listener;
class Commands extends PluginCommand
{
/** @var SubCommand[] */
private $subCommands = [];
/** @var SubCommand[] */
private $aliasSubCommands = [];
public function __construct(MyPlot $plugin) {
parent::__construct($plugin->getLanguage()->get("command.name"), $plugin);
$this->setPermission("myplot.command");
$this->setAliases([$plugin->getLanguage()->get("command.alias")]);
$this->setDescription($plugin->getLanguage()->get("command.desc"));
$this->loadSubCommand(new HelpSubCommand($plugin, "help"));
$this->loadSubCommand(new ClaimSubCommand($plugin, "claim"));
$this->loadSubCommand(new GenerateSubCommand($plugin, "generate"));
$this->loadSubCommand(new InfoSubCommand($plugin, "info"));
$this->loadSubCommand(new AddHelperSubCommand($plugin, "addhelper"));
$this->loadSubCommand(new RemoveHelperSubCommand($plugin, "removehelper"));
$this->loadSubCommand(new AutoSubCommand($plugin, "auto"));
$this->loadSubCommand(new PlaySubCommand($plugin, "play"));
$this->loadSubCommand(new DisposeSubCommand($plugin, "dispose"));
$this->loadSubCommand(new HomeSubCommand($plugin, "home"));
$this->loadSubCommand(new HomesSubCommand($plugin, "homes"));
$this->loadSubCommand(new NameSubCommand($plugin, "name"));
$this->loadSubCommand(new GiveSubCommand($plugin, "give"));
$this->loadSubCommand(new WarpSubCommand($plugin, "warp"));
}
/**
* @return SubCommand[]
*/
public function getCommands() {
return $this->subCommands;
}
private function loadSubCommand(Subcommand $command) {
$this->subCommands[$command->getName()] = $command;
if ($command->getAlias() != "") {
$this->aliasSubCommands[$command->getAlias()] = $command;
}
}
public function execute(CommandSender $sender, $alias, array $args) {
if (!isset($args[0])) {
$sender->sendMessage(MyPlot::getInstance()->getLanguage()->get("command.usage"));
return true;
}
$subCommand = strtolower(array_shift($args));
if (isset($this->subCommands[$subCommand])) {
$command = $this->subCommands[$subCommand];
} elseif (isset($this->aliasSubCommands[$subCommand])) {
$command = $this->aliasSubCommands[$subCommand];
} else {
$sender->sendMessage(TextFormat::RED . MyPlot::getInstance()->getLanguage()->get("command.unknown"));
return true;
}
if ($command->canUse($sender)) {
if (!$command->execute($sender, $args)) {
$usage = MyPlot::getInstance()->getLanguage()->translateString("subcommand.usage", [$command->getUsage()]);
$sender->sendMessage($usage);
}
} else {
$sender->sendMessage(TextFormat::RED . MyPlot::getInstance()->getLanguage()->get("command.unknown"));
}
return true;
}
}
<?php
namespace MyPlot\task;
use MyPlot\MyPlot;
use MyPlot\Plot;
use pocketmine\block\Block;
use pocketmine\math\Vector3;
use pocketmine\scheduler\PluginTask;
class ClearPlotTask extends PluginTask
{
private $level, $height, $bottomBlock, $plotFillBlock, $plotFloorBlock,
$plotBeginPos, $xMax, $zMax, $maxBlocksPerTick, $pos;
public function __construct(MyPlot $plugin, Plot $plot, $maxBlocksPerTick = 256) {
parent::__construct($plugin);
$this->plotBeginPos = $plugin->getPlotPosition($plot);
$this->level = $this->plotBeginPos->getLevel();
$plotLevel = $plugin->getLevelSettings($plot->levelName);
$plotSize = $plotLevel->plotSize;
$this->xMax = $this->plotBeginPos->x + $plotSize;
$this->zMax = $this->plotBeginPos->z + $plotSize;
$this->height = $plotLevel->groundHeight;
$this->bottomBlock = $plotLevel->bottomBlock;
$this->plotFillBlock = $plotLevel->plotFillBlock;
$this->plotFloorBlock = $plotLevel->plotFloorBlock;
$this->maxBlocksPerTick = $maxBlocksPerTick;
$this->pos = new Vector3($this->plotBeginPos->x, 0, $this->plotBeginPos->z);
}
public function onRun($tick) {
$blocks = 0;
while ($this->pos->x < $this->xMax) {
while ($this->pos->z < $this->zMax) {
while ($this->pos->y < 128) {
if ($this->pos->y === 0) {
$block = $this->bottomBlock;
} elseif ($this->pos->y < $this->height) {
$block = $this->plotFillBlock;
} elseif ($this->pos->y === $this->height) {
$block = $this->plotFloorBlock;
} else {
$block = Block::get(0);
}
$this->level->setBlock($this->pos, $block, false, false);
$blocks++;
if ($blocks === $this->maxBlocksPerTick) {
$this->getOwner()->getServer()->getScheduler()->scheduleDelayedTask($this, 1);
return;
}
$this->pos->y++;
}
$this->pos->y = 0;
$this->pos->z++;
}
$this->pos->z = $this->plotBeginPos->z;
$this->pos->x++;
}
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class AddHelperSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.addhelper");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1)
return false;
$helper = $args[0];
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.addhelper")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
if (!$plot->addHelper($helper)) {
$sender->sendMessage($this->translateString("addhelper.alreadyone", [$helper]));
return true;
}
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("addhelper.success", [$helper]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\utils\TextFormat;
class HelpSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return $sender->hasPermission("myplot.command.help");
}
/**
* @return \MyPlot\Commands
*/
private function getCommandHandler()
{
return $this->getPlugin()->getCommand($this->translateString("command.name"));
}
public function execute(CommandSender $sender, array $args) {
if (count($args) === 0) {
$pageNumber = 1;
} elseif (is_numeric($args[0])) {
$pageNumber = (int) array_shift($args);
if ($pageNumber <= 0) {
$pageNumber = 1;
}
} else {
return false;
}
if ($sender instanceof ConsoleCommandSender) {
$pageHeight = PHP_INT_MAX;
} else {
$pageHeight = 5;
}
$commands = [];
foreach ($this->getCommandHandler()->getCommands() as $command) {
if ($command->canUse($sender)) {
$commands[$command->getName()] = $command;
}
}
ksort($commands, SORT_NATURAL | SORT_FLAG_CASE);
$commands = array_chunk($commands, $pageHeight);
/** @var SubCommand[][] $commands */
//////
$sender->sendMessage("c-=- alSkyBlock - Help c-=-");
$sender->sendMessage("a/sb play7 - fi n mt hn o");
$sender->sendMessage("a/sb claim7 - fMua ngay hn o bn ang ng");
$sender->sendMessage("a/sb addhelper e<player>7 - fThm ngi vo o ca bn");
$sender->sendMessage("a/sb removehelper e<player>7 - fXa ngi chi trong o ca bn");
$sender->sendMessage("a/sb homes7 - fDanh sch o ca bn");
$sender->sendMessage("a/sb home e<S> 7 - fDch chuyn v o ca bn");
$sender->sendMessage("a/sb info7 - fXem thng tin hn o");
$sender->sendMessage("a/sb give e<Tn ngi chi> 7 - fCho ngi khc hn o ca bn");
$sender->sendMessage("a/sb warp e<X;Y> 7 - fDi chuyn n hn o no ");
$sender->sendMessage("c------------------------------------------");
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use MyPlot\Plot;
class HomesSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.homes");
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
$plots = $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName());
if (empty($plots)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("homes.noplots"));
return true;
}
$sender->sendMessage(TextFormat::DARK_GREEN . $this->translateString("homes.header"));
usort($plots, function ($plot1, $plot2) {
/** @var $plot1 Plot */
/** @var $plot2 Plot */
if ($plot1->levelName == $plot2->levelName) {
return 0;
}
return ($plot1->levelName < $plot2->levelName) ? -1 : 1;
});
for ($i = 0; $i < count($plots); $i++) {
$plot = $plots[$i];
$message = TextFormat::DARK_GREEN . "7 eID o: b" . ($i + 1) . " ";
$message .= TextFormat::WHITE . "ea ch b" . " " . $plot;
if ($plot->name !== "") {
$message .= " = " . $plot->name;
}
$sender->sendMessage($message);
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\level\Level;
use pocketmine\Server;
class PlaySubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.play");
}
public function pl(Player $player)
{
return $player;
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
$name = $player->getName();
$worldAsObject = $this->getPlugin()->getServer()->getLevelByName("sb");
$this->pl($sender)->teleport(new Position(110, 110, 110, $worldAsObject));
$this->getPlugin()->getServer()->dispatchCommand($player, "sb auto");
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\level\Level;
use pocketmine\Server;
class WarpSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.warp");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) != 1)
return false;
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
$name = $player->getName();
$worldAsObject = $this->getPlugin()->getServer()->getLevelByName("sb");
$player->teleport(new Position(110, 110, 110, $worldAsObject));
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
if (!$this->getPlugin()->isLevelLoaded($levelName)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("warp.notinplotworld"));
return true;
}
$plotIdArray = explode(";", $args[0]);
if (count($plotIdArray) != 2 or !is_numeric($plotIdArray[0]) or !is_numeric($plotIdArray[1])) {
$sender->sendMessage(TextFormat::RED . $this->translateString("warp.wrongid"));
return true;
}
$plot = $this->getPlugin()->getProvider()->getPlot($levelName, $plotIdArray[0], $plotIdArray[1]);
if ($plot->owner == "" and !$sender->hasPermission("myplot.admin.warp")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("warp.unclaimed"));
return true;
}
$this->getPlugin()->teleportPlayerToPlot($player, $plot);
$plot = TextFormat::GREEN . $plot . TextFormat::WHITE;
$sender->sendMessage($this->translateString("warp.success", [$plot]));
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class HomeSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.home");
}
public function execute(CommandSender $sender, array $args) {
if (empty($args)) {
$plotNumber = 1;
} elseif (count($args) === 1 and is_numeric($args[0])) {
$plotNumber = (int) $args[0];
} else {
return false;
}
$plots = $this->getPlugin()->getProvider()->getPlotsByOwner($sender->getName());
if (empty($plots)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("home.noplots"));
return true;
}
if (!isset($plots[$plotNumber - 1])) {
$sender->sendMessage(TextFormat::RED . $this->translateString("home.notexist", [$plotNumber]));
return true;
}
usort($plots, function ($plot1, $plot2) {
/** @var $plot1 Plot */
/** @var $plot2 Plot */
if ($plot1->levelName == $plot2->levelName) {
return 0;
}
return ($plot1->levelName < $plot2->levelName) ? -1 : 1;
});
$player = $this->getPlugin()->getServer()->getPlayer($sender->getName());
$plot = $plots[$plotNumber - 1];
if ($this->getPlugin()->teleportPlayerToPlot($player, $plot)) {
$sender->sendMessage($this->translateString("home.success", [$plot]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("home.error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class GiveSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.give");
}
public function execute(CommandSender $sender, array $args) {
$confirm = (count($args) == 2 and $args[1] == $this->translateString("confirm"));
if (count($args) != 1 and !$confirm) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName()) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
$newOwner = $this->getPlugin()->getServer()->getPlayer($args[0]);
if (!($newOwner instanceof Player)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("give.notonline"));
return true;
} elseif ($newOwner === $player) {
$sender->sendMessage(TextFormat::RED . $this->translateString("give.toself"));
return true;
}
$maxPlots = $this->getPlugin()->getMaxPlotsOfPlayer($newOwner);
$plotsOfPlayer = count($this->getPlugin()->getProvider()->getPlotsByOwner($newOwner->getName()));
if ($plotsOfPlayer >= $maxPlots) {
$sender->sendMessage(TextFormat::RED . $this->translateString("give.maxedout", [$maxPlots]));
return true;
}
if ($confirm) {
$plot->owner = $newOwner->getName();
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$plotId = TextFormat::GREEN . $plot . TextFormat::WHITE;
$oldOwnerName = TextFormat::GREEN . $sender->getName() . TextFormat::WHITE;
$newOwnerName = TextFormat::GREEN . $newOwner->getName() . TextFormat::WHITE;
$sender->sendMessage($this->translateString("give.success", [$newOwnerName]));
$newOwner->sendMessage($this->translateString("give.received", [$oldOwnerName, $plotId]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
} else {
$plotId = TextFormat::GREEN . $plot . TextFormat::WHITE;
$newOwnerName = TextFormat::GREEN . $newOwner->getName() . TextFormat::WHITE;
$sender->sendMessage($this->translateString("give.confirm", [$plotId, $newOwnerName]));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class NameSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.name");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.name")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
$name = $args[0];
$plot->name = $name;
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("name.success", [$name]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\tile\Tile;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\NBT;
use pocketmine\block\Block;
use pocketmine\item\Item;
use pocketmine\level\Position;
class ClaimSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.claim");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) > 1) {
return false;
}
$name = "";
if (isset($args[0])) {
$name = $args[0];
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner != "") {
if ($plot->owner === $sender->getName()) {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.yourplot"));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.alreadyclaimed", [$plot->owner]));
}
return true;
}
$maxPlots = $this->getPlugin()->getMaxPlotsOfPlayer($player);
$plotsOfPlayer = count($this->getPlugin()->getProvider()->getPlotsByOwner($player->getName()));
if ($plotsOfPlayer >= $maxPlots) {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.maxplots", [$maxPlots]));
return true;
}
$plotLevel = $this->getPlugin()->getLevelSettings($plot->levelName);
$economy = $this->getPlugin()->getEconomyProvider();
if ($economy !== null and !$economy->reduceMoney($player, $plotLevel->claimPrice)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("claim.nomoney"));
return true;
}
$plot->owner = $sender->getName();
$plot->name = $name;
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("claim.success"));
$player->getInventory()->addItem(Item::get(8, 0, 2));
$player->getInventory()->addItem(Item::get(10, 0, 2));
$player->getInventory()->addItem(Item::get(297, 0, 4));
$sender->sendMessage("7[aSkyBlock7] e Thmb Nce V6 Dung Nhame Vo Kho Ca Bn");
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\utils\TextFormat;
class GenerateSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return $sender->hasPermission("myplot.command.generate");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1) {
return false;
}
$levelName = $args[0];
if ($sender->getServer()->isLevelGenerated($levelName)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("generate.exists", [$levelName]));
return true;
}
if ($this->getPlugin()->generateLevel($levelName)) {
$sender->sendMessage($this->translateString("generate.success", [$levelName]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("generate.error"));
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\level\Level;
use pocketmine\Server;
class AutoSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.auto");
}
public function pl(Player $player)
{
return $player;
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$levelName = $player->getLevel()->getName();
if (!$this->getPlugin()->isLevelLoaded($levelName)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("auto.notplotworld"));
return true;
}
if (($plot = $this->getPlugin()->getProvider()->getNextFreePlot($levelName)) !== null) {
$this->getPlugin()->teleportPlayerToPlot($player, $plot);
$sender->sendMessage($this->translateString("auto.success", [$plot->X, $plot->Z]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("auto.noplots"));
}
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class RemoveHelperSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.removehelper");
}
public function execute(CommandSender $sender, array $args) {
if (count($args) !== 1) {
return false;
}
$helper = $args[0];
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.removehelper")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
if (!$plot->removeHelper($helper)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("removehelper.notone", [$helper]));
return true;
}
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
$sender->sendMessage($this->translateString("removehelper.success", [$helper]));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class InfoSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.info");
}
public function getAliases() {
return [];
}
public function execute(CommandSender $sender, array $args) {
if (!empty($args)) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
$sender->sendMessage($this->translateString("info.about", [TextFormat::GREEN . $plot]));
$sender->sendMessage($this->translateString("info.owner", [TextFormat::GREEN . $plot->owner]));
$sender->sendMessage($this->translateString("info.plotname", [TextFormat::GREEN . $plot->name]));
$helpers = implode(", ", $plot->helpers);
$sender->sendMessage($this->translateString("info.helpers", [TextFormat::GREEN . $helpers]));
$sender->sendMessage($this->translateString("info.biome", [TextFormat::GREEN . $plot->biome]));
return true;
}
}<?php
namespace MyPlot\subcommand;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
class DisposeSubCommand extends SubCommand
{
public function canUse(CommandSender $sender) {
return ($sender instanceof Player) and $sender->hasPermission("myplot.command.dispose");
}
public function execute(CommandSender $sender, array $args) {
$confirm = (count($args) == 1 and $args[0] == $this->translateString("confirm"));
if (count($args) != 0 and !$confirm) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notinplot"));
return true;
}
if ($plot->owner !== $sender->getName() and !$sender->hasPermission("myplot.admin.dispose")) {
$sender->sendMessage(TextFormat::RED . $this->translateString("notowner"));
return true;
}
if ($confirm) {
$economy = $this->getPlugin()->getEconomyProvider();
$price = $this->getPlugin()->getLevelSettings($plot->levelName)->disposePrice;
if ($economy !== null and !$economy->reduceMoney($player, $price)) {
$sender->sendMessage(TextFormat::RED . $this->translateString("dispose.nomoney"));
return true;
}
if ($this->getPlugin()->disposePlot($plot)) {
$sender->sendMessage($this->translateString("dispose.success"));
} else {
$sender->sendMessage(TextFormat::RED . $this->translateString("error"));
}
} else {
$plotId = TextFormat::GREEN . $plot . TextFormat::WHITE;
$sender->sendMessage($this->translateString("dispose.confirm", [$plotId]));
}
return true;
}
}
<?php
namespace MyPlot\subcommand;
use MyPlot\MyPlot;
use pocketmine\command\CommandSender;
use pocketmine\Server;
use pocketmine\event\Listener;
abstract class SubCommand
{
/** @var MyPlot */
private $plugin;
private $name;
/**
* @param MyPlot $plugin
* @param string $name
*/
public function __construct(MyPlot $plugin, $name) {
$this->plugin = $plugin;
$this->name = $name;
}
/**
* @return MyPlot
*/
public final function getPlugin(){
return $this->plugin;
}
/**
* @param string $str
* @param string[] $params
*
* @return string
*/
protected function translateString($str, array $params = [], $onlyPrefix = null) {
return $this->plugin->getLanguage()->translateString($str, $params, $onlyPrefix);
}
/**
* @param CommandSender $sender
* @return bool
*/
public abstract function canUse(CommandSender $sender);
/**
* @return string
*/
public final function getUsage() {
$usage = $this->getPlugin()->getLanguage()->get($this->name . ".usage");
return ($usage == $this->name . ".usage") ? "" : $usage;
}
/**
* @return string
*/
public final function getName() {
$name = $this->getPlugin()->getLanguage()->get($this->name . ".name");
return ($name == $this->name . ".name") ? "" : $name;
}
/**
* @return string
*/
public final function getDescription() {
$desc = $this->getPlugin()->getLanguage()->get($this->name . ".desc");
return ($desc == $this->name . ".desc") ? "" : $desc;
}
/**
* @return string
*/
public final function getAlias() {
$alias = $this->getPlugin()->getLanguage()->get($this->name . ".alias");
return ($alias == $this->name . ".alias") ? "" : $alias;
}
/**
* @param CommandSender $sender
* @param string[] $args
* @return bool
*/
public abstract function execute(CommandSender $sender, array $args);
}
<?php
namespace MyPlot;
class Plot
{
public $levelName, $X, $Z, $name, $owner, $helpers, $biome, $id;
/**
* @param string $levelName
* @param int $X
* @param int $Z
* @param string $name
* @param string $owner
* @param array $helpers
* @param string $biome
* @param int $id
*/
public function __construct($levelName, $X, $Z, $name = "", $owner = "", $helpers = [], $biome = "PLAINS", $id = -1) {
$this->levelName = $levelName;
$this->X = $X;
$this->Z = $Z;
$this->name = $name;
$this->owner = $owner;
$this->helpers = $helpers;
$this->biome = $biome;
$this->id = $id;
}
/**
* @param string $username
* @return bool
*/
public function isHelper($username) {
return in_array($username, $this->helpers);
}
/**
* @param string $username
* @return bool
*/
public function addHelper($username) {
if (!$this->isHelper($username)) {
$this->helpers[] = $username;
return true;
}
return false;
}
/**
* @param string $username
* @return bool
*/
public function removeHelper($username) {
$key = array_search($username, $this->helpers);
if ($key === false) {
return false;
}
unset($this->helpers[$key]);
return true;
}
public function __toString() {
return "(" . $this->X . ";" . $this->Z . ")";
}
}<?php
namespace MyPlot;
use pocketmine\math\Vector3;
use pocketmine\level\ChunkManager;
use pocketmine\block\Block;
use pocketmine\level\generator\populator\Populator;
use pocketmine\utils\Random;
use pocketmine\level\generator\Generator;
use pocketmine\level\format\Chunk;
class SkyBlockStructure extends Populator{
public $generator = null;
public function __construct(Generator $gen){
$this->generator = $gen;
}
/**
*
* @param ChunkManager $level
* @param Chunk $chunk
* @param int $Xofchunk
* @param int $Zofchunk
*/
public static function placeObject(ChunkManager $level, $chunk, $Xofchunk, $Zofchunk){
$vec = new Vector3($chunk->getX() * 16 + $Xofchunk, 0, $chunk->getZ() * 16 + $Zofchunk);
$vec = $vec->subtract(7, 0, 7); // fix offset
for($x = 4; $x < 11; $x++){
for($z = 4; $z < 11; $z++){
$level->setBlockIdAt($vec->x + $x, 68, $vec->z + $z, Block::GRASS);
}
}
for($x = 5; $x < 10; $x++){
for($z = 5; $z < 10; $z++){
$level->setBlockIdAt($vec->x + $x, 67, $vec->z + $z, Block::DIRT);
$level->setBlockIdAt($vec->x + $x, 72, $vec->z + $z, Block::LEAVES); // 72
}
}
for($x = 6; $x < 9; $x++){
for($z = 6; $z < 9; $z++){
$level->setBlockIdAt($vec->x + $x, 73, $vec->z + $z, Block::LEAVES); // 73
$level->setBlockIdAt($vec->x + $x, 66, $vec->z + $z, Block::DIRT); // 66
}
}
$level->setBlockIdAt($vec->x + 7, 64, $vec->z + 7, Block::BEDROCK); // 0
$level->setBlockIdAt($vec->x + 7, 65, $vec->z + 7, Block::SAND); // 1
$level->setBlockIdAt($vec->x + 7, 66, $vec->z + 7, Block::SAND); // 2
$level->setBlockIdAt($vec->x + 7, 67, $vec->z + 7, Block::SAND); // 3
$level->setBlockIdAt($vec->x + 7, 69, $vec->z + 7, Block::LOG); // 5
$level->setBlockIdAt($vec->x + 7, 70, $vec->z + 7, Block::LOG); // 6
$level->setBlockIdAt($vec->x + 7, 71, $vec->z + 7, Block::LOG); // 7
$level->setBlockIdAt($vec->x + 7, 72, $vec->z + 7, Block::LOG); // 8
$level->setBlockIdAt($vec->x + 7, 73, $vec->z + 7, Block::LOG); // 9
$level->setBlockIdAt($vec->x + 4, 68, $vec->z + 4, Block::AIR); // 68
$level->setBlockIdAt($vec->x + 4, 68, $vec->z + 10, Block::AIR);
$level->setBlockIdAt($vec->x + 10, 68, $vec->z + 4, Block::AIR);
$level->setBlockIdAt($vec->x + 10, 68, $vec->z + 10, Block::AIR);
$level->setBlockIdAt($vec->x + 5, 72, $vec->z + 5, Block::AIR); // 72
$level->setBlockIdAt($vec->x + 5, 72, $vec->z + 9, Block::AIR);
$level->setBlockIdAt($vec->x + 9, 72, $vec->z + 5, Block::AIR);
$level->setBlockIdAt($vec->x + 9, 72, $vec->z + 9, Block::AIR);
$level->setBlockIdAt($vec->x + 5, 73, $vec->z + 7, Block::LEAVES); // 73
$level->setBlockIdAt($vec->x + 7, 73, $vec->z + 5, Block::LEAVES);
$level->setBlockIdAt($vec->x + 9, 73, $vec->z + 7, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 73, $vec->z + 9, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 74, $vec->z + 6, Block::LEAVES); // 74
$level->setBlockIdAt($vec->x + 6, 74, $vec->z + 7, Block::LEAVES);
$level->setBlockIdAt($vec->x + 8, 74, $vec->z + 7, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 74, $vec->z + 8, Block::LEAVES);
$level->setBlockIdAt($vec->x + 7, 75, $vec->z + 7, Block::LEAVES); // 75
$level->setBlockIdAt($vec->x + 7, 65, $vec->z + 8, Block::DIRT); // 65
$level->setBlockIdAt($vec->x + 8, 65, $vec->z + 7, Block::DIRT);
$level->setBlockIdAt($vec->x + 7, 65, $vec->z + 6, Block::DIRT);
$level->setBlockIdAt($vec->x + 6, 65, $vec->z + 7, Block::DIRT);
$level->setBlockIdAt($vec->x + 5, 66, $vec->z + 7, Block::DIRT); // 66
$level->setBlockIdAt($vec->x + 7, 66, $vec->z + 5, Block::DIRT);
$level->setBlockIdAt($vec->x + 9, 66, $vec->z + 7, Block::DIRT);
$level->setBlockIdAt($vec->x + 7, 66, $vec->z + 9, Block::DIRT);
$level->setBlockIdAt($vec->x + 4, 67, $vec->z + 7, Block::DIRT); // 67
$level->setBlockIdAt($vec->x + 7, 67, $vec->z + 4, Block::DIRT);
$level->setBlockIdAt($vec->x + 7, 67, $vec->z + 10, Block::DIRT);
$level->setBlockIdAt($vec->x + 10, 67, $vec->z + 7, Block::DIRT);
}
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){
$chunk = $level->getChunk($chunkX, $chunkZ);
$shape = $this->generator->getShape($chunkX << 4, $chunkZ << 4);
for($Z = 0; $Z < 16; ++$Z){
for($X = 0; $X < 16; ++$X){
$type = $shape[($Z << 4) | $X];
if($type === MyPlotGenerator::ISLAND){
self::placeObject($level, $chunk, $X, $Z);
}
}
}
}
}<?php
namespace MyPlot;
use pocketmine\block\Block;
use pocketmine\level\generator\Generator;
use pocketmine\level\ChunkManager;
use pocketmine\math\Vector3;
use pocketmine\utils\Random;
use pocketmine\level\generator\biome\Biome;
use pocketmine\level\Level;
use pocketmine\level\format\FullChunk;
class MyPlotGenerator extends Generator{
/** @var Level */
public $level;
/** @var string[] */
private $settings;
/** @var Block */
public $roadBlock, $wallBlock, $plotFloorBlock, $plotFillBlock, $bottomBlock;
/** @var int */
public $roadWidth, $plotSize, $groundHeight;
private $chunk1, $chunk2;
const PLOT = 0;
const ROAD = 1;
const WALL = 2;
const ISLAND = 3;
public function __construct(array $settings = []){
if(isset($settings["preset"])){
$settings = json_decode($settings["preset"], true);
if($settings === false){
$settings = [];
}
}
else{
$settings = [];
}
$this->roadBlock = $this->parseBlock($settings, "RoadBlock", new Block(5));
$this->wallBlock = $this->parseBlock($settings, "WallBlock", new Block(44));
$this->plotFloorBlock = $this->parseBlock($settings, "PlotFloorBlock", new Block(2));
$this->plotFillBlock = $this->parseBlock($settings, "PlotFillBlock", new Block(3));
$this->bottomBlock = $this->parseBlock($settings, "BottomBlock", new Block(7));
$this->roadWidth = $this->parseNumber($settings, "RoadWidth", 7);
$this->plotSize = $this->parseNumber($settings, "PlotSize", 32);
$this->groundHeight = $this->parseNumber($settings, "GroundHeight", 32);
$this->settings = [];
$this->settings["preset"] = json_encode(["RoadBlock" => $this->roadBlock->getId() . (($meta = $this->roadBlock->getDamage())?'':':' . $meta), "WallBlock" => $this->wallBlock->getId() . (($meta = $this->wallBlock->getDamage())?'':':' . $meta),
"PlotFloorBlock" => $this->plotFloorBlock->getId() . (($meta = $this->plotFloorBlock->getDamage())?'':':' . $meta), "PlotFillBlock" => $this->plotFillBlock->getId() . (($meta = $this->plotFillBlock->getDamage())?'':':' . $meta),
"BottomBlock" => $this->bottomBlock->getId() . (($meta = $this->bottomBlock->getDamage())?'':':' . $meta), "RoadWidth" => $this->roadWidth, "PlotSize" => $this->plotSize, "GroundHeight" => $this->groundHeight]);
}
private function parseBlock(&$array, $key, $default){
if(isset($array[$key])){
$id = $array[$key];
if(is_numeric($id)){
$block = new Block($id);
}
else{
$split = explode(":", $id);
if(count($split) === 2 and is_numeric($split[0]) and is_numeric($split[1])){
$block = new Block($split[0], $split[1]);
}
else{
$block = $default;
}
}
}
else{
$block = $default;
}
return $block;
}
private function parseNumber(&$array, $key, $default){
if(isset($array[$key]) and is_numeric($array[$key])){
return $array[$key];
}
else{
return $default;
}
}
public function getName(){
return "skyblock";
}
public function getSettings(){
return $this->settings;
}
public function init(ChunkManager $level, Random $random){
$this->level = $level;
$this->random = $random;
}
public function generateChunk($chunkX, $chunkZ){
$shape = $this->getShape($chunkX << 4, $chunkZ << 4);
$chunk = $this->level->getChunk($chunkX, $chunkZ);
$chunk->setGenerated();
$bottomBlockId = $this->bottomBlock->getId();
$bottomBlockMeta = $this->bottomBlock->getDamage();
$plotFillBlockId = $this->plotFillBlock->getId();
$plotFillBlockMeta = $this->plotFillBlock->getDamage();
$plotFloorBlockId = $this->plotFloorBlock->getId();
$plotFloorBlockMeta = $this->plotFloorBlock->getDamage();
$roadBlockId = $this->roadBlock->getId();
$roadBlockMeta = $this->roadBlock->getDamage();
$wallBlockId = $this->wallBlock->getId();
$wallBlockMeta = $this->wallBlock->getDamage();
$groundHeight = $this->groundHeight;
for($Z = 0; $Z < 16; ++$Z){
for($X = 0; $X < 16; ++$X){
$chunk instanceof FullChunk;
}
}
$chunk->setX($chunkX);
$chunk->setZ($chunkZ);
$this->level->setChunk($chunkX, $chunkZ, $chunk);
$this->populateChunk($chunkX, $chunkZ);
}
public function getShape($x, $z){
$totalSize = $this->plotSize + $this->roadWidth;
if($x >= 0){
$X = $x % $totalSize;
}
else{
$X = $totalSize - abs($x % $totalSize);
}
if($z >= 0){
$Z = $z % $totalSize;
}
else{
$Z = $totalSize - abs($z % $totalSize);
}
$startX = $X;
$shape = new \SplFixedArray(256);
for($z = 0; $z < 16; $z++, $Z++){
if($Z === $totalSize){
$Z = 0;
}
if($Z < $this->plotSize){
$typeZ = self::PLOT;
}
else{
$typeZ = self::ROAD;
}
for($x = 0, $X = $startX; $x < 16; $x++, $X++){
if($X === $totalSize) $X = 0;
if($X < $this->plotSize){
$typeX = self::PLOT;
}
else{
$typeX = self::ROAD;
}
if($typeX === $typeZ){
$type = $typeX;
}
elseif($typeX === self::PLOT){
$type = $typeZ;
}
elseif($typeZ === self::PLOT){
$type = $typeX;
}
else{
$type = self::ROAD;
}
if($X == floor($this->plotSize / 2) && $Z == floor($this->plotSize / 2)){
$type = self::ISLAND;
}
$shape[($z << 4) | $x] = $type;
}
}
return $shape;
}
public function populateChunk($chunkX, $chunkZ){
$island = new SkyBlockStructure($this);
$island->populate($this->level, $chunkX, $chunkZ, $this->random);
}
public function getSpawn(){
return new Vector3(0, $this->groundHeight, 0);
}
}<?php
namespace MyPlot;
use pocketmine\block\Block;
class PlotLevelSettings
{
/** @var string */
public $name;
/** @var Block */
public $roadBlock, $wallBlock, $plotFloorBlock, $plotFillBlock, $bottomBlock;
/** @var int */
public $roadWidth, $plotSize, $groundHeight, $maxPlotsPerPlayer, $claimPrice, $clearPrice,
$disposePrice, $resetPrice;
public $restrictEntityMovement;
public function __construct($name, $settings = []) {
$this->name = $name;
if (!empty($settings)) {
$this->roadBlock = self::parseBlock($settings, "RoadBlock", new Block(5));
$this->wallBlock = self::parseBlock($settings, "WallBlock", new Block(44));
$this->plotFloorBlock = self::parseBlock($settings, "PlotFloorBlock", new Block(2));
$this->plotFillBlock = self::parseBlock($settings, "PlotFillBlock", new Block(3));
$this->bottomBlock = self::parseBlock($settings, "BottomBlock", new Block(7));
$this->roadWidth = self::parseNumber($settings, "RoadWidth", 7);
$this->plotSize = self::parseNumber($settings, "PlotSize", 22);
$this->groundHeight = self::parseNumber($settings, "GroundHeight", 64);
$this->maxPlotsPerPlayer = self::parseNumber($settings, "MaxPlotsPerPlayer", 2);
$this->claimPrice = self::parseNumber($settings, "ClaimPrice", 0);
$this->clearPrice = self::parseNumber($settings, "ClearPrice", 0);
$this->disposePrice = self::parseNumber($settings, "DisposePrice", 0);
$this->resetPrice = self::parseNumber($settings, "ResetPrice", 0);
$this->restrictEntityMovement = self::parseBool($settings, "RestrictEntityMovement", true);
}
}
private static function parseBlock(&$array, $key, $default) {
if (isset($array[$key])) {
$id = $array[$key];
if (is_numeric($id)) {
$block = new Block($id);
} else {
$split = explode(":", $id);
if (count($split) === 2 and is_numeric($split[0]) and is_numeric($split[1])) {
$block = new Block($split[0], $split[1]);
} else {
$block = $default;
}
}
} else {
$block = $default;
}
return $block;
}
private static function parseNumber(&$array, $key, $default) {
if (isset($array[$key]) and is_numeric($array[$key])) {
return $array[$key];
} else {
return $default;
}
}
private static function parseBool(&$array, $key, $default) {
if (isset($array[$key]) and is_bool($array[$key])) {
return $array[$key];
} else {
return $default;
}
}
}<?php
namespace MyPlot\provider;
use MyPlot\MyPlot;
use MyPlot\Plot;
abstract class DataProvider
{
/** @var Plot[] */
private $cache = [];
/** @var int */
private $cacheSize;
/** @var MyPlot */
protected $plugin;
public function __construct(MyPlot $plugin, $cacheSize = 0) {
$this->plugin = $plugin;
$this->cacheSize = $cacheSize;
}
protected final function cachePlot(Plot $plot) {
if ($this->cacheSize > 0) {
$key = $plot->levelName . ';' . $plot->X . ';' . $plot->Z;
if (isset($this->cache[$key])) {
unset($this->cache[$key]);
} elseif($this->cacheSize <= count($this->cache)) {
array_pop($this->cache);
}
$this->cache = array_merge(array($key => clone $plot), $this->cache);
}
}
protected final function getPlotFromCache($levelName, $X, $Z) {
if ($this->cacheSize > 0) {
$key = $levelName . ';' . $X . ';' . $Z;
if (isset($this->cache[$key])) {
return $this->cache[$key];
}
}
return null;
}
/**
* @param Plot $plot
* @return bool
*/
public abstract function savePlot(Plot $plot);
/**
* @param Plot $plot
* @return bool
*/
public abstract function deletePlot(Plot $plot);
/**
* @param string $levelName
* @param int $X
* @param int $Z
* @return Plot
*/
public abstract function getPlot($levelName, $X, $Z);
/**
* @param string $owner
* @param string $levelName
* @return Plot[]
*/
public abstract function getPlotsByOwner($owner, $levelName = "");
/**
* @param string $levelName
* @param int $limitXZ
* @return Plot|null
*/
public abstract function getNextFreePlot($levelName, $limitXZ = 0);
public abstract function close();
}<?php
namespace MyPlot\provider;
use pocketmine\Player;
use PocketMoney\PocketMoney;
class PocketMoneyProvider implements EconomyProvider
{
private $plugin;
public function __construct(PocketMoney $plugin) {
$this->plugin = $plugin;
}
public function reduceMoney(Player $player, $amount) {
$money = $this->plugin->getMoney($player->getName());
if ($money === false or ($money - $amount) < 0) {
return false;
}
return $this->plugin->setMoney($player->getName(), $money - $amount);
}
}<?php
namespace MyPlot\provider;
use MyPlot\MyPlot;
use MyPlot\Plot;
use SQLite3;
use SQLite3Stmt;
class SQLiteDataProvider extends DataProvider
{
/** @var SQLite3 */
private $db;
/** @var SQLite3Stmt */
private $sqlGetPlot, $sqlSavePlot, $sqlSavePlotById, $sqlRemovePlot,
$sqlRemovePlotById, $sqlGetPlotsByOwner, $sqlGetPlotsByOwnerAndLevel,
$sqlGetExistingXZ;
public function __construct(MyPlot $plugin, $cacheSize = 0) {
parent::__construct($plugin, $cacheSize);
$this->db = new SQLite3($this->plugin->getDataFolder() . "plots.db");
$this->db->exec(
"CREATE TABLE IF NOT EXISTS plots
(id INTEGER PRIMARY KEY AUTOINCREMENT, level TEXT, X INTEGER, Z INTEGER, name TEXT,
owner TEXT, helpers TEXT, biome TEXT)"
);
$this->sqlGetPlot = $this->db->prepare(
"SELECT id, name, owner, helpers, biome FROM plots WHERE level = :level AND X = :X AND Z = :Z"
);
$this->sqlSavePlot = $this->db->prepare(
"INSERT OR REPLACE INTO plots (id, level, X, Z, name, owner, helpers, biome) VALUES
((select id from plots where level = :level AND X = :X AND Z = :Z),
:level, :X, :Z, :name, :owner, :helpers, :biome);"
);
$this->sqlSavePlotById = $this->db->prepare(
"UPDATE plots SET name = :name, owner = :owner, helpers = :helpers, biome = :biome WHERE id = :id"
);
$this->sqlRemovePlot = $this->db->prepare(
"DELETE FROM plots WHERE level = :level AND X = :X AND Z = :Z"
);
$this->sqlRemovePlotById = $this->db->prepare("DELETE FROM plots WHERE id = :id");
$this->sqlGetPlotsByOwner = $this->db->prepare("SELECT * FROM plots WHERE owner = :owner");
$this->sqlGetPlotsByOwnerAndLevel = $this->db->prepare(
"SELECT * FROM plots WHERE owner = :owner AND level = :level"
);
$this->sqlGetExistingXZ = $this->db->prepare(
"SELECT X, Z FROM plots WHERE (
level = :level
AND (
(abs(X) == :number AND abs(Z) <= :number) OR
(abs(Z) == :number AND abs(X) <= :number)
)
)"
);
}
public function close() {
$this->db->close();
}
public function savePlot(Plot $plot) {
$helpers = implode(",", $plot->helpers);
if ($plot->id >= 0) {
$stmt = $this->sqlSavePlotById;
$stmt->bindValue(":id", $plot->id, SQLITE3_INTEGER);
} else {
$stmt = $this->sqlSavePlot;
$stmt->bindValue(":level", $plot->levelName, SQLITE3_TEXT);
$stmt->bindValue(":X", $plot->X, SQLITE3_INTEGER);
$stmt->bindValue(":Z", $plot->Z, SQLITE3_INTEGER);
}
$stmt->bindValue(":name", $plot->name, SQLITE3_TEXT);
$stmt->bindValue(":owner", $plot->owner, SQLITE3_TEXT);
$stmt->bindValue(":helpers", $helpers, SQLITE3_TEXT);
$stmt->bindValue(":biome", $plot->biome, SQLITE3_TEXT);
$stmt->reset();
$result = $stmt->execute();
if ($result === false) {
return false;
}
$this->cachePlot($plot);
return true;
}
public function deletePlot(Plot $plot) {
if ($plot->id >= 0) {
$stmt = $this->sqlRemovePlotById;
$stmt->bindValue(":id", $plot->id, SQLITE3_INTEGER);
} else {
$stmt = $this->sqlRemovePlot;
$stmt->bindValue(":level", $plot->levelName, SQLITE3_TEXT);
$stmt->bindValue(":X", $plot->X, SQLITE3_INTEGER);
$stmt->bindValue(":Z", $plot->Z, SQLITE3_INTEGER);
}
$stmt->reset();
$result = $stmt->execute();
if ($result === false) {
return false;
}
$plot = new Plot($plot->levelName, $plot->X, $plot->Z);
$this->cachePlot($plot);
return true;
}
public function getPlot($levelName, $X, $Z) {
if ($plot = $this->getPlotFromCache($levelName, $X, $Z)) {
return $plot;
}
$this->sqlGetPlot->bindValue(":level", $levelName, SQLITE3_TEXT);
$this->sqlGetPlot->bindValue(":X", $X, SQLITE3_INTEGER);
$this->sqlGetPlot->bindValue(":Z", $Z, SQLITE3_INTEGER);
$this->sqlGetPlot->reset();
$result = $this->sqlGetPlot->execute();
if ($val = $result->fetchArray(SQLITE3_ASSOC)) {
if ($val["helpers"] === null or $val["helpers"] === "") {
$helpers = [];
} else {
$helpers = explode(",", (string)$val["helpers"]);
}
$plot = new Plot($levelName, $X, $Z, (string)$val["name"], (string)$val["owner"],
$helpers, (string)$val["biome"], (int)$val["id"]);
} else {
$plot = new Plot($levelName, $X, $Z);
}
$this->cachePlot($plot);
return $plot;
}
public function getPlotsByOwner($owner, $levelName = "") {
if ($levelName === "") {
$stmt = $this->sqlGetPlotsByOwner;
} else {
$stmt = $this->sqlGetPlotsByOwnerAndLevel;
$stmt->bindValue(":level", $levelName, SQLITE3_TEXT);
}
$stmt->bindValue(":owner", $owner, SQLITE3_TEXT);
$plots = [];
$stmt->reset();
$result = $stmt->execute();
while ($val = $result->fetchArray(SQLITE3_ASSOC)) {
$helpers = explode(",", (string)$val["helpers"]);
$plots[] = new Plot((string)$val["level"], (int)$val["X"], (int)$val["Z"], (string)$val["name"],
(string)$val["owner"], $helpers, (string)$val["biome"], (int)$val["id"]);
}
usort($plots, function ($plot1, $plot2) {
/** @var Plot $plot1 */
/** @var Plot $plot2 */
return strcmp($plot1->levelName, $plot2->levelName);
});
return $plots;
}
public function getNextFreePlot($levelName, $limitXZ = 0) {
$this->sqlGetExistingXZ->bindValue(":level", $levelName, SQLITE3_TEXT);
$i = 0;
$this->sqlGetExistingXZ->bindParam(":number", $i, SQLITE3_INTEGER);
for (; $limitXZ <= 0 or $i < $limitXZ; $i++) {
$this->sqlGetExistingXZ->reset();
$result = $this->sqlGetExistingXZ->execute();
$plots = [];
while ($val = $result->fetchArray(SQLITE3_NUM)) {
$plots[$val[0]][$val[1]] = true;
}
if (count($plots) === max(1, 8 * $i)) {
continue;
}
if ($ret = self::findEmptyPlotSquared(0, $i, $plots)) {
list($X, $Z) = $ret;
$plot = new Plot($levelName, $X, $Z);
$this->cachePlot($plot);
return $plot;
}
for ($a = 1; $a < $i; $a++) {
if ($ret = self::findEmptyPlotSquared($a, $i, $plots)) {
list($X, $Z) = $ret;
$plot = new Plot($levelName, $X, $Z);
$this->cachePlot($plot);
return $plot;
}
}
if ($ret = self::findEmptyPlotSquared($i, $i, $plots)) {
list($X, $Z) = $ret;
$plot = new Plot($levelName, $X, $Z);
$this->cachePlot($plot);
return $plot;
}
}
return null;
}
private static function findEmptyPlotSquared($a, $b, &$plots) {
if (!isset($plots[$a][$b])) return array($a, $b);
if (!isset($plots[$b][$a])) return array($b, $a);
if ($a !== 0) {
if (!isset($plots[-$a][$b])) return array(-$a, $b);
if (!isset($plots[$b][-$a])) return array($b, -$a);
}
if ($b !== 0) {
if (!isset($plots[-$b][$a])) return array(-$b, $a);
if (!isset($plots[$a][-$b])) return array($a, -$b);
}
if ($a | $b === 0) {
if (!isset($plots[-$a][-$b])) return array(-$a, -$b);
if (!isset($plots[-$b][-$a])) return array(-$b, -$a);
}
return null;
}
}<?php
namespace MyPlot\provider;
use pocketmine\Player;
interface EconomyProvider
{
/**
* @param Player $player
* @param int $amount
* @return bool
*/
public function reduceMoney(Player $player, $amount);
}<?php
namespace MyPlot\provider;
use onebone\economyapi\EconomyAPI;
use pocketmine\Player;
class EconomySProvider implements EconomyProvider
{
public function reduceMoney(Player $player, $amount) {
if ($amount == 0) {
return true;
} elseif ($amount < 0) {
$ret = EconomyAPI::getInstance()->addMoney($player, -$amount, true);
} else {
$ret = EconomyAPI::getInstance()->reduceMoney($player, $amount, true);
}
return ($ret === EconomyAPI::RET_SUCCESS);
}
}<?php
namespace MyPlot;
use MyPlot\provider\EconomySProvider;
use MyPlot\provider\PocketMoneyProvider;
use MyPlot\task\ClearPlotTask;
use pocketmine\event\level\LevelLoadEvent;
use pocketmine\event\Listener;
use pocketmine\lang\BaseLang;
use pocketmine\level\generator\biome\Biome;
use pocketmine\level\Position;
use pocketmine\permission\Permission;
use pocketmine\plugin\PluginBase;
use pocketmine\level\generator\Generator;
use pocketmine\Player;
use MyPlot\provider\DataProvider;
use pocketmine\level\Level;
use MyPlot\provider\SQLiteDataProvider;
use MyPlot\provider\EconomyProvider;
class MyPlot extends PluginBase implements Listener
{
/** @var MyPlot */
private static $instance;
/** @var PlotLevelSettings[] */
private $levels = [];
/** @var DataProvider */
private $dataProvider = null;
/** @var EconomyProvider */
private $economyProvider = null;
/** @var BaseLang */
private $baseLang = null;
/**
* @api
* @return MyPlot
*/
public static function getInstance() {
return self::$instance;
}
/**
* @api
* @return BaseLang
*/
public function getLanguage() {
return $this->baseLang;
}
/**
* Returns the DataProvider that is being used
*
* @api
* @return DataProvider
*/
public function getProvider() {
return $this->dataProvider;
}
/**
* Returns the EconomyProvider that is being used
*
* @api
* @return EconomyProvider
*/
public function getEconomyProvider() {
return $this->economyProvider;
}
/**
* Returns a PlotLevelSettings object which contains all the settings of a level
*
* @api
* @param string $levelName
* @return PlotLevelSettings|null
*/
public function getLevelSettings($levelName) {
if (isset($this->levels[$levelName])) {
return $this->levels[$levelName];
}
return null;
}
/**
* Checks if a plot level is loaded
*
* @api
* @param string $levelName
* @return bool
*/
public function isLevelLoaded($levelName) {
return isset($this->levels[$levelName]);
}
/**
* Generate a new plot level with optional settings
*
* @api
* @param string $levelName
* @param array $settings
* @return bool
*/
public function generateLevel($levelName, $settings = []) {
if ($this->getServer()->isLevelGenerated($levelName) === true) {
return false;
}
if (empty($settings)) {
$settings = $this->getConfig()->get("DefaultWorld");
}
$settings = [
"preset" => json_encode($settings)
];
return $this->getServer()->generateLevel($levelName, null, MyPlotGenerator::class, $settings);
}
/**
* Saves provided plot if changed
*
* @api
* @param Plot $plot
* @return bool
*/
public function savePlot(Plot $plot) {
return $this->dataProvider->savePlot($plot);
}
/**
* Get all the plots a player owns (in a certain level if $levelName is provided)
*
* @api
* @param string $username
* @param string $levelName
* @return Plot[]
*/
public function getPlotsOfPlayer($username, $levelName = "") {
return $this->dataProvider->getPlotsByOwner($username, $levelName);
}
/**
* Get the next free plot in a level
*
* @api
* @param string $levelName
* @param int $limitXZ
* @return Plot|null
*/
public function getNextFreePlot($levelName, $limitXZ = 0) {
return $this->dataProvider->getNextFreePlot($levelName, $limitXZ);
}
/**
* Finds the plot at a certain position or null if there is no plot at that position
*
* @api
* @param Position $position
* @return Plot|null
*/
public function getPlotByPosition(Position $position) {
$x = $position->x;
$z = $position->z;
$levelName = $position->level->getName();
$plotLevel = $this->getLevelSettings($levelName);
if ($plotLevel === null) {
return null;
}
$plotSize = $plotLevel->plotSize;
$roadWidth = $plotLevel->roadWidth;
$totalSize = $plotSize + $roadWidth;
if ($x >= 0) {
$X = floor($x / $totalSize);
$difX = $x % $totalSize;
} else {
$X = ceil(($x - $plotSize + 1) / $totalSize);
$difX = abs(($x - $plotSize + 1) % $totalSize);
}
if ($z >= 0) {
$Z = floor($z / $totalSize);
$difZ = $z % $totalSize;
} else {
$Z = ceil(($z - $plotSize + 1) / $totalSize);
$difZ = abs(($z - $plotSize + 1) % $totalSize);
}
if (($difX > $plotSize - 1) or ($difZ > $plotSize - 1)) {
return null;
}
return $this->dataProvider->getPlot($levelName, $X, $Z);
}
/**
* Get the begin position of a plot
*
* @api
* @param Plot $plot
* @return Position|null
*/
public function getPlotPosition(Plot $plot) {
$plotLevel = $this->getLevelSettings($plot->levelName);
if ($plotLevel === null) {
return null;
}
$plotSize = $plotLevel->plotSize;
$roadWidth = $plotLevel->roadWidth;
$totalSize = $plotSize + $roadWidth;
$x = $totalSize * $plot->X;
$z = $totalSize * $plot->Z;
$level = $this->getServer()->getLevelByName($plot->levelName);
return new Position($x, $plotLevel->groundHeight, $z, $level);
}
/**
* Teleport a player to a plot
*
* @api
* @param Player $player
* @param Plot $plot
* @return bool
*/
public function teleportPlayerToPlot(Player $player, Plot $plot) {
$plotLevel = $this->getLevelSettings($plot->levelName);
if ($plotLevel === null) {
return false;
}
$pos = $this->getPlotPosition($plot);
$plotSize = $plotLevel->plotSize;
$pos->x += floor($plotSize / 2);
$pos->z -= -88;
$pos->y += 5;
$player->teleport($pos);
return true;
}
/**
* Reset all the blocks inside a plot
*
* @api
* @param Plot $plot
* @param int $maxBlocksPerTick
* @return bool
*/
public function clearPlot(Plot $plot, $maxBlocksPerTick = 256) {
if (!$this->isLevelLoaded($plot->levelName)) {
return false;
}
$task = new ClearPlotTask($this, $plot, $maxBlocksPerTick);
$task->onRun(0);
return true;
}
/**
* Delete the plot data
*
* @param Plot $plot
* @return bool
*/
public function disposePlot(Plot $plot) {
return $this->dataProvider->deletePlot($plot);
}
/**
* Clear and dispose a plot
*
* @param Plot $plot
* @param int $maxBlocksPerTick
* @return bool
*/
public function resetPlot(Plot $plot, $maxBlocksPerTick = 256) {
if ($this->disposePlot($plot)) {
return $this->clearPlot($plot, $maxBlocksPerTick);
}
return false;
}
/**
* Changes the biome of a plot
*
* @api
* @param Plot $plot
* @param Biome $biome
* @return bool
*/
public function setPlotBiome(Plot $plot, Biome $biome) {
$plotLevel = $this->getLevelSettings($plot->levelName);
if ($plotLevel === null) {
return false;
}
$level = $this->getServer()->getLevelByName($plot->levelName);
$pos = $this->getPlotPosition($plot);
$plotSize = $plotLevel->plotSize;
$xMax = $pos->x + $plotSize;
$zMax = $pos->z + $plotSize;
$chunkIndexes = [];
for ($x = $pos->x; $x < $xMax; $x++) {
for ($z = $pos->z; $z < $zMax; $z++) {
$index = Level::chunkHash($x >> 4, $z >> 4);
if (!in_array($index, $chunkIndexes)) {
$chunkIndexes[] = $index;
}
$color = $biome->getColor();
$R = $color >> 16;
$G = ($color >> 8) & 0xff;
$B = $color & 0xff;
$level->setBiomeColor($x, $z, $R, $G, $B);
}
}
foreach ($chunkIndexes as $index) {
Level::getXZ($index, $X, $Z);
$chunk = $level->getChunk($X, $Z);
foreach ($level->getChunkPlayers($X, $Z) as $player) {
$player->onChunkChanged($chunk);
}
}
$plot->biome = $biome->getName();
$this->dataProvider->savePlot($plot);
return true;
}
/**
* Returns the PlotLevelSettings of all the loaded levels
*
* @api
* @return string[]
*/
public function getPlotLevels() {
return $this->levels;
}
/**
* Get the maximum number of plots a player can claim
*
* @param Player $player
* @return int
*/
public function getMaxPlotsOfPlayer(Player $player) {
if ($player->hasPermission("myplot.claimplots.unlimited"))
return PHP_INT_MAX;
/** @var Permission[] $perms */
$perms = array_merge($this->getServer()->getPluginManager()->getDefaultPermissions($player->isOp()),
$player->getEffectivePermissions());
$perms = array_filter($perms, function ($name) {
return (substr($name, 0, 18) === "myplot.claimplots.");
}, ARRAY_FILTER_USE_KEY);
if (count($perms) == 0)
return 0;
krsort($perms);
foreach ($perms as $name => $perm) {
$maxPlots = substr($name, 18);
if (is_numeric($maxPlots)) {
return $maxPlots;
}
}
return 0;
}
/* -------------------------- Non-API part -------------------------- */
public function onEnable() {
$this->getServer()->getPluginManager()->registerEvents($this, $this);
$this->getLogger()->info("Loading MyPlot");
self::$instance = $this;
$this->saveDefaultConfig();
$this->reloadConfig();
@mkdir($this->getDataFolder());
@mkdir($this->getDataFolder() . "worlds");
Generator::addGenerator(MyPlotGenerator::class, "myplot");
$lang = $this->getConfig()->get("language", BaseLang::FALLBACK_LANGUAGE);
$this->baseLang = new BaseLang($lang, $this->getFile() . "resources/");
// Initialize DataProvider
$cacheSize = $this->getConfig()->get("PlotCacheSize");
switch (strtolower($this->getConfig()->get("DataProvider"))) {
case "sqlite":
default:
$this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
break;
}
// Initialize EconomyProvider
if ($this->getConfig()->get("UseEconomy") == true) {
if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
$this->economyProvider = new EconomySProvider();
} elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
$this->economyProvider = new PocketMoneyProvider($plugin);
}
}
$eventListener = new EventListener($this);
$this->getServer()->getPluginManager()->registerEvents($eventListener, $this);
foreach($this->getServer()->getLevels() as $level) {
$eventListener->onLevelLoad(new LevelLoadEvent($level));
}
$this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
}
public function addLevelSettings($levelName, PlotLevelSettings $settings) {
$this->levels[$levelName] = $settings;
}
public function unloadLevelSettings($levelName) {
if (isset($this->levels[$levelName])) {
unset($this->levels[$levelName]);
return true;
}
return false;
}
public function onDisable() {
if ($this->dataProvider !== null) {
$this->dataProvider->close();
}
}
}
<?php
namespace MyPlot;
use pocketmine\block\Sapling;
use pocketmine\event\player\PlayerMoveEvent;
use pocketmine\Player;
use pocketmine\event\block\BlockUpdateEvent;
use pocketmine\event\entity\EntityExplodeEvent;
use pocketmine\event\entity\EntityMotionEvent;
use pocketmine\event\Listener;
use pocketmine\event\level\LevelLoadEvent;
use pocketmine\event\level\LevelUnloadEvent;
use pocketmine\utils\Config;
use pocketmine\event\block\BlockPlaceEvent;
use pocketmine\event\block\BlockBreakEvent;
use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\utils\TextFormat;
use pocketmine\block\Lava;
use pocketmine\block\Water;
class EventListener implements Listener
{
/** @var MyPlot */
private $plugin;
public function __construct(MyPlot $plugin){
$this->plugin = $plugin;
$plugin->getServer()->getPluginManager()->registerEvents($this, $plugin);
}
public function onLevelLoad(LevelLoadEvent $event) {
if ($event->getLevel()->getProvider()->getGenerator() === "myplot") {
$settings = $event->getLevel()->getProvider()->getGeneratorOptions();
if (isset($settings["preset"]) === false or $settings["preset"] === "") {
return;
}
$settings = json_decode($settings["preset"], true);
if ($settings === false) {
return;
}
$levelName = $event->getLevel()->getName();
$filePath = $this->plugin->getDataFolder() . "worlds/" . $levelName . ".yml";
$config = $this->plugin->getConfig();
$default = [
"MaxPlotsPerPlayer" => $config->getNested("DefaultWorld.MaxPlotsPerPlayer"),
"RestrictEntityMovement" => $config->getNested("DefaultWorld.RestrictEntityMovement"),
"ClaimPrice" => $config->getNested("DefaultWorld.ClaimPrice"),
"ClearPrice" => $config->getNested("DefaultWorld.ClearPrice"),
"DisposePrice" => $config->getNested("DefaultWorld.DisposePrice"),
"ResetPrice" => $config->getNested("DefaultWorld.ResetPrice"),
];
$config = new Config($filePath, Config::YAML, $default);
foreach (array_keys($default) as $key) {
$settings[$key] = $config->get($key);
}
$this->plugin->addLevelSettings($levelName, new PlotLevelSettings($levelName, $settings));
}
}
public function onLevelUnload(LevelUnloadEvent $event) {
$levelName = $event->getLevel()->getName();
$this->plugin->unloadLevelSettings($levelName);
}
public function onBlockPlace(BlockPlaceEvent $event) {
$this->onEventOnBlock($event);
}
public function onBlockBreak(BlockBreakEvent $event) {
$this->onEventOnBlock($event);
}
public function onPlayerInteract(PlayerInteractEvent $event) {
$this->onEventOnBlock($event);
}
public function onExplosion(EntityExplodeEvent $event) {
$levelName = $event->getEntity()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName))
return;
$plot = $this->plugin->getPlotByPosition($event->getPosition());
if ($plot === null) {
$event->setCancelled(true);
return;
}
$beginPos = $this->plugin->getPlotPosition($plot);
$endPos = clone $beginPos;
$plotSize = $this->plugin->getLevelSettings($levelName)->plotSize;
$endPos->x += $plotSize;
$endPos->z += $plotSize;
$blocks = array_filter($event->getBlockList(), function($block) use($beginPos, $endPos) {
if ($block->x >= $beginPos->x and $block->z >= $beginPos->z and $block->x < $endPos->x and $block->z < $endPos->z) {
return true;
}
return false;
});
$event->setBlockList($blocks);
}
/**
* @param BlockPlaceEvent|BlockBreakEvent|PlayerInteractEvent $event
*/
private function onEventOnBlock($event) {
$levelName = $event->getBlock()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName)) {
return;
}
$plot = $this->plugin->getPlotByPosition($event->getBlock());
if ($plot !== null) {
$username = $event->getPlayer()->getName();
if ($plot->owner == $username or $plot->isHelper($username) or $event->getPlayer()->hasPermission("myplot.admin.build.plot")) {
if (!($event instanceof PlayerInteractEvent and $event->getBlock() instanceof Sapling))
return;
/*
* Prevent growing a tree near the edge of a plot
* so the leaves won't go outside the plot
*/
$block = $event->getBlock();
$maxLengthLeaves = (($block->getDamage() & 0x07) == Sapling::SPRUCE) ? 3 : 2;
$beginPos = $this->plugin->getPlotPosition($plot);
$endPos = clone $beginPos;
$beginPos->x += $maxLengthLeaves;
$beginPos->z += $maxLengthLeaves;
$plotSize = $this->plugin->getLevelSettings($levelName)->plotSize;
$endPos->x += $plotSize - $maxLengthLeaves;
$endPos->z += $plotSize - $maxLengthLeaves;
if ($block->x >= $beginPos->x and $block->z >= $beginPos->z and $block->x < $endPos->x and $block->z < $endPos->z) {
return;
}
}
} elseif ($event->getPlayer()->hasPermission("myplot.admin.build.road")) {
return;
}
$event->setCancelled(true);
}
public function onEntityMotion(EntityMotionEvent $event) {
$levelName = $event->getEntity()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName))
return;
$settings = $this->plugin->getLevelSettings($levelName);
if ($settings->restrictEntityMovement and !($event->getEntity() instanceof Player)) {
$event->setCancelled(true);
}
}
public function onPlayerMove(PlayerMoveEvent $event) {
if (!$this->plugin->getConfig()->get("ShowPlotPopup", true))
return;
$levelName = $event->getPlayer()->getLevel()->getName();
if (!$this->plugin->isLevelLoaded($levelName))
return;
$plot = $this->plugin->getPlotByPosition($event->getTo());
if ($plot !== null and $plot !== $this->plugin->getPlotByPosition($event->getFrom())) {
$plotName = TextFormat::GREEN . $plot;
$popup = $this->plugin->getLanguage()->translateString("popup", [$plotName]);
if ($plot->owner != "") {
$owner = TextFormat::GREEN . $plot->owner;
$ownerPopup = $this->plugin->getLanguage()->translateString("popup.owner", [$owner]);
$paddingSize = floor((strlen($popup) - strlen($ownerPopup)) / 2);
$paddingPopup = str_repeat(" ", max(0, -$paddingSize));
$paddingOwnerPopup = str_repeat(" ", max(0, $paddingSize));
$popup = TextFormat::WHITE . $paddingPopup . $popup . "\n" .
TextFormat::WHITE . $paddingOwnerPopup . $ownerPopup;
} else {
$ownerPopup = $this->plugin->getLanguage()->translateString("popup.available");
$paddingSize = floor((strlen($popup) - strlen($ownerPopup)) / 2);
$paddingPopup = str_repeat(" ", max(0, -$paddingSize));
$paddingOwnerPopup = str_repeat(" ", max(0, $paddingSize));
$popup = TextFormat::WHITE . $paddingPopup . $popup . "\n" .
TextFormat::WHITE . $paddingOwnerPopup . $ownerPopup;
}
$event->getPlayer()->sendMessage($popup);
}
}
}
name: SkyBlock
main: MyPlot\MyPlot
version: 2.0
load: STARTUP
api: 2.0.0
author: Wies and Exxarion
description: Plot and protection plugin
softdepend: [EconomyAPI, PocketMoney]
permissions:
myplot.command:
description: Allows users to use myplot features
default: op
children:
myplot.command.help:
description: Displays all the available commands
default: true
myplot.command.claim:
description: Gives the claim command
default: true
myplot.command.info:
description: Gives the info command
default: true
myplot.command.generate:
description: Gives the generate command
default: op
myplot.command.addhelper:
description: Gives the addhelper command
default: true
myplot.command.removehelper:
description: Gives the removehelper command
default: true
myplot.command.auto:
description: Gives the auto command
default: true
myplot.command.play:
description: Play command
default: true
myplot.command.clear:
description: Gives the clear command
default: true
myplot.command.dispose:
description: Gives the dispose command
default: true
myplot.command.reset:
description: Gives the reset command
default: true
myplot.command.biome:
description: Gives the biome command
default: true
myplot.command.home:
description: Gives the home command
default: true
myplot.command.homes:
description: Gives the homes command
default: true
myplot.command.name:
description: Gives the name command
default: true
myplot.command.give:
description: Gives the give command
default: true
myplot.command.warp:
description: Gives the warp command
default: true
myplot.admin:
description: Grant administrator powers
default: op
children:
myplot.admin.clear:
description: Allow clear command on every plot
default: op
myplot.admin.dispose:
description: Allow dispose command on every plot
default: op
myplot.admin.reset:
description: Allow reset command on every plot
default: op
myplot.admin.addhelper:
description: Allow addhelper command on every plot
default: op
myplot.admin.removehelper:
description: Allow removehelper command on every plot
default: op
myplot.admin.build:
description: Allow player to build outside his own plots
default: op
children:
myplot.admin.build.plot:
description: Allow player to build on all plots
default: op
myplot.admin.build.road:
description: Allow player to build on the road
default: op
myplot.admin.name:
description: Allows player to change the name of every plot
default: op
myplot.admin.warp:
description: Allow player to warp to unclaimed plots
default: op
myplot.admin.biome:
description: Allow player to use the biome command on all plots
default: op
myplot.claimplots:
description: Allows players to claim X plots
default: false
children:
myplot.claimplots.2:
description: Allow player to claim 2 plots
default: true
myplot.claimplots.unlimited:
description: Allow player to claim unlimited plots
default: oplanguage: "it"
#Italian language pack created by AryToNeX
#Follow him on Twitter: @AryToNeX :D
#############################
# Messages for commands
#############################
messages:
# Add helper
addhelper-desc: "Aggiungi un aiutante in un lotto"
addhelper-alias: addh
addhelper-usage: "/p addhelper <nome giocatore>"
addhelper-notinplot: "Non sei dentro un lotto"
addhelper-notowner: "Non sei il proprietario di questo lotto"
addhelper-alreadyone: " e gi un aiutante di questo lotto"
addhelper-success: " adesso un aiutante di questo lotto"
addhelper-error: "Impossibile aggiungere un aiutante"
# Remove Helper
removehelper-desc: "Rimuovi un aiutante da un lotto"
removehelper-alias: delh
removehelper-notinplot: "Non sei dentro un lotto"
removehelper-notowner: "Non sei il proprietario di questo lotto"
removehelper-notone: " non un aiutante di questo lotto"
removehelper-success: " stato rimosso dagli aiutanti di questo lotto"
removehelper-error: "Impossibile rimuovere un aiutante"
# Claim
claim-desc: "Prendi propriet del lotto su cui sei sopra"
claim-alias: c
claim-notinplot: "Non sei dentro un lotto"
claim-notowner: "Non sei il proprietario di questo lotto"
claim-already: "Questo lotto gi stato preso da "
claim-max: "Hai gi raggiunto il numero massimo di lotti che puoi avere"
claim-money: "Non hai abbastanza soldi per comprare questo lotto"
claim-success: "Lotto privatizzato"
claim-error: "Impossibile privatizzare il lotto"
# Auto
auto-desc: "Teletrasporta nel prossimo lotto libero"
auto-alias: a
auto-notinworld: "Non sei in un mondo lotti"
auto-success: "Teletrasportato a "
auto-error: "Non sono disponibili lotti aperti qui"
# Dispose
dispose-desc: "Dispone il tuo lotto; ci lo rende privatizzabile da altri"
dispose-alias: d
dispose-notinplot: "Non sei dentro un lotto"
dispose-notowner: "Non sei il proprietario di questo lotto"
dispose-money: "Non hai abbastanza soldi per disporre questo lotto"
dispose-success: "Lotto disposto"
dispose-error: "Impossibile disporre il lotto"
# Reset
reset-desc: "Pulisce e dispone il tuo lotto"
reset-alias: r
reset-notinplot: "Non sei dentro un lotto"
reset-notowner: "Non sei il proprietario di questo lotto"
reset-money: "Non hai abbastanza soldi per resettare questo lotto"
reset-success: "Lotto resettato"
reset-error: "Impossibile resettare il lotto"
# Clear
clear-desc: "Pulisce il tuo lotto"
clear-alias: cl
clear-notinplot: "Non sei dentro un lotto"
clear-notowner: "Non sei il proprietario di questo lotto"
clear-money: "Non hai abbastanza soldi per pulire il lotto"
clear-success: "Lotto pulito"
clear-error: "Impossibile pulire il lotto"
# Biome
biome-desc: "Cambia il bioma del lotto"
biome-alias: a
biome-notinplot: "Non sei dentro un lotto"
biome-notowner: "Non sei il proprietario di questo lotto"
biome-success: "Bioma del lotto cambiato"
biome-invalid: "Quel bioma non esiste"
biome-possible: "I possibili biomi sono: "
biome-error: "Impossibile cambiare il bioma del lotto"
# Name
name-desc: "Imposta o cambia il nome del lotto"
name-alias: n
name-notinplot: "Non sei dentro un lotto"
name-notowner: "Non sei il proprietario di questo lotto"
name-success: "Il nome del lotto stato cambiato in "
name-error: "Impossibile cambiare il nome del lotto"
# Home
home-desc: "Vai al tuo lotto"
home-alias: h
home-noplots: "Non possiedi alcun lotto"
home-notexist: "Non possiedi alcun lotto con numero "
home-success: "Teletrasportato al tuo lotto "
home-error: "Impossibile teletrasportarti nel tuo lotto"
# Info
info-desc: "Mostra informazioni su un lotto"
info-alias: i
info-notinplot: "Non sei dentro un lotto"
info-about: "Info su "
info-name: "Nome: "
info-owner: "Proprietario: "
info-helpers: "Aiutanti: "
info-biome: "Bioma: "
# List
list-desc: "Lista i tuoi lotti"
list-alias: l
list-noplots: "Non possiedi alcun lotto"
list-plots: "Lotti che possiedi"
# Dutch language pack for MyPlot
# Created by Wiez
# Popup when entering a plot
popup=Dit is plot {%0}
popup.owner=Van {%0}
# /p info
command.name=plot
command.alias=p
command.desc=Beheer uw plots
command.usage=Gebruik: /plot <help|sub-cmd> [opties]
command.unknown=Onbekend commando. Gebruik /p help voor een lijst van alle commandos
subcommand.usage=Gebruik: {%0}
# Errors that are displayed when the player does something wrong, or the plugin screws up.
error=Oeps! Er is iets verkeerd gelopen
notinplot=Je staat niet in een plot
notowner=Dit is niet jouw plot
confirm=confirm
#The /p help Subcommand
help.name=help
help.desc=Toont het help menu
help.usage=/p help [pagina]
help.header=--- MyPlot help pagina {%0} van de {%1} ---
#The /p addhelper Subcommand
addhelper.name=addhelper
addhelper.alias=addh
addhelper.desc=Voeg een helper toe aan jouw plot
addhelper.usage=/p addhelper <speler>
addhelper.alreadyone={%0} is al een helper van jouw plot
addhelper.success={%0} is nu een helper van jouw plot
#The /p removehelper Subcommand
removehelper.name=removehelper
removehelper.alias=delh
removehelper.desc=Verwijder een helper van jouw plot
removehelper.usage=/p removehelper <player>
removehelper.notone={%0} is geen helper
removehelper.success={%0} is verwijderd als helper
#The /p claim Subcommand
claim.name=claim
claim.desc=Bemachtig het stukje land waar je op staat
claim.usage=/p claim [naam]
claim.yourplot=Dit is jouw plot al
claim.alreadyclaimed=Dit plot is al van {%0}
claim.maxplots=Je hebt de limiet bereikt van {%0} plots per speler
claim.nomoney=Je hebt niet genoeg geld om deze plot te bemachtigen
claim.success=Dit is nu jouw stukje land
#The /p auto Subcommand
auto.name=auto
auto.alias=a
auto.desc=Teleporteer naar de volgende vrije plot
auto.usage=/p auto
auto.notplotworld=Je bent niet in een plot wereld
auto.success=Je bent geteleporteerd naar plot ({%0}, {%1})
auto.noplots=Er zijn geen vrije plots gevonden
#The /p dispose Subcommand
dispose.name=dispose
dispose.desc=Doe afstand van deze plot
dispose.usage=/p dispose
dispose.confirm=Ben je zeker dat je niet meer de eigenaar wil zijn van plot {%0} ? Doe dan /p dispose confirm
dispose.nomoney=Je hebt hiervoor niet genoeg geld
dispose.success=Je bent niet meer de eigenaar van deze plot
#The /p reset Subcommand
reset.name=reset
reset.desc=Herstel een plot naar zijn begin toestand en doe er afstand van
reset.usage=/p reset
reset.confirm=Ben je zeker dat je plot {%0} wil resetten? Doe dan /p reset confirm
reset.nomoney=Je hebt niet genoeg geld om deze plot te resetten
reset.success=De plot is gereset
#The /p clear Subcommand
clear.name=clear
clear.desc=Herstelt deze plot naar zijn begin toestand
clear.usage=/p clear
clear.confirm=Ben je zeker dat je plot {%0} wil herstellen? Doe dan /p clear confirm
clear.nomoney=Je hebt niet genoeg geld om deze plot te herstellen
clear.success=De plot is hersteld
#The /p biome Subcommand
biome.name=biome
biome.desc=Verandert de biome in een ander type
biome.usage=/p biome [type]
biome.success=De biome van deze plot is veranderd naar {%0}
biome.invalid=Dat type bestaat niet
biome.possible=De mogelijke biome types zijn: {%0}
#The /p name Subcommand
name.name=name
name.desc=Verandert de naam van deze plot
name.usage=/p name <naam>
name.success=Deze plot noemt nu {%0}
#The /p home Subcommand
home.name=home
home.alias=h
home.desc=Ga naar een van je plots
home.usage=/p home [nummer]
home.noplots=Je hebt geen plots
home.notexist=Je hebt geen plot met nummer {%0}. Gebruik /p homes om al je plots te bekijken
home.success=Je bent geteleporteerd naar plot {%0}
home.error=Er is iets mis gegaan bij het teleporteren
#The /p homes Subcommand
homes.name=homes
homes.desc=Geeft een lijst van al jouw plots
homes.usage=/p homes
homes.noplots=Je hebt geen plots
homes.header=Jouw plots:
#The /p info Subcommand
info.name=info
info.alias=i
info.desc=Toont informatie over een plot
info.usage=/p info
info.about=Info van plot {%0}
info.plotname=Naam: {%0}
info.owner=Eigenaar: {%0}
info.helpers=Helpers: {%0}
info.biome=Biome: {%0}
#The /p generate Subcommand - Can only be used by OPs or players with the myplot.command.generate permission
generate.name=generate
generate.alias=gen
generate.desc=Genereert een nieuwe plot wereld
generate.usage=/p generate <naam>
generate.exists=Er bestaat al een wereld met naam {%0}
generate.success=De nieuwe plot wereld {%0} is gegenereerd
generate.error=De wereld kon niet gegenereerd worden
#The /p give Subcommand
give.name=give
give.desc=Geef je plot aan iemand anders
give.usage=/p give [speler]
give.notonline=Die speler is niet online
give.maxedout=Die speler heeft de maximale plot limiet bereikt
give.toself=Je kan de plot niet aan jezelf geven
give.confirm=Ben je zeker dat je plot {%0} wil geven aan {%1}? Doe dan /p give {%1} confirm
give.success=Je hebt jouw plot gegeven aan {%0}
give.received={%0} heeft plot {%1} aan jouw gegeven
# The /p warp Subcommand
warp.name=warp
warp.desc=Teleporteer naar een plot
warp.usage=/p warp <x;z>
warp.wrongid=De plot nummer moet in het formaat X;Z zijn
warp.notinplotworld=Je bent niet in een plot wereld
warp.unclaimed=Je kan niet naar een leeg plot teleporteren
warp.success=Je bent geteleporteerd naar {%0}
# Vietnamese language pack for MyPlot
# Created by Parroted - an old guy and QuangDo - play.fcavn.net
# Popup when entering a plot
popup=Bn vo o {%0}
popup.owner=S hu bi {%0}
popup.available=o ny cha c ch! Dng /sb claim
# /sb info
command.name=skyblock
command.alias=sb
command.desc=Nhn v qun l o
command.usage=Usage: /sb help
command.unknown=C g sai sai. Hy nhp /sb help xem cc lnh
subcommand.usage=Cch dng: {%0}
#Errors that are displayed when the player does something wrong, or the plugin screws up.
error=! C g khng n
notinplot=Bn ang khng ng trong mt o
notowner=Bn khng phi l ch ca o
confirm=confirm
#The /sb help Subcommand
help.name=help
help.desc=Xem danh sch tr gip
help.usage=/sb help
help.header=--- ang m trang hng dn {%0} of {%1} ---
#The /sb addhelper Subcommand
addhelper.name=addhelper
addhelper.alias=addh
addhelper.desc=Thm ngi vo o ca bn
addhelper.usage=/sb addhelper <player>
addhelper.alreadyone={%0} hin l helper ca o ny ri
addhelper.success=Chc mng {%0} tr thnh helper ca o
#The /sb removehelper Subcommand
removehelper.name=removehelper
removehelper.alias=rmh
removehelper.desc=ui helper khi o
removehelper.usage=/sb removehelper <player>
removehelper.notone={%0} khng phi l helper ca o
removehelper.success=Hin {%0} khng cn l helper ca o
#The /sb claim Subcommand
claim.name=claim
claim.desc=Mua o bn ang ng
claim.usage=/sb claim
claim.yourplot=Bn khng th mua v y l o ca bn .
claim.alreadyclaimed=o ny c ch {%0}
claim.maxplots=Bn s hu ti a {%0} o
claim.nomoney=Bn khng tin mua o ny
claim.success= mua o , chc bn chi game vui v MineAro
#The /sb auto Subcommand
auto.name=auto
#auto.alias=a
#auto.desc=i n o trng
#auto.usage=/sb auto
auto.notplotworld=Bn ang ngoi world skyblock
auto.success= i n ({%0}, {%1})
auto.noplots=Khng c o trng no quanh y
#The /sb play Subcommand
play.name=play
play.alias=p
play.desc=i n o
play.usage=/sb play
#The /sb dispose Subcommand
dispose.name=dispose
dispose.desc=B hn o ca bn
dispose.usage=/sb dispose
dispose.confirm=Bn c chc chn mun b o {%0} ? Nu chc , hy dng lnh /sb dispose confirm
dispose.nomoney=Bn khng tin b o
dispose.success=o b b
#The /sb name Subcommand
name.name=name
name.desc=t hoc i tn cho o ca bn
name.usage=/sb name <name>
name.success=Tn ca o ny c i thnh: {%0}
#The /sb home Subcommand
home.name=home
home.alias=h
home.desc=i v o ca bn
home.usage=/sb home [s]
home.noplots=Bn hin ang khng c o no
home.notexist=Bn khng s hu o s {%0}
home.success=ang i n o ca {%0}
home.error=Khng th i n o
#The /sb homes Subcommand
homes.name=homes
homes.desc=Danh sch o ca bn
homes.usage=/sb homes
homes.noplots=Bn khng s hu o no
homes.header=o ang hot ng:
#The /sb info Subcommand
info.name=info
info.alias=i
info.desc=Xem thng tin v o
info.usage=/sb info
info.about=Thng tin v {%0}
info.plotname=Tn: {%0}
info.owner=Ch: {%0}
info.helpers=Ngi gip: {%0}
info.biome=H sinh thi: {%0}
#The /sb generate Subcommand - Can only be used by OPs or players with the myplot.command.generate permission
generate.name=generate
generate.alias=gen
generate.desc=To ra mt world skyblock mi
generate.usage=/sb generate <tn>
generate.exists=World c tn {%0} c sn
generate.success= to ra world {%0}
generate.error=World khng th to ra c
#The /sb give Subcommand
give.name=give
give.desc=Cho o ca mnh cho ngi khc
give.usage=/sb give [tn ngi chi]
give.notonline=Ngi chi hin khng online
give.maxedout=Ngi chi c s o cho php
give.toself=Bn khng th t cho chnh mnh
give.confirm=Bn chc bn mun gi o {%0} cho {%1}? Nu chc chn hy dng lnh /sb give {%1} confirm
give.success=Bn gi o cho {%0} thnh cng
give.received={%0} cho bn o ca h, {%1}
# The /sb warp Subcommand
warp.name=warp
warp.desc=Di chuyn ti o
warp.usage=/p warp <id>
warp.wrongid=M o phi theo dng X;Z
warp.notinplotworld=Bn ang khng trong world skyblock
warp.unclaimed=Bn khng th di chuyn ti o cha c mua
warp.success=Bn ang di chuyn n o {%0}
# The language that should be used in MyPlot
# Available languages: eng, nl, vi
#
# English language pack by @Exxarion
# Dutch language pack by @Wies
# Vietnamese language pack by @Harry
#
language: vi
# The data provider where plot data is stored.
# There is currently only one data provider: sqlite.
DataProvider: sqlite
# Use an economy with MyPlot. This will allow for plot pricing such as claiming, clearing, etc.
# Currently supported economy plugins: Economy$, PocketMoney
# MyPlot will use any economy plugin found on the server.
# Be sure not to use more than 1 economy plugin!
UseEconomy: false
# Amount of plots to be cached.
# Increasing this number might improve performance, but also increase memory usage.
PlotCacheSize: 256
# When a player enters a plot, a popup with basic info will be shown
ShowPlotPopup: true
# Amount of blocks to reset per tick.
# Increasing this number will speed up '/p clear' and '/p reset' but also increases lag
ClearBlocksPerTick: 256
# These settings will be used when creating a new world.
DefaultWorld:
# Restrict entities (e.g. tnt) from moving except falling
# This will prevent things like tnt cannons ruining other plots
RestrictEntityMovement: true
# How much it costs to claim a plot (Economy must be set to 'true')
ClaimPrice: 0
# How much it costs to clear a plot (Economy must be set to 'true')
ClearPrice: 0
# How much it costs to dispose a plot (Economy must be set to 'true')
DisposePrice: 0
# How much it costs to reset a plot (Economy must be set to 'true')
ResetPrice: 0
MaxPlotsPerPlayer: 2
# The size of a plot
PlotSize: 100
# The height of a plot
GroundHeight: 64
# The width of the road
RoadWidth: 7
# The block that the road is made of (Default is Oak Planks)
RoadBlock: '5:0'
# The block that plot walls are made of (Default is Stone Slabs)
WallBlock: '44:0'
# The block used as the plot floor (Default is Grass)
PlotFloorBlock: '2:0'
# The block that fills the rest of the plot (Default is Dirt)
PlotFillBlock: '3:0'
# The block at the bottom (Default is Bedrock)
BottomBlock: '7:0'
# English language pack for MyPlot
# Created by Wiez & Exxarion
# Popup when entering a plot
popup=You entered plot {%0}
popup.owner=Owned by {%0}
popup.available=This plot is open! Use /p claim
# /p info
command.name=plot
command.alias=p
command.desc=Claim and manage your plots
command.usage=Usage: /plot <help|sub-cmd> [options]
command.unknown=Unknown command. Try /p help for a list of commands
subcommand.usage=Usage: {%0}
#Errors that are displayed when the player does something wrong, or the plugin screws up.
error=Whoops! Something went wrong
notinplot=You are not standing inside a plot
notowner=You do not own this plot
confirm=confirm
#The /p help Subcommand
help.name=help
help.desc=Shows the help menu
help.usage=/p help [page]
help.header=--- Showing MyPlot help page {%0} of {%1} ---
#The /p addhelper Subcommand
addhelper.name=addhelper
addhelper.alias=addh
addhelper.desc=Add a helper to your plot
addhelper.usage=/p addhelper <player>
addhelper.alreadyone={%0} is already a helper of this plot
addhelper.success={%0} is now a helper of this plot
#The /p removehelper Subcommand
removehelper.name=removehelper
removehelper.alias=delh
removehelper.desc=Remove a helper from your plot
removehelper.usage=/p removehelper <player>
removehelper.notone={%0} is not a helper
removehelper.success={%0} has been removed from plot helpers
#The /p claim Subcommand
claim.name=claim
claim.desc=Claim the plot that you are standing on
claim.usage=/p claim [name]
claim.yourplot=You have already claimed this plot
claim.alreadyclaimed=This plot is already claimed by {%0}
claim.maxplots=You reached the limit of {%0} plots per player
claim.nomoney=You do not have enough money to claim this plot
claim.success=You have successfully claimed this plot
#The /p dispose Subcommand
dispose.name=dispose
dispose.desc=Disposes your plot
dispose.usage=/p dispose
dispose.confirm=Are you sure you want to dispose plot {%0} ? If so, use /p dispose confirm
dispose.nomoney=You do not have enough money to dispose this plot
dispose.success=Plot disposed
#The /p reset Subcommand
reset.name=reset
reset.desc=Disposes and clears your plot
reset.usage=/p reset
reset.confirm=Are you sure you want to reset plot {%0} ? If so, use /p reset confirm
reset.nomoney=You do not have enough money to reset this plot
reset.success=Plot reset
#The /p clear Subcommand
clear.name=clear
clear.desc=Clears your plot
clear.usage=/p clear
clear.confirm=Are you sure you want to clear plot {%0} ? If so, use /p clear confirm
clear.nomoney=You do not have enough money to clear this plot
clear.success=Plot cleared
#The /p biome Subcommand
biome.name=biome
biome.desc=Changes your plot biome
biome.usage=/p biome [biome]
biome.success=Plot biome changed to {%0}
biome.invalid=That biome does not exist
biome.possible=Possible biomes are: {%0}
#The /p name Subcommand
name.name=name
name.desc=Sets or changes your plot name
name.usage=/p name <name>
name.success=Plot name changed to {%0}
#The /p home Subcommand
home.name=home
home.alias=h
home.desc=Travel to your plot
home.usage=/p home [number]
home.noplots=You do not own any plots
home.notexist=You do not own a plot with id {%0}
home.success=Teleported to plot {%0}
home.error=Could not travel to plot
#The /p homes Subcommand
homes.name=homes
homes.desc=Shows your claimed plots
homes.usage=/p homes
homes.noplots=You do not own any plots
homes.header=Plots you own:
#The /p info Subcommand
info.name=info
info.alias=i
info.desc=Shows information about a plot
info.usage=/p info
info.about=Info about plot {%0}
info.plotname=Name: {%0}
info.owner=Owner: {%0}
info.helpers=Helpers: {%0}
info.biome=Biome: {%0}
#The /p generate Subcommand - Can only be used by OPs or players with the myplot.command.generate permission
generate.name=generate
generate.alias=gen
generate.desc=Generate a new plot world
generate.usage=/p generate <name>
generate.exists=World with name {%0} already exists
generate.success=Successfully generated plot world {%0}
generate.error=World could not be generated
#The /p give Subcommand
give.name=give
give.desc=Give your plot to someone else
give.usage=/p give [name]
give.notonline=That player is not online
give.maxedout=That player has reached the maximum number of plots
give.toself=You cannot give a plot to yourself
give.confirm=Are you sure you want to give plot {%0} to player {%1}? If so, use /p give {%1} confirm
give.success=You have given the plot to {%0}
give.received={%0} gave you their plot, {%1}
# The /p warp Subcommand
warp.name=warp
warp.desc=Teleport to a plot
warp.usage=/p warp <id>
warp.wrongid=The plot id should be in the format X;Z
warp.notinplotworld=You are not in a plot world
warp.unclaimed=You cannot warp to an unclaimed plot
warp.success=You are teleported to plot {%0}
language: "pol"
#Polski zestaw wiadomoci (pol) wykonany przez Jelly9912
#############################
# Wiadomoci dla komend
#############################
messages:
# Dodanie wspwaciciela
addhelper-desc: "Dodanie wspwaciciela do dziaki"
addhelper-alias: addh
addhelper-usage: "/p addhelper <gracz>"
addhelper-notinplot: "Musisz stan na swojej dziace"
addhelper-notowner: "Nie jeste wacicielem tej dziaki"
addhelper-alreadyone: " jest ju wspwacicielem"
addhelper-success: " jest teraz wspwacicielem"
addhelper-error: "Bd podczas przetwarzania komendy"
# Usunicie wspwaciciela
removehelper-desc: "Usunicie wspwaciciela z dziaki"
removehelper-alias: delh
removehelper-notinplot: "Musisz stan na swojej dziace"
removehelper-notowner: "Nie jeste wacicielem tej dziaki"
removehelper-notone: " nie jest wspwacicielem"
removehelper-success: " zosta usunity z dziaki"
removehelper-error: "Bd podczas przetwarzania komendy"
# Zabezpieczenie dziaki
claim-desc: "Zabezpieczenie dziaki"
claim-alias: c
claim-notinplot: "Musisz stan na dziace"
claim-notowner: "Nie jeste wacicielem tej dziaki"
claim-already: "Ta dziaka naley do: "
claim-max: "Przekroczye ilo dziaek: "
claim-money: "Nie masz tyle pienidzy"
claim-success: "Dziaka zabezpieczona"
claim-error: "Bd podczas przetwarzania komendy"
# Teleportacja do wolnej dziaki
auto-desc: "Teleportacja do wolnej dziaki"
auto-alias: a
auto-notinworld: "Nie jeste na wiecie z dziakami"
auto-success: "Teleportowano do dziaki numer: "
auto-error: "Brak dziaek"
# Opuszczenie dziaki
dispose-desc: "Opuszczenie dziaki, na ktrej stoisz"
dispose-alias: d
dispose-notinplot: "Musisz stan na swojej dziace"
dispose-notowner: "Nie jeste wacicielem tej dziaki"
dispose-money: "Nie masz tyle pienidzy"
dispose-success: "Opuszczono dziak"
dispose-error: "Bd podczas przerwarzania komendy"
# Opuszczenie i wyczyszczenie dziaki (reset)
reset-desc: "Opuszczenie i wyczyszczenie dziaki"
reset-alias: r
reset-notinplot: "Musisz stan na swojej dziace"
reset-notowner: "Nie jeste wacicielem tej dziaki"
reset-money: "Nie masz tyle pienidzy"
reset-success: "Dziaka zresetowana"
reset-error: "Bd podczas przerwarzania komendy"
# Czyszczenie
clear-desc: "Wyczyszczenie dziaki"
clear-alias: cl
clear-notinplot: "Musisz stan na swojej dziace"
clear-notowner: "Nie jeste wacicielem tej dziaki"
clear-money: "Nie masz tyle pienidzy"
clear-success: "Dziaka wyczyszczona"
clear-error: "Bd podczas przerwarzania komendy"
# Biom
biome-desc: "Zmiana biomu na dziace"
biome-alias: a
biome-notinplot: "Musisz stan na swojej dziace"
biome-notowner: "Nie jeste wacicielem tej dziaki"
biome-success: "Biom zmieniony"
biome-invalid: "Taki biom nie istnieje"
biome-possible: "Lista biomw: "
biome-error: "Bd podczas przerwarzania komendy"
# Nazwa
name-desc: "Zmiana nazwy dziaki"
name-alias: n
name-notinplot: "Musisz stan
Function Calls
| None |
Stats
| MD5 | 8daec1f768188ac6d11ffc51c629945f |
| Eval Count | 0 |
| Decode Time | 164 ms |