parent
b7318b8f98
commit
543d145252
110
pom.xml
110
pom.xml
|
@ -1,56 +1,56 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.CityCraft</groupId>
|
||||
<artifactId>LuckLottery</artifactId>
|
||||
<version>0.0.3-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<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>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Vault-1.4.1.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.CityCraft</groupId>
|
||||
<artifactId>LuckLottery</artifactId>
|
||||
<version>0.0.5-SNAPSHOT</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<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>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Vault-1.4.1.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<String> 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()
|
||||
|
|
|
@ -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<List<String>> addLottery(Player player,
|
||||
List<String> lottery) {
|
||||
List<List<String>> playerhas = playerLottery.get(player.getName());
|
||||
|
|
|
@ -1,8 +1,29 @@
|
|||
#本文件为插件的主配置文件
|
||||
version: 1.0
|
||||
#服务器名称
|
||||
servername: ''
|
||||
#插件名称
|
||||
pluginname: '&6[&b彩票系统&6]&r '
|
||||
#是否需要对应彩票号码位置
|
||||
numbersame: true
|
||||
#本文件为插件的主配置文件
|
||||
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
|
||||
|
||||
|
|
@ -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]
|
Loading…
Reference in New Issue