From 543d145252faecba97919f4418f3285b4399692d Mon Sep 17 00:00:00 2001 From: j502647092 Date: Wed, 20 May 2015 23:48:42 +0800 Subject: [PATCH] switch to custom version... Signed-off-by: j502647092 --- pom.xml | 110 +++++++++--------- src/cn/citycraft/LuckLottery/LuckLottery.java | 10 +- .../command/LuckLotteryCommand.java | 12 +- .../LuckLottery/runnable/LotteryReward.java | 62 +--------- .../LuckLottery/utils/LotteryUtils.java | 16 +++ src/config.yml | 37 ++++-- src/plugin.yml | 4 +- 7 files changed, 119 insertions(+), 132 deletions(-) diff --git a/pom.xml b/pom.xml index 319ee04..ba0ffc8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,56 +1,56 @@ - - 4.0.0 - cn.CityCraft - LuckLottery - 0.0.3-SNAPSHOT - - src - - - src - - **/*.java - - - - - - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public/ - - - vault-repo - http://nexus.theyeticave.net/content/repositories/pub_releases - - - - - org.spigotmc - spigot-api - jar - 1.8.3-R0.1-SNAPSHOT - - - net.milkbowl.vault - VaultAPI - 1.5 - system - ${project.basedir}/lib/Vault-1.4.1.jar - - - - UTF-8 - + + 4.0.0 + cn.CityCraft + LuckLottery + 0.0.5-SNAPSHOT + + src + + + src + + **/*.java + + + + + + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public/ + + + vault-repo + http://nexus.theyeticave.net/content/repositories/pub_releases + + + + + org.spigotmc + spigot-api + jar + 1.8.3-R0.1-SNAPSHOT + + + net.milkbowl.vault + VaultAPI + 1.5 + system + ${project.basedir}/lib/Vault-1.4.1.jar + + + + UTF-8 + \ No newline at end of file diff --git a/src/cn/citycraft/LuckLottery/LuckLottery.java b/src/cn/citycraft/LuckLottery/LuckLottery.java index 51d1fad..9d29336 100644 --- a/src/cn/citycraft/LuckLottery/LuckLottery.java +++ b/src/cn/citycraft/LuckLottery/LuckLottery.java @@ -30,12 +30,15 @@ public class LuckLottery extends JavaPlugin { OfflineDate.load(this); PlayerDate.load(this); ChatUtils.setPluginname(Config.getMessage("pluginname")); - LotteryUtils.setNumbersame(Config.getInstance().getBoolean("numbersame")); + + LotteryUtils.setNumbersame(Config.getInstance() + .getBoolean("numbersame")); + LotteryUtils.setPrice(Config.getInstance().getInt("price")); } public void onEnable() { PluginManager pm = this.getServer().getPluginManager(); - if (!pm.getPlugin("Vault").isEnabled()){ + if (!pm.getPlugin("Vault").isEnabled()) { this.getLogger().warning("未找到前置插件Vault 关闭插件..."); this.getServer().getPluginManager().disablePlugin(this); return; @@ -48,7 +51,8 @@ public class LuckLottery extends JavaPlugin { this.getServer().getPluginManager().disablePlugin(this); return; } - this.getServer().getScheduler() + this.getServer() + .getScheduler() .runTaskTimer(plugin, new LotteryReward(true), 10, 10 * 60 * 20); this.getLogger().info("彩票系统已开启..."); pm.registerEvents(new PlayerListen(), this); diff --git a/src/cn/citycraft/LuckLottery/command/LuckLotteryCommand.java b/src/cn/citycraft/LuckLottery/command/LuckLotteryCommand.java index 632e8ce..f725d30 100644 --- a/src/cn/citycraft/LuckLottery/command/LuckLotteryCommand.java +++ b/src/cn/citycraft/LuckLottery/command/LuckLotteryCommand.java @@ -25,14 +25,15 @@ public class LuckLotteryCommand implements CommandExecutor { String[] args) { switch (args.length) { case 0: - if (isPlayer(sender)){ + if (isPlayer(sender)) { Player p = (Player) sender; + int price = LotteryUtils.getPrice(); if (LuckLottery.economy.hasAccount(p) - && LuckLottery.economy.has(p, 200)) { + && LuckLottery.economy.has(p, price)) { InvUtils.openGui(p); } else { ChatUtils.sendMessage(p, ChatColor.GOLD - + "你没有足够的金钱购买彩票,每张彩票" + ChatColor.RED + "200" + + "你没有足够的金钱购买彩票,每张彩票" + ChatColor.RED + price + ChatColor.GOLD + "元!"); } } @@ -60,11 +61,12 @@ public class LuckLotteryCommand implements CommandExecutor { case "reward": if (PermissionUtils.Check(sender, PermissionUtils.Reward)) { LotteryUtils.rewardLastLottery(); - ChatUtils.sendMessage(sender, ChatColor.GREEN + "已结算上一轮彩票!"); + ChatUtils + .sendMessage(sender, ChatColor.GREEN + "已结算上一轮彩票!"); } return true; case "look": - if (PermissionUtils.Check(sender, PermissionUtils.Reward)){ + if (PermissionUtils.Check(sender, PermissionUtils.Reward)) { LotteryUtils.showSystemLottery(sender); } return true; diff --git a/src/cn/citycraft/LuckLottery/runnable/LotteryReward.java b/src/cn/citycraft/LuckLottery/runnable/LotteryReward.java index 8529989..92f577d 100644 --- a/src/cn/citycraft/LuckLottery/runnable/LotteryReward.java +++ b/src/cn/citycraft/LuckLottery/runnable/LotteryReward.java @@ -9,6 +9,7 @@ import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import cn.citycraft.LuckLottery.LuckLottery; +import cn.citycraft.LuckLottery.config.Config; import cn.citycraft.LuckLottery.config.OfflineDate; import cn.citycraft.LuckLottery.utils.ChatUtils; import cn.citycraft.LuckLottery.utils.LotteryUtils; @@ -39,65 +40,8 @@ public class LotteryReward implements Runnable { for (List playerlottery : pl) { int win = LotteryUtils.getSameNumber(playerlottery); int winprices = 0; - switch (win) { - case 10: - case 11: - winprices = 500; - break; - case 12: - winprices = 1000; - break; - case 3: - case 13: - winprices = 3000; - break; - case 14: - case 5: - case 15: - winprices = 5000; - break; - // case 0: - // case 1: - // winprices = 0; - // break; - // case 2: - // winprices = 500; - // break; - // case 3: - // winprices = 1000; - // break; - // case 4: - // winprices = 3000; - // break; - // case 5: - // winprices = 5000; - // break; - // case 6: - // winprices = 10000; - // break; - // case 10: - // winprices = 0; - // break; - // case 11: - // winprices = 500; - // break; - // case 12: - // winprices = 1000; - // break; - // case 13: - // winprices = 3000; - // break; - // case 14: - // winprices = 5000; - // break; - // case 15: - // winprices = 10000; - // break; - // case 16: - // winprices = 50000; - // break; - default: - } + winprices = Config.getInstance().getInt("Reward." + win, + 200); if (winprices > 0) { String message = ChatColor.GREEN + "您的彩票: " + ChatColor.YELLOW + playerlottery.toString() diff --git a/src/cn/citycraft/LuckLottery/utils/LotteryUtils.java b/src/cn/citycraft/LuckLottery/utils/LotteryUtils.java index 0ab8fc4..ab916dd 100644 --- a/src/cn/citycraft/LuckLottery/utils/LotteryUtils.java +++ b/src/cn/citycraft/LuckLottery/utils/LotteryUtils.java @@ -24,6 +24,22 @@ public class LotteryUtils { protected static boolean numbersame; + protected static int price; + + /** + * @return price + */ + public static int getPrice() { + return price; + } + + /** + * @param price 要设置的 price + */ + public static void setPrice(int price) { + LotteryUtils.price = price; + } + public static List> addLottery(Player player, List lottery) { List> playerhas = playerLottery.get(player.getName()); diff --git a/src/config.yml b/src/config.yml index ac8af4f..8c94d68 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,8 +1,29 @@ -#本文件为插件的主配置文件 -version: 1.0 -#服务器名称 -servername: '' -#插件名称 -pluginname: '&6[&b彩票系统&6]&r ' -#是否需要对应彩票号码位置 -numbersame: true \ No newline at end of file +#本文件为插件的主配置文件 +version: 1.0 +#服务器名称 +servername: '' +#插件名称 +pluginname: '&6[&b彩票系统&6]&r ' +#是否需要对应彩票号码位置 +numbersame: true +#单张彩票价格 +price: 200 +#返现金额(红色球一个代表1点,蓝色球代表10点自行相加!) +#注意:请不要删除0这一行,配置错误将默认全部返还彩票价格的金钱. +Reward: + 0:0 + 1: 50 + 2: 100 + 3: 300 + 4: 500 + 5: 1000 + 6: 2000 + 10: 300 + 11: 500 + 12: 800 + 13: 1200 + 14: 2400 + 15: 3600 + 16: 5000 + + \ No newline at end of file diff --git a/src/plugin.yml b/src/plugin.yml index 918d323..bd057c5 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,8 +1,8 @@ name: LuckLottery main: cn.citycraft.LuckLottery.LuckLottery author: 喵♂呜 -version: 0.0.1 -depended: [BVLib,Vault] +version: 0.0.5 +depended: [Vault] commands: lucklottery: aliases: [ll] \ No newline at end of file