Skip to content

Commit

Permalink
continued work on JSON and YAML data formats
Browse files Browse the repository at this point in the history
added typedef hints
added more PhpDoc comments
removed the biomes command
matched formatting to all classes
changed all indents back to tabs
added support for EconomyPlus
added required php extensions to plugin.yml
  • Loading branch information
jasonw4331 committed May 28, 2017
1 parent 7d7f2b3 commit ae1c532
Show file tree
Hide file tree
Showing 45 changed files with 2,726 additions and 2,221 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- put an 'x' in the brackets -->
- [ ] This issue isn't duplicated - you can check if it is by using the search bar located at the top left hand corner and select "Issues" on the left.
- [ ] This issue includes appropriate markdown for sections - e.g. code blocks for crash dumps.
- [ ] This issue is understandable - feel free to use your native language to write issues if you are not comfortable with English.
- [x] This issue isn't duplicated - you can check if it is by using the search bar located at the top left hand corner and select "Issues" on the left.
- [x] This issue includes appropriate markdown for sections - e.g. code blocks for crash dumps.
- [x] This issue is understandable - feel free to use your native language to write issues if you are not comfortable with English.

<!-- ISSUE DESCRIPTION - write a SHORT title about what problem you're having. -->
## Issue description
Expand Down
12 changes: 6 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!-- Welcome to the MyPlot pull request system! -->
<!-- Before you make an issue, make sure your pull request matches the criteria below. -->
<!-- PLEASE TICK THE CHECKBOXES -->
- [ ] This PR actually submits something - don't use this system as a messaging service!
- [ ] This PR isn't duplicated - you can check if it is by scanning the small list - link is on the navigation bar for this repository.
- [ ] This PR includes appropriate markdown for sections - e.g. code blocks for suggested code.
- [ ] This PR description and comments in code is understandable - feel free to use your native language to write if you are not comfortable with English.
- [ ] This PR has a single branch for itself in your fork - don't just commit to the master branch of your repository!
- [ ] This PR has comments written in clear English - please don't write unreadable comments just for your eyes.
- [x] This PR actually submits something - don't use this system as a messaging service!
- [x] This PR isn't duplicated - you can check if it is by scanning the small list - link is on the navigation bar for this repository.
- [x] This PR includes appropriate markdown for sections - e.g. code blocks for suggested code.
- [x] This PR description and comments in code is understandable - feel free to use your native language to write if you are not comfortable with English.
- [x] This PR has a single branch for itself in your fork - don't just commit to the master branch of your repository!
- [x] This PR has comments written in clear English - please don't write unreadable comments just for your eyes.

