mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-13 06:06:28 +01:00
fix the description on the readme
This commit is contained in:
parent
396da3f3a4
commit
e6805897ca
@ -108,8 +108,7 @@ Github and we'll get to it at our convenience.
|
||||
- Group Manager (Essentials)
|
||||
|
||||
## Implementing Vault
|
||||
Implementing Vault is quite simple through obtaining an instance through the
|
||||
Bukkit PluginManager class by using the string "Vault". See the example below:
|
||||
Implementing Vault is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below:
|
||||
|
||||
```java
|
||||
package com.example.plugin;
|
||||
@ -184,7 +183,7 @@ public class ExamplePlugin extends JavaPlugin {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(command.getLabel().equals("test-economy")) {
|
||||
// Lets give the player 1.05 currency (note that SOME economic plugins require rounding!
|
||||
// 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.getName(), 1.05);
|
||||
if(r.transactionSuccess()) {
|
||||
|
@ -349,7 +349,7 @@ public class Vault extends JavaPlugin {
|
||||
sender.sendMessage("You must have at least 2 economies loaded to convert.");
|
||||
return;
|
||||
} else if (args.length != 2) {
|
||||
sender.sendMessage("You must specify only the economy to convert from and the economy to convert to. (without spaces)");
|
||||
sender.sendMessage("You must specify only the economy to convert from and the economy to convert to. (names should not contain spaces)");
|
||||
return;
|
||||
}
|
||||
Economy econ1 = null;
|
||||
|
@ -19,6 +19,7 @@ import in.mDev.MiracleM4n.mChatSuite.mChatSuite;
|
||||
import in.mDev.MiracleM4n.mChatSuite.api.Reader;
|
||||
import in.mDev.MiracleM4n.mChatSuite.api.Writer;
|
||||
import in.mDev.MiracleM4n.mChatSuite.types.InfoType;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
@ -44,7 +45,7 @@ public class Chat_mChatSuite extends Chat {
|
||||
super(perms);
|
||||
this.plugin = plugin;
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin);
|
||||
|
||||
// Load Plugin in case it was loaded before
|
||||
if (mChat == null) {
|
||||
@ -59,18 +60,13 @@ public class Chat_mChatSuite extends Chat {
|
||||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
Chat_mChatSuite chat = null;
|
||||
|
||||
public PermissionServerListener(Chat_mChatSuite chat) {
|
||||
this.chat = chat;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (this.chat.mChat == null) {
|
||||
if (mChat == null) {
|
||||
Plugin chat = plugin.getServer().getPluginManager().getPlugin("mChatSuite");
|
||||
if (chat != null) {
|
||||
this.chat.mChat = (mChatSuite) chat;
|
||||
mChat = (mChatSuite) chat;
|
||||
mReader = mChat.getReader();
|
||||
mWriter = mChat.getWriter();
|
||||
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "mChatSuite"));
|
||||
@ -80,9 +76,9 @@ public class Chat_mChatSuite extends Chat {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (this.chat.mChat != null) {
|
||||
if (mChat != null) {
|
||||
if (event.getPlugin().getDescription().getName().equals("mChatSuite")) {
|
||||
this.chat.mChat = null;
|
||||
mChat = null;
|
||||
mReader = null;
|
||||
mWriter = null;
|
||||
log.info(String.format("[%s][Chat] %s un-hooked.", plugin.getDescription().getName(), "mChatSuite"));
|
||||
|
Loading…
Reference in New Issue
Block a user