upload the dogshit
This commit is contained in:
parent
231a4dcac9
commit
2bcc5dab79
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
target/*
|
||||
.idea/*
|
180
HestiaCore.iml
Normal file
180
HestiaCore.iml
Normal file
@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Hestia-BungeeSync" level="project" />
|
||||
<orderEntry type="library" name="spigot-1.8.8-R0.1-SNAPSHOT-latest (2)" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.mojang:authlib:1.5.21" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:17.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.0-beta9" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.9" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.0-beta9" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:2.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:4.1.0-rc0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mariadb.jdbc:mariadb-java-client:2.6.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:VaultAPI:1.7" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: ru.tehkode.permissions.bukkit:PermissionsEx:1.22.10">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/PermissionsEx-1.22.10.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: com.allatori:Annotations:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/allatori-annotations.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot1.8.8n:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.8.8-R0.1-SNAPSHOT-latest.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot183:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.8.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot18:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot19:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.9.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot110:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.10.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot111:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot112:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.12.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot113:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.13.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot1131:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.13.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot114:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.14.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot115:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.15.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot1161:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.8.8-R0.1-SNAPSHOT-latest.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: net.minecraft:spigot1162:1.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libraries/spigot-1.16.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.9.2" level="project" />
|
||||
</component>
|
||||
</module>
|
BIN
libraries/Hestia-Discord.jar
Normal file
BIN
libraries/Hestia-Discord.jar
Normal file
Binary file not shown.
BIN
libraries/PermissionsEx-1.22.10.jar
Normal file
BIN
libraries/PermissionsEx-1.22.10.jar
Normal file
Binary file not shown.
BIN
libraries/allatori-annotations.jar
Normal file
BIN
libraries/allatori-annotations.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.10.2.jar
Normal file
BIN
libraries/spigot-1.10.2.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.11.1.jar
Normal file
BIN
libraries/spigot-1.11.1.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.11.2.jar
Normal file
BIN
libraries/spigot-1.11.2.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.11.jar
Normal file
BIN
libraries/spigot-1.11.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.12.jar
Normal file
BIN
libraries/spigot-1.12.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.13.1.jar
Normal file
BIN
libraries/spigot-1.13.1.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.13.jar
Normal file
BIN
libraries/spigot-1.13.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.14.1.jar
Normal file
BIN
libraries/spigot-1.14.1.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.14.2.jar
Normal file
BIN
libraries/spigot-1.14.2.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.14.4.jar
Normal file
BIN
libraries/spigot-1.14.4.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.14.jar
Normal file
BIN
libraries/spigot-1.14.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.15.2.jar
Normal file
BIN
libraries/spigot-1.15.2.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.15.jar
Normal file
BIN
libraries/spigot-1.15.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.16.2.jar
Normal file
BIN
libraries/spigot-1.16.2.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.7.10-SNAPSHOT-b1657.jar
Normal file
BIN
libraries/spigot-1.7.10-SNAPSHOT-b1657.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.8.3.jar
Normal file
BIN
libraries/spigot-1.8.3.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.8.4-R0.1-SNAPSHOT-latest.jar
Normal file
BIN
libraries/spigot-1.8.4-R0.1-SNAPSHOT-latest.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.8.6-R0.1-SNAPSHOT-latest.jar
Normal file
BIN
libraries/spigot-1.8.6-R0.1-SNAPSHOT-latest.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.8.8-R0.1-SNAPSHOT-latest(2).jar
Normal file
BIN
libraries/spigot-1.8.8-R0.1-SNAPSHOT-latest(2).jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.8.8-R0.1-SNAPSHOT-latest.jar
Normal file
BIN
libraries/spigot-1.8.8-R0.1-SNAPSHOT-latest.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.8.jar
Normal file
BIN
libraries/spigot-1.8.jar
Normal file
Binary file not shown.
BIN
libraries/spigot-1.9.jar
Normal file
BIN
libraries/spigot-1.9.jar
Normal file
Binary file not shown.
303
pom.xml
Normal file
303
pom.xml
Normal file
@ -0,0 +1,303 @@
|
||||
<?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>me.quartz</groupId>
|
||||
<artifactId>HestiaCore</artifactId>
|
||||
<version>1.0.7</version>
|
||||
|
||||
<name>HestiaCore</name>
|
||||
|
||||
<description>Tag, Rank, Punishment, Grant, Essentials Server Core.</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<archive>y
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
</archive>
|
||||
<finalName>${project.name}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||
<!--outputFile>C:\Users\Vlad\Downloads\dewnmdikwerdjnuninwe\cheruiwhwierf\plugins\HestiaCore-nonobf.jar</outputFile-->
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.hikari</pattern>
|
||||
<shadedPattern>me.quartz.libs.hikari</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google.guava</pattern>
|
||||
<shadedPattern>me.quartz.libs.guava</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.slf4j</pattern>
|
||||
<shadedPattern>me.quartz.libs.hikari.slf4j</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>redis.clients</pattern>
|
||||
<shadedPattern>me.quartz.libs.jedis</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.mongodb</pattern>
|
||||
<shadedPattern>me.quartz.libs.mongodb</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.mariadb</pattern>
|
||||
<shadedPattern>me.quartz.libs.mariadb</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bson</pattern>
|
||||
<shadedPattern>me.quartz.libs.bson</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.mariadb.jdbc</pattern>
|
||||
<shadedPattern>me.quartz.libs.mariadb</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>snapshots-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>minecraft-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-vault-api</id>
|
||||
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>local-maven-repo</id>
|
||||
<url>file:///C:/Users/Vlad/Documents/hestia%20compile%20test%20fuck%20shit%20balls/hestia/Hestia-main/libraries</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>localrepository</id>
|
||||
<url>file://${project.basedir}/libraries</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.21</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongo-java-driver</artifactId>
|
||||
<version>3.12.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>bson</artifactId>
|
||||
<version>4.1.0-rc0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>3.4.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.tehkode.permissions.bukkit</groupId>
|
||||
<artifactId>PermissionsEx</artifactId>
|
||||
<version>1.22.10</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\PermissionsEx-1.22.10.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.allatori</groupId>
|
||||
<artifactId>Annotations</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\allatori-annotations.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot1.8.8n</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.8.8-R0.1-SNAPSHOT-latest.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot183</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.8.3.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot18</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.8.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot19</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.9.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot110</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.10.2.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot111</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.11.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot112</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.12.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot113</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.13.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot1131</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.13.1.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot114</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.14.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot115</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.15.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot1161</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.8.8-R0.1-SNAPSHOT-latest.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecraft</groupId>
|
||||
<artifactId>spigot1162</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}\libraries\spigot-1.16.2.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
178
src/main/java/me/quartz/hestia/AdvancedHestiaAPI.java
Normal file
178
src/main/java/me/quartz/hestia/AdvancedHestiaAPI.java
Normal file
@ -0,0 +1,178 @@
|
||||
package me.quartz.hestia;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.commands.staff.freeze.FreezeCMD;
|
||||
import me.quartz.hestia.commands.staff.vanish.VanishCMD;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class AdvancedHestiaAPI {
|
||||
|
||||
@DoNotRename
|
||||
private static Hestia hestia;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
private static void setHestia(Hestia hestia) {
|
||||
AdvancedHestiaAPI.hestia = hestia;
|
||||
}
|
||||
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public AdvancedHestiaAPI(Hestia hestia) {
|
||||
setHestia(hestia);
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
public static AdvancedHestiaAPI instance;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRank(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRankString(true);
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public ChatColor getRankColor(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRank(true).getColor();
|
||||
}
|
||||
return ChatColor.WHITE;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRankPrefix(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRank(true).getPrefix();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRankSuffix(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRank(true).getSuffix();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getTag(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getTagString();
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getTagPrefix(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getTag().getPrefix();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isStaffChat(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.isStaffChat();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isAdminChat(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.isAdminChat();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getDiscordUserID(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getDiscordid();
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isVanished(UUID uuid){
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player != null) {
|
||||
return VanishCMD.getVanished().contains(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isFrozen(UUID uuid){
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player != null) {
|
||||
return FreezeCMD.getFrozen().contains(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isAlerts(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.isAlerts();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isJailServer(){
|
||||
return hestia.getConfig().getBoolean("punishment.jail");
|
||||
}
|
||||
}
|
497
src/main/java/me/quartz/hestia/Hestia.java
Normal file
497
src/main/java/me/quartz/hestia/Hestia.java
Normal file
@ -0,0 +1,497 @@
|
||||
package me.quartz.hestia;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.commands.chat.ClearChatCMD;
|
||||
import me.quartz.hestia.commands.chat.MuteChatCMD;
|
||||
import me.quartz.hestia.commands.chat.SlowChatCMD;
|
||||
import me.quartz.hestia.commands.core.*;
|
||||
import me.quartz.hestia.commands.core.disguise.CheckDisguiseCMD;
|
||||
import me.quartz.hestia.commands.core.disguise.DisguiseCMD;
|
||||
import me.quartz.hestia.commands.core.disguise.UnDisguiseCMD;
|
||||
import me.quartz.hestia.commands.core.permissions.ImportCMD;
|
||||
import me.quartz.hestia.files.SettingsFile;
|
||||
import me.quartz.hestia.listeners.ImportListener;
|
||||
import me.quartz.hestia.commands.essentials.*;
|
||||
import me.quartz.hestia.commands.punishments.*;
|
||||
import me.quartz.hestia.commands.ranks.*;
|
||||
import me.quartz.hestia.commands.ranks.subcommands.*;
|
||||
import me.quartz.hestia.commands.ranks.subcommands.ClearCMD;
|
||||
import me.quartz.hestia.commands.ranks.subcommands.ListCMD;
|
||||
import me.quartz.hestia.commands.ranks.subcommands.RenameCMD;
|
||||
import me.quartz.hestia.commands.server.SystemCMD;
|
||||
import me.quartz.hestia.commands.staff.*;
|
||||
import me.quartz.hestia.commands.staff.freeze.FreezeCMD;
|
||||
import me.quartz.hestia.listeners.FreezeListener;
|
||||
import me.quartz.hestia.commands.staff.vanish.VanishCMD;
|
||||
import me.quartz.hestia.listeners.VanishListener;
|
||||
import me.quartz.hestia.commands.tags.SetTagCMD;
|
||||
import me.quartz.hestia.commands.tags.TagCMD;
|
||||
import me.quartz.hestia.commands.tags.TagsCMD;
|
||||
import me.quartz.hestia.data.storage.MongoDB;
|
||||
import me.quartz.hestia.data.storage.MySQL;
|
||||
import me.quartz.hestia.data.storage.MySQLUtil;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.profile.ProfileMongoDB;
|
||||
import me.quartz.hestia.data.system.profile.ProfileMySQL;
|
||||
import me.quartz.hestia.data.system.punishment.PunishmentMongoDB;
|
||||
import me.quartz.hestia.data.system.punishment.PunishmentMySQL;
|
||||
import me.quartz.hestia.data.system.rank.*;
|
||||
import me.quartz.hestia.data.system.tag.Tag;
|
||||
import me.quartz.hestia.data.system.tag.TagMongoDB;
|
||||
import me.quartz.hestia.data.system.tag.TagMySQL;
|
||||
import me.quartz.hestia.discord.SyncCMD;
|
||||
import me.quartz.hestia.discord.DesyncCMD;
|
||||
import me.quartz.hestia.files.MessagesFile;
|
||||
import me.quartz.hestia.listeners.*;
|
||||
import me.quartz.hestia.listeners.connect.ServerJoinListener;
|
||||
import me.quartz.hestia.listeners.connect.PunishmentJoinListener;
|
||||
import me.quartz.hestia.listeners.connect.PermissionJoinListener;
|
||||
import me.quartz.hestia.placeholderapi.PlaceHolderAPIP;
|
||||
import me.quartz.hestia.sync.redis.RedisManager;
|
||||
import me.quartz.hestia.utils.MessageUtil;
|
||||
import me.quartz.hestia.utils.PermissionUtil;
|
||||
import me.quartz.hestia.utils.Util;
|
||||
import me.quartz.hestia.vault.Vault;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import org.bukkit.plugin.InvalidPluginException;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@DoNotRename
|
||||
public final class Hestia extends JavaPlugin {
|
||||
|
||||
private boolean connectedToDB = false;
|
||||
private MessagesFile messagesFile;
|
||||
private SettingsFile settingsFile;
|
||||
private MessageUtil messageUtil;
|
||||
private Util util;
|
||||
private MySQL mySQL;
|
||||
private MongoDB mongoDB;
|
||||
private MySQLUtil mySQLUtil;
|
||||
private ProfileMongoDB profileMongoDB;
|
||||
private ProfileMySQL profileMySQL;
|
||||
private RankMongoDB rankMongoDB;
|
||||
private RankMySQL rankMySQL;
|
||||
private TagMongoDB tagMongoDB;
|
||||
private TagMySQL tagMySQL;
|
||||
private RankHistoryMongoDB rankHistoryMongoDB;
|
||||
private RankHistoryMySQL rankHistoryMySQL;
|
||||
private PunishmentMongoDB punishmentMongoDB;
|
||||
private PunishmentMySQL punishmentMySQL;
|
||||
private RedisManager redisManager;
|
||||
private PermissionUtil permissionUtil;
|
||||
public int version;
|
||||
public List<Profile> profiles = new ArrayList<>();
|
||||
public List<Rank> ranks = new ArrayList<>();
|
||||
public List<Tag> tags = new ArrayList<>();
|
||||
public HestiaAPI api;
|
||||
|
||||
public boolean isConenctedToDB(){return connectedToDB;}
|
||||
@DoNotRename
|
||||
public void setConnectedToDB(boolean connectedToDB){
|
||||
this.connectedToDB = connectedToDB;
|
||||
}
|
||||
@DoNotRename
|
||||
public MessagesFile getMessagesFile() {
|
||||
return messagesFile;
|
||||
}
|
||||
@DoNotRename
|
||||
public SettingsFile getSettingsFile() {
|
||||
return settingsFile;
|
||||
}
|
||||
@DoNotRename
|
||||
public MessageUtil getMessageUtil() {
|
||||
return messageUtil;
|
||||
}
|
||||
public Util getUtil() {
|
||||
return util;
|
||||
}
|
||||
public MySQL getMySQL() {
|
||||
return mySQL;
|
||||
}
|
||||
public MongoDB getMongoDB() {
|
||||
return mongoDB;
|
||||
}
|
||||
public MySQLUtil getMySQLUtil() {
|
||||
return mySQLUtil;
|
||||
}
|
||||
public ProfileMongoDB getProfileMongoDB() {
|
||||
return profileMongoDB;
|
||||
}
|
||||
public ProfileMySQL getProfileMySQL() {
|
||||
return profileMySQL;
|
||||
}
|
||||
public RankMongoDB getRankMongoDB() {
|
||||
return rankMongoDB;
|
||||
}
|
||||
public RankMySQL getRankMySQL() {
|
||||
return rankMySQL;
|
||||
}
|
||||
public TagMongoDB getTagMongoDB() {
|
||||
return tagMongoDB;
|
||||
}
|
||||
public TagMySQL getTagMySQL() {
|
||||
return tagMySQL;
|
||||
}
|
||||
public RankHistoryMongoDB getRankHistoryMongoDB() {
|
||||
return rankHistoryMongoDB;
|
||||
}
|
||||
public RankHistoryMySQL getRankHistoryMySQL() {
|
||||
return rankHistoryMySQL;
|
||||
}
|
||||
public PunishmentMongoDB getPunishmentMongoDB() {
|
||||
return punishmentMongoDB;
|
||||
}
|
||||
public PunishmentMySQL getPunishmentMySQL() {
|
||||
return punishmentMySQL;
|
||||
}
|
||||
public RedisManager getRedisManager() {
|
||||
return redisManager;
|
||||
}
|
||||
public PermissionUtil getPermissionUtil() {
|
||||
return permissionUtil;
|
||||
}
|
||||
@DoNotRename
|
||||
public List<Profile> getProfiles() {
|
||||
return profiles;
|
||||
}
|
||||
@DoNotRename
|
||||
public List<Rank> getRanks() {
|
||||
return ranks;
|
||||
}
|
||||
@DoNotRename
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
@DoNotRename
|
||||
public HestiaAPI getApi() {
|
||||
return api;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@Override
|
||||
public void onEnable() {
|
||||
saveDefaultConfig();
|
||||
registerFunctions();
|
||||
registerConfigs();
|
||||
registerVersions();
|
||||
getCommand("hestiacore").setExecutor(new HestiaCoreCMD(this));
|
||||
getCommand("hcdebug").setExecutor(new HCDebugCMD(this));
|
||||
api = new HestiaAPI(this);
|
||||
if(connectedToDB && isEnabled()) {
|
||||
registerDatabase();
|
||||
registerSync();
|
||||
registerCommands();
|
||||
registerListeners();
|
||||
if (Bukkit.getServer().getPluginManager().isPluginEnabled("Vault")) {
|
||||
new Vault(this);
|
||||
}
|
||||
if (Bukkit.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
new PlaceHolderAPIP(this).register();
|
||||
}
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
getProfiles().clear();
|
||||
getRanks().clear();
|
||||
}
|
||||
}.runTaskTimer(this, 0, 6000);
|
||||
try {
|
||||
PluginDescriptionFile object = getDescription();
|
||||
Field field = PluginDescriptionFile.class.getDeclaredField("name");
|
||||
field.setAccessible(true);
|
||||
if(settingsFile.getSettingsConfig().contains("plugin") && settingsFile.getSettingsConfig().getString("plugin") != null) {
|
||||
field.set(object, settingsFile.getSettingsConfig().getString("plugin"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@Override
|
||||
public void onDisable() {
|
||||
}
|
||||
|
||||
private void registerFunctions() {
|
||||
messagesFile = new MessagesFile(this);
|
||||
settingsFile = new SettingsFile(this);
|
||||
messageUtil = new MessageUtil(this);
|
||||
util = new Util(this);
|
||||
permissionUtil = new PermissionUtil(this);
|
||||
}
|
||||
|
||||
private void registerConfigs() {
|
||||
Util.createMessagesFile(this);
|
||||
messagesFile.createMessages();
|
||||
settingsFile.createSettings();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void registerDatabase() {
|
||||
if (getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
mySQL = new MySQL(this,
|
||||
getConfig().getString("database.host"),
|
||||
getConfig().getInt("database.port"),
|
||||
getConfig().getString("database.database"),
|
||||
getConfig().getString("database.username"),
|
||||
getConfig().getString("database.password")
|
||||
);
|
||||
if(mySQL.getDataSource() != null) {
|
||||
mySQLUtil = new MySQLUtil(mySQL);
|
||||
rankMySQL = new RankMySQL(this);
|
||||
rankMySQL.tableCreate();
|
||||
tagMySQL = new TagMySQL(this);
|
||||
tagMySQL.tableCreate();
|
||||
rankHistoryMySQL = new RankHistoryMySQL(this);
|
||||
rankHistoryMySQL.tableCreate();
|
||||
punishmentMySQL = new PunishmentMySQL(this);
|
||||
punishmentMySQL.tableCreate();
|
||||
Rank rank = rankMySQL.getRank(getSettingsFile().getSettingsConfig().getString("default-rank"));
|
||||
if (rank == null) {
|
||||
Rank defaultRank = new Rank(this, getSettingsFile().getSettingsConfig().getString("default-rank"));
|
||||
rankMySQL.createRank(defaultRank);
|
||||
}
|
||||
profileMySQL = new ProfileMySQL(this);
|
||||
profileMySQL.tableCreate();
|
||||
}
|
||||
} else {
|
||||
mongoDB = new MongoDB(this, getConfig().getString("database.host"),
|
||||
getConfig().getInt("database.port"),
|
||||
getConfig().getString("database.database"),
|
||||
getConfig().getString("database.username"),
|
||||
getConfig().getString("database.password"));
|
||||
rankMongoDB = new RankMongoDB(this);
|
||||
Rank rank = rankMongoDB.getRank(getSettingsFile().getSettingsConfig().getString("default-rank"));
|
||||
if(this.isConenctedToDB()) {
|
||||
if (rank == null) {
|
||||
Rank defaultRank = new Rank(this, getSettingsFile().getSettingsConfig().getString("default-rank"));
|
||||
rankMongoDB.createRank(defaultRank);
|
||||
}
|
||||
}
|
||||
tagMongoDB = new TagMongoDB(this);
|
||||
if(this.isConenctedToDB())rankHistoryMongoDB = new RankHistoryMongoDB(this);
|
||||
punishmentMongoDB = new PunishmentMongoDB(this);
|
||||
if(this.isConenctedToDB())profileMongoDB = new ProfileMongoDB(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerVersions(){
|
||||
String version = getServer().getClass().getPackage().getName();
|
||||
version = version.substring(version.lastIndexOf('.') + 1);
|
||||
version = version.replace("_", ".").replace("v", "");
|
||||
version = version.substring(0, version.indexOf(".R"));
|
||||
String need = version;
|
||||
version = version.replace("1.", "");
|
||||
this.version = Integer.parseInt(version.contains(".") ? version.substring(0, version.indexOf(".")) : version);
|
||||
if(this.version >= 13 && !getServer().getPluginManager().isPluginEnabled("Hestia-OtherVersion")) {
|
||||
try {
|
||||
File pluginsDirectory = new File("." + File.separatorChar + "plugins");
|
||||
File file = new File(pluginsDirectory, "Hestia-OtherVersion.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-OtherVersion.jar", file, "Hestia-OtherVersion");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void download(String url, File file, String s) throws IOException {
|
||||
URL download = new URL(url);
|
||||
ReadableByteChannel rbc = Channels.newChannel(download.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
rbc.close();
|
||||
fos.close();
|
||||
try {
|
||||
Bukkit.getPluginManager().loadPlugin(file);
|
||||
Bukkit.getPluginManager().enablePlugin(Bukkit.getPluginManager().getPlugin(s));
|
||||
} catch (InvalidPluginException | InvalidDescriptionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerSync(){
|
||||
if(getConfig().getString("sync-storage").equalsIgnoreCase("Redis")) {
|
||||
redisManager = new RedisManager(this);
|
||||
redisManager.createListener(this, "staffchat");
|
||||
redisManager.createListener(this, "adminchat");
|
||||
redisManager.createListener(this, "report");
|
||||
redisManager.createListener(this, "helpop");
|
||||
redisManager.createListener(this, "kick");
|
||||
redisManager.createListener(this, "connect");
|
||||
redisManager.createListener(this, "servers");
|
||||
redisManager.createListener(this, "server");
|
||||
redisManager.createListener(this, "runcmd");
|
||||
redisManager.createListener(this, "runnedcmd");
|
||||
redisManager.createListener(this, "alert");
|
||||
redisManager.createListener(this, "updateplayer");
|
||||
redisManager.createListener(this, "updaterank");
|
||||
}
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
private void registerCommands() {
|
||||
// essentials
|
||||
getCommand("teleport").setExecutor(new TeleportCMD(this));
|
||||
getCommand("teleporthere").setExecutor(new TeleportHereCMD(this));
|
||||
getCommand("teleportpos").setExecutor(new TeleportPosCMD(this));
|
||||
getCommand("heal").setExecutor(new HealCMD(this));
|
||||
getCommand("feed").setExecutor(new FeedCMD(this));
|
||||
getCommand("gamemode").setExecutor(new GamemodeCMD(this));
|
||||
getCommand("gma").setExecutor(new GmaCMD(this));
|
||||
getCommand("gmc").setExecutor(new GmcCMD(this));
|
||||
getCommand("gms").setExecutor(new GmsCMD(this));
|
||||
getCommand("gmsp").setExecutor(new GmspCMD(this));
|
||||
getCommand("clear").setExecutor(new me.quartz.hestia.commands.essentials.ClearCMD(this));
|
||||
getCommand("fly").setExecutor(new FlyCMD(this));
|
||||
getCommand("give").setExecutor(new GiveCMD(this));
|
||||
getCommand("item").setExecutor(new ItemCMD(this));
|
||||
getCommand("ping").setExecutor(new PingCMD(this));
|
||||
getCommand("invsee").setExecutor(new InvseeCMD(this));
|
||||
getCommand("skull").setExecutor(new SkullCMD(this));
|
||||
getCommand("list").setExecutor(new me.quartz.hestia.commands.essentials.ListCMD(this));
|
||||
getCommand("onlinestaff").setExecutor(new me.quartz.hestia.commands.essentials.OnlineStaffCMD(this));
|
||||
getCommand("staffalerts").setExecutor(new StaffAlertsCMD(this));
|
||||
getCommand("sudo").setExecutor(new SudoCMD(this));
|
||||
getCommand("speed").setExecutor(new SpeedCMD(this));
|
||||
getCommand("lore").setExecutor(new LoreCMD(this));
|
||||
getCommand("rename").setExecutor(new me.quartz.hestia.commands.essentials.RenameCMD(this));
|
||||
getCommand("broadcast").setExecutor(new BroadcastCMD(this));
|
||||
getCommand("alert").setExecutor(new AlertCMD(this));
|
||||
|
||||
// ranks
|
||||
RankCMD rankCMD = new RankCMD(this);
|
||||
rankCMD.register("create", new CreateCMD(this));
|
||||
rankCMD.register("delete", new DeleteCMD(this));
|
||||
rankCMD.register("setcolor", new ColorCMD(this));
|
||||
rankCMD.register("color", new ColorCMD(this));
|
||||
rankCMD.register("setpriority", new PriorityCMD(this));
|
||||
rankCMD.register("priority", new PriorityCMD(this));
|
||||
rankCMD.register("weight", new PriorityCMD(this));
|
||||
rankCMD.register("setweight", new PriorityCMD(this));
|
||||
rankCMD.register("setitalic", new ItalicCMD(this));
|
||||
rankCMD.register("italic", new ItalicCMD(this));
|
||||
rankCMD.register("bold", new BoldCMD(this));
|
||||
rankCMD.register("setbold", new BoldCMD(this));
|
||||
rankCMD.register("list", new ListCMD(this));
|
||||
rankCMD.register("info", new InfoCMD(this));
|
||||
rankCMD.register("addperm", new AddPermCMD(this));
|
||||
rankCMD.register("addpermsfrom", new AddPermsFromCMD(this));
|
||||
//rankCMD.register("addbungeeperm", new AddBungeePermCMD(this));
|
||||
rankCMD.register("delperm", new DelPermCMD(this));
|
||||
//rankCMD.register("delbungeeperm", new DelBungeePermCMD(this));
|
||||
rankCMD.register("clear", new ClearCMD(this));
|
||||
rankCMD.register("inherit", new InheritCMD(this));
|
||||
rankCMD.register("uninherit", new UninheritCMD(this));
|
||||
rankCMD.register("rename", new RenameCMD(this));
|
||||
rankCMD.register("default", new SetDefaultCMD(this));
|
||||
rankCMD.register("setdefault", new SetDefaultCMD(this));
|
||||
rankCMD.register("setprefix", new PrefixCMD(this));
|
||||
rankCMD.register("prefix", new PrefixCMD(this));
|
||||
rankCMD.register("setsuffix", new SuffixCMD(this));
|
||||
rankCMD.register("suffix", new SuffixCMD(this));
|
||||
getCommand("rank").setExecutor(rankCMD);
|
||||
getCommand("rank").setTabCompleter(rankCMD);
|
||||
getCommand("message").setExecutor(new MessageCMD(this));
|
||||
getCommand("reply").setExecutor(new ReplyCMD(this));
|
||||
getCommand("ignore").setExecutor(new IgnoreCMD(this));
|
||||
getCommand("sounds").setExecutor(new SoundsCMD(this));
|
||||
getCommand("toggleglobalchat").setExecutor(new ToggleGlobalChatCMD(this));
|
||||
getCommand("togglepm").setExecutor(new TogglePMCMD(this));
|
||||
getCommand("setrank").setExecutor(new SetRankCMD(this));
|
||||
getCommand("grant").setExecutor(new GrantCMD(this));
|
||||
getCommand("grants").setExecutor(new GrantsCMD(this));
|
||||
getCommand("player").setExecutor(new PlayerCMD(this));
|
||||
|
||||
// punishment
|
||||
getCommand("kick").setExecutor(new KickCMD(this));
|
||||
getCommand("ban").setExecutor(new BanCMD(this));
|
||||
getCommand("mute").setExecutor(new MuteCMD(this));
|
||||
getCommand("warn").setExecutor(new WarnCMD(this));
|
||||
getCommand("blacklist").setExecutor(new BlacklistCMD(this));
|
||||
getCommand("unban").setExecutor(new UnbanCMD(this));
|
||||
getCommand("unblacklist").setExecutor(new UnblacklistCMD(this));
|
||||
getCommand("unmute").setExecutor(new UnmuteCMD(this));
|
||||
getCommand("punishments").setExecutor(new PunishmentsCMD(this));
|
||||
getCommand("staffhistory").setExecutor(new StaffHistoryCMD(this));
|
||||
getCommand("staffrollback").setExecutor(new StaffRollbackCMD(this));
|
||||
getCommand("wipepunishments").setExecutor(new WipePunishmentsCMD(this));
|
||||
|
||||
// staff
|
||||
getCommand("staffchat").setExecutor(new StaffChatCMD(this));
|
||||
getCommand("adminchat").setExecutor(new AdminChatCMD(this));
|
||||
getCommand("report").setExecutor(new ReportCMD(this));
|
||||
getCommand("helpop").setExecutor(new HelpopCMD(this));
|
||||
getCommand("notes").setExecutor(new NotesCMD(this));
|
||||
getCommand("alts").setExecutor(new AltsCMD(this));
|
||||
getCommand("lookup").setExecutor(new LookupCMD(this));
|
||||
getCommand("freeze").setExecutor(new FreezeCMD(this));
|
||||
getCommand("vanish").setExecutor(new VanishCMD(this));
|
||||
|
||||
// chat
|
||||
getCommand("slowchat").setExecutor(new SlowChatCMD(this));
|
||||
getCommand("clearchat").setExecutor(new ClearChatCMD(this));
|
||||
getCommand("mutechat").setExecutor(new MuteChatCMD(this));
|
||||
|
||||
// server
|
||||
if(getConfig().getBoolean("disguise.enabled")) {
|
||||
getCommand("disguise").setExecutor(new DisguiseCMD(this));
|
||||
getCommand("undisguise").setExecutor(new UnDisguiseCMD(this));
|
||||
getCommand("checkdisguise").setExecutor(new CheckDisguiseCMD(this));
|
||||
}
|
||||
getCommand("system").setExecutor(new SystemCMD(this));
|
||||
getCommand("confirm").setExecutor(new ConfirmCMD(this));
|
||||
getCommand("reboot").setExecutor(new RebootCMD(this));
|
||||
getCommand("customize").setExecutor(new CustomizeCMD(this));
|
||||
getCommand("addon").setExecutor(new AddonCMD(this));
|
||||
getCommand("import").setExecutor(new ImportCMD(this));
|
||||
|
||||
// ranks
|
||||
TagCMD tagCMD = new TagCMD(this);
|
||||
tagCMD.register("create", new me.quartz.hestia.commands.tags.subcommands.CreateCMD(this));
|
||||
tagCMD.register("delete", new me.quartz.hestia.commands.tags.subcommands.DeleteCMD(this));
|
||||
tagCMD.register("setprefix", new me.quartz.hestia.commands.tags.subcommands.PrefixCMD(this));
|
||||
tagCMD.register("prefix", new me.quartz.hestia.commands.tags.subcommands.PrefixCMD(this));
|
||||
getCommand("tag").setExecutor(tagCMD);
|
||||
getCommand("tag").setTabCompleter(tagCMD);
|
||||
getCommand("settag").setExecutor(new SetTagCMD(this));
|
||||
getCommand("tags").setExecutor(new TagsCMD(this));
|
||||
if (getConfig().getBoolean("discord.sync.enabled")) {
|
||||
getCommand("sync").setExecutor(new SyncCMD(this));
|
||||
getCommand("desync").setExecutor(new DesyncCMD(this));
|
||||
}
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
private void registerListeners() {
|
||||
Bukkit.getPluginManager().registerEvents(new FreezeListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new DisconnectListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ServerJoinListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PunishmentJoinListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PermissionJoinListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new VanishListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new InventoryClickListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ImportListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new AsyncChatListener(this), this);
|
||||
}
|
||||
}
|
173
src/main/java/me/quartz/hestia/HestiaAPI.java
Normal file
173
src/main/java/me/quartz/hestia/HestiaAPI.java
Normal file
@ -0,0 +1,173 @@
|
||||
package me.quartz.hestia;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.commands.ranks.PlayerCMD;
|
||||
import me.quartz.hestia.commands.staff.freeze.FreezeCMD;
|
||||
import me.quartz.hestia.commands.staff.vanish.VanishCMD;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class HestiaAPI {
|
||||
|
||||
@DoNotRename
|
||||
private static Hestia hestia;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
private static void setHestia(Hestia hestia) {
|
||||
HestiaAPI.hestia = hestia;
|
||||
}
|
||||
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public HestiaAPI(Hestia hestia) {
|
||||
setHestia(hestia);
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
public static HestiaAPI instance;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRank(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRankString(true);
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public ChatColor getRankColor(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRank(true).getColor();
|
||||
}
|
||||
return ChatColor.WHITE;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRankPrefix(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRank(true).getPrefix();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRankSuffix(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getRank(true).getSuffix();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getTag(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getTagString();
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getTagPrefix(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getTag().getPrefix();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isStaffChat(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.isStaffChat();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isAdminChat(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.isAdminChat();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getDiscordUserID(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.getDiscordid();
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isVanished(UUID uuid){
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player != null) {
|
||||
return VanishCMD.getVanished().contains(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isFrozen(UUID uuid){
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player != null) {
|
||||
return FreezeCMD.getFrozen().contains(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public boolean isAlerts(UUID uuid){
|
||||
Profile profile = Profile.getProfile(uuid, hestia);
|
||||
if(profile != null) {
|
||||
return profile.isAlerts();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package me.quartz.hestia.commands.chat;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
@DoNotRename
|
||||
public class ClearChatCMD implements CommandExecutor {
|
||||
@DoNotRename
|
||||
private Hestia hestia;
|
||||
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public ClearChatCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("clearchat")) {
|
||||
if (sender.hasPermission("hestia.clearchat")) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!player.hasPermission("hestia.clearchat.bypass")) {
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
player.sendMessage(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
Profile profile = null;
|
||||
if (sender instanceof Player) {
|
||||
profile = Profile.getProfile(((Player) sender).getUniqueId(), hestia);
|
||||
}
|
||||
Bukkit.broadcastMessage(hestia.getMessageUtil().fileM("chat", "clearchat").replace("{player}", (profile != null ? profile.getRank(true).getColor() + profile.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package me.quartz.hestia.commands.chat;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class MuteChatCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
@DoNotRename
|
||||
private static boolean mutechat;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static boolean getMuteChat(){return mutechat;}
|
||||
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public MuteChatCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
mutechat = false;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("mutechat")) {
|
||||
if (sender.hasPermission("hestia.mutechat")) {
|
||||
mutechat = !mutechat;
|
||||
Profile profile = null;
|
||||
if (sender instanceof Player) {
|
||||
profile = Profile.getProfile(((Player) sender).getUniqueId(), hestia);
|
||||
}
|
||||
Bukkit.broadcastMessage(hestia.getMessageUtil().fileM("chat", "mutechat").replace("{player}", (profile != null ? profile.getRank(true).getColor() + profile.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{state}", (mutechat ? "muted" : "unmuted")));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package me.quartz.hestia.commands.chat;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SlowChatCMD implements CommandExecutor {
|
||||
|
||||
@DoNotRename
|
||||
private Hestia hestia;
|
||||
@DoNotRename
|
||||
public static int slowchat;
|
||||
@DoNotRename
|
||||
private static HashMap<UUID, Integer> cooldown;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static HashMap<UUID, Integer> getCooldown(){return cooldown;}
|
||||
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public SlowChatCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
cooldown = new HashMap<>();
|
||||
slowchat = 0;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("slowchat")){
|
||||
if(sender.hasPermission("hestia.slowchat")){
|
||||
if(args.length > 0){
|
||||
String secString = args[0].replace("s", "");
|
||||
if(NumberUtils.isNumber(secString)){
|
||||
slowchat = Integer.parseInt(secString);
|
||||
Profile profile = null;
|
||||
if(sender instanceof Player){
|
||||
profile = Profile.getProfile(((Player) sender).getUniqueId(), hestia);
|
||||
}
|
||||
Bukkit.broadcastMessage(hestia.getMessageUtil().fileM("chat", "slowchat").replace("{player}", (profile != null ? profile.getRank(true).getColor() + profile.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-number"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/" + command.getName() + " [Time]").replace("{usage-c}", "/" + command.getName().toLowerCase() + ChatColor.WHITE + " [Time]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
332
src/main/java/me/quartz/hestia/commands/core/AddonCMD.java
Normal file
332
src/main/java/me/quartz/hestia/commands/core/AddonCMD.java
Normal file
@ -0,0 +1,332 @@
|
||||
package me.quartz.hestia.commands.core;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.vault.Chat;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
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.InvalidDescriptionException;
|
||||
import org.bukkit.plugin.InvalidPluginException;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.HashMap;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
public class AddonCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public AddonCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("addon")) {
|
||||
if (sender.hasPermission("hestia.addon")) {
|
||||
if (args.length > 0) {
|
||||
File pluginsDirectory = new File("." + File.separatorChar + "plugins");
|
||||
if (args[0].equalsIgnoreCase("install")) {
|
||||
if (args.length > 1) {
|
||||
if (args[1].equalsIgnoreCase("Hestia-BungeeSync") || args[1].equalsIgnoreCase("BungeeSync") || args[1].equalsIgnoreCase("Bungee") || args[1].equalsIgnoreCase("Sync")) {
|
||||
new Thread(() -> {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Hestia-BungeeSync")) {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Installing 'Hestia-BungeeSync.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-BungeeSync.jar");
|
||||
try {
|
||||
download("http://private-01.pernther.com:25680/Hestia-BungeeSync.jar", file, "Hestia-BungeeSync");
|
||||
} catch (FileNotFoundException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Addon not found.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-BungeeSync.jar' has been installed.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "This addon is already added!");
|
||||
}
|
||||
}).start();
|
||||
} else if (args[1].equalsIgnoreCase("Hestia-Staffmode") || args[1].equalsIgnoreCase("Staffmode")) {
|
||||
new Thread(() -> {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Hestia-Staffmode")) {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Installing 'Hestia-Staffmode.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-Staffmode.jar");
|
||||
try {
|
||||
download("http://private-01.pernther.com:25680/Hestia-Staffmode.jar", file, "Hestia-Staffmode");
|
||||
} catch (FileNotFoundException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Addon not found.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-Staffmode.jar' has been installed.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "This addon is already added!");
|
||||
}
|
||||
}).start();
|
||||
} else if (args[1].equalsIgnoreCase("Discord") || args[1].equalsIgnoreCase("Hestia-Discord")) {
|
||||
new Thread(() -> {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Hestia-Discord")) {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Installing 'Hestia-Discord.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-Discord.jar");
|
||||
try {
|
||||
download("http://private-01.pernther.com:25680/Hestia-Discord.jar", file, "Hestia-Discord");
|
||||
} catch (FileNotFoundException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Addon not found.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-Discord.jar' has been installed.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "This addon is already added!");
|
||||
}
|
||||
}).start();
|
||||
} else if (args[1].equalsIgnoreCase("Hestia-OtherVersion") || args[1].equalsIgnoreCase("OtherVersion") || args[1].equalsIgnoreCase("Version")) {
|
||||
new Thread(() -> {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Hestia-OtherVersion")) {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Installing 'Hestia-OtherVersion.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-OtherVersion.jar");
|
||||
try {
|
||||
download("http://private-01.pernther.com:25680/Hestia-OtherVersion.jar", file, "Hestia-OtherVersion");
|
||||
} catch (FileNotFoundException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Addon not found.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-OtherVersion.jar' has been installed.");
|
||||
Bukkit.shutdown();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "This addon is already added!");
|
||||
}
|
||||
}).start();
|
||||
} else if (args[1].equalsIgnoreCase("Hestia-AutoUpdater") || args[1].equalsIgnoreCase("AutoUpdater") || args[1].equalsIgnoreCase("Updater")) {
|
||||
new Thread(() -> {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Hestia-AutoUpdater")) {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Installing 'Hestia-AutoUpdater.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-AutoUpdater.jar");
|
||||
try {
|
||||
download("http://private-01.pernther.com:25680/Hestia-AutoUpdater.jar", file, "Hestia-AutoUpdater");
|
||||
} catch (FileNotFoundException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Addon not found.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-AutoUpdater.jar' has been installed.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "This addon is already added!");
|
||||
}
|
||||
}).start();
|
||||
} else if (args[1].equalsIgnoreCase("Hestia-Essentials") || args[1].equalsIgnoreCase("Essentials")) {
|
||||
new Thread(() -> {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Hestia-Essentials")) {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Installing 'Hestia-Essentials.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-Essentials.jar");
|
||||
try {
|
||||
download("http://private-01.pernther.com:25680/Hestia-Essentials.jar", file, "Hestia-AutoUpdater");
|
||||
} catch (FileNotFoundException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Addon not found.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-Essentials.jar' has been installed.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "This addon is already added!");
|
||||
}
|
||||
}).start();
|
||||
} else if (args[1].equalsIgnoreCase("Hestia-Auth") || args[1].equalsIgnoreCase("Auth")) {
|
||||
new Thread(() -> {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("Hestia-Auth")) {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Installing 'Hestia-Auth.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-Auth.jar");
|
||||
try {
|
||||
download("http://private-01.pernther.com:25680/Hestia-Auth.jar", file, "Hestia-Auth");
|
||||
} catch (FileNotFoundException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Addon not found.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-Auth.jar' has been installed.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "This addon is already added!");
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "The addon '" + args[1] + "' doesn't exist!");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "No addon provided.");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("update")) {
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
if (plugin.getName().equalsIgnoreCase("Hestia-OtherVersion")) {
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
unload(plugin);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Updating 'Hestia-OtherVersion.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-OtherVersion.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-OtherVersion.jar", file, "Hestia-OtherVersion");
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-OtherVersion.jar' has been updated.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
} else if (plugin.getName().equalsIgnoreCase("Hestia-Discord")) {
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
unload(plugin);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Updating 'Hestia-Discord.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-Discord.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-Discord.jar", file, "Hestia-Discord");
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-Discord.jar' has been updated.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
} else if (plugin.getName().equalsIgnoreCase("Hestia-OtherVersion")) {
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
unload(plugin);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Updating 'Hestia-BungeeSync.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-BungeeSync.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-BungeeSync.jar", file, "Hestia-BungeeSync");
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-BungeeSync.jar' has been updated.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
} else if (plugin.getName().equalsIgnoreCase("Hestia-AutoUpdater")) {
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
unload(plugin);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Updating 'Hestia-AutoUpdater.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-AutoUpdater.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-AutoUpdater.jar", file, "Hestia-AutoUpdater");
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-AutoUpdater.jar' has been updated.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
} else if (plugin.getName().equalsIgnoreCase("Hestia-Essentials")) {
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
unload(plugin);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Updating 'Hestia-Essentials.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-Essentials.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-Essentials.jar", file, "Hestia-Essentials");
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-Essentials.jar' has been updated.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
} else if (plugin.getName().equalsIgnoreCase("Hestia-StaffMode")) {
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
unload(plugin);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Updating 'Hestia-StaffMode.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-StaffMode.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-StaffMode.jar", file, "Hestia-StaffMode");
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-StaffMode.jar' has been updated.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
} else if (plugin.getName().equalsIgnoreCase("Hestia-Auth")) {
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
unload(plugin);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sender.sendMessage(ChatColor.GRAY + "Updating 'Hestia-Auth.jar'.");
|
||||
File file = new File(pluginsDirectory, "Hestia-Auth.jar");
|
||||
download("http://private-01.pernther.com:25680/Hestia-StaffMode.jar", file, "Hestia-Auth");
|
||||
sender.sendMessage(ChatColor.GREEN + "The addon 'Hestia-Auth.jar' has been updated.");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.DARK_GRAY.toString() + ChatColor.STRIKETHROUGH + "-------------------");
|
||||
sender.sendMessage(ChatColor.YELLOW + "/addon install " + ChatColor.GRAY + "[Addon]");
|
||||
sender.sendMessage(ChatColor.YELLOW + "/addon update");
|
||||
sender.sendMessage(ChatColor.DARK_GRAY.toString() + ChatColor.STRIKETHROUGH + "-------------------");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.DARK_GRAY.toString() + ChatColor.STRIKETHROUGH + "-------------------");
|
||||
sender.sendMessage(ChatColor.YELLOW + "/addon install " + ChatColor.GRAY + "[Addon]");
|
||||
sender.sendMessage(ChatColor.YELLOW + "/addon update");
|
||||
sender.sendMessage(ChatColor.DARK_GRAY.toString() + ChatColor.STRIKETHROUGH + "-------------------");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void unload(Plugin plugin) {
|
||||
ClassLoader classLoader = plugin.getClass().getClassLoader();
|
||||
if (classLoader instanceof URLClassLoader) {
|
||||
try {
|
||||
((URLClassLoader) classLoader).close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
System.gc();
|
||||
}
|
||||
|
||||
public void download(String url, File file, String s) throws IOException {
|
||||
URL download = new URL(url);
|
||||
ReadableByteChannel rbc = Channels.newChannel(download.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
rbc.close();
|
||||
fos.close();
|
||||
try {
|
||||
Bukkit.getPluginManager().loadPlugin(file);
|
||||
Bukkit.getPluginManager().enablePlugin(Bukkit.getPluginManager().getPlugin(s));
|
||||
} catch (InvalidPluginException | InvalidDescriptionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static File getPluginFile(JavaPlugin plugin) {
|
||||
Validate.notNull(plugin);
|
||||
try {
|
||||
Method m = JavaPlugin.class.getDeclaredMethod("getFile");
|
||||
m.setAccessible(true);
|
||||
return (File) m.invoke(plugin);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to invoke method getFile()", e);
|
||||
}
|
||||
}
|
||||
}
|
119
src/main/java/me/quartz/hestia/commands/core/BackupCMD.java
Normal file
119
src/main/java/me/quartz/hestia/commands/core/BackupCMD.java
Normal file
@ -0,0 +1,119 @@
|
||||
package me.quartz.hestia.commands.core;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import me.quartz.hestia.files.BackupFile;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class BackupCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public BackupCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("customize")){
|
||||
if(sender.hasPermission("hestia.backup")){
|
||||
if(args.length > 0) {
|
||||
if(args[0].equalsIgnoreCase("create")){
|
||||
BackupFile backupFile = new BackupFile(hestia);
|
||||
backupFile.createMessages();
|
||||
new Thread(() -> {
|
||||
for(Profile profile : hestia.getProfileMongoDB().getProfiles()){
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".name", profile.getName());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".ip", profile.getIpAddress());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".firstjoin", dateToString(profile.getFirstJoin()));
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".server", profile.getServer());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".discordid", profile.getDiscordid());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".staffchat", profile.isStaffChat());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".adminchat", profile.isAdminChat());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".pm", profile.isPm());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".sounds", profile.isSounds());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".globalchat", profile.isGlobalchat());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".alerts", profile.isAlerts());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".namemc", profile.isNamemc());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".rank", profile.getRankString(false));
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".expire", dateToString(profile.getExpireRank()));
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".tag", profile.getTagString());
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".reports", profile.getReportAmount());
|
||||
StringBuilder altIps = new StringBuilder();
|
||||
for(String ips : profile.getAltIps()){
|
||||
altIps.append(ips).append(",");
|
||||
}
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".altips", altIps);
|
||||
StringBuilder ignoreList = new StringBuilder();
|
||||
for(String ips : profile.getIgnoreList()){
|
||||
altIps.append(ips).append(",");
|
||||
}
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".ignores", ignoreList);
|
||||
StringBuilder notes = new StringBuilder();
|
||||
for(String ips : profile.getNotes()){
|
||||
altIps.append(ips).append(",");
|
||||
}
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".notes", notes);
|
||||
StringBuilder permissions = new StringBuilder();
|
||||
for(String ips : profile.getPermissions()){
|
||||
altIps.append(ips).append(",");
|
||||
}
|
||||
backupFile.getMessageConfig().set("profiles." + profile.getUuid() + ".permissions", permissions);
|
||||
}for(Rank ranks : hestia.getRankMongoDB().getRanks()){
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".type", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".added", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".expired", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".reason", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".uuid", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".executor", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".unbanner", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".unbanned", null);
|
||||
backupFile.getMessageConfig().set("punishments." + ranks.getName() + ".unbanned_reason", null);
|
||||
}
|
||||
try {
|
||||
backupFile.getMessageConfig().save(backupFile.getMessageFile());
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String dateToString(Date date) {
|
||||
if(date != null) {
|
||||
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Date stringToDate(String string) {
|
||||
if(string != null && !string.equalsIgnoreCase("")) {
|
||||
try {
|
||||
return new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(string);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
78
src/main/java/me/quartz/hestia/commands/core/ConfirmCMD.java
Normal file
78
src/main/java/me/quartz/hestia/commands/core/ConfirmCMD.java
Normal file
@ -0,0 +1,78 @@
|
||||
package me.quartz.hestia.commands.core;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.utils.Util;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ConfirmCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public ConfirmCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("confirm")){
|
||||
if(sender instanceof Player){
|
||||
if(args.length > 0){
|
||||
if(args[0].equalsIgnoreCase("deleterank")){
|
||||
if (sender.hasPermission("hestia.rank.delete")) {
|
||||
TextComponent delete = new TextComponent(ChatColor.translateAlternateColorCodes('&', "&aAre you sure you want to delete this rank?"));
|
||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.translateAlternateColorCodes('&', "&cDelete '" + args[1] + "'")).create()));
|
||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/rank delete " + args[1]));
|
||||
((Player) sender).spigot().sendMessage(delete);
|
||||
}
|
||||
}else if(args[0].equalsIgnoreCase("clearrank")){
|
||||
if (sender.hasPermission("hestia.rank.clear")) {
|
||||
TextComponent delete = new TextComponent(ChatColor.translateAlternateColorCodes('&', "&aAre you sure you want to clear this rank?"));
|
||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.translateAlternateColorCodes('&', "&cClear '" + args[1] + "'")).create()));
|
||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/rank clear " + args[1]));
|
||||
((Player) sender).spigot().sendMessage(delete);
|
||||
}
|
||||
}else if(args[0].equalsIgnoreCase("delperm")){
|
||||
if (sender.hasPermission("hestia.rank.delperm")) {
|
||||
TextComponent delete = new TextComponent(ChatColor.translateAlternateColorCodes('&', "&aAre you sure you want to delete this permission?"));
|
||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.translateAlternateColorCodes('&', "&cRemove permission '" + args[2] + "'")).create()));
|
||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/rank delperm " + args[1] + " " + args[2]));
|
||||
((Player) sender).spigot().sendMessage(delete);
|
||||
}
|
||||
}else if(args[0].equalsIgnoreCase("delpermp")){
|
||||
if (sender.hasPermission("hestia.delperm")) {
|
||||
TextComponent delete = new TextComponent(ChatColor.translateAlternateColorCodes('&', "&aAre you sure you want to delete this permission?"));
|
||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.translateAlternateColorCodes('&', "&cRemove permission '" + args[2] + "'")).create()));
|
||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/player delperm " + args[1] + " " + args[2]));
|
||||
((Player) sender).spigot().sendMessage(delete);
|
||||
}
|
||||
}else if(args[0].equalsIgnoreCase("uninherit")){
|
||||
if (sender.hasPermission("hestia.rank.uninherit")) {
|
||||
TextComponent delete = new TextComponent(ChatColor.translateAlternateColorCodes('&', "&aAre you sure you want to uninherit this rank?"));
|
||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.translateAlternateColorCodes('&', "&cRemove inherit '" + args[1] + "'")).create()));
|
||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/rank uninherit " + args[1] + " " + args[2]));
|
||||
((Player) sender).spigot().sendMessage(delete);
|
||||
}
|
||||
}else if(args[0].equalsIgnoreCase("shutdown")){
|
||||
if (sender.hasPermission("hestia.system")) {
|
||||
TextComponent delete = new TextComponent(ChatColor.translateAlternateColorCodes('&', "&aAre you sure you want to shutdown this?"));
|
||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.translateAlternateColorCodes('&', "&cRemove inherit '" + args[1] + "'")).create()));
|
||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/system runcmd " + args[1] + " stop"));
|
||||
((Player) sender).spigot().sendMessage(delete);
|
||||
}
|
||||
}
|
||||
Util.createMessagesFile(hestia);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package me.quartz.hestia.commands.core;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class CustomizeCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public CustomizeCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("customize")){
|
||||
if(sender.hasPermission("hestia.customize")){
|
||||
if(args.length > 0){
|
||||
String name = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(String s : args){
|
||||
sb.append(s).append(" ");
|
||||
}
|
||||
try {
|
||||
PluginDescriptionFile object = hestia.getDescription();
|
||||
Field field = PluginDescriptionFile.class.getDeclaredField("name");
|
||||
field.setAccessible(true);
|
||||
name = field.get(object).toString();
|
||||
field.set(object, sb.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
hestia.getSettingsFile().getSettingsConfig().set("plugin", sb.toString() + "");
|
||||
try {
|
||||
hestia.getSettingsFile().getSettingsConfig().save(hestia.getSettingsFile().getSettingsFile());
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
sender.sendMessage(" ");
|
||||
sender.sendMessage(ChatColor.GRAY + "Customizing your core..");
|
||||
sender.sendMessage(" ");
|
||||
sender.sendMessage(ChatColor.GRAY + name + " has been " + ChatColor.RED + "de-activated!");
|
||||
sender.sendMessage(ChatColor.GRAY + sb.toString() + " has been " + ChatColor.GREEN + "activated!");
|
||||
sender.sendMessage(" ");
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/" + command.getName() + " [Name]").replace("{usage-c}", "/" + command.getName().toLowerCase() + ChatColor.WHITE + " [Name]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
104
src/main/java/me/quartz/hestia/commands/core/HCDebugCMD.java
Normal file
104
src/main/java/me/quartz/hestia/commands/core/HCDebugCMD.java
Normal file
@ -0,0 +1,104 @@
|
||||
package me.quartz.hestia.commands.core;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
|
||||
public class HCDebugCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public HCDebugCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("hcdebug")) {
|
||||
if (sender.isOp()) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("cp")) {
|
||||
if (args.length > 1 && args[1].equalsIgnoreCase("confirm")) {
|
||||
sender.sendMessage(ChatColor.RED + "Terminated Profile UUID's.");
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
try (Connection con = hestia.getMySQL().getDataSource().getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.executeUpdate("DELETE FROM profiles");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
hestia.getMongoDB().hestiaDB.getCollection("profiles").drop();
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.GRAY + "This command will remove all the profiles information.");
|
||||
sender.sendMessage(ChatColor.GRAY + "Which means all the players their information will be removed (e.x: rank).");
|
||||
sender.sendMessage(ChatColor.GRAY + "The ranks, punishments & tags will still be saved.");
|
||||
sender.sendMessage(ChatColor.GRAY + " ");
|
||||
sender.sendMessage(ChatColor.RED + "/hcdebug cp confirm " + ChatColor.GRAY + "to confirm.");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("ticket")) {
|
||||
String bungeecord = "false";
|
||||
File file = new File("spigot.yml");
|
||||
if (file.exists()) {
|
||||
FileConfiguration configuration = YamlConfiguration.loadConfiguration(file);
|
||||
bungeecord = configuration.getConfigurationSection("settings").getString("bungeecord");
|
||||
}
|
||||
com.misq.api.hastebin.Hastebin hastebin = new com.misq.api.hastebin.Hastebin();
|
||||
String url = "";
|
||||
boolean raw = false;
|
||||
try {
|
||||
String version = hestia.getServer().getClass().getPackage().getName();
|
||||
version = version.substring(version.lastIndexOf('.') + 1);
|
||||
version = version.replace("_", ".").replace("v", "");
|
||||
version = version.substring(0, version.indexOf(".R"));
|
||||
StringBuilder pluginList = new StringBuilder();
|
||||
|
||||
Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
|
||||
for (Plugin plugin : plugins) {
|
||||
if (pluginList.length() > 0) {
|
||||
pluginList.append(", ");
|
||||
}
|
||||
pluginList.append(plugin.getDescription().getName());
|
||||
}
|
||||
String text = ("HestiaCore Version: " + hestia.getDescription().getVersion() + "\n" +
|
||||
"Server Version: " + version + "\n\n" +
|
||||
"License: " + hestia.getConfig().getString("license") + "\n" +
|
||||
"Database: " + hestia.getConfig().getString("data-storage") + "\n\n" +
|
||||
"The server is in " + (Bukkit.getOnlineMode() ? "online" : "offline") + " mode.\n" +
|
||||
"The spigot.yml bungeecord is " + (bungeecord.equalsIgnoreCase("true") ? "enabled" : "disabled") + ".\n" +
|
||||
"The server has clickable messages " + (hestia.getConfig().getBoolean("server.clickable-messages") ? "enabled" : "disable") + "\n\n" +
|
||||
"Plugins (" + Bukkit.getPluginManager().getPlugins().length + "): " + pluginList.toString() + "\n\nMySQL Details:\n" +
|
||||
"- Host is '" + hestia.getConfig().getString("database.host") + "'\n" +
|
||||
"- Port is '" + hestia.getConfig().getString("database.port") + "'\n" +
|
||||
"- Username is '" + hestia.getConfig().getString("database.username") + "'\n" +
|
||||
"- Database is '" + hestia.getConfig().getString("database.database") + "'\n" +
|
||||
"- Password is " +
|
||||
((hestia.getConfig().getString("database.database").equalsIgnoreCase("") || hestia.getConfig().getString("database.database").equalsIgnoreCase(" "))
|
||||
? "not set" : "set" + "."
|
||||
|
||||
));
|
||||
url = hastebin.post(text, raw);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sender.sendMessage(ChatColor.RED + url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package me.quartz.hestia.commands.core;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class HestiaCoreCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public HestiaCoreCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("hestiacore")){
|
||||
if(sender instanceof Player){
|
||||
if((args.length == 0 || !args[0].equalsIgnoreCase("reload") || !sender.hasPermission("hestia.reload"))) {
|
||||
sender.sendMessage(ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "--------------------------");
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + hestia.getDescription().getName() + " Core");
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + " ");
|
||||
TextComponent first = new TextComponent(ChatColor.LIGHT_PURPLE + "Created By: ");
|
||||
TextComponent second = new TextComponent(ChatColor.WHITE + "TheCoderEmily#6695");
|
||||
if(hestia.getConfig().getBoolean("server.clickable-messages")) {
|
||||
second.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "Private"));
|
||||
}
|
||||
first.addExtra(second);
|
||||
((Player) sender).spigot().sendMessage(first);
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "Version: " + ChatColor.WHITE + hestia.getDescription().getVersion());
|
||||
sender.sendMessage(ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "--------------------------");
|
||||
if (!hestia.getConfig().contains("license") || (hestia.getConfig().getString("license").length() != 16)) {
|
||||
sender.sendMessage(ChatColor.RED.toString() + "Forked By TropicalHCF Dev Team");
|
||||
sender.sendMessage(ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "--------------------------");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.GRAY + "Reloading...");
|
||||
if (hestia.getMessagesFile() != null) {
|
||||
hestia.getMessagesFile().reloadConfig();
|
||||
}
|
||||
hestia.reloadConfig();
|
||||
if(!hestia.isConenctedToDB()){
|
||||
hestia.onEnable();
|
||||
}
|
||||
if(hestia.isConenctedToDB()){
|
||||
if(hestia.getMySQL() != null){
|
||||
hestia.registerDatabase();
|
||||
}
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "Successfully reloaded TropicalCore. " + ChatColor.GRAY + "(" + ChatColor.GREEN + "License" + ChatColor.GRAY + ", " + ChatColor.GREEN + "MySQL" + ChatColor.GRAY + " & " + ChatColor.GREEN + "Files" + ChatColor.GRAY + ")");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
69
src/main/java/me/quartz/hestia/commands/core/RebootCMD.java
Normal file
69
src/main/java/me/quartz/hestia/commands/core/RebootCMD.java
Normal file
@ -0,0 +1,69 @@
|
||||
package me.quartz.hestia.commands.core;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.utils.TimeUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class RebootCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
private boolean cancelled = false;
|
||||
private int reboot = 0;
|
||||
|
||||
public RebootCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("reboot")){
|
||||
if(sender.hasPermission("hestia.reboot")){
|
||||
reboot++;
|
||||
cancelled = false;
|
||||
int i = reboot;
|
||||
long defaultMillis = hestia.getConfig().getInt("server.reboot-time") * 1000;
|
||||
Date expire = new Date(System.currentTimeMillis() + defaultMillis);
|
||||
if(args.length > 0) {
|
||||
if (TimeUtil.check(args[0])) {
|
||||
TimeUtil time = TimeUtil.parseString(args[0]);
|
||||
long millis = time.toMilliseconds();
|
||||
expire = new Date(System.currentTimeMillis() + millis);
|
||||
} else if(args[0].equalsIgnoreCase("cancel")) {
|
||||
cancelled = true;
|
||||
Bukkit.broadcastMessage(hestia.getMessageUtil().fileM("system", "reboot-cancel"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Bukkit.broadcastMessage(hestia.getMessageUtil().fileM("system", "reboot").replace("{time}", TimeUtil.toString(expire.getTime() - new Date().getTime())));
|
||||
Date finalExpire = expire;
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
if(reboot == i) {
|
||||
if (!cancelled) {
|
||||
if (new Date().after(finalExpire)) {
|
||||
hestia.getServer().shutdown();
|
||||
} else {
|
||||
int i = Math.toIntExact((finalExpire.getTime() - new Date().getTime()) / 1000);
|
||||
if (i == 600 || i == 300 || i == 240 || i == 180 || i == 120 || i == 60 || i == 30 || i == 10 || i == 5 || i == 4 || i == 3 || i == 2 || i == 1)
|
||||
Bukkit.broadcastMessage(hestia.getMessageUtil().fileM("system", "reboot").replace("{time}", TimeUtil.toString(finalExpire.getTime() - new Date().getTime())));
|
||||
}
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
} else{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(hestia, 0, 20);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package me.quartz.hestia.commands.core.disguise;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import me.quartz.hestia.vault.Chat;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CheckDisguiseCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public CheckDisguiseCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("checkdisguise")) {
|
||||
if (sender.hasPermission("hestia.checkdisguise")) {
|
||||
if(args.length > 0){
|
||||
Disguise disguise = Disguise.getRealName(args[0]);
|
||||
if(disguise != null){
|
||||
Profile profile = Profile.getProfile(disguise.getUuid(), hestia);
|
||||
if(profile != null) {
|
||||
Rank rank = profile.getRank(false);
|
||||
String normal = ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("chat.chat-format")
|
||||
.replace("{player}", rank.getColor() + (rank.isItalic() ? ChatColor.ITALIC + "" : "") + (rank.isBold() ? ChatColor.BOLD + "" : "") + disguise.getRealname()))
|
||||
.replace("{prefix}", rank.getPrefix())
|
||||
.replace("{suffix}", rank.getSuffix())
|
||||
.replace("{tag}", "")
|
||||
.replace("{message}", "I'm using my own skin.");
|
||||
Rank rank2 = profile.getRank(true);
|
||||
String fake = ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("chat.chat-format")
|
||||
.replace("{player}", rank2.getColor() + (rank2.isItalic() ? ChatColor.ITALIC + "" : "") + (rank2.isBold() ? ChatColor.BOLD + "" : "") + disguise.getFakename()))
|
||||
.replace("{prefix}", rank2.getPrefix())
|
||||
.replace("{suffix}", rank2.getSuffix())
|
||||
.replace("{tag}", "")
|
||||
.replace("{message}", "I'm using " + disguise.getFakeskin() + "'s skin.");
|
||||
for(String s : hestia.getMessageUtil().fileMList("disguise", "check-disguise")){
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', s
|
||||
.replace("{normal}", normal)
|
||||
.replace("{disguise}", fake)
|
||||
.replace("{name}", disguise.getRealname())
|
||||
.replace("{dname}", disguise.getFakename())
|
||||
.replace("{skin}", disguise.getRealskin())
|
||||
.replace("{dskin}", disguise.getFakeskin())
|
||||
.replace("{rank}", disguise.getRealrank())
|
||||
.replace("{drank}", disguise.getFakerank())
|
||||
));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[1]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("disguise", "not-disguised-other"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/" + command.getName() + " [Player]").replace("{usage-c}", "/" + command.getName().toLowerCase() + ChatColor.WHITE + " [Player]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
package me.quartz.hestia.commands.core.disguise;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class Disguise {
|
||||
|
||||
private UUID uuid;
|
||||
private String realname;
|
||||
private String fakename;
|
||||
private String realskin;
|
||||
private String fakeskin;
|
||||
private String realrank;
|
||||
private String fakerank;
|
||||
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Disguise(UUID uuid, String realname, String fakename, String realskin, String fakeskin, String realrank, String fakerank) {
|
||||
this.uuid = uuid;
|
||||
this.realname = realname;
|
||||
this.fakename = fakename;
|
||||
this.realskin = realskin;
|
||||
this.fakeskin = fakeskin;
|
||||
this.realrank = realrank;
|
||||
this.fakerank = fakerank;
|
||||
Disguise disguise = getRealName(realname);
|
||||
if (disguise != null) {
|
||||
disguise.setFakename(fakename);
|
||||
disguise.setFakerank(fakerank);
|
||||
disguise.setFakeskin(fakeskin);
|
||||
} else {
|
||||
DisguiseCMD.getDisguises().add(this);
|
||||
}
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRealname() {
|
||||
return realname;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setRealname(String realname) {
|
||||
this.realname = realname;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getFakename() {
|
||||
return fakename;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setFakename(String fakename) {
|
||||
this.fakename = fakename;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRealskin() {
|
||||
return realskin;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setRealskin(String realskin) {
|
||||
this.realskin = realskin;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getFakeskin() {
|
||||
return fakeskin;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setFakeskin(String fakeskin) {
|
||||
this.fakeskin = fakeskin;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getRealrank() {
|
||||
return realrank;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setRealrank(String realrank) {
|
||||
this.realrank = realrank;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public String getFakerank() {
|
||||
return fakerank;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setFakerank(String fakerank) {
|
||||
this.fakerank = fakerank;
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static Disguise getRealName(String name){
|
||||
for(Disguise disguise : DisguiseCMD.getDisguises()){
|
||||
if(disguise.getRealname().equalsIgnoreCase(name)){
|
||||
return disguise;
|
||||
}else if(disguise.getFakename().equalsIgnoreCase(name)){
|
||||
return disguise;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,197 @@
|
||||
package me.quartz.hestia.commands.core.disguise;
|
||||
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.commands.core.disguise.nms.SkinNMS;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
public class DisguiseCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
@DoNotRename
|
||||
private static List<Disguise> disguises = new ArrayList<>();
|
||||
@DoNotRename
|
||||
private static HashMap<UUID, String> disguiseRank = new HashMap<>();
|
||||
@DoNotRename
|
||||
private static HashMap<UUID, String> disguiseName = new HashMap<>();
|
||||
@DoNotRename
|
||||
private static HashMap<UUID, String> disguiseSkin = new HashMap<>();
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static List<Disguise> getDisguises() {
|
||||
return disguises;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static HashMap<UUID, String> getDisguiseRank() {
|
||||
return disguiseRank;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static HashMap<UUID, String> getDisguiseName() {
|
||||
return disguiseName;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static HashMap<UUID, String> getDisguiseSkin() {
|
||||
return disguiseSkin;
|
||||
}
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public DisguiseCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("disguise")) {
|
||||
if (sender.hasPermission("hestia.disguise")) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
HashMap<Rank, Integer> ranks = new HashMap<>();
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
for (Rank rank : hestia.getRankMySQL().getRanks()) {
|
||||
ranks.put(rank, rank.getPriority());
|
||||
}
|
||||
} else {
|
||||
for (Rank rank : hestia.getRankMongoDB().getRanks()) {
|
||||
ranks.put(rank, rank.getPriority());
|
||||
}
|
||||
}
|
||||
Inventory inventory = Bukkit.createInventory(null, invSize(ranks.size()), ChatColor.GRAY + "Choose a Rank");
|
||||
for (int i = 0; i < 9; i++) {
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 7, ""));
|
||||
}
|
||||
for (int i = (inventory.getSize() - 9); i < (inventory.getSize()); i++) {
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 7, ""));
|
||||
}
|
||||
int i = 9;
|
||||
Rank playerRank = Profile.getProfile(player.getUniqueId(), hestia).getRank(false);
|
||||
for (Rank rank : hestia.getUtil().sorted(ranks).keySet()) {
|
||||
if (hestia.getConfig().getBoolean("disguise.higher-ranks") || player.isOp() || rank.getPriority() < playerRank.getPriority()) {
|
||||
String color = rank.getColor().name().toLowerCase().replace("_", " ");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : color.split(" ")) {
|
||||
sb.append(rank.getColor()).append(s.substring(0, 1).toUpperCase()).append(s.substring(1)).append(" ");
|
||||
}
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.BOOK, 1, 0, rank.getColor() + rank.getName(), ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "---------------------", ChatColor.GRAY + "Prefix: " + ChatColor.translateAlternateColorCodes('&', rank.getPrefix()), ChatColor.GRAY + "Suffix: " + ChatColor.translateAlternateColorCodes('&', rank.getSuffix()), " ", ChatColor.GRAY + "Color: " + sb.toString(), ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "---------------------"));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int invSize(int i) {
|
||||
if (i <= 9) {
|
||||
return 27;
|
||||
} else if (i <= 18) {
|
||||
return 36;
|
||||
} else if (i <= 27) {
|
||||
return 45;
|
||||
} else if (i <= 36) {
|
||||
return 54;
|
||||
} else {
|
||||
return 63;
|
||||
}
|
||||
}
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void changePlayer(String name, String skin, String rank, Player player, boolean message, Hestia hestia) {
|
||||
if (hestia.isEnabled()) {
|
||||
try {
|
||||
new Disguise(player.getUniqueId(), player.getName(), name, player.getName(), skin, Profile.getProfile(player.getUniqueId(), hestia).getRankString(false), rank);
|
||||
player.setPlayerListName(player.getPlayerListName().replace(player.getName(), name));
|
||||
Method getHandle = player.getClass().getMethod("getHandle");
|
||||
Object entityPlayer = getHandle.invoke(player);
|
||||
boolean gameProfileExists = false;
|
||||
try {
|
||||
Class.forName("net.minecraft.util.com.mojang.authlib.GameProfile");
|
||||
gameProfileExists = true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
|
||||
}
|
||||
try {
|
||||
Class.forName("com.mojang.authlib.GameProfile");
|
||||
gameProfileExists = true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
|
||||
}
|
||||
if (!gameProfileExists) {
|
||||
Field nameField = entityPlayer.getClass().getSuperclass().getDeclaredField("name");
|
||||
nameField.setAccessible(true);
|
||||
nameField.set(entityPlayer, name);
|
||||
} else {
|
||||
Object profile = entityPlayer.getClass().getMethod("getProfile").invoke(entityPlayer);
|
||||
Field ff = profile.getClass().getDeclaredField("name");
|
||||
ff.setAccessible(true);
|
||||
ff.set(profile, name);
|
||||
}
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
if (hestia.isEnabled()) {
|
||||
SkinNMS nms = (SkinNMS) Class.forName("me.quartz.hestia.commands.core.disguise.nms.SkinNMS_v" + Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3].substring(1)).newInstance();
|
||||
nms.setSkin(player, skin, hestia);
|
||||
}
|
||||
if (message) {
|
||||
player.sendMessage(hestia.getMessageUtil().fileM("disguise", "disguised").replace("{name}", name).replace("{skin}", skin));
|
||||
}
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchFieldException | ClassNotFoundException | InstantiationException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package me.quartz.hestia.commands.core.disguise;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UnDisguiseCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public UnDisguiseCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("undisguise")) {
|
||||
if (sender.hasPermission("hestia.undisguise")) {
|
||||
if (args.length == 0) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Disguise disguise = Disguise.getRealName(player.getName());
|
||||
if (disguise != null) {
|
||||
DisguiseCMD.changePlayer(disguise.getRealname(), disguise.getRealskin(), disguise.getRealrank(), player, false, hestia);
|
||||
DisguiseCMD.getDisguises().remove(disguise);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("disguise", "undisguised"));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("disguise", "not-disguised"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[1]));
|
||||
}
|
||||
} else {
|
||||
Disguise disguise = Disguise.getRealName(args[0]);
|
||||
if (disguise != null) {
|
||||
Player player = Bukkit.getPlayer(disguise.getUuid());
|
||||
if(player != null) {
|
||||
DisguiseCMD.changePlayer(disguise.getRealname(), disguise.getRealskin(), disguise.getRealrank(), player, false, hestia);
|
||||
DisguiseCMD.getDisguises().remove(disguise);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("disguise", "undisguised-other").replace("{player}", player.getName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("disguise", "not-disguised-other"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public interface SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
void setSkin(Player player, String skin, Hestia hestia);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_10_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_11_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_12_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_13_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_13_R2 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_14_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_15_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_16_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_16_R2 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_8_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_8_R2 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_8_R3 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_9_R1 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.core.disguise.nms;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public class SkinNMS_v1_9_R2 implements SkinNMS {
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public Property getProp(String skin) {
|
||||
try {
|
||||
URL url_0 = new URL("https://api.mojang.com/users/profiles/minecraft/" + skin);
|
||||
InputStreamReader reader_0 = new InputStreamReader(url_0.openStream());
|
||||
String uuid = new JsonParser().parse(reader_0).getAsJsonObject().get("id").getAsString();
|
||||
URL url_1 = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||
InputStreamReader reader_1 = new InputStreamReader(url_1.openStream());
|
||||
JsonObject textureProperty = new JsonParser().parse(reader_1).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||
String texture = textureProperty.get("value").getAsString();
|
||||
|
||||
String signature = textureProperty.get("signature").getAsString();
|
||||
|
||||
return new Property("textures",
|
||||
texture,
|
||||
signature);
|
||||
|
||||
} catch (IOException | IllegalStateException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public void setSkin(Player player, String skin, Hestia hestia) {
|
||||
GameProfile profile = ((CraftPlayer) player).getProfile();
|
||||
profile.getProperties().clear();
|
||||
if(getProp(skin) != null) {
|
||||
profile.getProperties().put("textures", getProp(skin));
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class) {
|
||||
Collection<? extends Player> players = (Collection<? extends Player>) Bukkit.class.getMethod("getOnlinePlayers").invoke(null);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
} else {
|
||||
Player[] players = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers").invoke(null));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : players) {
|
||||
p.hidePlayer(player);
|
||||
p.showPlayer(player);
|
||||
|
||||
}
|
||||
}
|
||||
}.runTask(hestia);
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package me.quartz.hestia.commands.core.permissions;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class ImportCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public ImportCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("import")){
|
||||
if(sender.hasPermission("hestia.import")){
|
||||
if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
Inventory inventory = Bukkit.createInventory(null, 27, "Import Data");
|
||||
for(int i = 0; i < inventory.getSize(); i++){
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 15, " "));
|
||||
}
|
||||
inventory.setItem(10, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, hestia.getServer().getPluginManager().isPluginEnabled("PermissionsEx") ? 13 : 14, hestia.getServer().getPluginManager().isPluginEnabled("PermissionsEx") ? ChatColor.DARK_GREEN + "PermissionsEx" : ChatColor.RED + "PermissionsEx", ChatColor.GRAY + "Import data of PermissionsEx", "",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Remove all current ranks.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Create all PEX ranks.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Add all PEX permissions.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.RED + "✘" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Add players to group."
|
||||
));
|
||||
inventory.setItem(13, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, hestia.getServer().getPluginManager().isPluginEnabled("NCore") ? 13 : 14, hestia.getServer().getPluginManager().isPluginEnabled("NCore") ? ChatColor.DARK_GREEN + "nCore" : ChatColor.RED + "nCore", ChatColor.GRAY + "Import data of nCore", "",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Remove all current ranks.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Remove all current tags.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Create all nCore ranks.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Create all nCore tags.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "✔" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Add all nCore permissions.",
|
||||
ChatColor.DARK_GRAY + "[" + ChatColor.RED + "✘" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + "Add players to group."
|
||||
));
|
||||
inventory.setItem(16, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 14, ChatColor.RED + "???"));
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class AlertCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public AlertCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("alert")){
|
||||
if(sender.hasPermission("hestia.alert")){
|
||||
if(args.length > 0){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(String s : args){
|
||||
sb.append(s).append(" ");
|
||||
}
|
||||
String bc = hestia.getMessageUtil().fileM("essentials", "alert").replace("{message}", ChatColor.translateAlternateColorCodes('&', sb.toString()));
|
||||
if(hestia.getConfig().getString("sync-storage").equalsIgnoreCase("Redis")) {
|
||||
hestia.getRedisManager().getRedisPublish().pub("alert", bc);
|
||||
}else if(hestia.getConfig().getString("sync-storage").equalsIgnoreCase("BungeeCord")) {
|
||||
if(hestia.getServer().getPluginManager().isPluginEnabled("Hestia-BungeeSync")) {
|
||||
//HestiaBungeeSync.postInfo("alert", bc);
|
||||
}
|
||||
Bukkit.broadcastMessage(bc);
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/" + command.getName().toLowerCase() + " [Message]").replace("{usage-c}", "/" + command.getName().toLowerCase() + "" + ChatColor.WHITE + " [Message]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class BroadcastCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public BroadcastCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("broadcast")){
|
||||
if(sender.hasPermission("hestia.broadcast")){
|
||||
if(args.length > 0){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(String s : args){
|
||||
sb.append(s).append(" ");
|
||||
}
|
||||
Bukkit.broadcastMessage(hestia.getMessageUtil().fileM("essentials", "broadcast").replace("{message}", ChatColor.translateAlternateColorCodes('&', sb.toString())));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/" + command.getName().toLowerCase() + " [Message]").replace("{usage-c}", "/" + command.getName().toLowerCase() + "" + ChatColor.WHITE + " [Message]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ClearCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public ClearCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("clear")){
|
||||
if(sender.hasPermission("hestia.clear")){
|
||||
if(args.length > 0){
|
||||
if(sender.hasPermission("hestia.clear.other")) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setBoots(null);
|
||||
player.getInventory().setLeggings(null);
|
||||
player.getInventory().setChestplate(null);
|
||||
player.getInventory().setHelmet(null);
|
||||
player.sendMessage(hestia.getMessageUtil().fileM("essentials", "clear"));
|
||||
if (player != sender) {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "clear-other").replace("{player}", player.getName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
} else if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setBoots(null);
|
||||
player.getInventory().setLeggings(null);
|
||||
player.getInventory().setChestplate(null);
|
||||
player.getInventory().setHelmet(null);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "clear").replace("{player}", player.getName()));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FeedCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public FeedCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("feed")){
|
||||
if(sender.hasPermission("hestia.feed")){
|
||||
if(args.length > 0){
|
||||
if(sender.hasPermission("hestia.feed.other")) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
player.setFoodLevel(20);
|
||||
player.sendMessage(hestia.getMessageUtil().fileM("essentials", "feed"));
|
||||
if (player != sender) {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "feed-other").replace("{player}", player.getName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
} else if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
player.setFoodLevel(20);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "feed").replace("{player}", player.getName()));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FlyCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public FlyCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("fly")){
|
||||
if(sender.hasPermission("hestia.fly")){
|
||||
if(args.length > 0){
|
||||
if(sender.hasPermission("hestia.fly.other")) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
player.setAllowFlight(!player.getAllowFlight());
|
||||
player.sendMessage(hestia.getMessageUtil().fileM("essentials", "fly").replace("{toggle}", player.getAllowFlight() ? "enabled" : "disabled"));
|
||||
if (player != sender) {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "fly-other").replace("{player}", player.getName()).replace("{toggle}", player.getAllowFlight() ? "enabled" : "disabled"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
} else if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
player.setAllowFlight(!player.getAllowFlight());
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "fly").replace("{player}", player.getName()).replace("{toggle}", player.getAllowFlight() ? "enabled" : "disabled"));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GamemodeCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public GamemodeCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("gamemode")){
|
||||
if(
|
||||
sender.hasPermission("hestia.gamemode") ||
|
||||
sender.hasPermission("hestia.gamemode.other") ||
|
||||
sender.hasPermission("hestia.gamemode.creative") ||
|
||||
sender.hasPermission("hestia.gamemode.survival") ||
|
||||
sender.hasPermission("hestia.gamemode.adventure") ||
|
||||
sender.hasPermission("hestia.gamemode.creative.other") ||
|
||||
sender.hasPermission("hestia.gamemode.survival.other") ||
|
||||
sender.hasPermission("hestia.gamemode.adventure.other")
|
||||
){
|
||||
if(args.length > 0) {
|
||||
if(args.length > 1) {
|
||||
Player player = Bukkit.getPlayer(args[1]);
|
||||
if (player != null) {
|
||||
GameMode gameMode = hestia.getUtil().getGameMode(player, args[0]);
|
||||
hestia.getUtil().setGamemode(sender, player, gameMode, hestia);
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[1]));
|
||||
}
|
||||
} else if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
GameMode gameMode = hestia.getUtil().getGameMode(player, args[0]);
|
||||
hestia.getUtil().setGamemodePersonal(sender, player, gameMode, hestia);
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/gamemode [GameMode] <Player>").replace("{usage-c}", "/gamemode" + ChatColor.WHITE + " [GameMode] <Player>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class GiveCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public GiveCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("give")){
|
||||
if(sender.hasPermission("hestia.give")){
|
||||
if(args.length > 1) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if(player != null){
|
||||
if(Material.getMaterial(args[1].toUpperCase()) != null){
|
||||
Material material = Material.valueOf(args[1].toUpperCase());
|
||||
int amount = 1;
|
||||
if(args.length > 2 && NumberUtils.isNumber(args[2])){
|
||||
amount = Integer.parseInt(args[2]);
|
||||
}
|
||||
player.getInventory().addItem(new ItemStack(material, amount));
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "give").replace("{material}", material.name()).replace("{amount}", amount + "").replace("{player}", player.getName()));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "material-not-found").replace("{material}", args[1]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/give [Player] [Material] <Amount>").replace("{usage-c}", "/give" + ChatColor.WHITE + " [Player] [Material] <Amount>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GmaCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public GmaCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("gma")) {
|
||||
if (
|
||||
sender.hasPermission("hestia.gamemode") ||
|
||||
sender.hasPermission("hestia.gamemode.other") ||
|
||||
sender.hasPermission("hestia.gamemode.adventure") ||
|
||||
sender.hasPermission("hestia.gamemode.adventure.other")
|
||||
) {
|
||||
if (args.length > 0) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
GameMode gameMode = GameMode.ADVENTURE;
|
||||
hestia.getUtil().setGamemode(sender, player, gameMode, hestia);
|
||||
}
|
||||
} else if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
GameMode gameMode = GameMode.ADVENTURE;
|
||||
hestia.getUtil().setGamemodePersonal(sender, player, gameMode, hestia);
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GmcCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public GmcCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("gmc")) {
|
||||
if (
|
||||
sender.hasPermission("hestia.gamemode") ||
|
||||
sender.hasPermission("hestia.gamemode.other") ||
|
||||
sender.hasPermission("hestia.gamemode.creative") ||
|
||||
sender.hasPermission("hestia.gamemode.creative.other")
|
||||
) {
|
||||
if (args.length > 0) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
GameMode gameMode = GameMode.CREATIVE;
|
||||
hestia.getUtil().setGamemode(sender, player, gameMode, hestia);
|
||||
}
|
||||
} else if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
GameMode gameMode = GameMode.CREATIVE;
|
||||
hestia.getUtil().setGamemodePersonal(sender, player, gameMode, hestia);
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GmsCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public GmsCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("gms")) {
|
||||
if (
|
||||
sender.hasPermission("hestia.gamemode") ||
|
||||
sender.hasPermission("hestia.gamemode.other") ||
|
||||
sender.hasPermission("hestia.gamemode.survival") ||
|
||||
sender.hasPermission("hestia.gamemode.survival.other")
|
||||
) {
|
||||
if (args.length > 0) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
GameMode gameMode = GameMode.SURVIVAL;
|
||||
hestia.getUtil().setGamemode(sender, player, gameMode, hestia);
|
||||
}
|
||||
} else if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
GameMode gameMode = GameMode.SURVIVAL;
|
||||
hestia.getUtil().setGamemodePersonal(sender, player, gameMode, hestia);
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GmspCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public GmspCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("gmsp")) {
|
||||
if(hestia.version >= 8) {
|
||||
if (
|
||||
sender.hasPermission("hestia.gamemode") ||
|
||||
sender.hasPermission("hestia.gamemode.other") ||
|
||||
sender.hasPermission("hestia.gamemode.spectator") ||
|
||||
sender.hasPermission("hestia.gamemode.spectator.other")
|
||||
) {
|
||||
if (args.length > 0) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
GameMode gameMode = GameMode.SPECTATOR;
|
||||
hestia.getUtil().setGamemode(sender, player, gameMode, hestia);
|
||||
}
|
||||
} else if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
GameMode gameMode = GameMode.SPECTATOR;
|
||||
hestia.getUtil().setGamemodePersonal(sender, player, gameMode, hestia);
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
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.potion.PotionEffect;
|
||||
|
||||
public class HealCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public HealCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("heal")){
|
||||
if(sender.hasPermission("hestia.heal")){
|
||||
if(args.length > 0){
|
||||
if(sender.hasPermission("hestia.heal.other")) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
player.setHealth(20);
|
||||
player.setFoodLevel(20);
|
||||
player.getActivePotionEffects().clear();
|
||||
player.sendMessage(hestia.getMessageUtil().fileM("essentials", "heal"));
|
||||
for (PotionEffect effect :player.getActivePotionEffects ()){
|
||||
player.removePotionEffect(effect.getType());
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
} else if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
player.setHealth(20);
|
||||
player.setFoodLevel(20);
|
||||
for (PotionEffect effect :player.getActivePotionEffects ()){
|
||||
player.removePotionEffect(effect.getType());
|
||||
}
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "heal").replace("{player}", player.getName()));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class IgnoreCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public IgnoreCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("ignore")){
|
||||
if(sender.hasPermission("hestia.ignore")) {
|
||||
if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
Profile profile;
|
||||
profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (profile != null) {
|
||||
if (target != null) {
|
||||
List<String> ignores = profile.getIgnoreList();
|
||||
if (ignores.contains(target.getName())) {
|
||||
ignores.remove(target.getName());
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "unignored").replace("{player}", target.getName()));
|
||||
} else {
|
||||
ignores.add(target.getName());
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "ignored").replace("{player}", target.getName()));
|
||||
}
|
||||
profile.setIgnoreList(ignores);
|
||||
} else if (args[0].equalsIgnoreCase("list")) {
|
||||
TextComponent ignores = new TextComponent("");
|
||||
int ignoretime = profile.getIgnoreList().size();
|
||||
for (String ignore : profile.getIgnoreList()) {
|
||||
ignoretime--;
|
||||
TextComponent delete = new TextComponent(ChatColor.DARK_GRAY + "(" + ChatColor.DARK_RED + "✘" + ChatColor.DARK_GRAY + ") ");
|
||||
TextComponent extra;
|
||||
if (ignoretime == 0) {
|
||||
extra = new TextComponent(ignore);
|
||||
} else {
|
||||
extra = new TextComponent(ignore + ", ");
|
||||
}
|
||||
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.translateAlternateColorCodes('&', "&cRemove '" + ignore + "' from ignore list.")).create()));
|
||||
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ignore " + ignore));
|
||||
ignores.addExtra(delete);
|
||||
ignores.addExtra(extra);
|
||||
}
|
||||
for(String string : hestia.getMessageUtil().fileMList("essentials", "ignore-list")) {
|
||||
if(string.contains("{ignores}")){
|
||||
((Player) sender).spigot().sendMessage(ignores);
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', string).replace("{amount}", profile.getIgnoreList().size() + ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/ignore [Player]").replace("{usage-c}", "/ignore" + ChatColor.WHITE + " [Player]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
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.inventory.Inventory;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class InvseeCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public InvseeCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("invsee")){
|
||||
if(sender.hasPermission("hestia.invsee")){
|
||||
if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if (target != null) {
|
||||
Inventory inventory = Bukkit.createInventory(null, 54, ChatColor.GRAY + "Inventory of " + target.getName());
|
||||
player.openInventory(inventory);
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
if(target.isOnline()) {
|
||||
if (player.getOpenInventory() != null
|
||||
&& player.getOpenInventory().getTopInventory() != null
|
||||
&& player.getOpenInventory().getTopInventory().getTitle() != null
|
||||
&& player.getOpenInventory().getTopInventory().getTitle().startsWith(ChatColor.GRAY + "Inventory of")
|
||||
) {
|
||||
player.getOpenInventory().getTopInventory().setContents(target.getInventory().getContents());
|
||||
player.getOpenInventory().getTopInventory().setItem(53, target.getInventory().getHelmet());
|
||||
player.getOpenInventory().getTopInventory().setItem(52, target.getInventory().getChestplate());
|
||||
player.getOpenInventory().getTopInventory().setItem(51, target.getInventory().getLeggings());
|
||||
player.getOpenInventory().getTopInventory().setItem(50, target.getInventory().getBoots());
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
} else {
|
||||
player.closeInventory();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(hestia, 0, 1);
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[1]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/invsee [Player]").replace("{usage-c}", "/invsee" + ChatColor.WHITE + " [Player]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public ItemCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("item")){
|
||||
if(sender.hasPermission("hestia.item")){
|
||||
if(args.length > 0) {
|
||||
if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
if(Material.getMaterial(args[0].toUpperCase()) != null){
|
||||
Material material = Material.valueOf(args[0].toUpperCase());
|
||||
int amount = 1;
|
||||
if(args.length > 1 && NumberUtils.isNumber(args[1])){
|
||||
amount = Integer.parseInt(args[1]);
|
||||
}
|
||||
player.getInventory().addItem(new ItemStack(material, amount));
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "item").replace("{material}", material.name()).replace("{amount}", amount + ""));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "material-not-found").replace("{material}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/item [Material] <Amount>").replace("{usage-c}", "/item" + ChatColor.WHITE + " [Material] <Amount>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.commands.staff.vanish.VanishCMD;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ListCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public ListCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("list")){
|
||||
if(sender.hasPermission("hestia.list")){
|
||||
List<Rank> ranks;
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
ranks = hestia.getRankMySQL().getRanks();
|
||||
} else {
|
||||
ranks = hestia.getRankMongoDB().getRanks();
|
||||
}
|
||||
StringBuilder rankSB = new StringBuilder();
|
||||
HashMap<Rank, Integer> ranksHashmap = new HashMap<>();
|
||||
for (Rank rank : ranks) {
|
||||
ranksHashmap.put(rank, rank.getPriority());
|
||||
}
|
||||
for(Rank rank : hestia.getUtil().sorted(ranksHashmap).keySet()){
|
||||
rankSB.append(rank.getColor()).append((rank.isBold() ? ChatColor.BOLD + "" : "")).append((rank.isItalic() ? ChatColor.ITALIC + "" : "")).append(rank.getName()).append(ChatColor.WHITE).append(", ");
|
||||
}
|
||||
StringBuilder playerSB = new StringBuilder();
|
||||
HashMap<Player, Rank> playerHashmap = new HashMap<>();
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (profile != null) {
|
||||
Rank rank = null;
|
||||
for (Rank rankies : ranks) {
|
||||
if (rankies.getName().equalsIgnoreCase(profile.getRankString(true))) {
|
||||
rank = rankies;
|
||||
}
|
||||
}
|
||||
if (rank != null) {
|
||||
playerHashmap.put(player, rank);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(Rank rank : hestia.getUtil().sorted(ranksHashmap).keySet()) {
|
||||
for (Player player : playerHashmap.keySet()) {
|
||||
if (playerHashmap.get(player) == rank) {
|
||||
if (!VanishCMD.getVanished().contains(player)) {
|
||||
playerSB.append(rank.getColor()).append((rank.isBold() ? ChatColor.BOLD + "" : "")).append((rank.isItalic() ? ChatColor.ITALIC + "" : "")).append(player.getName()).append(ChatColor.WHITE).append(", ");
|
||||
}else if (sender.hasPermission("hestia.notify")) {
|
||||
playerSB.append(ChatColor.AQUA).append("[S] ").append(rank.getColor()).append((rank.isBold() ? ChatColor.BOLD + "" : "")).append((rank.isItalic() ? ChatColor.ITALIC + "" : "")).append(player.getName()).append(ChatColor.WHITE).append(", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(String string : hestia.getMessageUtil().fileMList("essentials", "list")){
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', string.
|
||||
replace("{ranks}", rankSB.toString().length() > 1 ? rankSB.toString().substring(0, rankSB.toString().length() - 2) : "").
|
||||
replace("{players}", playerSB.toString().length() > 1 ? playerSB.toString().substring(0, playerSB.toString().length() - 2) : "").
|
||||
replace("{max}", Bukkit.getMaxPlayers() + "").
|
||||
replace("{online}", (Bukkit.getOnlinePlayers().size() - VanishCMD.getVanished().size()) + "")
|
||||
));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LoreCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public LoreCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("lore")){
|
||||
if(sender.hasPermission("hestia.lore")){
|
||||
if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("add")) {
|
||||
if (args.length > 1) {
|
||||
ItemStack itemStack = player.getInventory().getItemInHand();
|
||||
if (itemStack != null && itemStack.getType() != Material.AIR) {
|
||||
StringBuilder line = new StringBuilder();
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
line.append(args[i]).append(" ");
|
||||
}
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
List<String> lore = new ArrayList<>();
|
||||
if(itemMeta.getLore() != null){
|
||||
lore.addAll(itemMeta.getLore());
|
||||
}
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', line.toString()));
|
||||
itemMeta.setLore(lore);
|
||||
player.getInventory().getItemInHand().setItemMeta(itemMeta);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "added-lore").replace("{number}", lore.size() + ""));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "no-item"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/lore add [Text]").replace("{usage-c}", "/lore add" + ChatColor.WHITE + " [Text]"));
|
||||
}
|
||||
}else if (args[0].equalsIgnoreCase("delete")) {
|
||||
if (args.length > 1) {
|
||||
ItemStack itemStack = player.getInventory().getItemInHand();
|
||||
if (itemStack != null && itemStack.getType() != Material.AIR) {
|
||||
if (NumberUtils.isNumber(args[1])) {
|
||||
int i = Integer.parseInt(args[1]) - 1;
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta.getLore() != null && itemMeta.getLore().size() >= i) {
|
||||
List<String> lore = itemMeta.getLore();
|
||||
lore.remove(i);
|
||||
itemMeta.setLore(lore);
|
||||
player.getInventory().getItemInHand().setItemMeta(itemMeta);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "deleted-lore").replace("{number}", (i + 1) + ""));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "no-lore"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-number"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "no-item"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/lore delete [Line]").replace("{usage-c}", "/lore delete" + ChatColor.WHITE + " [Line]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/lore add/delete").replace("{usage-c}", "/lore add/delete" + ChatColor.WHITE + ""));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/lore add/delete").replace("{usage-c}", "/lore add/delete" + ChatColor.WHITE + ""));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.commands.staff.vanish.VanishCMD;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MessageCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
private static HashMap<Player, Player> recents = new HashMap<>();
|
||||
|
||||
public static HashMap<Player, Player> getRecents() {
|
||||
return recents;
|
||||
}
|
||||
|
||||
public MessageCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("message")) {
|
||||
if (sender.hasPermission("hestia.message")) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 1) {
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if (target != null && (!VanishCMD.getVanished().contains(target) || sender.hasPermission("hestia.vanish"))) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
sb.append(args[i]).append(" ");
|
||||
}
|
||||
Profile profileTarget = Profile.getProfile(target.getUniqueId(), hestia);
|
||||
if (profileTarget != null && !profileTarget.getIgnoreList().contains(player.getName())) {
|
||||
if(profileTarget.isPm()) {
|
||||
Profile profilePlayer = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (profilePlayer != null && !profilePlayer.getIgnoreList().contains(target.getName())) {
|
||||
if(profilePlayer.isPm()) {
|
||||
new Thread(() -> {
|
||||
Rank targetRank = profileTarget.getRank(true);
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("chat.to-format").replace("{player}", targetRank.getColor() + (targetRank.isBold() ? ChatColor.BOLD + "" : "") + (targetRank.isItalic() ? ChatColor.ITALIC + "" : "") + target.getName()).replace("{message}", sb.toString())));
|
||||
}).start();
|
||||
new Thread(() -> {
|
||||
Rank playerRank = profilePlayer.getRank(true);
|
||||
target.sendMessage(ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("chat.from-format").replace("{player}", playerRank.getColor() + (playerRank.isBold() ? ChatColor.BOLD + "" : "") + (playerRank.isItalic() ? ChatColor.ITALIC + "" : "") + player.getName()).replace("{message}", sb.toString())));
|
||||
MessageCMD.getRecents().put(player, target);
|
||||
MessageCMD.getRecents().put(target, player);
|
||||
if(profileTarget.isSounds()) {
|
||||
target.playSound(player.getLocation(), "SUCCESSFUL_HIT", 10, 1);
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "player-togglepm"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "player-ignored"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "target-togglepm"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "target-ignored"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/message [Player] [Message]").replace("{usage-c}", "/message" + ChatColor.WHITE + " [Player] [Message]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.commands.core.disguise.Disguise;
|
||||
import me.quartz.hestia.commands.staff.vanish.VanishCMD;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class OnlineStaffCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public OnlineStaffCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("onlinestaff")){
|
||||
if(sender.hasPermission("hestia.onlinestaff")){
|
||||
List<Rank> ranks;
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
ranks = hestia.getRankMySQL().getRanks();
|
||||
} else {
|
||||
ranks = hestia.getRankMongoDB().getRanks();
|
||||
}
|
||||
HashMap<Rank, Integer> ranksHashmap = new HashMap<>();
|
||||
for (Rank rank : ranks) {
|
||||
ranksHashmap.put(rank, rank.getPriority());
|
||||
}
|
||||
StringBuilder playerSB = new StringBuilder();
|
||||
HashMap<Player, Rank> playerHashmap = new HashMap<>();
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.hasPermission("hestia.staff") && !VanishCMD.getVanished().contains(player) && (Disguise.getRealName(player.getName()) == null)) {
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (profile != null) {
|
||||
Rank rank = null;
|
||||
for (Rank rankies : ranks) {
|
||||
if (rankies.getName().equalsIgnoreCase(profile.getRankString(true))) {
|
||||
rank = rankies;
|
||||
}
|
||||
}
|
||||
if (rank != null) {
|
||||
playerHashmap.put(player, rank);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(Rank rank : hestia.getUtil().sorted(ranksHashmap).keySet()) {
|
||||
for (Player player : playerHashmap.keySet()) {
|
||||
if (playerHashmap.get(player) == rank) {
|
||||
playerSB.append(rank.getPrefix()).append(rank.getColor()).append((rank.isBold() ? ChatColor.BOLD + "" : "")).append((rank.isItalic() ? ChatColor.ITALIC + "" : "")).append(player.getName()).append(ChatColor.WHITE).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
for(String string : hestia.getMessageUtil().fileMList("essentials", "onlinestaff")){
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', string.
|
||||
replace("{players}", playerSB.toString()).
|
||||
replace("{max}", Bukkit.getMaxPlayers() + "").
|
||||
replace("{online}", Bukkit.getOnlinePlayers().size() + "")
|
||||
));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class PingCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public PingCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("ping")){
|
||||
if(sender.hasPermission("hestia.ping")){
|
||||
if(args.length > 0){
|
||||
if(sender.hasPermission("hestia.ping.other")) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
try {
|
||||
Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
|
||||
int ping = (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "ping-other").replace("{ping}", ping + "").replace("{player}", player.getName()));
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | NoSuchFieldException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Error.");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
} else if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
try {
|
||||
Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
|
||||
int ping = (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "ping").replace("{ping}", ping + ""));
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | NoSuchFieldException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Error.");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RenameCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public RenameCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("rename")){
|
||||
if(sender.hasPermission("hestia.rename")){
|
||||
if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
ItemStack itemStack = player.getInventory().getItemInHand();
|
||||
if (itemStack != null && itemStack.getType() != Material.AIR) {
|
||||
StringBuilder line = new StringBuilder();
|
||||
for (String arg : args) {
|
||||
line.append(arg).append(" ");
|
||||
}
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', line.toString()));
|
||||
player.getInventory().getItemInHand().setItemMeta(itemMeta);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "renamed"));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "no-item"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/lore add/delete").replace("{usage-c}", "/lore add/delete" + ChatColor.WHITE + ""));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.commands.staff.vanish.VanishCMD;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ReplyCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public ReplyCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("reply")) {
|
||||
if (sender.hasPermission("hestia.reply")) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
Player target = MessageCMD.getRecents().getOrDefault(player, null);
|
||||
if (target != null && (!VanishCMD.getVanished().contains(target) || sender.hasPermission("hestia.vanish"))) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String arg : args) {
|
||||
sb.append(arg).append(" ");
|
||||
}
|
||||
Profile profileTarget = Profile.getProfile(target.getUniqueId(), hestia);
|
||||
if (profileTarget != null && !profileTarget.getIgnoreList().contains(player.getName())) {
|
||||
if(profileTarget.isPm()) {
|
||||
Profile profilePlayer = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (profilePlayer != null && !profilePlayer.getIgnoreList().contains(target.getName())) {
|
||||
if(profilePlayer.isPm()) {
|
||||
new Thread(() -> {
|
||||
Rank targetRank = profileTarget.getRank(true);
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("chat.to-format").replace("{player}", target.getName()).replace("{player-color}", targetRank.getColor() + (targetRank.isBold() ? ChatColor.BOLD + "" : "") + (targetRank.isItalic() ? ChatColor.ITALIC + "" : "") + target.getName()).replace("{message}", sb.toString())));
|
||||
}).start();
|
||||
new Thread(() -> {
|
||||
Rank playerRank = profilePlayer.getRank(true);
|
||||
target.sendMessage(ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("chat.from-format").replace("{player}", player.getName()).replace("{player-color}", playerRank.getColor() + (playerRank.isBold() ? ChatColor.BOLD + "" : "") + (playerRank.isItalic() ? ChatColor.ITALIC + "" : "") + player.getName()).replace("{message}", sb.toString())));
|
||||
MessageCMD.getRecents().put(player, target);
|
||||
MessageCMD.getRecents().put(target, player);
|
||||
if(profileTarget.isSounds()) {
|
||||
target.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 10, 1);
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "player-togglepm"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "player-ignored"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "target-togglepm"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "target-ignored"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "no-reply").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/reply [Message]").replace("{usage-c}", "/reply" + ChatColor.WHITE + " [Message]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
public class SkullCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public SkullCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("skull")){
|
||||
if(sender.hasPermission("hestia.skull")){
|
||||
if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
if (sender.hasPermission("hestia.skull.other")) {
|
||||
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1);
|
||||
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
|
||||
skullMeta.setOwner((args[0]));
|
||||
skull.setItemMeta(skullMeta);
|
||||
player.getInventory().addItem(skull);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "skull").replace("{player}", args[0]));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
} else {
|
||||
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1);
|
||||
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
|
||||
skullMeta.setOwner(player.getName());
|
||||
skull.setItemMeta(skullMeta);
|
||||
player.getInventory().addItem(skull);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "skull").replace("{player}", player.getName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SoundsCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public SoundsCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("sounds")){
|
||||
if(sender.hasPermission("hestia.sounds")){
|
||||
if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if(profile != null){
|
||||
profile.toggleSounds();
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "sounds").replace("{player}", sender.getName()).replace("{toggle}", (profile.isSounds() ? "enabled" : "disabled")));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SpeedCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public SpeedCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("speed")){
|
||||
if(sender.hasPermission("hestia.speed")){
|
||||
if(sender instanceof Player) {
|
||||
if (args.length > 0) {
|
||||
Player player = (Player) sender;
|
||||
if(NumberUtils.isNumber(args[0]) && !args[0].contains("f")){
|
||||
double speed = Double.parseDouble(args[0]);
|
||||
if(speed <= 10 && speed >= 0) {
|
||||
if (player.isFlying()) {
|
||||
player.setFlySpeed((float) (speed / 10));
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "flyspeed").replace("{speed}", speed + ""));
|
||||
} else {
|
||||
player.setWalkSpeed((float) (speed / 10));
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "walkspeed").replace("{speed}", speed + ""));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "maxspeed"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-number"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/speed [Speed]").replace("{usage-c}", "/speed" + ChatColor.WHITE + " [Speed]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class StaffAlertsCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public StaffAlertsCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("staffalerts")){
|
||||
if(sender.hasPermission("hestia.staffalerts")){
|
||||
if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if(profile != null){
|
||||
profile.toggleAlerts();
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "staffalert").replace("{player}", sender.getName()).replace("{toggle}", (profile.isAlerts() ? "enabled" : "disabled")));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SudoCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public SudoCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("sudo")){
|
||||
if(sender.hasPermission("hestia.sudo")){
|
||||
if(args.length > 1){
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if(player != null){
|
||||
StringBuilder commandS = new StringBuilder();
|
||||
for(int i = 1; i < args.length; i++){
|
||||
commandS.append(args[i]).append(" ");
|
||||
}
|
||||
String execute = commandS.toString();
|
||||
if(execute.startsWith("/")){
|
||||
player.performCommand(execute.replaceFirst("/", ""));
|
||||
} else {
|
||||
player.chat(execute);
|
||||
}
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "sudo").replace("{player}", player.getName()).replace("{execute}", execute.substring(0, execute.length() - 1)));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/sudo [Player] [Execute]").replace("{usage-c}", "/sudo" + ChatColor.WHITE + " [Player] [Execute]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TeleportCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public TeleportCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("teleport")){
|
||||
if(sender.hasPermission("hestia.teleport")){
|
||||
Player target = null;
|
||||
Player teleporter = null;
|
||||
if(args.length == 1){
|
||||
if(sender instanceof Player){
|
||||
teleporter = (Player) sender;
|
||||
target = Bukkit.getPlayer(args[0]);
|
||||
if(target != null){
|
||||
teleporter.teleport(target);
|
||||
teleporter.sendMessage(hestia.getMessageUtil().fileM("essentials", "teleport").replace("{player}", target.getName()));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else if(args.length > 1) {
|
||||
if (sender.hasPermission("hestia.teleporthere")) {
|
||||
teleporter = Bukkit.getPlayer(args[0]);
|
||||
target = Bukkit.getPlayer(args[1]);
|
||||
if (teleporter != null) {
|
||||
if (target != null) {
|
||||
teleporter.teleport(target);
|
||||
teleporter.sendMessage(hestia.getMessageUtil().fileM("essentials", "teleport").replace("{player}", target.getName()));
|
||||
if(teleporter != sender){
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "teleport-other").replace("{player}", teleporter.getName()).replace("{target}", target.getName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[1]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/teleport [Player] <Player>").replace("{usage-c}", "/teleport" + ChatColor.WHITE + " [Player] <Player>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TeleportHereCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public TeleportHereCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("teleporthere")) {
|
||||
if (sender.hasPermission("hestia.teleporthere")) {
|
||||
if (args.length > 0) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if(target != null){
|
||||
target.teleport(player);
|
||||
target.sendMessage(hestia.getMessageUtil().fileM("essentials", "teleport").replace("{player}", player.getName()));
|
||||
if(target != player) {
|
||||
player.sendMessage(hestia.getMessageUtil().fileM("essentials", "teleport-here").replace("{player}", target.getName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/teleporthere [Player]").replace("{usage-c}", "/teleporthere" + ChatColor.WHITE + " [Player]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TeleportPosCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public TeleportPosCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("teleportpos")) {
|
||||
if (sender.hasPermission("hestia.teleportpos")) {
|
||||
if (args.length > 2) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (NumberUtils.isNumber(args[0]) && NumberUtils.isNumber(args[1]) && NumberUtils.isNumber(args[2])) {
|
||||
Location location = new Location(player.getWorld(), ((Integer.parseInt(args[0]) > 0) ? Integer.parseInt(args[0]) + 0.5 : Integer.parseInt(args[0]) - 0.5), Integer.parseInt(args[1]), ((Integer.parseInt(args[2]) > 0) ? Integer.parseInt(args[2]) + 0.5 : Integer.parseInt(args[2]) - 0.5));
|
||||
player.teleport(location);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "teleport-pos").replace("{location}", args[0] + ", " + args[1] + ", " + args[2]));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-number").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/teleportpos [x] [y] [z]").replace("{usage-c}", "/teleportpos" + ChatColor.WHITE + " [x] [y] [z]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ToggleGlobalChatCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public ToggleGlobalChatCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("toggleglobalchat")){
|
||||
if(sender.hasPermission("hestia.toggleglobalchat")){
|
||||
if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if(profile != null){
|
||||
profile.toggleGlobalchat();
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "toggleglobalchat").replace("{player}", sender.getName()).replace("{toggle}", (profile.isGlobalchat() ? "enabled" : "disabled")));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package me.quartz.hestia.commands.essentials;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TogglePMCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public TogglePMCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("togglepm")){
|
||||
if(sender.hasPermission("hestia.togglepm")){
|
||||
if(sender instanceof Player){
|
||||
Player player = (Player) sender;
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if(profile != null){
|
||||
profile.togglePm();
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("essentials", "pms").replace("{player}", sender.getName()).replace("{toggle}", (profile.isPm() ? "enabled" : "disabled")));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
142
src/main/java/me/quartz/hestia/commands/punishments/BanCMD.java
Normal file
142
src/main/java/me/quartz/hestia/commands/punishments/BanCMD.java
Normal file
@ -0,0 +1,142 @@
|
||||
package me.quartz.hestia.commands.punishments;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.punishment.Type;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import me.quartz.hestia.utils.TimeUtil;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.Date;
|
||||
|
||||
public class BanCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public BanCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("ban")) {
|
||||
if (sender.hasPermission("hestia.ban") || sender.hasPermission("hestia.tempban")) {
|
||||
if (args.length > 0) {
|
||||
Profile target = Profile.getProfile(args[0], hestia);
|
||||
if (target != null) {
|
||||
String reason = hestia.getConfig().getString("punishment.ban-reason");
|
||||
boolean silent = false;
|
||||
Date expire = null;
|
||||
if (args.length > 1) {
|
||||
int argI = 1;
|
||||
if(TimeUtil.check(args[1])){
|
||||
TimeUtil time = TimeUtil.parseString(args[1]);
|
||||
long millis = time.toMilliseconds();
|
||||
expire = new Date(System.currentTimeMillis() + millis);
|
||||
argI++;
|
||||
}
|
||||
if((argI == 1 && sender.hasPermission("hestia.ban")) || (argI == 2)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = argI; i < args.length; i++) {
|
||||
if (args[i].equalsIgnoreCase("-s") || hestia.getConfig().getBoolean("punishment.auto-silent")) {
|
||||
silent = true;
|
||||
}
|
||||
sb.append(args[i].replace("-s", "")).append(" ");
|
||||
}
|
||||
if (sb.toString().equalsIgnoreCase(" ") || sb.toString().equalsIgnoreCase("")) {
|
||||
reason = hestia.getConfig().getString("punishment.ban-reason");
|
||||
} else {
|
||||
reason = sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean finalSilent = silent;
|
||||
String finalReason = reason;
|
||||
Date finalExpire = expire;
|
||||
Date finalExpire1 = expire;
|
||||
String finalReason1 = reason;
|
||||
Date finalExpire2 = expire;
|
||||
String finalReason2 = reason;
|
||||
new Thread(() -> {
|
||||
Profile playerP = null;
|
||||
if(sender instanceof Player){
|
||||
playerP = Profile.getProfile(((Player) sender).getUniqueId(), hestia);
|
||||
}
|
||||
Rank targetR = target.getRank(false);
|
||||
Rank playerR = null;
|
||||
if (playerP != null) {
|
||||
playerR = playerP.getRank(false);
|
||||
}
|
||||
if(playerR != null && targetR != null){
|
||||
if(playerR.getPriority() <= targetR.getPriority() && !sender.isOp()){
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("punishment", "no-higher"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
Rank finalPlayerR = playerR;
|
||||
new Thread(() -> {
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (player.hasPermission("hestia.notify") && profile != null && profile.isAlerts() && hestia.getConfig().getBoolean("server.clickable-messages")) {
|
||||
TextComponent message = new TextComponent((hestia.getMessageUtil().fileM("punishment", (finalSilent ? "silent-" : "") + (finalExpire != null ? "temp-" : "") + "ban").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (targetR != null ? targetR.getColor() + (targetR.isBold() ? ChatColor.BOLD + "" : "") + (targetR.isItalic() ? ChatColor.ITALIC + "" : "") + target.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{reason}", finalReason)));
|
||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
|
||||
ChatColor.YELLOW + "Reason: " + ChatColor.RED + finalReason + "\n"
|
||||
+ ChatColor.YELLOW + "Duration: " + ChatColor.RED + (finalExpire != null ? TimeUtil.toString((finalExpire.getTime() + 1000) - new Date().getTime()) : "Perm")).create()));
|
||||
player.spigot().sendMessage(message);
|
||||
} else if (!finalSilent) {
|
||||
TextComponent message = new TextComponent(hestia.getMessageUtil().fileM("punishment", (finalExpire != null ? "temp-" : "") + "ban").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (targetR != null ? targetR.getColor() + (targetR.isBold() ? ChatColor.BOLD + "" : "") + (targetR.isItalic() ? ChatColor.ITALIC + "" : "") + target.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{reason}", finalReason));
|
||||
player.spigot().sendMessage(message);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
Punishment punishment = new Punishment(Type.BAN, new Date(), finalExpire1, finalReason1, target.getUuid(), (sender instanceof Player ? ((Player) sender).getUniqueId() : null));
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
hestia.getPunishmentMySQL().createHistory(punishment);
|
||||
} else {
|
||||
hestia.getPunishmentMongoDB().createHistory(punishment);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String r : hestia.getMessageUtil().fileMList("punishment", (punishment.getExpired() == null ? "" : "temp-") + "ban-screen")) {
|
||||
sb.append(ChatColor.translateAlternateColorCodes('&', r.replace("{reason}", punishment.getReason()).replace("{expire}",
|
||||
(punishment.getExpired() == null ? "Never" : TimeUtil.toString(punishment.getExpired().getTime() - new Date().getTime()))))).append("\n");
|
||||
}
|
||||
Bukkit.getScheduler().runTask(hestia, () -> {
|
||||
String post = target.getName() + "/-/" + sb.toString();
|
||||
if(hestia.getConfig().getString("sync-storage").equalsIgnoreCase("Redis")) {
|
||||
hestia.getRedisManager().getRedisPublish().pub("kick", post);
|
||||
}else if(hestia.getConfig().getString("sync-storage").equalsIgnoreCase("BungeeCord")) {
|
||||
if(hestia.getServer().getPluginManager().isPluginEnabled("Hestia-BungeeSync")) {
|
||||
//HestiaBungeeSync.postInfo("kick", post);
|
||||
}
|
||||
Player player = Bukkit.getPlayer(target.getName());
|
||||
if(player != null){
|
||||
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', post.split("/-/")[1]));
|
||||
}
|
||||
}
|
||||
});
|
||||
if(hestia.getServer().getPluginManager().isPluginEnabled("Hestia-Discord") && hestia.getConfig().getBoolean("discord.punishments-log.enabled")) {
|
||||
//API.sendPunishment("banned", "BAN", target.getName(), playerP == null ? "Console" : playerP.getName(), finalReason2, finalExpire2 == null ? "Permanent" : TimeUtil.toString(finalExpire2.getTime() - new Date().getTime()));
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "never-joined").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/ban [Player] <Time> <Reason> <-s>").replace("{usage-c}", "/ban" + ChatColor.WHITE + " [Player] <Time> <Reason> <-s>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package me.quartz.hestia.commands.punishments;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.punishment.Type;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import me.quartz.hestia.utils.TimeUtil;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.Date;
|
||||
|
||||
public class BlacklistCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public BlacklistCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("blacklist")) {
|
||||
if (sender.hasPermission("hestia.blacklist")) {
|
||||
if (args.length > 0) {
|
||||
Profile target = Profile.getProfile(args[0], hestia);
|
||||
if (target != null) {
|
||||
String reason = hestia.getConfig().getString("punishment.blacklist-reason");
|
||||
boolean silent = false;
|
||||
if (args.length > 1) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
if (args[i].equalsIgnoreCase("-s") || hestia.getConfig().getBoolean("punishment.auto-silent")) {
|
||||
silent = true;
|
||||
}
|
||||
sb.append(args[i].replace("-s", "")).append(" ");
|
||||
}
|
||||
if (sb.toString().equalsIgnoreCase(" ") || sb.toString().equalsIgnoreCase("")) {
|
||||
reason = hestia.getConfig().getString("punishment.blacklist-reason");
|
||||
} else {
|
||||
reason = sb.toString();
|
||||
}
|
||||
}
|
||||
boolean finalSilent = silent;
|
||||
String finalReason = reason;
|
||||
String finalReason1 = reason;
|
||||
String finalReason2 = reason;
|
||||
new Thread(() -> {
|
||||
Profile playerP = null;
|
||||
if(sender instanceof Player) {
|
||||
playerP = Profile.getProfile(((Player) sender).getUniqueId(), hestia);
|
||||
}
|
||||
Rank targetR = target.getRank(false);
|
||||
Rank playerR = null;
|
||||
if (playerP != null) {
|
||||
playerR = playerP.getRank(false);
|
||||
}
|
||||
if(playerR != null && targetR != null){
|
||||
if(playerR.getPriority() <= targetR.getPriority() && !sender.isOp()){
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("punishment", "no-higher"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
Rank finalPlayerR = playerR;
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (player.hasPermission("hestia.notify") && profile != null && profile.isAlerts() && hestia.getConfig().getBoolean("server.clickable-messages")) {
|
||||
TextComponent message = new TextComponent((hestia.getMessageUtil().fileM("punishment", (finalSilent ? "silent-" : "") + "blacklist").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (targetR != null ? targetR.getColor() + (targetR.isBold() ? ChatColor.BOLD + "" : "") + (targetR.isItalic() ? ChatColor.ITALIC + "" : "") : "") + target.getName()).replace("{reason}", finalReason)));
|
||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
|
||||
ChatColor.YELLOW + "Reason: " + ChatColor.RED + finalReason).create()));
|
||||
player.spigot().sendMessage(message);
|
||||
} else if (!finalSilent) {
|
||||
TextComponent message = new TextComponent(hestia.getMessageUtil().fileM("punishment", "blacklist").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (targetR != null ? targetR.getColor() + (targetR.isBold() ? ChatColor.BOLD + "" : "") + (targetR.isItalic() ? ChatColor.ITALIC + "" : "") : "") + target.getName()).replace("{reason}", finalReason));
|
||||
player.spigot().sendMessage(message);
|
||||
}
|
||||
}
|
||||
Punishment punishment = new Punishment(Type.BLACKLIST, new Date(), null, finalReason1, target.getUuid(), (sender instanceof Player ? ((Player) sender).getUniqueId() : null));
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
hestia.getPunishmentMySQL().createHistory(punishment);
|
||||
} else {
|
||||
hestia.getPunishmentMongoDB().createHistory(punishment);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String r : hestia.getMessageUtil().fileMList("punishment", "blacklist-screen")) {
|
||||
sb.append(ChatColor.translateAlternateColorCodes('&', r.replace("{reason}", punishment.getReason()))).append("\n");
|
||||
}
|
||||
Profile finalPlayerP = playerP;
|
||||
Bukkit.getScheduler().runTask(hestia, () -> {
|
||||
String post = finalPlayerP.getName() + "/-/" + sb.toString();
|
||||
if (hestia.getConfig().getString("sync-storage").equalsIgnoreCase("Redis")) {
|
||||
hestia.getRedisManager().getRedisPublish().pub("kick", post);
|
||||
} else if (hestia.getConfig().getString("sync-storage").equalsIgnoreCase("BungeeCord")) {
|
||||
if (hestia.getServer().getPluginManager().isPluginEnabled("Hestia-BungeeSync")) {
|
||||
//HestiaBungeeSync.postInfo("kick", post);
|
||||
}
|
||||
Player player = Bukkit.getPlayer(finalPlayerP.getName());
|
||||
if (player != null) {
|
||||
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', post.split("/-/")[1]));
|
||||
}
|
||||
}
|
||||
if (hestia.getServer().getPluginManager().isPluginEnabled("Hestia-Discord") && hestia.getConfig().getBoolean("discord.punishments-log.enabled")) {
|
||||
//API.sendPunishment("blacklisted", "BLACKLIST", target.getName(), finalPlayerP == null ? "Console" : finalPlayerP.getName(), finalReason2, "Permanent");
|
||||
}
|
||||
});
|
||||
new Thread(() -> {
|
||||
if(hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
for(Profile profile : hestia.getProfileMySQL().createPlayerIp(target.getIpAddress())){
|
||||
if(profile != finalPlayerP) {
|
||||
Bukkit.getScheduler().runTask(hestia, () -> {
|
||||
String post = profile.getName() + "/-/" + sb.toString();
|
||||
if (hestia.getConfig().getString("sync-storage").equalsIgnoreCase("Redis")) {
|
||||
hestia.getRedisManager().getRedisPublish().pub("kick", post);
|
||||
} else if (hestia.getConfig().getString("sync-storage").equalsIgnoreCase("BungeeCord")) {
|
||||
if (hestia.getServer().getPluginManager().isPluginEnabled("Hestia-BungeeSync")) {
|
||||
//HestiaBungeeSync.postInfo("kick", post);
|
||||
}
|
||||
Player player = Bukkit.getPlayer(profile.getName());
|
||||
if (player != null) {
|
||||
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', post.split("/-/")[1]));
|
||||
}
|
||||
}
|
||||
if (hestia.getServer().getPluginManager().isPluginEnabled("Hestia-Discord") && hestia.getConfig().getBoolean("discord.punishments-log.enabled")) {
|
||||
//API.sendPunishment("blacklisted", "BLACKLIST", target.getName(), finalPlayerP == null ? "Console" : finalPlayerP.getName(), finalReason2, "Permanent");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(Profile profile : hestia.getProfileMongoDB().createPlayerFromIP(target.getIpAddress())){
|
||||
if(profile != finalPlayerP) {
|
||||
Bukkit.getScheduler().runTask(hestia, () -> {
|
||||
String post = profile.getName() + "/-/" + sb.toString();
|
||||
if (hestia.getConfig().getString("sync-storage").equalsIgnoreCase("Redis")) {
|
||||
hestia.getRedisManager().getRedisPublish().pub("kick", post);
|
||||
} else if (hestia.getConfig().getString("sync-storage").equalsIgnoreCase("BungeeCord")) {
|
||||
if (hestia.getServer().getPluginManager().isPluginEnabled("Hestia-BungeeSync")) {
|
||||
//HestiaBungeeSync.postInfo("kick", post);
|
||||
}
|
||||
Player player = Bukkit.getPlayer(profile.getName());
|
||||
if (player != null) {
|
||||
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', post.split("/-/")[1]));
|
||||
}
|
||||
}
|
||||
if (hestia.getServer().getPluginManager().isPluginEnabled("Hestia-Discord") && hestia.getConfig().getBoolean("discord.punishments-log.enabled")) {
|
||||
//API.sendPunishment("blacklisted", "BLACKLIST", target.getName(), finalPlayerP == null ? "Console" : finalPlayerP.getName(), finalReason2, "Permanent");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}).start();
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "never-joined").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/blacklist [Player] <Reason> <-s>").replace("{usage-c}", "/blacklist" + ChatColor.WHITE + " [Player] <Reason> <-s>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
123
src/main/java/me/quartz/hestia/commands/punishments/KickCMD.java
Normal file
123
src/main/java/me/quartz/hestia/commands/punishments/KickCMD.java
Normal file
@ -0,0 +1,123 @@
|
||||
package me.quartz.hestia.commands.punishments;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.punishment.Type;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import me.quartz.hestia.utils.TimeUtil;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.Date;
|
||||
|
||||
public class KickCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public KickCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("kick")) {
|
||||
if (sender.hasPermission("hestia.kick")) {
|
||||
if (args.length > 0) {
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if (target != null) {
|
||||
String reason = hestia.getConfig().getString("punishment.kick-reason");
|
||||
boolean silent = false;
|
||||
if (args.length > 1) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
if (args[i].equalsIgnoreCase("-s") || hestia.getConfig().getBoolean("punishment.auto-silent")) {
|
||||
silent = true;
|
||||
}
|
||||
sb.append(args[i].replace("-s", "")).append(" ");
|
||||
}
|
||||
if (sb.toString().equalsIgnoreCase(" ") || sb.toString().equalsIgnoreCase("")) {
|
||||
reason = hestia.getConfig().getString("punishment.kick-reason");
|
||||
} else {
|
||||
reason = sb.toString();
|
||||
}
|
||||
}
|
||||
boolean finalSilent = silent;
|
||||
String finalReason = reason;
|
||||
String finalReason1 = reason;
|
||||
new Thread(() -> {
|
||||
Profile playerP = null;
|
||||
if(sender instanceof Player) {
|
||||
playerP = Profile.getProfile(((Player) sender).getUniqueId(), hestia);
|
||||
}
|
||||
Profile targetP;
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
targetP = hestia.getProfileMySQL().createPlayer(target.getUniqueId());
|
||||
} else {
|
||||
targetP = hestia.getProfileMongoDB().createPlayer(target.getUniqueId());
|
||||
}
|
||||
Rank playerR = null;
|
||||
Rank targetR = null;
|
||||
if (playerP != null) {
|
||||
playerR = playerP.getRank(false);
|
||||
} if(targetP != null){
|
||||
targetR = targetP.getRank(false);
|
||||
}
|
||||
if(playerR != null && targetR != null){
|
||||
if(playerR.getPriority() <= targetR.getPriority() && !sender.isOp()){
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("punishment", "no-higher"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
Rank finalPlayerR = playerR;
|
||||
Rank finalTargetR = targetR;
|
||||
new Thread(() -> {
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (player.hasPermission("hestia.notify") && profile != null && profile.isAlerts() && hestia.getConfig().getBoolean("server.clickable-messages")) {
|
||||
TextComponent message = new TextComponent((hestia.getMessageUtil().fileM("punishment", (finalSilent ? "silent-" : "") + "kick").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (finalTargetR != null ? finalTargetR.getColor() + (finalTargetR.isBold() ? ChatColor.BOLD + "" : "") + (finalTargetR.isItalic() ? ChatColor.ITALIC + "" : "") : "") + target.getName()).replace("{reason}", finalReason)));
|
||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
|
||||
ChatColor.YELLOW + "Reason: " + ChatColor.RED + finalReason).create()));
|
||||
player.spigot().sendMessage(message);
|
||||
} else if (!finalSilent) {
|
||||
TextComponent message = new TextComponent(hestia.getMessageUtil().fileM("punishment", "kick").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (finalTargetR != null ? finalTargetR.getColor() + (finalTargetR.isBold() ? ChatColor.BOLD + "" : "") + (finalTargetR.isItalic() ? ChatColor.ITALIC + "" : "") : "") + target.getName()).replace("{reason}", finalReason));
|
||||
player.spigot().sendMessage(message);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
Punishment punishment = new Punishment(Type.KICK, new Date(), null, finalReason1, target.getUniqueId(), (sender instanceof Player ? ((Player) sender).getUniqueId() : null));
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
hestia.getPunishmentMySQL().createHistory(punishment);
|
||||
} else {
|
||||
hestia.getPunishmentMongoDB().createHistory(punishment);
|
||||
}
|
||||
if(hestia.getServer().getPluginManager().isPluginEnabled("Hestia-Discord") && hestia.getConfig().getBoolean("discord.punishments-log.enabled")){
|
||||
//API.sendPunishment("kicked", "KICK", target.getName(), playerP == null ? "Console" : playerP.getName(), finalReason, "N/A");
|
||||
}
|
||||
}).start();
|
||||
StringBuilder screen = new StringBuilder();
|
||||
for (String string : hestia.getMessageUtil().fileMList("punishment", "kick-screen")) {
|
||||
screen.append(ChatColor.translateAlternateColorCodes('&', string)).append("\n");
|
||||
}
|
||||
target.kickPlayer(ChatColor.translateAlternateColorCodes('&', screen.toString().replace("{reason}", finalReason1)));
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/kick [Player] <Reason> <-s>").replace("{usage-c}", "/kick" + ChatColor.WHITE + " [Player] <Reason> <-s>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
122
src/main/java/me/quartz/hestia/commands/punishments/MuteCMD.java
Normal file
122
src/main/java/me/quartz/hestia/commands/punishments/MuteCMD.java
Normal file
@ -0,0 +1,122 @@
|
||||
package me.quartz.hestia.commands.punishments;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.punishment.Type;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import me.quartz.hestia.utils.TimeUtil;
|
||||
//import me.quartz.hestiadiscord.API;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
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 java.util.Date;
|
||||
|
||||
public class MuteCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
|
||||
public MuteCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("mute")) {
|
||||
if (sender.hasPermission("hestia.mute") || sender.hasPermission("hestia.tempmute")) {
|
||||
if (args.length > 0) {
|
||||
Profile target = Profile.getProfile(args[0], hestia);
|
||||
if (target != null) {
|
||||
String reason = hestia.getConfig().getString("punishment.mute-reason");
|
||||
boolean silent = false;
|
||||
Date expire = null;
|
||||
if (args.length > 1) {
|
||||
int argI = 1;
|
||||
if(TimeUtil.check(args[1])){
|
||||
TimeUtil time = TimeUtil.parseString(args[1]);
|
||||
long millis = time.toMilliseconds();
|
||||
expire = new Date(System.currentTimeMillis() + millis);
|
||||
argI++;
|
||||
}
|
||||
if((argI == 1 && sender.hasPermission("hestia.mute")) || (argI == 2)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = argI; i < args.length; i++) {
|
||||
if (args[i].equalsIgnoreCase("-s") || hestia.getConfig().getBoolean("punishment.auto-silent")) {
|
||||
silent = true;
|
||||
}
|
||||
sb.append(args[i].replace("-s", "")).append(" ");
|
||||
}
|
||||
if (sb.toString().equalsIgnoreCase(" ") || sb.toString().equalsIgnoreCase("")) {
|
||||
reason = hestia.getConfig().getString("punishment.mute-reason");
|
||||
} else {
|
||||
reason = sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean finalSilent = silent;
|
||||
String finalReason = reason;
|
||||
Date finalExpire = expire;
|
||||
Date finalExpire1 = expire;
|
||||
String finalReason1 = reason;
|
||||
new Thread(() -> {
|
||||
Profile playerP = null;
|
||||
if(sender instanceof Player) {
|
||||
playerP = Profile.getProfile(((Player) sender).getUniqueId(), hestia);
|
||||
}
|
||||
Rank targetR = target.getRank(false);
|
||||
Rank playerR = null;
|
||||
if (playerP != null) {
|
||||
playerR = playerP.getRank(false);
|
||||
}
|
||||
if(playerR != null && targetR != null){
|
||||
if(playerR.getPriority() <= targetR.getPriority() && !sender.isOp()){
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("punishment", "no-higher"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
Rank finalPlayerR = playerR;
|
||||
new Thread(() -> {
|
||||
Profile profile = Profile.getProfile(player.getUniqueId(), hestia);
|
||||
if (player.hasPermission("hestia.notify") && profile != null && profile.isAlerts() && hestia.getConfig().getBoolean("server.clickable-messages")) {
|
||||
TextComponent message = new TextComponent((hestia.getMessageUtil().fileM("punishment", (finalSilent ? "silent-" : "") + (finalExpire != null ? "temp-" : "") + "mute").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (targetR != null ? targetR.getColor() + (targetR.isBold() ? ChatColor.BOLD + "" : "") + (targetR.isItalic() ? ChatColor.ITALIC + "" : "") : "") + target.getName()).replace("{reason}", finalReason)));
|
||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
|
||||
ChatColor.YELLOW + "Reason: " + ChatColor.RED + finalReason + "\n"
|
||||
+ ChatColor.YELLOW + "Duration: " + ChatColor.RED + (finalExpire != null ? TimeUtil.toString((finalExpire.getTime() + 1000) - new Date().getTime()) : "Perm")).create()));
|
||||
player.spigot().sendMessage(message);
|
||||
} else if (!finalSilent) {
|
||||
TextComponent message = new TextComponent(hestia.getMessageUtil().fileM("punishment", (finalExpire != null ? "temp-" : "") + "mute").replace("{player}", (finalPlayerR != null ? finalPlayerR.getColor() + (finalPlayerR.isBold() ? ChatColor.BOLD + "" : "") + (finalPlayerR.isItalic() ? ChatColor.ITALIC + "" : "") + sender.getName() : ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console")))).replace("{target}", (targetR != null ? targetR.getColor() + (targetR.isBold() ? ChatColor.BOLD + "" : "") + (targetR.isItalic() ? ChatColor.ITALIC + "" : "") : "") + target.getName()).replace("{reason}", finalReason));
|
||||
player.spigot().sendMessage(message);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
Punishment punishment = new Punishment(Type.MUTE, new Date(), finalExpire1, finalReason1, target.getUuid(), (sender instanceof Player ? ((Player) sender).getUniqueId() : null));
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
hestia.getPunishmentMySQL().createHistory(punishment);
|
||||
} else {
|
||||
hestia.getPunishmentMongoDB().createHistory(punishment);
|
||||
}
|
||||
if(hestia.getServer().getPluginManager().isPluginEnabled("Hestia-Discord") && hestia.getConfig().getBoolean("discord.punishments-log.enabled")){
|
||||
//API.sendPunishment("muted", "MUTE", target.getName(), playerP == null ? "Console" : playerP.getName(), finalReason, finalExpire == null ? "Permanent" : TimeUtil.toString(finalExpire.getTime() - new Date().getTime()));
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "never-joined").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/mute [Player] <Time> <Reason> <-s>").replace("{usage-c}", "/mute" + ChatColor.WHITE + " [Player] <Time> <Reason> <-s>"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
package me.quartz.hestia.commands.punishments;
|
||||
|
||||
import com.allatori.annotations.ControlFlowObfuscation;
|
||||
import com.allatori.annotations.DoNotRename;
|
||||
import com.allatori.annotations.ExtensiveFlowObfuscation;
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.punishment.Type;
|
||||
import me.quartz.hestia.data.system.rank.Rank;
|
||||
import me.quartz.hestia.data.system.rank.RankHistory;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class PunishmentsCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
@DoNotRename
|
||||
private static HashMap<Player, Type> playersType = new HashMap<>();
|
||||
@DoNotRename
|
||||
@ControlFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
@ExtensiveFlowObfuscation(ControlFlowObfuscation.DISABLE)
|
||||
public static HashMap<Player, Type> getPlayersType(){return playersType;}
|
||||
|
||||
public PunishmentsCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("punishments")) {
|
||||
if (sender.hasPermission("hestia.punishments")) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
UUID uuid;
|
||||
String name;
|
||||
Profile profile = Profile.getProfile(args[0], hestia);
|
||||
if (profile != null) {
|
||||
uuid = profile.getUuid();
|
||||
name = profile.getName();
|
||||
if (uuid != null) {
|
||||
List<Punishment> punishments;
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
punishments = hestia.getPunishmentMySQL().getPunishmentHistory(uuid);
|
||||
} else {
|
||||
punishments = hestia.getPunishmentMongoDB().getPunishmentHistory(uuid);
|
||||
}
|
||||
Map<Date, Punishment> map = new TreeMap<>(Comparator.reverseOrder());
|
||||
for (Punishment punishment : punishments) {
|
||||
if(!getPlayersType().containsKey(player)) {
|
||||
map.put(punishment.getAdded(), punishment);
|
||||
} else if(punishment.getType() == getPlayersType().get(player)){
|
||||
map.put(punishment.getAdded(), punishment);
|
||||
}
|
||||
}
|
||||
int invs = (map.size() == 0 ? map.size() : map.size() - 1) / 28;
|
||||
Inventory inventory = Bukkit.createInventory(null, 45, ChatColor.GREEN + "Check " + name + ChatColor.GRAY + " [1/" + (invs + 1) + "]");
|
||||
for (int i = 0; i < 9; i++) {
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 8, " "));
|
||||
}for (int i = inventory.getSize() - 9; i < inventory.getSize(); i++) {
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 8, " "));
|
||||
}
|
||||
inventory.setItem(0, hestia.getUtil().itemStack(Material.TORCH, 1, 1, ChatColor.YELLOW + "Previous Page"));
|
||||
inventory.setItem(4, hestia.getUtil().itemStack(Material.SKULL_ITEM, 1, 3, ChatColor.LIGHT_PURPLE + "Type:",
|
||||
(!getPlayersType().containsKey(player) ? ChatColor.GREEN + "» All" : ChatColor.GRAY + "» All"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.BLACKLIST ? ChatColor.GREEN + "» Blacklist" : ChatColor.GRAY + "» Blacklist"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.BAN ? ChatColor.GREEN + "» Ban" : ChatColor.GRAY + "» Ban"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.MUTE ? ChatColor.GREEN + "» Mute" : ChatColor.GRAY + "» Mute"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.KICK ? ChatColor.GREEN + "» Kick" : ChatColor.GRAY + "» Kick"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.WARN ? ChatColor.GREEN + "» Warn" : ChatColor.GRAY + "» Warn")
|
||||
));
|
||||
inventory.setItem(8, hestia.getUtil().itemStack(Material.TORCH, 1, 1, ChatColor.YELLOW + "Next Page"));
|
||||
inventory.setItem(40, hestia.getUtil().itemStack(Material.REDSTONE_BLOCK, 1, 1, ChatColor.RED + "Close GUI"));
|
||||
List<Punishment> punishmenties = new ArrayList<>(map.values());
|
||||
player.openInventory(inventory);
|
||||
for (int i = 0; i <= 26; i++) {
|
||||
if (player.getOpenInventory() != null && player.getOpenInventory().getTopInventory().getTitle().equalsIgnoreCase(ChatColor.GREEN + "Check " + name + ChatColor.GRAY + " [1/" + (invs + 1) + "]")) {
|
||||
if (punishmenties.size() > i) {
|
||||
Punishment punishment = punishmenties.get(i);
|
||||
String executor;
|
||||
String remover;
|
||||
if (punishment.getExecutor() != null) {
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
executor = hestia.getProfileMySQL().createPlayer(punishment.getExecutor()).getName();
|
||||
} else {
|
||||
executor = hestia.getProfileMongoDB().createPlayer(punishment.getExecutor()).getName();
|
||||
}
|
||||
} else {
|
||||
executor = ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console"));
|
||||
}
|
||||
if (punishment.getUnbanner() != null) {
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
remover = hestia.getProfileMySQL().createPlayer(punishment.getUnbanner()).getName();
|
||||
} else {
|
||||
remover = hestia.getProfileMongoDB().createPlayer(punishment.getUnbanner()).getName();
|
||||
}
|
||||
} else {
|
||||
remover = ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console"));
|
||||
}
|
||||
if (punishment.getUnbanned() == null) {
|
||||
player.getOpenInventory().setItem(i + 9, hestia.getUtil().itemStack(Material.WOOL, 1, punishment.getUnbanner() == null ? 13 : 14, ChatColor.RED + punishment.getType().name() + ChatColor.GRAY + " (#" + punishment.getId() + ")",
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GREEN + "Added By: " + ChatColor.WHITE + executor,
|
||||
ChatColor.GREEN + "Added Date: " + ChatColor.WHITE + new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getAdded()),
|
||||
" ",
|
||||
ChatColor.GREEN + "Reason: " + ChatColor.WHITE + punishment.getReason(),
|
||||
ChatColor.GREEN + "Expire: " + ChatColor.WHITE + (punishment.getExpired() != null ? new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getExpired()) : "Never"),
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GRAY + "Click to remove this grant.",
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------"
|
||||
));
|
||||
}
|
||||
if (punishment.getUnbanned() != null) {
|
||||
player.getOpenInventory().setItem(i + 9, hestia.getUtil().itemStack(Material.WOOL, 1, punishment.getUnbanned() == null ? 13 : 14, ChatColor.RED + punishment.getType().name() + ChatColor.GRAY + " (#" + punishment.getId() + ")",
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GREEN + "Added By: " + ChatColor.WHITE + executor,
|
||||
ChatColor.GREEN + "Added Date: " + ChatColor.WHITE + new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getAdded()),
|
||||
" ",
|
||||
ChatColor.GREEN + "Reason: " + ChatColor.WHITE + punishment.getReason(),
|
||||
ChatColor.GREEN + "Expire: " + ChatColor.WHITE + (punishment.getExpired() != null ? new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getExpired()) : "Never"),
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GREEN + "Removed By: " + ChatColor.WHITE + remover,
|
||||
ChatColor.GREEN + "Removed Date: " + ChatColor.WHITE + new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getUnbanned()),
|
||||
ChatColor.GREEN + "Removed Reason: " + ChatColor.WHITE + punishment.getUnbanned_reason(),
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------"
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/punishments [Player]").replace("{usage-c}", "/punishments" + ChatColor.WHITE + " [Player]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package me.quartz.hestia.commands.punishments;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.punishment.Type;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class StaffHistoryCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
private static HashMap<Player, Type> playersType = new HashMap<>();
|
||||
public static HashMap<Player, Type> getPlayersType(){return playersType;}
|
||||
|
||||
public StaffHistoryCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("staffhistory")) {
|
||||
if (sender.hasPermission("hestia.staffhistory")) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 0) {
|
||||
UUID uuid;
|
||||
String name;
|
||||
Profile profile = Profile.getProfile(args[0], hestia);
|
||||
if (profile != null) {
|
||||
uuid = profile.getUuid();
|
||||
name = profile.getName();
|
||||
if (uuid != null) {
|
||||
List<Punishment> punishments;
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
punishments = hestia.getPunishmentMySQL().getPunisherPunishments(uuid, null);
|
||||
} else {
|
||||
punishments = hestia.getPunishmentMongoDB().getPunisherPunishments(uuid, null);
|
||||
}
|
||||
Map<Date, Punishment> map = new TreeMap<>(Comparator.reverseOrder());
|
||||
for (Punishment punishment : punishments) {
|
||||
if (!getPlayersType().containsKey(player)) {
|
||||
map.put(punishment.getAdded(), punishment);
|
||||
} else if (punishment.getType() == getPlayersType().get(player)) {
|
||||
map.put(punishment.getAdded(), punishment);
|
||||
}
|
||||
}
|
||||
int invs = (map.size() == 0 ? map.size() : map.size() - 1) / 28;
|
||||
Inventory inventory = Bukkit.createInventory(null, 45, ChatColor.GREEN + "History " + name + ChatColor.GRAY + " [1/" + (invs + 1) + "]");
|
||||
for (int i = 0; i < 9; i++) {
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 8, " "));
|
||||
}
|
||||
for (int i = inventory.getSize() - 9; i < inventory.getSize(); i++) {
|
||||
inventory.setItem(i, hestia.getUtil().itemStack(Material.STAINED_GLASS_PANE, 1, 8, " "));
|
||||
}
|
||||
inventory.setItem(0, hestia.getUtil().itemStack(Material.TORCH, 1, 1, ChatColor.YELLOW + "Previous Page"));
|
||||
inventory.setItem(4, hestia.getUtil().itemStack(Material.SKULL_ITEM, 1, 3, ChatColor.LIGHT_PURPLE + "Type:",
|
||||
(!getPlayersType().containsKey(player) ? ChatColor.GREEN + "» All" : ChatColor.GRAY + "» All"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.BLACKLIST ? ChatColor.GREEN + "» Blacklist" : ChatColor.GRAY + "» Blacklist"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.BAN ? ChatColor.GREEN + "» Ban" : ChatColor.GRAY + "» Ban"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.MUTE ? ChatColor.GREEN + "» Mute" : ChatColor.GRAY + "» Mute"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.KICK ? ChatColor.GREEN + "» Kick" : ChatColor.GRAY + "» Kick"),
|
||||
(getPlayersType().containsKey(player) && getPlayersType().get(player) == Type.WARN ? ChatColor.GREEN + "» Warn" : ChatColor.GRAY + "» Warn")
|
||||
));
|
||||
inventory.setItem(8, hestia.getUtil().itemStack(Material.TORCH, 1, 1, ChatColor.YELLOW + "Next Page"));
|
||||
inventory.setItem(40, hestia.getUtil().itemStack(Material.REDSTONE_BLOCK, 1, 1, ChatColor.RED + "Close GUI"));
|
||||
List<Punishment> punishmenties = new ArrayList<>(map.values());
|
||||
player.openInventory(inventory);
|
||||
for (int i = 0; i <= 26; i++) {
|
||||
if (player.getOpenInventory() != null && player.getOpenInventory().getTopInventory().getTitle().equalsIgnoreCase(ChatColor.GREEN + "History " + name + ChatColor.GRAY + " [1/" + (invs + 1) + "]")) {
|
||||
if (punishmenties.size() > i) {
|
||||
Punishment punishment = punishmenties.get(i);
|
||||
String executor;
|
||||
String remover;
|
||||
if (punishment.getExecutor() != null) {
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
executor = hestia.getProfileMySQL().createPlayer(punishment.getUuid()).getName();
|
||||
} else {
|
||||
executor = hestia.getProfileMongoDB().createPlayer(punishment.getUuid()).getName();
|
||||
}
|
||||
} else {
|
||||
executor = ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console"));
|
||||
}
|
||||
if (punishment.getUnbanner() != null) {
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
remover = hestia.getProfileMySQL().createPlayer(punishment.getUnbanner()).getName();
|
||||
} else {
|
||||
remover = hestia.getProfileMongoDB().createPlayer(punishment.getUnbanner()).getName();
|
||||
}
|
||||
} else {
|
||||
remover = ChatColor.translateAlternateColorCodes('&', hestia.getConfig().getString("server.console"));
|
||||
}
|
||||
if (punishment.getUnbanned() == null) {
|
||||
player.getOpenInventory().setItem(i + 9, hestia.getUtil().itemStack(Material.WOOL, 1, punishment.getUnbanner() == null ? 13 : 14, ChatColor.RED + punishment.getType().name() + ChatColor.GRAY + " (#" + punishment.getId() + ")",
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GREEN + "Added To: " + ChatColor.WHITE + executor,
|
||||
ChatColor.GREEN + "Added Date: " + ChatColor.WHITE + new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getAdded()),
|
||||
" ",
|
||||
ChatColor.GREEN + "Reason: " + ChatColor.WHITE + punishment.getReason(),
|
||||
ChatColor.GREEN + "Expire: " + ChatColor.WHITE + (punishment.getExpired() != null ? new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getExpired()) : "Never"),
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GRAY + "Click to remove this grant.",
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------"
|
||||
));
|
||||
}
|
||||
if (punishment.getUnbanned() != null) {
|
||||
player.getOpenInventory().setItem(i + 9, hestia.getUtil().itemStack(Material.WOOL, 1, punishment.getUnbanned() == null ? 13 : 14, ChatColor.RED + punishment.getType().name() + ChatColor.GRAY + " (#" + punishment.getId() + ")",
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GREEN + "Added To: " + ChatColor.WHITE + executor,
|
||||
ChatColor.GREEN + "Added Date: " + ChatColor.WHITE + new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getAdded()),
|
||||
" ",
|
||||
ChatColor.GREEN + "Reason: " + ChatColor.WHITE + punishment.getReason(),
|
||||
ChatColor.GREEN + "Expire: " + ChatColor.WHITE + (punishment.getExpired() != null ? new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getExpired()) : "Never"),
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------",
|
||||
ChatColor.GREEN + "Removed By: " + ChatColor.WHITE + remover,
|
||||
ChatColor.GREEN + "Removed Date: " + ChatColor.WHITE + new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(punishment.getUnbanned()),
|
||||
ChatColor.GREEN + "Removed Reason: " + ChatColor.WHITE + punishment.getUnbanned_reason(),
|
||||
ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------------"
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/punishments [Player]").replace("{usage-c}", "/punishments" + ChatColor.WHITE + " [Player]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package me.quartz.hestia.commands.punishments;
|
||||
|
||||
import me.quartz.hestia.Hestia;
|
||||
import me.quartz.hestia.data.system.profile.Profile;
|
||||
import me.quartz.hestia.data.system.punishment.Punishment;
|
||||
import me.quartz.hestia.data.system.punishment.Type;
|
||||
import me.quartz.hestia.utils.TimeUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class StaffRollbackCMD implements CommandExecutor {
|
||||
|
||||
private Hestia hestia;
|
||||
private static HashMap<Player, Type> playersType = new HashMap<>();
|
||||
public static HashMap<Player, Type> getPlayersType(){return playersType;}
|
||||
|
||||
public StaffRollbackCMD(Hestia hestia) {
|
||||
this.hestia = hestia;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("staffrollback")) {
|
||||
if (sender.hasPermission("hestia.staffrollback")) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args.length > 1) {
|
||||
UUID uuid;
|
||||
String name;
|
||||
Profile profile = Profile.getProfile(args[0], hestia);
|
||||
if (profile != null) {
|
||||
uuid = profile.getUuid();
|
||||
name = profile.getName();
|
||||
if (uuid != null) {
|
||||
if(TimeUtil.check(args[1])) {
|
||||
TimeUtil time = TimeUtil.parseString(args[1]);
|
||||
long millis = time.toMilliseconds();
|
||||
Date until = new Date(System.currentTimeMillis() - millis);
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("punishment", "rollback-start"));
|
||||
int amount = 0;
|
||||
if (hestia.getConfig().getString("data-storage").equalsIgnoreCase("MySQL")) {
|
||||
for (Punishment punishment : hestia.getPunishmentMySQL().getPunisherPunishments(uuid, until)) {
|
||||
hestia.getPunishmentMySQL().deletePunishment(punishment.getId());
|
||||
amount++;
|
||||
}
|
||||
} else {
|
||||
for (Punishment punishment : hestia.getPunishmentMongoDB().getPunisherPunishments(uuid, until)) {
|
||||
hestia.getPunishmentMongoDB().deletePunishment(punishment.getId());
|
||||
amount++;
|
||||
}
|
||||
}
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("punishment", "rollback-end").replace("{player}", name).replace("{date}", new SimpleDateFormat("hh:mm:ss MM/dd/yyyy").format(until)).replace("{amount}", amount + ""));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "player-not-found").replace("{player}", args[0]));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "usage").replace("{usage}", "/staffrollback [Player] [Time]").replace("{usage-c}", "/staffrollback" + ChatColor.WHITE + " [Player] [Time]"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "only-players"));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(hestia.getMessageUtil().fileM("general", "no-perms"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int inventorySize(int number){
|
||||
if(number <= 9){
|
||||
return inventorySizeMultiplier(number + 27 + 2);
|
||||
} else if(number <= 18){
|
||||
return inventorySizeMultiplier(number + 27 + 4);
|
||||
} else if(number <= 27){
|
||||
return inventorySizeMultiplier(number + 27 + 6);
|
||||
}
|
||||
return 63;
|
||||
}
|
||||
|
||||
public int inventorySizeMultiplier(int number){
|
||||
if(number <= 27){
|
||||
return 27;
|
||||
} else if(number <= 36){
|
||||
return 36;
|
||||
} else if(number <= 45){
|
||||
return 45;
|
||||
} else if(number <= 54){
|
||||
return 54;
|
||||
}
|
||||
return 63;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user