1
1
mirror of https://github.com/geekfrog/PermissionsTime.git synced 2024-11-22 07:28:47 +00:00

添加统计功能

This commit is contained in:
GeekFrog 2017-07-10 13:06:41 +08:00
parent 5400ac92ee
commit 405deda1d5
3 changed files with 70 additions and 13 deletions

39
pom.xml
View File

@ -29,6 +29,10 @@
<id>vault-repo</id> <id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases/</url> <url>http://nexus.hc.to/content/repositories/pub_releases/</url>
</repository> </repository>
<repository>
<id>Plugin Metrics</id>
<url>http://repo.mcstats.org/content/repositories/public</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
@ -36,7 +40,13 @@
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version> <version>1.11.2-R0.1-SNAPSHOT</version>
<type>jar</type> <type>jar</type>
<scope>provided</scope> <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mcstats.bukkit</groupId>
<artifactId>metrics</artifactId>
<version>R8-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.milkbowl.vault</groupId> <groupId>net.milkbowl.vault</groupId>
@ -49,7 +59,6 @@
<artifactId>SQLibrary</artifactId> <artifactId>SQLibrary</artifactId>
<version>7.1</version> <version>7.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>PermissionsTime-${project.version}</finalName> <finalName>PermissionsTime-${project.version}</finalName>
@ -98,6 +107,32 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<artifactSet>
<includes>
<include>org.mcstats.*:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.mcstats</pattern>
<shadedPattern>gg.frog.mc.permissionstime</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<ciManagement> <ciManagement>

View File

@ -2,7 +2,9 @@ package gg.frog.mc.permissionstime;
import java.util.Locale; import java.util.Locale;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.mcstats.Metrics;
import gg.frog.mc.permissionstime.command.TheCommand; import gg.frog.mc.permissionstime.command.TheCommand;
import gg.frog.mc.permissionstime.config.ConfigManager; import gg.frog.mc.permissionstime.config.ConfigManager;
@ -22,17 +24,29 @@ public class PluginMain extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
pm = this; if (!checkPluginDepends()) {
cm = new ConfigManager();
registerListeners(); } else {
registerCommands(); pm = this;
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "===============================")); cm = new ConfigManager();
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX)); registerListeners();
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " " + PluginMain.PLUGIN_NAME + " v" + PluginMain.PLUGIN_VERSION)); registerCommands();
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " authorGeekFrog QQ324747460")); pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "==============================="));
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " https://github.com/geekfrog/PermissionsTime/ ")); pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX));
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX)); pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " " + PluginMain.PLUGIN_NAME + " v" + PluginMain.PLUGIN_VERSION));
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "===============================")); pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " authorGeekFrog QQ324747460"));
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " https://github.com/geekfrog/PermissionsTime/ "));
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX));
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "==============================="));
if(PluginCfg.IS_METRICS){
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
} }
public static PluginMain getInstance() { public static PluginMain getInstance() {
@ -58,4 +72,9 @@ public class PluginMain extends JavaPlugin {
public ConfigManager getConfigManager() { public ConfigManager getConfigManager() {
return cm; return cm;
} }
private boolean checkPluginDepends() {
// return false;
return true;
}
} }

View File

@ -12,6 +12,7 @@ import gg.frog.mc.permissionstime.utils.config.PluginConfig;
public class PluginCfg extends PluginConfig { public class PluginCfg extends PluginConfig {
public static String PLUGIN_PREFIX = null; public static String PLUGIN_PREFIX = null;
public static Boolean IS_METRICS = null;
public static Boolean IS_DEBUG = null; public static Boolean IS_DEBUG = null;
public static String LANG = null; public static String LANG = null;
public static String SQL_HOSTNAME; public static String SQL_HOSTNAME;
@ -27,6 +28,7 @@ public class PluginCfg extends PluginConfig {
@Override @Override
protected void init() { protected void init() {
getConfig().set("lang","zh-cn"); getConfig().set("lang","zh-cn");
getConfig().set("metrics", true);
getConfig().set("debug", false); getConfig().set("debug", false);
saveConfig(); saveConfig();
} }
@ -35,6 +37,7 @@ public class PluginCfg extends PluginConfig {
protected void loadToDo() { protected void loadToDo() {
PLUGIN_PREFIX = getConfig().getString("pluginPrefix","&b["+PluginMain.PLUGIN_NAME+"]&r"); PLUGIN_PREFIX = getConfig().getString("pluginPrefix","&b["+PluginMain.PLUGIN_NAME+"]&r");
IS_DEBUG = getConfig().getBoolean("debug", false); IS_DEBUG = getConfig().getBoolean("debug", false);
IS_METRICS = getConfig().getBoolean("metrics", true);
LANG = getConfig().getString("lang","zh-cn"); LANG = getConfig().getString("lang","zh-cn");
} }