mirror of
https://e.coding.net/circlecloud/LuckLottery.git
synced 2025-11-24 21:46:23 +00:00
25
.classpath
25
.classpath
@@ -1,25 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
57
pom.xml
57
pom.xml
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>LuckLottery</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.3</version>
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
<resources>
|
||||
@@ -15,7 +15,7 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
@@ -30,14 +30,14 @@
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>pw.yumc:YumCore</include>
|
||||
<include>cn.citycraft:PluginHelper</include>
|
||||
<include>org.mcstats.*:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.mcstats</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.mcstats</shadedPattern>
|
||||
<pattern>pw.yumc.YumCore</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>cn.citycraft.PluginHelper</pattern>
|
||||
@@ -56,34 +56,28 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<ciManagement>
|
||||
<system>Jenkins</system>
|
||||
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
|
||||
</ciManagement>
|
||||
<properties>
|
||||
<update.description></update.description>
|
||||
<update.changes></update.changes>
|
||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mengcraft-repo</id>
|
||||
<url>http://ci.mengcraft.com:8080/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citycraft-repo</id>
|
||||
<url>http://ci.sumcraft.net:8080/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
@@ -92,20 +86,15 @@
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Vault.jar</systemPath>
|
||||
<groupId>pw.yumc</groupId>
|
||||
<artifactId>YumCore</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mcstats.bukkit</groupId>
|
||||
<artifactId>metrics</artifactId>
|
||||
<version>R8-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.5.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -6,6 +6,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import cn.citycraft.LuckLottery.command.LuckLotteryCommand;
|
||||
import cn.citycraft.LuckLottery.config.OfflineDate;
|
||||
import cn.citycraft.LuckLottery.config.PlayerData;
|
||||
import cn.citycraft.LuckLottery.listen.PlayerListen;
|
||||
import cn.citycraft.LuckLottery.runnable.LotteryReward;
|
||||
import cn.citycraft.LuckLottery.utils.ChatUtils;
|
||||
@@ -20,7 +21,6 @@ public class LuckLottery extends JavaPlugin {
|
||||
public static LuckLottery plugin;
|
||||
protected FileConfig config;
|
||||
protected OfflineDate offlinedata;
|
||||
protected FileConfig playerdata;
|
||||
|
||||
@Override
|
||||
public FileConfig getConfig() {
|
||||
@@ -31,15 +31,11 @@ public class LuckLottery extends JavaPlugin {
|
||||
return offlinedata;
|
||||
}
|
||||
|
||||
public FileConfig getPlayerdata() {
|
||||
return playerdata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
this.getLogger().info("保存彩票数据中...");
|
||||
this.getLogger().info("保存玩家数据中...");
|
||||
LotteryUtils.saveLottery();
|
||||
PlayerData.saveLottery();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,10 +55,10 @@ public class LuckLottery extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
final int rewardtime = config.getInt("RewardTime", 10);
|
||||
this.getServer().getScheduler().runTaskTimer(plugin, new LotteryReward(this, true), 10, rewardtime * 60 * 20);
|
||||
this.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new LotteryReward(this, true), 10, rewardtime * 60 * 20);
|
||||
this.getLogger().info("彩票系统已开启...");
|
||||
pm.registerEvents(new PlayerListen(this), this);
|
||||
getCommand("ll").setExecutor(new LuckLotteryCommand(this));
|
||||
new LuckLotteryCommand();
|
||||
new VersionChecker(this);
|
||||
}
|
||||
|
||||
@@ -71,9 +67,7 @@ public class LuckLottery extends JavaPlugin {
|
||||
plugin = this;
|
||||
config = new FileConfig(this);
|
||||
offlinedata = new OfflineDate(this);
|
||||
playerdata = new FileConfig(this, "playerdate.yml");
|
||||
LotteryUtils.init(this);
|
||||
LotteryUtils.reloadPlayerLottery();
|
||||
PlayerData.reloadPlayerLottery();
|
||||
ChatUtils.setPluginname(config.getMessage("pluginname"));
|
||||
LotteryUtils.setNumbersame(config.getBoolean("numbersame"));
|
||||
LotteryUtils.setPrice(config.getInt("price"));
|
||||
|
||||
@@ -1,121 +1,106 @@
|
||||
package cn.citycraft.LuckLottery.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import cn.citycraft.LuckLottery.LuckLottery;
|
||||
import cn.citycraft.LuckLottery.config.PlayerData;
|
||||
import cn.citycraft.LuckLottery.utils.ChatUtils;
|
||||
import cn.citycraft.LuckLottery.utils.InvUtils;
|
||||
import cn.citycraft.LuckLottery.utils.LotteryUtils;
|
||||
import cn.citycraft.LuckLottery.utils.PermissionUtils;
|
||||
import cn.citycraft.LuckLottery.utils.Perm;
|
||||
import pw.yumc.YumCore.commands.CommandArgument;
|
||||
import pw.yumc.YumCore.commands.CommandExecutor;
|
||||
import pw.yumc.YumCore.commands.CommandManager;
|
||||
import pw.yumc.YumCore.commands.annotation.Async;
|
||||
import pw.yumc.YumCore.commands.annotation.Cmd;
|
||||
import pw.yumc.YumCore.commands.annotation.Help;
|
||||
import pw.yumc.YumCore.commands.annotation.Sort;
|
||||
|
||||
public class LuckLotteryCommand implements CommandExecutor {
|
||||
|
||||
LuckLottery plugin;
|
||||
|
||||
public LuckLotteryCommand(LuckLottery main) {
|
||||
plugin = main;
|
||||
public LuckLotteryCommand() {
|
||||
new CommandManager("ll").register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String string,
|
||||
String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (isPlayer(sender)) {
|
||||
final Player p = (Player) sender;
|
||||
int price = LotteryUtils.getPrice();
|
||||
if (LuckLottery.economy.hasAccount(p)
|
||||
&& LuckLottery.economy.has(p, price)) {
|
||||
@Cmd(permission = Perm.Clear)
|
||||
@Help("清除所有已购买彩票§4(管理员命令)")
|
||||
@Sort(6)
|
||||
public void clear(final CommandArgument e) {
|
||||
final CommandSender sender = e.getSender();
|
||||
if (e.getArgs().length > 0) {
|
||||
ChatUtils.sendMessage(sender, ChatColor.DARK_RED + "警告: 已经清理所有彩票数据,此操作无法撤销!");
|
||||
LotteryUtils.clearPlayerLottery(sender);
|
||||
} else {
|
||||
ChatUtils.sendMessage(sender, ChatColor.LIGHT_PURPLE + "警告: 即将清理所有彩票数据,此操作将无法取消!");
|
||||
ChatUtils.sendMessage(sender, ChatColor.RED + "命令: 请使用/ll clear confirm 确定清理!");
|
||||
}
|
||||
}
|
||||
|
||||
@Cmd(onlyPlayer = true)
|
||||
@Help("打开彩票购买界面")
|
||||
public boolean ll(final CommandArgument e) {
|
||||
final Player p = (Player) e.getSender();
|
||||
final int price = LotteryUtils.getPrice();
|
||||
if (LuckLottery.economy.hasAccount(p) && LuckLottery.economy.has(p, price)) {
|
||||
InvUtils.openGui(p);
|
||||
} else {
|
||||
ChatUtils.sendMessage(p, ChatColor.GOLD
|
||||
+ "你没有足够的金钱购买彩票,每张彩票" + ChatColor.RED + price
|
||||
+ ChatColor.GOLD + "元!");
|
||||
}
|
||||
ChatUtils.sendMessage(p, ChatColor.GOLD + "你没有足够的金钱购买彩票,每张彩票" + ChatColor.RED + price + ChatColor.GOLD + "元!");
|
||||
}
|
||||
return true;
|
||||
case 1:
|
||||
switch (args[0]) {
|
||||
case "load":
|
||||
if (isPlayer(sender)) {
|
||||
Player p = (Player) sender;
|
||||
LotteryUtils.loadPlayerLottery(p);
|
||||
ChatUtils.sendMessage(p, ChatColor.BLUE + "已加载您的彩票数据...");
|
||||
}
|
||||
return true;
|
||||
case "show":
|
||||
if (isPlayer(sender)) {
|
||||
Player p = (Player) sender;
|
||||
LotteryUtils.showPlayerLottery(p);
|
||||
}
|
||||
return true;
|
||||
case "clear":
|
||||
if (PermissionUtils.Check(sender, PermissionUtils.Clear)) {
|
||||
ChatUtils.sendMessage(sender, ChatColor.LIGHT_PURPLE
|
||||
+ "警告: 即将清理所有彩票数据,此操作将无法取消!");
|
||||
ChatUtils.sendMessage(sender, ChatColor.RED
|
||||
+ "命令: 请使用/ll clear confirm 确定清理!");
|
||||
}
|
||||
return true;
|
||||
case "showall":
|
||||
if (PermissionUtils.Check(sender, PermissionUtils.ShowAll)) {
|
||||
LotteryUtils.showAllPlayerLottery(sender);
|
||||
}
|
||||
return true;
|
||||
case "random":
|
||||
if (PermissionUtils.Check(sender, PermissionUtils.Random)) {
|
||||
LotteryUtils.updateSystemLottery(sender);
|
||||
}
|
||||
return true;
|
||||
case "reward":
|
||||
if (PermissionUtils.Check(sender, PermissionUtils.Reward)) {
|
||||
LotteryUtils.rewardLastLottery();
|
||||
ChatUtils
|
||||
.sendMessage(sender, ChatColor.GREEN + "已结算上一轮彩票!");
|
||||
}
|
||||
return true;
|
||||
case "look":
|
||||
if (PermissionUtils.Check(sender, PermissionUtils.Reward)) {
|
||||
|
||||
@Async
|
||||
@Cmd(permission = Perm.Look)
|
||||
@Help("查看彩票系统状态§4(管理员命令)")
|
||||
@Sort(3)
|
||||
public void look(final CommandArgument e) {
|
||||
final CommandSender sender = e.getSender();
|
||||
LotteryUtils.showSystemLottery(sender);
|
||||
PlayerData.printStatus(sender);
|
||||
}
|
||||
return true;
|
||||
case "reload":
|
||||
if (PermissionUtils.Check(sender, PermissionUtils.Reload)) {
|
||||
PluginManager pm = plugin.getServer().getPluginManager();
|
||||
|
||||
@Cmd(permission = Perm.Random)
|
||||
@Help("重新生成彩票号码§4(管理员命令)")
|
||||
@Sort(4)
|
||||
public void random(final CommandArgument e) {
|
||||
LotteryUtils.updateSystemLottery(e.getSender());
|
||||
}
|
||||
|
||||
@Cmd(permission = Perm.Reload)
|
||||
@Help("重载彩票插件§4(管理员命令)")
|
||||
@Sort(7)
|
||||
public void reload(final CommandArgument e) {
|
||||
final CommandSender sender = e.getSender();
|
||||
final PluginManager pm = plugin.getServer().getPluginManager();
|
||||
ChatUtils.sendMessage(sender, ChatColor.GREEN + "配置文件已重载!");
|
||||
pm.disablePlugin(plugin);
|
||||
pm.enablePlugin(plugin);
|
||||
}
|
||||
return true;
|
||||
case "help":
|
||||
ChatUtils.sendHelp(sender);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (args[0]) {
|
||||
case "clear":
|
||||
if (PermissionUtils.Check(sender, PermissionUtils.Clear)) {
|
||||
ChatUtils.sendMessage(sender, ChatColor.DARK_RED
|
||||
+ "警告: 已经清理所有彩票数据,此操作无法撤销!");
|
||||
LotteryUtils.clearPlayerLottery(sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
|
||||
@Cmd(permission = Perm.Reward)
|
||||
@Help("结算上一轮彩票§4(管理员命令)")
|
||||
@Sort(5)
|
||||
public void reward(final CommandArgument e) {
|
||||
LotteryUtils.rewardLastLottery();
|
||||
ChatUtils.sendMessage(e.getSender(), ChatColor.GREEN + "已结算上一轮彩票!");
|
||||
}
|
||||
|
||||
public boolean isPlayer(CommandSender p) {
|
||||
if (p instanceof Player)
|
||||
return true;
|
||||
return false;
|
||||
@Cmd(onlyPlayer = true)
|
||||
@Help("查看已购买彩票")
|
||||
@Sort(1)
|
||||
public void show(final CommandArgument e) {
|
||||
PlayerData.showPlayerLottery((Player) e.getSender());
|
||||
}
|
||||
|
||||
@Cmd(permission = Perm.ShowAll)
|
||||
@Help("查看所以玩家已购买彩票§4(管理员命令)")
|
||||
@Sort(2)
|
||||
public void showall(final CommandArgument e) {
|
||||
PlayerData.showAllPlayerLottery(e.getSender());
|
||||
}
|
||||
}
|
||||
|
||||
132
src/main/java/cn/citycraft/LuckLottery/config/PlayerData.java
Normal file
132
src/main/java/cn/citycraft/LuckLottery/config/PlayerData.java
Normal file
@@ -0,0 +1,132 @@
|
||||
package cn.citycraft.LuckLottery.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import cn.citycraft.LuckLottery.LuckLottery;
|
||||
import cn.citycraft.LuckLottery.utils.ChatUtils;
|
||||
import cn.citycraft.LuckLottery.utils.LotteryUtils;
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
|
||||
public class PlayerData {
|
||||
public static Map<String, List<List<String>>> playerLottery = new HashMap<String, List<List<String>>>();
|
||||
public static FileConfig playerdata = new FileConfig(LuckLottery.plugin, "playerdate.yml");
|
||||
|
||||
public static void addCount() {
|
||||
playerdata.set("Count", playerdata.getInt("Count", 0) + 1);
|
||||
playerdata.set("PriceTotal", playerdata.getInt("PriceTotal", 0) + LotteryUtils.getPrice());
|
||||
playerdata.save();
|
||||
}
|
||||
|
||||
public static List<List<String>> addLottery(final Player player, final List<String> lottery) {
|
||||
List<List<String>> playerhas = playerLottery.get(player.getName());
|
||||
if (playerhas == null) {
|
||||
playerhas = new ArrayList<List<String>>();
|
||||
}
|
||||
if (!player.isOnline()) {
|
||||
return playerhas;
|
||||
}
|
||||
playerhas.add(lottery);
|
||||
playerLottery.put(player.getName(), playerhas);
|
||||
playerdata.set(player.getName(), playerhas);
|
||||
addCount();
|
||||
return playerhas;
|
||||
}
|
||||
|
||||
public static void clearLottery() {
|
||||
for (final Entry<String, List<List<String>>> pl : playerLottery.entrySet()) {
|
||||
final String p = pl.getKey();
|
||||
playerdata.set(p, null);
|
||||
}
|
||||
playerLottery.clear();
|
||||
playerdata.save();
|
||||
}
|
||||
|
||||
public static Map<String, List<List<String>>> getPlayerLottery() {
|
||||
return playerLottery;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void loadPlayerLottery(final Player p) {
|
||||
final List<?> pl = playerdata.getList(p.getName());
|
||||
if (pl != null) {
|
||||
playerLottery.put(p.getName(), (List<List<String>>) pl);
|
||||
}
|
||||
}
|
||||
|
||||
public static void printStatus(final CommandSender sender) {
|
||||
int nc = 0;
|
||||
int np = 0;
|
||||
int ncc = 0;
|
||||
for (final List<List<String>> lls : playerLottery.values()) {
|
||||
nc += lls.size();
|
||||
np += LotteryUtils.getPrice();
|
||||
for (final List<String> a : lls) {
|
||||
ncc += LuckLottery.plugin.getConfig().getInt("Reward." + LotteryUtils.getSameNumber(a), 200);
|
||||
}
|
||||
}
|
||||
ChatUtils.sendMessage(sender, String.format("§a本轮当前售出彩票 §e%s §a张", nc));
|
||||
ChatUtils.sendMessage(sender, String.format("§a本轮预计回收金额 §e%s§a(总: §e%s §a中奖返还: §e%s§a) §a元", np - ncc, np, ncc));
|
||||
ChatUtils.sendMessage(sender, String.format("§d总计出售彩票 §e%s §d张", playerdata.getInt("Count", 0)));
|
||||
ChatUtils.sendMessage(sender, String.format("§d总计回收金额 §e%s §d元", playerdata.getInt("PriceTotal", 0)));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void reloadPlayerLottery() {
|
||||
final Set<String> apl = playerdata.getKeys(false);
|
||||
for (final String p : apl) {
|
||||
final List<?> pl = playerdata.getList(p);
|
||||
if (pl != null) {
|
||||
playerLottery.put(p, (List<List<String>>) pl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void reward(final int price) {
|
||||
playerdata.set("PriceTotal", playerdata.getInt("PriceTotal", 0) - price);
|
||||
playerdata.save();
|
||||
}
|
||||
|
||||
public static void saveLottery() {
|
||||
for (final Entry<String, List<List<String>>> pl : playerLottery.entrySet()) {
|
||||
final String p = pl.getKey();
|
||||
final List<List<String>> l = pl.getValue();
|
||||
playerdata.set(p, l);
|
||||
}
|
||||
playerdata.save();
|
||||
}
|
||||
|
||||
public static void showAllPlayerLottery(final CommandSender sender) {
|
||||
ChatUtils.sendMessage(sender, "§c正在检索玩家彩票数据...");
|
||||
boolean has = false;
|
||||
for (final Entry<String, List<List<String>>> phas : playerLottery.entrySet()) {
|
||||
ChatUtils.sendMessage(sender, "§6玩家: §a" + phas.getKey() + "§6购买的彩票有");
|
||||
for (final List<String> lry : phas.getValue()) {
|
||||
has = true;
|
||||
ChatUtils.sendMessage(sender, "§a" + lry.toString());
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
ChatUtils.sendMessage(sender, "§d没有玩家购买本轮彩票...");
|
||||
}
|
||||
}
|
||||
|
||||
public static void showPlayerLottery(final Player p) {
|
||||
final List<List<String>> playerhas = playerLottery.get(p.getName());
|
||||
if (playerhas != null && !playerhas.isEmpty()) {
|
||||
ChatUtils.sendMessage(p, "§6您当前购买的彩票有:");
|
||||
for (final List<String> lry : playerhas) {
|
||||
ChatUtils.sendMessage(p, "§a" + lry.toString());
|
||||
}
|
||||
} else {
|
||||
ChatUtils.sendMessage(p, "§c您当前没有购买的彩票!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import cn.citycraft.LuckLottery.LuckLottery;
|
||||
import cn.citycraft.LuckLottery.config.PlayerData;
|
||||
import cn.citycraft.LuckLottery.runnable.LaterShow;
|
||||
import cn.citycraft.LuckLottery.utils.ChatUtils;
|
||||
import cn.citycraft.LuckLottery.utils.InvUtils;
|
||||
@@ -50,7 +51,7 @@ public class PlayerListen implements Listener {
|
||||
return;
|
||||
}
|
||||
final List<String> lottery = InvUtils.getLotteryNumber(inv);
|
||||
LotteryUtils.addLottery(p, lottery);
|
||||
PlayerData.addLottery(p, lottery);
|
||||
ChatUtils.sendMessage(p, "§6您当前购买的彩票号码为: " + ChatColor.GREEN + lottery.toString());
|
||||
ChatUtils.howToShow(p);
|
||||
LuckLottery.economy.withdrawPlayer(p, LotteryUtils.getPrice());
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import cn.citycraft.LuckLottery.LuckLottery;
|
||||
import cn.citycraft.LuckLottery.config.PlayerData;
|
||||
import cn.citycraft.LuckLottery.utils.ChatUtils;
|
||||
import cn.citycraft.LuckLottery.utils.LotteryUtils;
|
||||
|
||||
@@ -29,7 +30,8 @@ public class LotteryReward implements Runnable {
|
||||
}
|
||||
ChatUtils.broadcastMessage(ChatColor.GOLD + "本轮彩票开奖: " + ChatColor.RED + LotteryUtils.getSystemLottery().toString());
|
||||
ChatUtils.broadcastMessage(ChatColor.BLUE + "使用命令: " + ChatColor.RED + "/ll" + ChatColor.BLUE + " 或闹钟菜单可以购买彩票!");
|
||||
for (final Entry<String, List<List<String>>> players : LotteryUtils.playerLottery.entrySet()) {
|
||||
int priceTotal = 0;
|
||||
for (final Entry<String, List<List<String>>> players : PlayerData.playerLottery.entrySet()) {
|
||||
final OfflinePlayer p = Bukkit.getOfflinePlayer(players.getKey());
|
||||
final List<List<String>> pl = players.getValue();
|
||||
if (pl != null && !pl.isEmpty()) {
|
||||
@@ -38,21 +40,21 @@ public class LotteryReward implements Runnable {
|
||||
int winprices = 0;
|
||||
winprices = plugin.getConfig().getInt("Reward." + win, 200);
|
||||
if (winprices > 0) {
|
||||
priceTotal += winprices;
|
||||
ChatUtils.broadcastMessage(
|
||||
ChatColor.GREEN + p.getName() + "的彩票: " + ChatColor.YELLOW + playerlottery.toString() + ChatColor.GREEN + "获得了" + ChatColor.GOLD + winprices + ChatColor.GREEN + "元!");
|
||||
final String message = ChatColor.GREEN + "您的彩票: " + ChatColor.YELLOW + playerlottery.toString() + ChatColor.GREEN + "获得了" + ChatColor.GOLD + winprices + ChatColor.GREEN + "元!";
|
||||
if (p.isOnline()) {
|
||||
// ChatUtils.sendMessage((Player) p, message);
|
||||
} else {
|
||||
if (!p.isOnline()) {
|
||||
plugin.getOfflineData().addMessage(p.getName(), message);
|
||||
}
|
||||
LuckLottery.economy.depositPlayer(p, winprices);
|
||||
}
|
||||
}
|
||||
}
|
||||
LotteryUtils.playerLottery.put(players.getKey(), null);
|
||||
PlayerData.reward(priceTotal);
|
||||
PlayerData.playerLottery.put(players.getKey(), null);
|
||||
}
|
||||
LotteryUtils.clearLottery();
|
||||
PlayerData.clearLottery();
|
||||
if (update) {
|
||||
LotteryUtils.updateSystemLottery();
|
||||
}
|
||||
|
||||
@@ -9,69 +9,30 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ChatUtils {
|
||||
protected static String pluginname = "";
|
||||
public static String[] helps = new String[]{
|
||||
"§6=========彩票插件帮助========",
|
||||
"§a/ll 打开彩票购买界面",
|
||||
"§b/ll show 查看已购买彩票",
|
||||
"§3/ll showall查看所以玩家已购买彩票§4(管理员命令)",
|
||||
"§c/ll random 重新生成彩票§4(管理员命令)",
|
||||
"§d/ll reward 结算上一轮彩票§4(管理员命令)",
|
||||
"§e/ll clear 清除所有已购买彩票§4(管理员命令)",
|
||||
"§5/ll look 查看本轮彩票号码§4(管理员命令)",
|
||||
"§c/ll reload 重载彩票插件§4(管理员命令)"
|
||||
};
|
||||
|
||||
public static void broadcastMessage(final String message) {
|
||||
Bukkit.broadcastMessage(pluginname + message);
|
||||
}
|
||||
|
||||
public static String getPluginname() {
|
||||
return pluginname;
|
||||
}
|
||||
|
||||
public static void setPluginname(String pluginname) {
|
||||
public static void howToShow(final Player p) {
|
||||
sendMessage(p, ChatColor.GOLD + "命令: " + ChatColor.RED + "/ll show " + ChatColor.GOLD + "查看已购买彩票!");
|
||||
}
|
||||
|
||||
public static void sendMessage(final CommandSender p, final String message) {
|
||||
p.sendMessage(pluginname + message);
|
||||
}
|
||||
|
||||
public static void sendMessage(final Player p, final List<String> messages) {
|
||||
for (final String msg : messages) {
|
||||
sendMessage(p, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setPluginname(final String pluginname) {
|
||||
ChatUtils.pluginname = pluginname;
|
||||
}
|
||||
|
||||
public static void sendMessage(Player p, String message) {
|
||||
p.sendMessage(pluginname + message);
|
||||
}
|
||||
|
||||
public static void sendMessage(CommandSender p, String message) {
|
||||
p.sendMessage(pluginname + message);
|
||||
}
|
||||
|
||||
public static void sendMessage(Player p, String[] messages) {
|
||||
for (String msg : messages) {
|
||||
sendMessage(p, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendMessage(Player p, List<String> messages) {
|
||||
for (String msg : messages) {
|
||||
sendMessage(p, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendHelp(Player p){
|
||||
p.sendMessage(helps);
|
||||
}
|
||||
|
||||
public static void sendHelp(CommandSender sender) {
|
||||
sender.sendMessage(helps);
|
||||
}
|
||||
|
||||
public static void broadcastMessage(String message) {
|
||||
Bukkit.broadcastMessage(pluginname + message);
|
||||
}
|
||||
|
||||
public static void howToShow(Player p) {
|
||||
sendMessage(p, ChatColor.GOLD + "命令: " + ChatColor.RED + "/ll show "
|
||||
+ ChatColor.GOLD + "查看已购买彩票!");
|
||||
}
|
||||
|
||||
public static void noPermission(Player p) {
|
||||
ChatUtils.sendMessage(p, PermissionUtils.No_Permission);
|
||||
}
|
||||
|
||||
public static void noPermission(CommandSender p) {
|
||||
ChatUtils.sendMessage(p, PermissionUtils.No_Permission);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class InvUtils {
|
||||
|
||||
public static final String InvName = ChatUtils.getPluginname() + " §c§l售价: "
|
||||
+ LotteryUtils.getPrice() + "元一份";
|
||||
public static final String InvName = ChatUtils.getPluginname() + " §c§l售价: " + LotteryUtils.getPrice() + "元一份";
|
||||
|
||||
public static final String NumPrefix = "§6§l";
|
||||
public static final String Normal1 = "§6§l1";
|
||||
@@ -110,6 +109,7 @@ public class InvUtils {
|
||||
public static final ItemStack CantCreat = new ItemStack(Material.EMPTY_MAP);
|
||||
public static final ItemStack A = new ItemStack(Material.AIR);
|
||||
public static final ItemStack RT = new ItemStack(Material.LAVA_BUCKET);
|
||||
|
||||
static {
|
||||
setDisplayName(W, WEB);
|
||||
setDisplayName(L0, Normal1);
|
||||
@@ -152,81 +152,21 @@ public class InvUtils {
|
||||
setDisplayName(Creat, Create);
|
||||
}
|
||||
|
||||
private static final ItemStack[] GUI_LINE1 = {
|
||||
W,
|
||||
L0,
|
||||
L1,
|
||||
L2,
|
||||
L3,
|
||||
L4,
|
||||
L5,
|
||||
L6,
|
||||
W
|
||||
private static final ItemStack[] GUI_LINE1 = { W, L0, L1, L2, L3, L4, L5, L6, W
|
||||
/* 第一行结束 */ };
|
||||
private static final ItemStack[] GUI_LINE2 = {
|
||||
L7,
|
||||
L8,
|
||||
L9,
|
||||
L10,
|
||||
L11,
|
||||
L12,
|
||||
L13,
|
||||
L14,
|
||||
L15
|
||||
private static final ItemStack[] GUI_LINE2 = { L7, L8, L9, L10, L11, L12, L13, L14, L15
|
||||
/* 第二行结束 */ };
|
||||
private static final ItemStack[] GUI_LINE3 = {
|
||||
B0,
|
||||
B1,
|
||||
B2,
|
||||
B3,
|
||||
B4,
|
||||
B5,
|
||||
B6,
|
||||
B7,
|
||||
B8
|
||||
private static final ItemStack[] GUI_LINE3 = { B0, B1, B2, B3, B4, B5, B6, B7, B8
|
||||
/* 第三行结束 */ };
|
||||
private static final ItemStack[] GUI_LINE4 = {
|
||||
W,
|
||||
B9,
|
||||
B10,
|
||||
B11,
|
||||
B12,
|
||||
B13,
|
||||
B14,
|
||||
B15,
|
||||
W
|
||||
private static final ItemStack[] GUI_LINE4 = { W, B9, B10, B11, B12, B13, B14, B15, W
|
||||
/* 第四行结束 */ };
|
||||
private static final ItemStack[] GUI_LINE5 = {
|
||||
W,
|
||||
W,
|
||||
W,
|
||||
W,
|
||||
W,
|
||||
W,
|
||||
RT,
|
||||
W,
|
||||
W
|
||||
private static final ItemStack[] GUI_LINE5 = { W, W, W, W, W, W, RT, W, W
|
||||
/* 第五行结束 */ };
|
||||
private static final ItemStack[] GUI_LINE6 = {
|
||||
A,
|
||||
A,
|
||||
A,
|
||||
A,
|
||||
A,
|
||||
A,
|
||||
CM,
|
||||
A,
|
||||
CantCreat
|
||||
private static final ItemStack[] GUI_LINE6 = { A, A, A, A, A, A, CM, A, CantCreat
|
||||
/* 第六行结束 */ };
|
||||
|
||||
private static void setDisplayName(ItemStack item, String displayName) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(displayName);
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
|
||||
public static ItemStack[] getGui() {
|
||||
List<ItemStack> invgui = new ArrayList<ItemStack>();
|
||||
final List<ItemStack> invgui = new ArrayList<ItemStack>();
|
||||
invgui.addAll(Arrays.asList(GUI_LINE1));
|
||||
invgui.addAll(Arrays.asList(GUI_LINE2));
|
||||
invgui.addAll(Arrays.asList(GUI_LINE3));
|
||||
@@ -236,26 +176,16 @@ public class InvUtils {
|
||||
return invgui.toArray(new ItemStack[0]);
|
||||
}
|
||||
|
||||
public static void openGui(Player p) {
|
||||
Inventory scrollInv = Bukkit.createInventory(null, 6 * 9, InvName);
|
||||
scrollInv.setContents(getGui());
|
||||
p.openInventory(scrollInv);
|
||||
public static String getItemNumber(final ItemStack item) {
|
||||
final String num = item.getItemMeta().getDisplayName();
|
||||
if (num.startsWith(NumPrefix)) {
|
||||
return num.substring(NumPrefix.length());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isLotteryGUI(Inventory inv) {
|
||||
if (inv == null)
|
||||
return false;
|
||||
return inv.getHolder() == null && inv.getTitle().equals(InvName);
|
||||
}
|
||||
|
||||
public static boolean selectFinish(Inventory inv) {
|
||||
return (inv.getItem(45) != null && inv.getItem(46) != null && inv.getItem(47) != null
|
||||
&& inv.getItem(48) != null && inv.getItem(49) != null && inv.getItem(50) != null && inv
|
||||
.getItem(52) != null);
|
||||
}
|
||||
|
||||
public static List<String> getLotteryNumber(Inventory inv) {
|
||||
List<String> lty = new ArrayList<String>();
|
||||
public static List<String> getLotteryNumber(final Inventory inv) {
|
||||
final List<String> lty = new ArrayList<String>();
|
||||
for (int i = 45; i < 51; i++) {
|
||||
lty.add(getItemNumber(inv.getItem(i)));
|
||||
}
|
||||
@@ -263,15 +193,37 @@ public class InvUtils {
|
||||
return lty;
|
||||
}
|
||||
|
||||
public static String getItemNumber(ItemStack item) {
|
||||
String num = item.getItemMeta().getDisplayName();
|
||||
if (num.startsWith(NumPrefix))
|
||||
return num.substring(NumPrefix.length());
|
||||
return null;
|
||||
public static boolean isLotteryGUI(final Inventory inv) {
|
||||
if (inv == null) {
|
||||
return false;
|
||||
}
|
||||
return inv.getHolder() == null && inv.getTitle().equals(InvName);
|
||||
}
|
||||
|
||||
public static boolean isLotteryItem(ItemStack item) {
|
||||
String num = item.getItemMeta().getDisplayName();
|
||||
public static boolean isLotteryItem(final ItemStack item) {
|
||||
final String num = item.getItemMeta().getDisplayName();
|
||||
return num.startsWith(NumPrefix);
|
||||
}
|
||||
|
||||
public static void openGui(final Player p) {
|
||||
final Inventory scrollInv = Bukkit.createInventory(null, 6 * 9, InvName);
|
||||
scrollInv.setContents(getGui());
|
||||
p.openInventory(scrollInv);
|
||||
}
|
||||
|
||||
public static boolean selectFinish(final Inventory inv) {
|
||||
return (inv.getItem(45) != null
|
||||
&& inv.getItem(46) != null
|
||||
&& inv.getItem(47) != null
|
||||
&& inv.getItem(48) != null
|
||||
&& inv.getItem(49) != null
|
||||
&& inv.getItem(50) != null
|
||||
&& inv.getItem(52) != null);
|
||||
}
|
||||
|
||||
private static void setDisplayName(final ItemStack item, final String displayName) {
|
||||
final ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(displayName);
|
||||
item.setItemMeta(itemMeta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +1,26 @@
|
||||
package cn.citycraft.LuckLottery.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import cn.citycraft.LuckLottery.LuckLottery;
|
||||
import cn.citycraft.LuckLottery.config.PlayerData;
|
||||
import cn.citycraft.LuckLottery.runnable.LotteryReward;
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
|
||||
public class LotteryUtils {
|
||||
public static Map<String, List<List<String>>> playerLottery = new HashMap<String, List<List<String>>>();
|
||||
protected static boolean numbersame;
|
||||
protected static FileConfig playerdata;
|
||||
protected static LuckLottery plugin;
|
||||
protected static int price;
|
||||
protected static LuckLottery plugin = LuckLottery.plugin;
|
||||
protected static List<String> systemLottery = new ArrayList<String>();
|
||||
|
||||
public static List<List<String>> addLottery(final Player player, final List<String> lottery) {
|
||||
List<List<String>> playerhas = playerLottery.get(player.getName());
|
||||
if (playerhas == null) {
|
||||
playerhas = new ArrayList<List<String>>();
|
||||
}
|
||||
playerhas.add(lottery);
|
||||
playerLottery.put(player.getName(), playerhas);
|
||||
playerdata.set(player.getName(), playerhas);
|
||||
playerdata.save();
|
||||
return playerhas;
|
||||
}
|
||||
|
||||
public static void clearLottery() {
|
||||
for (final Entry<String, List<List<String>>> pl : playerLottery.entrySet()) {
|
||||
final String p = pl.getKey();
|
||||
playerdata.set(p, null);
|
||||
}
|
||||
playerLottery.clear();
|
||||
playerdata.save();
|
||||
}
|
||||
protected static boolean numbersame;
|
||||
protected static int price;
|
||||
|
||||
public static void clearPlayerLottery(final CommandSender sender) {
|
||||
ChatUtils.sendMessage(sender, "§c提示: 以清除所有玩家彩票数据...");
|
||||
clearLottery();
|
||||
PlayerData.clearLottery();
|
||||
}
|
||||
|
||||
public static int getPrice() {
|
||||
@@ -69,27 +41,7 @@ public class LotteryUtils {
|
||||
}
|
||||
|
||||
public static int getSameNumber(final List<String> lottery) {
|
||||
int samenum = 0;
|
||||
final List<String> system = systemLottery;
|
||||
if (numbersame) {
|
||||
for (int i = 0; i < lottery.size(); i++) {
|
||||
if (lottery.get(i).equals(system.get(i))) {
|
||||
samenum++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (final String pn : lottery) {
|
||||
for (final String sn : system) {
|
||||
if (pn.equals(sn)) {
|
||||
samenum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lottery.get(lottery.size() - 1).equalsIgnoreCase(system.get(system.size() - 1))) {
|
||||
samenum += 9;
|
||||
}
|
||||
return samenum;
|
||||
return getSameNumber(lottery, systemLottery);
|
||||
}
|
||||
|
||||
public static int getSameNumber(final List<String> lottery, final List<String> system) {
|
||||
@@ -119,11 +71,6 @@ public class LotteryUtils {
|
||||
return systemLottery;
|
||||
}
|
||||
|
||||
public static void init(final LuckLottery luckLottery) {
|
||||
plugin = luckLottery;
|
||||
playerdata = plugin.getPlayerdata();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return numbersame
|
||||
*/
|
||||
@@ -131,36 +78,8 @@ public class LotteryUtils {
|
||||
return numbersame;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void loadPlayerLottery(final Player p) {
|
||||
final List<?> pl = playerdata.getList(p.getName());
|
||||
if (pl != null) {
|
||||
playerLottery.put(p.getName(), (List<List<String>>) pl);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void reloadPlayerLottery() {
|
||||
final Set<String> apl = playerdata.getKeys(false);
|
||||
for (final String p : apl) {
|
||||
final List<?> pl = playerdata.getList(p);
|
||||
if (pl != null) {
|
||||
playerLottery.put(p, (List<List<String>>) pl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void rewardLastLottery() {
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(LuckLottery.plugin, new LotteryReward(plugin, true));
|
||||
}
|
||||
|
||||
public static void saveLottery() {
|
||||
for (final Entry<String, List<List<String>>> pl : playerLottery.entrySet()) {
|
||||
final String p = pl.getKey();
|
||||
final List<List<String>> l = pl.getValue();
|
||||
playerdata.set(p, l);
|
||||
}
|
||||
playerdata.save();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(plugin, new LotteryReward(plugin, true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,33 +98,6 @@ public class LotteryUtils {
|
||||
LotteryUtils.systemLottery = systemLottery;
|
||||
}
|
||||
|
||||
public static void showAllPlayerLottery(final CommandSender sender) {
|
||||
ChatUtils.sendMessage(sender, "§c正在检索玩家彩票数据...");
|
||||
boolean has = false;
|
||||
for (final Entry<String, List<List<String>>> phas : playerLottery.entrySet()) {
|
||||
ChatUtils.sendMessage(sender, "§6玩家: §a" + phas.getKey() + "§6购买的彩票有");
|
||||
for (final List<String> lry : phas.getValue()) {
|
||||
has = true;
|
||||
ChatUtils.sendMessage(sender, "§a" + lry.toString());
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
ChatUtils.sendMessage(sender, "§d没有玩家购买本轮彩票...");
|
||||
}
|
||||
}
|
||||
|
||||
public static void showPlayerLottery(final Player p) {
|
||||
final List<List<String>> playerhas = playerLottery.get(p.getName());
|
||||
if (playerhas != null && !playerhas.isEmpty()) {
|
||||
ChatUtils.sendMessage(p, "§6您当前购买的彩票有:");
|
||||
for (final List<String> lry : playerhas) {
|
||||
ChatUtils.sendMessage(p, "§a" + lry.toString());
|
||||
}
|
||||
} else {
|
||||
ChatUtils.sendMessage(p, "§c您当前没有购买的彩票!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void showSystemLottery(final CommandSender p) {
|
||||
ChatUtils.sendMessage(p, ChatColor.DARK_PURPLE + "此轮彩票号码为: " + ChatColor.YELLOW + LotteryUtils.systemLottery.toString());
|
||||
}
|
||||
|
||||
11
src/main/java/cn/citycraft/LuckLottery/utils/Perm.java
Normal file
11
src/main/java/cn/citycraft/LuckLottery/utils/Perm.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package cn.citycraft.LuckLottery.utils;
|
||||
|
||||
public class Perm {
|
||||
public static final String ShowAll = "lucklottery.showall";
|
||||
public static final String Status = "lucklottery.status";
|
||||
public static final String Reward = "lucklottery.reward";
|
||||
public static final String Random = "lucklottery.random";
|
||||
public static final String Look = "lucklottery.look";
|
||||
public static final String Clear = "lucklottery.clear";
|
||||
public static final String Reload = "lucklottery.reload";
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package cn.citycraft.LuckLottery.utils;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class PermissionUtils {
|
||||
public static final String ShowAll = "lucklottery.showall";
|
||||
public static final String Reward = "lucklottery.reward";
|
||||
public static final String Random = "lucklottery.random";
|
||||
public static final String Look = "lucklottery.look";
|
||||
public static final String Clear = "lucklottery.clear";
|
||||
public static final String Reload = "lucklottery.reload";
|
||||
|
||||
public static String No_Permission = ChatColor.RED + "你没有此命令的权限!";
|
||||
|
||||
public static boolean Check(Player p, String perm) {
|
||||
if (p.hasPermission(perm)) {
|
||||
return true;
|
||||
} else {
|
||||
ChatUtils.noPermission(p);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean Check(CommandSender p, String perm) {
|
||||
if (p.hasPermission(perm)) {
|
||||
return true;
|
||||
} else {
|
||||
ChatUtils.noPermission(p);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
name: ${project.artifactId}
|
||||
description: ${project.description}
|
||||
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||
version: ${project.version}
|
||||
version: ${project.version}-git-${env.GIT_COMMIT}
|
||||
author: 喵♂呜
|
||||
website: http://ci.sumcraft.net:8080/job/${project.artifactId}/
|
||||
depended: [Vault]
|
||||
website: ${ciManagement.url}
|
||||
depend: [Vault]
|
||||
commands:
|
||||
lucklottery:
|
||||
aliases: [ll]
|
||||
@@ -19,6 +19,9 @@ permissions:
|
||||
lucklottery.look: true
|
||||
lucklottery.clear: true
|
||||
lucklottery.reload: true
|
||||
lucklottery.status:
|
||||
description: 允许查看彩票状态!
|
||||
default: op
|
||||
lucklottery.showall:
|
||||
description: 允许查看所有已购买彩票!
|
||||
default: op
|
||||
|
||||
Reference in New Issue
Block a user