Merge remote-tracking branch 'Coding/master'

master
502647092 2015-08-18 17:06:43 +08:00
commit 1ed77faf0a
8 changed files with 159 additions and 168 deletions

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src"> <classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
/.settings
.classpath
# netbeans # netbeans
/nbproject /nbproject

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>LuckLottery</name> <name>LuckLottery</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <name>org.eclipse.jdt.core.javabuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name> <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,76 +1,76 @@
package cn.citycraft.LuckLottery; package cn.citycraft.LuckLottery;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import cn.citycraft.LuckLottery.command.LuckLotteryCommand; import cn.citycraft.LuckLottery.command.LuckLotteryCommand;
import cn.citycraft.LuckLottery.config.Config; import cn.citycraft.LuckLottery.config.Config;
import cn.citycraft.LuckLottery.config.OfflineDate; import cn.citycraft.LuckLottery.config.OfflineDate;
import cn.citycraft.LuckLottery.config.PlayerDate; import cn.citycraft.LuckLottery.config.PlayerDate;
import cn.citycraft.LuckLottery.listen.PlayerListen; import cn.citycraft.LuckLottery.listen.PlayerListen;
import cn.citycraft.LuckLottery.runnable.LotteryReward; import cn.citycraft.LuckLottery.runnable.LotteryReward;
import cn.citycraft.LuckLottery.utils.ChatUtils; import cn.citycraft.LuckLottery.utils.ChatUtils;
import cn.citycraft.LuckLottery.utils.LotteryUtils; import cn.citycraft.LuckLottery.utils.LotteryUtils;
import cn.citycraft.LuckLottery.utils.VersionChecker; import cn.citycraft.LuckLottery.utils.VersionChecker;
public class LuckLottery extends JavaPlugin { public class LuckLottery extends JavaPlugin {
public static boolean isEconomy; public static boolean isEconomy;
public static Economy economy = null; public static Economy economy = null;
public static LuckLottery plugin; public static LuckLottery plugin;
@Override @Override
public void onDisable() { public void onDisable() {
this.getLogger().info("保存彩票数据中..."); this.getLogger().info("保存彩票数据中...");
this.getLogger().info("保存玩家数据中..."); this.getLogger().info("保存玩家数据中...");
LotteryUtils.saveLottery(); LotteryUtils.saveLottery();
} }
@Override @Override
public void onEnable() { public void onEnable() {
PluginManager pm = this.getServer().getPluginManager(); PluginManager pm = this.getServer().getPluginManager();
if (pm.getPlugin("Vault") == null && !pm.getPlugin("Vault").isEnabled()) { if (pm.getPlugin("Vault") == null && !pm.getPlugin("Vault").isEnabled()) {
this.getLogger().warning("未找到前置插件Vault 关闭插件..."); this.getLogger().warning("未找到前置插件Vault 关闭插件...");
this.getServer().getPluginManager().disablePlugin(this); this.getServer().getPluginManager().disablePlugin(this);
return; return;
} }
if (setupEconomy()) { if (setupEconomy()) {
LuckLottery.isEconomy = true; LuckLottery.isEconomy = true;
this.getLogger().info("发现Vault 载入数据..."); this.getLogger().info("发现Vault 载入数据...");
} else { } else {
this.getLogger().warning("发现Vault 但是无法找到经济插件 关闭插件..."); this.getLogger().warning("发现Vault 但是无法找到经济插件 关闭插件...");
this.getServer().getPluginManager().disablePlugin(this); this.getServer().getPluginManager().disablePlugin(this);
return; return;
} }
int rewardtime = Config.getInstance().getInt("RewardTime", 10); int rewardtime = Config.getInstance().getInt("RewardTime", 10);
this.getServer().getScheduler() this.getServer().getScheduler()
.runTaskTimer(plugin, new LotteryReward(true), 10, rewardtime * 60 * 20); .runTaskTimer(plugin, new LotteryReward(true), 10, rewardtime * 60 * 20);
this.getLogger().info("彩票系统已开启..."); this.getLogger().info("彩票系统已开启...");
new VersionChecker(this); new VersionChecker(this);
pm.registerEvents(new PlayerListen(), this); pm.registerEvents(new PlayerListen(), this);
getCommand("ll").setExecutor(new LuckLotteryCommand(this)); getCommand("ll").setExecutor(new LuckLotteryCommand(this));
} }
@Override @Override
public void onLoad() { public void onLoad() {
plugin = this; plugin = this;
Config.load(this, "1.2"); Config.load(this, "1.2");
OfflineDate.load(this); OfflineDate.load(this);
PlayerDate.load(this); PlayerDate.load(this);
LotteryUtils.reloadPlayerLottery(); LotteryUtils.reloadPlayerLottery();
ChatUtils.setPluginname(Config.getMessage("pluginname")); ChatUtils.setPluginname(Config.getMessage("pluginname"));
LotteryUtils.setNumbersame(Config.getInstance().getBoolean("numbersame")); LotteryUtils.setNumbersame(Config.getInstance().getBoolean("numbersame"));
LotteryUtils.setPrice(Config.getInstance().getInt("price")); LotteryUtils.setPrice(Config.getInstance().getInt("price"));
} }
public boolean setupEconomy() { public boolean setupEconomy() {
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager() RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager()
.getRegistration(net.milkbowl.vault.economy.Economy.class); .getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) { if (economyProvider != null) {
economy = economyProvider.getProvider(); economy = economyProvider.getProvider();
} }
return (economy != null); return (economy != null);
} }
} }

View File

@ -1,38 +1,38 @@
name: LuckLottery name: LuckLottery
main: cn.citycraft.LuckLottery.LuckLottery main: cn.citycraft.LuckLottery.LuckLottery
author: 喵♂呜 author: 喵♂呜
website: http://ci.citycraft.cn:8800/jenkins/job/LuckLottery/ website: http://ci.citycraft.cn:8800/jenkins/job/LuckLottery/
version: 0.1.0 version: 0.1.0
depended: [Vault] depended: [Vault]
commands: commands:
lucklottery: lucklottery:
aliases: [ll] aliases: [ll]
permissions: permissions:
lucklottery.*: lucklottery.*:
description: 允许使用所有命令! description: 允许使用所有命令!
default: op default: op
children: children:
lucklottery.showall: true lucklottery.showall: true
lucklottery.reward: true lucklottery.reward: true
lucklottery.random: true lucklottery.random: true
lucklottery.look: true lucklottery.look: true
lucklottery.clear: true lucklottery.clear: true
lucklottery.reload: true lucklottery.reload: true
lucklottery.showall: lucklottery.showall:
description: 允许查看所有已购买彩票! description: 允许查看所有已购买彩票!
default: op default: op
lucklottery.reward: lucklottery.reward:
description: 允许结算上一轮彩票! description: 允许结算上一轮彩票!
default: op default: op
lucklottery.random: lucklottery.random:
description: 允许重新生成本轮彩票! description: 允许重新生成本轮彩票!
default: op default: op
lucklottery.look: lucklottery.look:
description: 允许查看本轮彩票号码! description: 允许查看本轮彩票号码!
default: op default: op
lucklottery.clear: lucklottery.clear:
description: 允许清理玩家彩票数据! description: 允许清理玩家彩票数据!
default: op default: op
lucklottery.reload: lucklottery.reload:
description: 允许重载彩票插件! description: 允许重载彩票插件!
default: op default: op