1
0
mirror of https://e.coding.net/circlecloud/PvPTitles.git synced 2024-12-21 15:28:46 +00:00

修复点数扣除问题...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2016-01-08 23:31:01 +08:00
parent 516bfaa7d9
commit d08fe68b08
3 changed files with 182 additions and 183 deletions

View File

@ -41,9 +41,8 @@ public class CashCommand implements CommandExecutor {
sender.sendMessage("§c不存在当前的物品!"); sender.sendMessage("§c不存在当前的物品!");
return true; return true;
} }
databaseHandler.setPoints(point - num);
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), databaseHandler.getCashList().get(num).replace("{player}", player.getName())); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), databaseHandler.getCashList().get(num).replace("{player}", player.getName()));
databaseHandler.SaveConfig(); databaseHandler.SavePlayerPoint(sender.getName(), point - num);
sender.sendMessage("§a兑换成功!"); sender.sendMessage("§a兑换成功!");
} else { } else {
player.sendMessage(ChatColor.RED + "不正确的参数!"); player.sendMessage(ChatColor.RED + "不正确的参数!");

View File

@ -49,7 +49,7 @@ public class DatabaseHandler {
final FileConfiguration config = new YamlConfiguration(); final FileConfiguration config = new YamlConfiguration();
config.set("Fame", 0); config.set("Fame", 0);
config.set("Points", new Random().nextInt(25) + 25); config.set("Points", new Random().nextInt(defaultPoints));
try { try {
config.save(file); config.save(file);
} catch (final IOException e) { } catch (final IOException e) {

View File

@ -87,14 +87,14 @@ public class HandlePlayerPrefix implements Listener {
fame++; fame++;
player.sendMessage(ChatColor.GREEN + "你击杀了 " + killed + " 获得一点 " + tag + "."); player.sendMessage(ChatColor.GREEN + "你击杀了 " + killed + " 获得一点 " + tag + ".");
this.databaseHandler.LoadPlayerData(player.getName()); this.databaseHandler.LoadPlayerData(player.getName());
if (killedpoint < 1) { if (killedpoint == 1) {
player.sendMessage(ChatColor.RED + killed + " 已经是穷光蛋了 无法获得任何点数."); player.sendMessage(ChatColor.RED + killed + " 已经是穷光蛋了 无法获得任何点数.");
} else { } else {
player.sendMessage(ChatColor.GREEN + "你击杀了 " + killed + " 获得了点数1点(可兑换物品)."); player.sendMessage(ChatColor.GREEN + "你击杀了 " + killed + " 获得了点数1点(可兑换物品).");
this.databaseHandler.SavePlayerPoint(player.getName(), databaseHandler.getPoints() + 1); this.databaseHandler.SavePlayerPoint(player.getName(), databaseHandler.getPoints() + 1);
this.databaseHandler.SavePlayerPoint(killed, killedpoint - 1);
} }
this.databaseHandler.SavePlayerFame(player.getName(), fame); this.databaseHandler.SavePlayerFame(player.getName(), fame);
final String newRank = this.ranks.GetRank(fame); final String newRank = this.ranks.GetRank(fame);
if (!currentRank.equalsIgnoreCase(newRank)) { if (!currentRank.equalsIgnoreCase(newRank)) {