<!-- If your PR matches this criteria, hooray! Submit this PR with no worries. If your PR doesn't match this criteria, please consider editing your PR to match it. Thanks for contributing to MyPlots! -->
<!-- PR DESCRIPTION - write a bit about what you've achieved in this pull request. -->
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ config.yml
plots.db
.idea/
!/resources/config.yml
.github/
.github/
.poggit.yml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Gitter](https://badges.gitter.im/jasonwynn10/MyPlot.svg)](https://gitter.im/jasonwynn10/MyPlot?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Poggit-Ci](https://poggit.pmmp.io/ci.shield/jasonwynn10/MyPlot/MyPlot)](https://poggit.pmmp.io/ci/jasonwynn10/MyPlot/MyPlot)
### **Create, manage, and build in protected plots! Keep your builds safe from griefers!**
======

#### Please note that the [API3](https://github.com/jasonwynn10/MyPlot/tree/API3) Branch is currently under heavy development for the new changes in pmmp 1.0 and may not work 100% of the time. The master branch is for compatability with 0.16 clients
<br>
<br>
Expand Down
26 changes: 19 additions & 7 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
name: MyPlot
description: "Plots and Protection Plugin for MCPE Servers"
description: "Plots and Protection Plugin for PMMP Servers"
authors: ["Wiez","Exxarion","jasonwynn10"]
main: MyPlot\MyPlot
version: 1.1.3
api: [3.0.0-ALPHA4, 3.0.0-ALPHA5]
softdepend: [EconomyAPI, PocketMoney, EssentialsPE]
version: 1.1.4
api:
- 3.0.0-ALPHA1
- 3.0.0-ALPHA2
- 3.0.0-ALPHA3
- 3.0.0-ALPHA4
- 3.0.0-ALPHA5
softdepend:
- EconomyAPI
- PocketMoney
- EssentialsPE
- EconomyPlus
load: STARTUP

extensions:
- sqlite3
- mysqli
- yaml
permissions:
myplot.command:
default: true
Expand Down Expand Up @@ -96,9 +108,9 @@ permissions:
myplot.admin.list:
default: op
myplot.claimplots:
default: false
default: op
children:
myplot.claimplots.2:
default: true
myplot.claimplots.unlimited:
default: op
default: op
151 changes: 79 additions & 72 deletions src/MyPlot/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,85 +30,92 @@

class Commands extends PluginCommand
{
/** @var SubCommand[] */
private $subCommands = [];
/** @var SubCommand[] */
private $subCommands = [];

/** @var SubCommand[] */
private $aliasSubCommands = [];
/** @var SubCommand[] */
private $aliasSubCommands = [];

/** @var MyPlot */
private $plugin;
/** @var MyPlot */
private $plugin;

public function __construct(MyPlot $plugin) {
$this->plugin = $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"));
public function __construct(MyPlot $plugin) {
$this->plugin = $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));
$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 ClearSubCommand($plugin, "clear"));
$this->loadSubCommand(new DisposeSubCommand($plugin, "dispose"));
$this->loadSubCommand(new ResetSubCommand($plugin, "reset"));
$this->loadSubCommand(new BiomeSubCommand($plugin, "biome"));
$this->loadSubCommand(new BiomesSubCommand($plugin, "biomes"));
$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"));
$this->loadSubCommand(new DenyPlayerSubCommand($plugin, "denyplayer"));
$this->loadSubCommand(new UnDenySubCommand($plugin, "undenyplayer"));
$this->loadSubCommand(new SetOwnerSubCommand($plugin, "setowner"));
$this->loadSubCommand(new ListSubCommand($plugin, "list"));
$this->plugin->getLogger()->debug("Commands Registered to MyPlot");
}
$this->loadSubCommand(new HelpSubCommand($plugin, "help", $this));
$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 ClearSubCommand($plugin, "clear"));
$this->loadSubCommand(new DisposeSubCommand($plugin, "dispose"));
$this->loadSubCommand(new ResetSubCommand($plugin, "reset"));
$this->loadSubCommand(new BiomeSubCommand($plugin, "biome"));
$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"));
$this->loadSubCommand(new DenyPlayerSubCommand($plugin, "denyplayer"));
$this->loadSubCommand(new UnDenySubCommand($plugin, "undenyplayer"));
$this->loadSubCommand(new SetOwnerSubCommand($plugin, "setowner"));
$this->loadSubCommand(new ListSubCommand($plugin, "list"));
$this->plugin->getLogger()->debug("Commands Registered to MyPlot");
}

/**
* @return SubCommand[]
*/
public function getCommands() : array {
return $this->subCommands;
}
/**
* @return SubCommand[]
*/
public function getCommands() : array {
return $this->subCommands;
}

/**
* @param SubCommand $command
*/
private function loadSubCommand(SubCommand $command) {
$this->subCommands[$command->getName()] = $command;
if ($command->getAlias() != "") {
$this->aliasSubCommands[$command->getAlias()] = $command;
}
}

private function loadSubCommand(SubCommand $command) {
$this->subCommands[$command->getName()] = $command;
if ($command->getAlias() != "") {
$this->aliasSubCommands[$command->getAlias()] = $command;
}
}
/**
* @param CommandSender $sender
* @param string $alias
* @param string[] $args
* @return bool
*/
public function execute(CommandSender $sender, $alias, array $args) {
if (!isset($args[0])) {
$sender->sendMessage($this->plugin->getLanguage()->get("command.usage"));
return true;
}

public function execute(CommandSender $sender, $alias, array $args) {
if (!isset($args[0])) {
$sender->sendMessage($this->plugin->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 . $this->plugin->getLanguage()->get("command.unknown"));
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 . $this->plugin->getLanguage()->get("command.unknown"));
return true;
}

if ($command->canUse($sender)) {
if (!$command->execute($sender, $args)) {
$usage = $this->plugin->getLanguage()->translateString("subcommand.usage", [$command->getUsage()]);
$sender->sendMessage($usage);
}
} else {
$sender->sendMessage(TextFormat::RED . $this->plugin->getLanguage()->get("command.unknown"));
}
return true;
}
if ($command->canUse($sender)) {
if (!$command->execute($sender, $args)) {
$usage = $this->plugin->getLanguage()->translateString("subcommand.usage", [$command->getUsage()]);
$sender->sendMessage($usage);
}
} else {
$sender->sendMessage(TextFormat::RED . $this->plugin->getLanguage()->get("command.unknown"));
}
return true;
}
}
Loading

0 comments on commit ae1c532

Please sign in to comment.