mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-21 01:38:51 +00:00
feat: 添加PlayerPoints接口
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
560724dd52
commit
df53b83538
BIN
lib/PlayerPoints.jar
Normal file
BIN
lib/PlayerPoints.jar
Normal file
Binary file not shown.
9
pom.xml
9
pom.xml
@ -125,12 +125,19 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/ProtocolLib-3.6.5-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>PlaceholderAPI</artifactId>
|
||||
<version>1.8.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/PlaceholderAPI.jar</systemPath>
|
||||
</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>
|
||||
</project>
|
99
src/main/java/pw/yumc/YumCore/plugin/playerpoint/PPAPI.java
Normal file
99
src/main/java/pw/yumc/YumCore/plugin/playerpoint/PPAPI.java
Normal 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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user