1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-03 22:48:56 +00:00

feat: 添加PlayerPoints接口

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-11-10 16:48:26 +08:00
parent 560724dd52
commit df53b83538
4 changed files with 111 additions and 6 deletions

BIN
lib/PlayerPoints.jar Normal file

Binary file not shown.

View File

@ -132,5 +132,12 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/lib/PlaceholderAPI.jar</systemPath> <systemPath>${project.basedir}/lib/PlaceholderAPI.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>org.black_ixx</groupId>
<artifactId>PlayerPoints</artifactId>
<version>2.1.4</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/PlayerPoints.jar</systemPath>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -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);
}
}

View File

@ -1,11 +1,10 @@
package pw.yumc.YumCore.plugin.vault; 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.Economy;
import net.milkbowl.vault.economy.EconomyResponse; 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.bukkit.Log;
import pw.yumc.YumCore.kit.PKit; import pw.yumc.YumCore.kit.PKit;
@ -58,7 +57,7 @@ public class VaultEconomy extends VaultBase {
* 数量 * 数量
* @return 是否 * @return 是否
*/ */
public static boolean had(OfflinePlayer oPlayer, double amont) { public static boolean has(OfflinePlayer oPlayer, double amont) {
return economy.has(oPlayer, amont); return economy.has(oPlayer, amont);
} }