mirror of
https://github.com/geekfrog/PermissionsTime.git
synced 2024-11-21 23:08:48 +00:00
修复路径BUG 更换统计
This commit is contained in:
parent
6953d1b5dd
commit
b94799dcea
253
pom.xml
253
pom.xml
@ -1,125 +1,132 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>gg.frog.mc</groupId>
|
||||
<artifactId>permissionstime</artifactId>
|
||||
<version>0.2.3-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>PermissionsTime</name>
|
||||
<description>支持跨服的权限限时插件</description>
|
||||
<organization>
|
||||
<url>https://github.com/geekfrog</url>
|
||||
<name>GeekFrog</name>
|
||||
</organization>
|
||||
<url>https://github.com/geekfrog/PermissionsTime/</url>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dakani</id>
|
||||
<name>Dakani Nexus Repo</name>
|
||||
<url>https://repo.dakanilabs.com/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mcstats.bukkit</groupId>
|
||||
<artifactId>metrics</artifactId>
|
||||
<version>R8-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>lib.PatPeter.SQLibrary</groupId>
|
||||
<artifactId>SQLibrary</artifactId>
|
||||
<version>7.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>PermissionsTime-${project.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/main</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}</directory>
|
||||
<includes>
|
||||
<include>README.md</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- 解决资源文件的编码问题 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>org.mcstats.*:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<ciManagement>
|
||||
<system>Jenkins</system>
|
||||
<url>http://ci.frog.gg/jenkins/job/PermissionsTime/</url>
|
||||
</ciManagement>
|
||||
<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>gg.frog.mc</groupId>
|
||||
<artifactId>permissionstime</artifactId>
|
||||
<version>0.2.4-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>PermissionsTime</name>
|
||||
<description>支持跨服的权限限时插件</description>
|
||||
<organization>
|
||||
<url>https://github.com/geekfrog</url>
|
||||
<name>GeekFrog</name>
|
||||
</organization>
|
||||
<url>https://github.com/geekfrog/PermissionsTime/</url>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dakani</id>
|
||||
<name>Dakani Nexus Repo</name>
|
||||
<url>https://repo.dakanilabs.com/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bstats-repo</id>
|
||||
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>lib.PatPeter.SQLibrary</groupId>
|
||||
<artifactId>SQLibrary</artifactId>
|
||||
<version>7.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>PermissionsTime-${project.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/main</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}</directory>
|
||||
<includes>
|
||||
<include>README.md</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- 解决资源文件的编码问题 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>org.bstats:*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<!-- Replace this with your package! -->
|
||||
<shadedPattern>gg.frog.mc.permissionstime</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<ciManagement>
|
||||
<system>Jenkins</system>
|
||||
<url>http://ci.frog.gg/jenkins/job/PermissionsTime/</url>
|
||||
</ciManagement>
|
||||
</project>
|
||||
|
@ -5,6 +5,7 @@ import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@ -41,7 +42,6 @@ public class PluginMain extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
pm = this;
|
||||
cm = new ConfigManager(pm);
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "==============================="));
|
||||
@ -64,8 +64,8 @@ public class PluginMain extends JavaPlugin {
|
||||
}
|
||||
if (PluginCfg.IS_METRICS) {
|
||||
try {
|
||||
org.mcstats.Metrics mcstats = new org.mcstats.Metrics(pm);
|
||||
mcstats.start();
|
||||
Metrics metrics = new Metrics(pm);
|
||||
// metrics.addCustomChart(new Metrics.SimplePie("chart_id", () -> "My value"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -132,7 +132,6 @@ public class PluginMain extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
super.onDisable();
|
||||
getServer().getServicesManager().unregisterAll(pm);
|
||||
Bukkit.getScheduler().cancelTasks(pm);
|
||||
try {
|
||||
|
@ -4,57 +4,61 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
public class FileUtil {
|
||||
|
||||
public interface FindFilesDo {
|
||||
boolean isProcess(String fileName);
|
||||
void process(String fileName, InputStream is);
|
||||
}
|
||||
public interface FindFilesDo {
|
||||
boolean isProcess(String fileName);
|
||||
|
||||
public static void findFilesFromJar(FindFilesDo ffd, Class<?> jarClazz) {
|
||||
JarFile jarFile = null;
|
||||
try {
|
||||
String jarFilePath = jarClazz.getProtectionDomain().getCodeSource().getLocation().getFile();
|
||||
jarFile = new JarFile(jarFilePath);
|
||||
Enumeration<JarEntry> entries = jarFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry e = entries.nextElement();
|
||||
if (ffd.isProcess(e.getName())) {
|
||||
InputStream is = jarFile.getInputStream(e);
|
||||
ffd.process(e.getName(), is);
|
||||
try {
|
||||
is.close();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (jarFile != null) {
|
||||
try {
|
||||
jarFile.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void process(String fileName, InputStream is);
|
||||
}
|
||||
|
||||
public static void writeOnFile(String fileName, String content) {
|
||||
FileWriter fw;
|
||||
try {
|
||||
File f = new File(fileName);
|
||||
fw = new FileWriter(f, true);
|
||||
fw.write(content + "\r\n");
|
||||
fw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void findFilesFromJar(FindFilesDo ffd, Class<?> jarClazz) {
|
||||
JarFile jarFile = null;
|
||||
try {
|
||||
String jarFilePath = jarClazz.getProtectionDomain().getCodeSource().getLocation().getFile();
|
||||
jarFilePath = URLDecoder.decode(jarFilePath, Charset.defaultCharset().name());
|
||||
jarFile = new JarFile(jarFilePath);
|
||||
Enumeration<JarEntry> entries = jarFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry e = entries.nextElement();
|
||||
if (ffd.isProcess(e.getName())) {
|
||||
InputStream is = jarFile.getInputStream(e);
|
||||
ffd.process(e.getName(), is);
|
||||
try {
|
||||
is.close();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (jarFile != null) {
|
||||
try {
|
||||
jarFile.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeOnFile(String fileName, String content) {
|
||||
FileWriter fw;
|
||||
try {
|
||||
File f = new File(fileName);
|
||||
fw = new FileWriter(f, true);
|
||||
fw.write(content + "\r\n");
|
||||
fw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: PermissionsTime
|
||||
version: 0.2.3-SNAPSHOT
|
||||
version: 0.2.4-SNAPSHOT
|
||||
main: gg.frog.mc.permissionstime.PluginMain
|
||||
author: GeekFrog
|
||||
softdepend:
|
||||
|
Loading…
Reference in New Issue
Block a user