pgmann/SpectatorPlus — pull request #4 by AmauryCarrade (2014-08-07 18:04:50+00:00)
Title: Proposition – improved API

A proposition of a better API.

The API is no longer static (because the API was not usable, no way to set the plugin). But It is easily possible to make a static API if you prefer this option.

I also added a way to change the config through the API, either permanently or not.

The methods are documented (javadoc).

Usage:
```java
// Ensure the plugin is loaded
Plugin spTest = Bukkit.getServer().getPluginManager().getPlugin("SpectatorPlus");
if(spTest == null || !spTest.isEnabled()) {
return;
}

SpectateAPI api = ((SpectatorPlus) spTest).getAPI();

if(api.isSpectator(player)) {
// ...
}

api.setSpectating(player, true);

api.setCompass(true, true); // 2d arg: if true, temp setting not saved in the toggles.yml file.
// See the SpectateAPI.java file to see all methods available.
// Spoiler: one for each option in the toggles.yml .
```