diff --git a/lib/PlayerPoints.jar b/lib/PlayerPoints.jar new file mode 100644 index 0000000..c17025e Binary files /dev/null and b/lib/PlayerPoints.jar differ diff --git a/pom.xml b/pom.xml index 46a3fc2..0cc1d99 100644 --- a/pom.xml +++ b/pom.xml @@ -125,12 +125,19 @@ system ${project.basedir}/lib/ProtocolLib-3.6.5-SNAPSHOT.jar - + me.clip PlaceholderAPI 1.8.6 system ${project.basedir}/lib/PlaceholderAPI.jar + + org.black_ixx + PlayerPoints + 2.1.4 + system + ${project.basedir}/lib/PlayerPoints.jar + \ No newline at end of file diff --git a/src/main/java/pw/yumc/YumCore/plugin/playerpoint/PPAPI.java b/src/main/java/pw/yumc/YumCore/plugin/playerpoint/PPAPI.java new file mode 100644 index 0000000..c1151f5 --- /dev/null +++ b/src/main/java/pw/yumc/YumCore/plugin/playerpoint/PPAPI.java @@ -0,0 +1,99 @@ +package pw.yumc.YumCore.plugin.playerpoint; + +import org.black_ixx.playerpoints.PlayerPoints; +import org.black_ixx.playerpoints.PlayerPointsAPI; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.plugin.Plugin; +import pw.yumc.YumCore.kit.PKit; + +@SuppressWarnings("deprecation") +public class PPAPI { + private static PlayerPointsAPI api; + static { + Plugin pp = Bukkit.getServer().getPluginManager().getPlugin("PlayerPoints"); + if (pp == null) { + PKit.disable("未找到 PlayerPoint 插件 停止加载..."); + } else { + api = ((PlayerPoints) pp).getAPI(); + } + } + + /** + * 添加点券 + * + * @param player + * 玩家 + * @param amount + * 数量 + * @return 是否成功 + */ + public boolean add(String player, int amount) { + return api.give(player, amount); + } + + /** + * 玩家是否指定的点券 + * + * @param player + * 玩家 + * @param amount + * 数量 + * @return 是否有 + */ + public boolean has(String player, int amount) { + return api.look(player) >= amount; + } + + /** + * 扣除点券 + * + * @param player + * 玩家 + * @param amount + * 数量 + * @return 是否成功 + */ + public boolean remove(String player, int amount) { + return api.take(player, amount); + } + + /** + * 添加点券 + * + * @param player + * 玩家 + * @param amount + * 数量 + * @return 是否成功 + */ + public boolean add(OfflinePlayer player, int amount) { + return api.give(player.getUniqueId(), amount); + } + + /** + * 玩家是否指定的点券 + * + * @param player + * 玩家 + * @param amount + * 数量 + * @return 是否有 + */ + public boolean has(OfflinePlayer player, int amount) { + return api.look(player.getUniqueId()) >= amount; + } + + /** + * 扣除点券 + * + * @param player + * 玩家 + * @param amount + * 数量 + * @return 是否成功 + */ + public boolean remove(OfflinePlayer player, int amount) { + return api.take(player.getUniqueId(), amount); + } +} diff --git a/src/main/java/pw/yumc/YumCore/plugin/vault/VaultEconomy.java b/src/main/java/pw/yumc/YumCore/plugin/vault/VaultEconomy.java index 5a7644d..3c602eb 100644 --- a/src/main/java/pw/yumc/YumCore/plugin/vault/VaultEconomy.java +++ b/src/main/java/pw/yumc/YumCore/plugin/vault/VaultEconomy.java @@ -1,11 +1,10 @@ package pw.yumc.YumCore.plugin.vault; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.plugin.RegisteredServiceProvider; - import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.EconomyResponse; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.plugin.RegisteredServiceProvider; import pw.yumc.YumCore.bukkit.Log; import pw.yumc.YumCore.kit.PKit; @@ -58,7 +57,7 @@ public class VaultEconomy extends VaultBase { * 数量 * @return 是否 */ - public static boolean had(OfflinePlayer oPlayer, double amont) { + public static boolean has(OfflinePlayer oPlayer, double amont) { return economy.has(oPlayer, amont); }