Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small formatting fixes (no code changes) #139

Closed
wants to merge 10 commits into from
Closed
18 changes: 9 additions & 9 deletions .mvn/settings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">

<activeProfiles>
Expand All @@ -25,12 +25,12 @@
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>MilkBowl</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
<server>
<id>github</id>
<username>MilkBowl</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
</settings>
10 changes: 5 additions & 5 deletions .utility/do-publish.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
current_dir=`pwd`
current_dir=$(pwd)

if [[ "$TRAVIS_REPO_SLUG" != "MilkBowl/VaultAPI" || "$TRAVIS_PULL_REQUEST" == "true" || "$TRAVIS_BRANCH" != "master" ]]
then
Expand All @@ -10,15 +10,15 @@ fi
mvn clean javadoc:javadoc javadoc:jar deploy --settings .utility/settings.xml

# Get to the Travis build directory, configure git and clone the repo
cd $HOME
cd "$HOME"
git config --global user.email "[email protected]"
git config --global user.name "travis-ci"
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/MilkBowl/VaultAPI gh-pages > /dev/null
git clone --quiet --branch=gh-pages https://"${GH_TOKEN}"@github.com/MilkBowl/VaultAPI gh-pages > /dev/null

# Commit and Push the Changes
cd gh-pages
git rm -rf *
cp -Rfv $current_dir/target/javadoc-latest/* ./
git rm -rf ./*
cp -Rfv "$current_dir"/target/javadoc-latest/* ./
git add -f .
git commit -m "Latest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
git push -fq origin gh-pages > /dev/null
2 changes: 1 addition & 1 deletion .utility/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<password>${env.DEPLOY_PASS}</password>
</server>
</servers>
</settings>
</settings>
202 changes: 103 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# VaultAPI - Abstraction Library API for Bukkit Plugins - [![](https://travis-ci.org/MilkBowl/VaultAPI.svg?branch=master)](https://travis-ci.org/MilkBowl/VaultAPI)
# VaultAPI - Abstraction Library API for Bukkit Plugins [![](https://travis-ci.org/MilkBowl/VaultAPI.svg?branch=master)](https://travis-ci.org/MilkBowl/VaultAPI)

How to include the API with Maven:
**How to include the API with Maven:**
```xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
```
```xml
<dependencies>
<dependency>
<groupId>com.github.MilkBowl</groupId>
Expand All @@ -18,29 +20,31 @@ How to include the API with Maven:
</dependencies>
```

How to include the API with Gradle:
**How to include the API with Gradle:**
```groovy
repositories {
maven { url 'https://jitpack.io' }
}
```
```groovy
dependencies {
compileOnly "com.github.MilkBowl:VaultAPI:1.7"
}
```

**Note**: The VaultAPI version has 2 numbers (major.minor), unlike Vault, which has 3. The 2 numbers in the VaultAPI will always correspond to the 2 beginning numbers in a Vault version to make it clear what versions your plugin will for sure work with.
**Note**: The VaultAPI version has 2 numbers (major.minor), unlike Vault, which has 3. The 2 numbers in the VaultAPI will always correspond to the 2 beginning numbers in a Vault version to make it clear what versions your plugin will work with.

## Why Vault?
I have no preference which library suits your plugin and development efforts
best. Really, I thought a central suite (rather...Vault) of solutions was the
the proper avenue than focusing on a single category of plugin. That's where
best. Really, I thought a central suite (rather...Vault) of solutions was the
proper avenue than focusing on a single category of plugin. That's where
the idea for Vault came into play.

So, what features do I _think_ you'll like the most?

* No need to include my source code in your plugin
* Broad range of supported plugins
* Choice!
* No need to include my source code in your plugin
* Broad range of supported plugins
* Choice!

## License
Copyright (C) 2011-2018 Morgan Humes <[email protected]>
Expand All @@ -52,11 +56,11 @@ the Free Software Foundation, either version 3 of the License, or

Vault is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Vault. If not, see <http://www.gnu.org/licenses/>.
with Vault. If not, see <https://www.gnu.org/licenses/>.

## Building
VaultAPI comes with all libraries needed to build from the current branch.
Expand All @@ -81,93 +85,93 @@ import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public class ExamplePlugin extends JavaPlugin {
private static final Logger log = Logger.getLogger("Minecraft");
private static Economy econ = null;
private static Permission perms = null;
private static Chat chat = null;

@Override
public void onDisable() {
log.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
}

@Override
public void onEnable() {
if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
setupPermissions();
setupChat();
}
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
private boolean setupChat() {
RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(Chat.class);
chat = rsp.getProvider();
return chat != null;
}
private boolean setupPermissions() {
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
perms = rsp.getProvider();
return perms != null;
}
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
if(!(sender instanceof Player)) {
log.info("Only players are supported for this Example Plugin, but you should not do this!!!");
return true;
}
Player player = (Player) sender;
if(command.getLabel().equals("test-economy")) {
// Lets give the player 1.05 currency (note that SOME economic plugins require rounding!)
sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getName()))));
EconomyResponse r = econ.depositPlayer(player, 1.05);
if(r.transactionSuccess()) {
sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance)));
} else {
sender.sendMessage(String.format("An error occured: %s", r.errorMessage));
}
return true;
} else if(command.getLabel().equals("test-permission")) {
// Lets test if user has the node "example.plugin.awesome" to determine if they are awesome or just suck
if(perms.has(player, "example.plugin.awesome")) {
sender.sendMessage("You are awesome!");
} else {
sender.sendMessage("You suck!");
}
return true;
} else {
return false;
}
}
public static Economy getEconomy() {
return econ;
}
public static Permission getPermissions() {
return perms;
}
public static Chat getChat() {
return chat;
}

private static final Logger log = Logger.getLogger("Minecraft");
private static Economy econ = null;
private static Permission perms = null;
private static Chat chat = null;

@Override
public void onDisable() {
log.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
}

@Override
public void onEnable() {
if (!setupEconomy()) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
setupPermissions();
setupChat();
}

private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}

private boolean setupChat() {
RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(Chat.class);
chat = rsp.getProvider();
return chat != null;
}

private boolean setupPermissions() {
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
perms = rsp.getProvider();
return perms != null;
}

public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
if (!(sender instanceof Player)) {
log.info("Only players are supported for this Example Plugin, but you should not do this!!!");
return true;
}

Player player = (Player) sender;

if (command.getLabel().equals("test-economy")) {
// Let's give the player 1.05 currency (note that SOME economic plugins require rounding!)
sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getName()))));
Jack1424 marked this conversation as resolved.
Show resolved Hide resolved
EconomyResponse r = econ.depositPlayer(player, 1.05);
if (r.transactionSuccess()) {
sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance)));
} else {
sender.sendMessage(String.format("An error occurred: %s", r.errorMessage));
}
return true;
} else if (command.getLabel().equals("test-permission")) {
// Let's test if user has the node "example.plugin.awesome" to determine if they are awesome or just suck
if (perms.has(player, "example.plugin.awesome")) {
sender.sendMessage("You are awesome!");
} else {
sender.sendMessage("You suck!");
}
return true;
} else {
return false;
}
}

public static Economy getEconomy() {
return econ;
}

public static Permission getPermissions() {
return perms;
}

public static Chat getChat() {
return chat;
}
}
```
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation.
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
Library.
27 changes: 14 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
Expand All @@ -8,9 +8,10 @@
<name>VaultAPI</name>
<description>Vault is a Permissions &amp; Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves.

Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms, Starburst, iConomy (4/5/6) BOSEconomy *6/7), EssentialsEcon, 3Co, MultiConomy, MineConomy, EconXP, eWallet, CurrencyCore, XPBank, CraftConomy, AEco, SDFEconomy, TAEcon
</description>
<url>http://dev.bukkit.org/server-mods/vault/</url>
Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms, Starburst, iConomy (4/5/6) BOSEconomy *6/7), EssentialsEcon, 3Co, MultiConomy, MineConomy, EconXP, eWallet, CurrencyCore, XPBank, CraftConomy, AEco, SDFEconomy, TAEcon
</description>

<url>https://dev.bukkit.org/projects/vault</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -41,17 +42,17 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/milkbowl/github-releases</url>
</repository>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/milkbowl/github-releases</url>
</repository>
</distributionManagement>

<dependencies>
Expand Down Expand Up @@ -93,8 +94,8 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
Expand Down
Loading