Compare commits
	
		
			3 Commits
		
	
	
		
			1.1.0
			...
			d40a47a783
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d40a47a783 | |||
| 09dbb19cad | |||
| b12e66cc3a | 
							
								
								
									
										5
									
								
								.idea/jarRepositories.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								.idea/jarRepositories.xml
									
									
									
										generated
									
									
									
								
							@@ -26,6 +26,11 @@
 | 
				
			|||||||
      <option name="name" value="spigot-repo" />
 | 
					      <option name="name" value="spigot-repo" />
 | 
				
			||||||
      <option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
 | 
					      <option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
 | 
				
			||||||
    </remote-repository>
 | 
					    </remote-repository>
 | 
				
			||||||
 | 
					    <remote-repository>
 | 
				
			||||||
 | 
					      <option name="id" value="dmulloy2-repo" />
 | 
				
			||||||
 | 
					      <option name="name" value="dmulloy2-repo" />
 | 
				
			||||||
 | 
					      <option name="url" value="https://repo.dmulloy2.net/repository/public/" />
 | 
				
			||||||
 | 
					    </remote-repository>
 | 
				
			||||||
    <remote-repository>
 | 
					    <remote-repository>
 | 
				
			||||||
      <option name="id" value="central" />
 | 
					      <option name="id" value="central" />
 | 
				
			||||||
      <option name="name" value="Maven Central repository" />
 | 
					      <option name="name" value="Maven Central repository" />
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							@@ -12,5 +12,8 @@
 | 
				
			|||||||
      </list>
 | 
					      </list>
 | 
				
			||||||
    </option>
 | 
					    </option>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK" />
 | 
					  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
 | 
				
			||||||
 | 
					  <component name="ProjectType">
 | 
				
			||||||
 | 
					    <option name="id" value="jpab" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
							
								
								
									
										6
									
								
								Plugin/SimplifyTools.iml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Plugin/SimplifyTools.iml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<module version="4">
 | 
				
			||||||
 | 
					  <component name="McpModuleSettings">
 | 
				
			||||||
 | 
					    <option name="srgType" value="SRG" />
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					</module>
 | 
				
			||||||
							
								
								
									
										34
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								README.md
									
									
									
									
									
								
							@@ -1,10 +1,12 @@
 | 
				
			|||||||
# SimplifyTools  
 | 
					# SimplifyTools  
 | 
				
			||||||
### An 'All-in-one' helper plugin for Minecraft Spigot Servers with a goal of combine useful plugins to a one.
 | 
					### An 'All-in-one' plugin for MC servers. 
 | 
				
			||||||
|  Build Status |                    [](https://ci.ditservices.hu/job/SimplifyTools/)                   |
 | 
					#### TabList Customizing, Custom Advancement, Connect messages, AutoSave, Logger
 | 
				
			||||||
|:-------------:|:-----------------------------------------------------------------------------------------------------------------:|
 | 
					 [](https://ci.ditservices.hu/job/SimplifyTools/)     [](https://bstats.org/plugin/bukkit/SimplifyTools/15108) 
 | 
				
			||||||
|   MC Version  |  |
 | 
					<br>[Changelog](docs/ChangeLog.md)
 | 
				
			||||||
| Lines of code |                              |
 | 
					<hr>
 | 
				
			||||||
|     Files     |                                     |
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Features
 | 
					## Features
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 - **Tab Manager** - Allows you to specify colored texts, with animations on the tab window.
 | 
					 - **Tab Manager** - Allows you to specify colored texts, with animations on the tab window.
 | 
				
			||||||
@@ -13,7 +15,7 @@
 | 
				
			|||||||
 - **Automatic/command saving** - Allows you to schedule auto saving of the world/player data on your server, or you can initiate a save by a command.
 | 
					 - **Automatic/command saving** - Allows you to schedule auto saving of the world/player data on your server, or you can initiate a save by a command.
 | 
				
			||||||
 - **Custom Connect/Disconnect messages** - Allows you to customize the message that is broadcasted when someone joins or leaves the server.
 | 
					 - **Custom Connect/Disconnect messages** - Allows you to customize the message that is broadcasted when someone joins or leaves the server.
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 - **Plugin Manager** - Allows you to unload/load plugins without a server restart.
 | 
					 - **Plugin Manager** - Allows you to unload/load plugins without a server restart. (Disabled by default since v1.2.1)
 | 
				
			||||||
 - **Gameplay statistics** - You can check your gameplay statistics such as player/mob kills, etc.
 | 
					 - **Gameplay statistics** - You can check your gameplay statistics such as player/mob kills, etc.
 | 
				
			||||||
 (Note: The plugin just shows the stats not recording itself, so stats before installing this plugin are counted too.)
 | 
					 (Note: The plugin just shows the stats not recording itself, so stats before installing this plugin are counted too.)
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
@@ -25,27 +27,13 @@
 | 
				
			|||||||
_________________
 | 
					_________________
 | 
				
			||||||
### [Commands & Permissions](docs/cmd_perms.md)
 | 
					### [Commands & Permissions](docs/cmd_perms.md)
 | 
				
			||||||
_________________
 | 
					_________________
 | 
				
			||||||
 | 
					### [Building from source](docs/BUILDING.md)
 | 
				
			||||||
 | 
					_________________
 | 
				
			||||||
### If you have an idea or bug report [Create an issue](https://github.com/LabodiDavid/SimplifyTools/issues/new/choose) or [Create a pull request](https://github.com/LabodiDavid/SimplifyTools/compare)
 | 
					### If you have an idea or bug report [Create an issue](https://github.com/LabodiDavid/SimplifyTools/issues/new/choose) or [Create a pull request](https://github.com/LabodiDavid/SimplifyTools/compare)
 | 
				
			||||||
_________________
 | 
					_________________
 | 
				
			||||||
## Main goal
 | 
					## Main goal
 | 
				
			||||||
My main goal is to create a single plugin that has many features, so it's can replace plugins that i often use on my servers while lowering the plugins count.
 | 
					My main goal is to create a single plugin that has many features, so it's can replace plugins that i often use on my servers while lowering the plugins count.
 | 
				
			||||||
_________________
 | 
					_________________
 | 
				
			||||||
## Building 
 | 
					 | 
				
			||||||
#### Dependencies:
 | 
					 | 
				
			||||||
- spigot-api-1.18.2-R0.1-SNAPSHOT-shaded.jar (from Spigot Repo Downloads Automatically OR **BuildTools** generated `Spigot\Spigot-API\target\`)
 | 
					 | 
				
			||||||
- brigadier-1.0.18.jar (from **BuildTools** generated `spigot-x.xx.x.jar\META-INF\libraries\`)
 | 
					 | 
				
			||||||
- craftbukkit-1.18.2-R0.1-SNAPSHOT.jar (from downloaded `craftbukkit-x.xx.x.jar\META-INF\versions\`)
 | 
					 | 
				
			||||||
##### Installing Dependencies:
 | 
					 | 
				
			||||||
You can install the dependencies to your maven repository through CLI like this:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- mvn install:install-file -Dfile=spigot-api-1.18.2-R0.1-SNAPSHOT-shaded.jar -DgroupId=org.spigotmc -DartifactId=spigot-api -Dversion=1.18.2-R0.1-SNAPSHOT -Dpackaging=jar
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- mvn install:install-file -Dfile=craftbukkit-1.18.2-R0.1-SNAPSHOT.jar -DgroupId=org.bukkit -DartifactId=craftbukkit -Dversion=1.18.2-R0.1-SNAPSHOT -Dpackaging=jar
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- mvn install:install-file -Dfile=brigadier-1.0.18.jar -DgroupId=com.mojang -DartifactId=brigadier -Dversion=1.0.18 -Dpackaging=jar
 | 
					 | 
				
			||||||
_________________
 | 
					 | 
				
			||||||
## 3rd party libraries used by this plugin
 | 
					## 3rd party libraries used by this plugin
 | 
				
			||||||
### [Config-Updater by tchristofferson](https://github.com/tchristofferson/Config-Updater)
 | 
					### [Config-Updater by tchristofferson](https://github.com/tchristofferson/Config-Updater)
 | 
				
			||||||
### [SpigotUpdateChecker by JEFF-Media-GbR](https://github.com/JEFF-Media-GbR/Spigot-UpdateChecker)
 | 
					### [SpigotUpdateChecker by JEFF-Media-GbR](https://github.com/JEFF-Media-GbR/Spigot-UpdateChecker)
 | 
				
			||||||
@@ -25,19 +25,20 @@
 | 
				
			|||||||
    <orderEntry type="inheritedJdk" />
 | 
					    <orderEntry type="inheritedJdk" />
 | 
				
			||||||
    <orderEntry type="sourceFolder" forTests="false" />
 | 
					    <orderEntry type="sourceFolder" forTests="false" />
 | 
				
			||||||
    <orderEntry type="library" name="Maven: com.jeff_media:SpigotUpdateChecker:2.2.0" level="project" />
 | 
					    <orderEntry type="library" name="Maven: com.jeff_media:SpigotUpdateChecker:2.2.0" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT" level="project" />
 | 
					    <orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:3.0.0" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
 | 
					    <orderEntry type="library" name="Maven: org.bstats:bstats-base:3.0.0" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.0.1-jre" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.1-jre" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.12.0" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.12.0" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.7.1" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.11.0" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.9" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.10" level="project" />
 | 
				
			||||||
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: org.joml:joml:1.10.5" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:2.0" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.18.2-R0.1-SNAPSHOT" level="project" />
 | 
					    <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.20.1-R0.1-SNAPSHOT" level="project" />
 | 
				
			||||||
    <orderEntry type="library" scope="PROVIDED" name="Maven: com.mojang:brigadier:1.0.18" level="project" />
 | 
					 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</module>
 | 
					</module>
 | 
				
			||||||
							
								
								
									
										30
									
								
								docs/BUILDING.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								docs/BUILDING.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					## SimplifyTools - Building
 | 
				
			||||||
 | 
					Some of these dependencies only needed
 | 
				
			||||||
 | 
					#### Dependencies:
 | 
				
			||||||
 | 
					- (1.18.2) - spigot-api-1.18.2-R0.1-SNAPSHOT-shaded.jar (from Spigot Repo Downloads Automatically OR **BuildTools** compiled `Spigot\Spigot-API\target\`)
 | 
				
			||||||
 | 
					- (1.18.2) - brigadier-1.0.18.jar (from **BuildTools** compiled `spigot-x.xx.x.jar\META-INF\libraries\`)
 | 
				
			||||||
 | 
					- (1.18.2) - craftbukkit-1.18.2-R0.1-SNAPSHOT.jar (from downloaded `craftbukkit-x.xx.x.jar\META-INF\versions\`)
 | 
				
			||||||
 | 
					- (1.16.5) - spigot-1.16.5.jar (**BuildTools** compiled)
 | 
				
			||||||
 | 
					- (1.15.2) - spigot-1.15.2.jar (**BuildTools** compiled)
 | 
				
			||||||
 | 
					- (1.14.4) - spigot-1.14.4.jar (**BuildTools** compiled)
 | 
				
			||||||
 | 
					##### Installing Dependencies:
 | 
				
			||||||
 | 
					You can install the dependencies to your maven repository through CLI like this:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- mvn install:install-file -Dfile=spigot-api-1.18.2-R0.1-SNAPSHOT-shaded.jar -DgroupId=org.spigotmc -DartifactId=spigot-api -Dversion=1.18.2-R0.1-SNAPSHOT -Dpackaging=jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- mvn install:install-file -Dfile=craftbukkit-1.18.2-R0.1-SNAPSHOT.jar -DgroupId=org.bukkit -DartifactId=craftbukkit -Dversion=1.18.2-R0.1-SNAPSHOT -Dpackaging=jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- mvn install:install-file -Dfile=brigadier-1.0.18.jar -DgroupId=com.mojang -DartifactId=brigadier -Dversion=1.0.18 -Dpackaging=jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- mvn install:install-file -Dfile=spigot-1.16.5.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.16.5-R0.1-SNAPSHOT -Dpackaging=jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- mvn install:install-file -Dfile=spigot-1.15.2.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.15.2-R0.1-SNAPSHOT -Dpackaging=jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- mvn install:install-file -Dfile=spigot-1.14.4.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.14.4-R0.1-SNAPSHOT -Dpackaging=jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- mvn install:install-file -Dfile=spigot-1.17.1.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.17.1-R0.1-SNAPSHOT -Dpackaging=jar
 | 
				
			||||||
@@ -1,8 +1,21 @@
 | 
				
			|||||||
# SimplifyTools - Changelog
 | 
					# SimplifyTools - Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 1.2.1
 | 
				
			||||||
 | 
					   - Added support for version up to 1.20.1
 | 
				
			||||||
 | 
					   - Plugin manager added setting, now disabled by default in the config.
 | 
				
			||||||
 | 
					   - Removed coloring of the logs in the server console
 | 
				
			||||||
 | 
					   - TPS number displayed in the TAB now rounded to the nearest integer.
 | 
				
			||||||
 | 
					   - Minor code refactors
 | 
				
			||||||
 | 
					 - 1.2.0
 | 
				
			||||||
 | 
					   - Added TPS command `/st tps` 
 | 
				
			||||||
 | 
					   - Added `{MOTD}`, `{TPS}` variable for TAB customization in the config 
 | 
				
			||||||
 | 
					   - Refactored code for multi version support (1.12 - 1.19.3)
 | 
				
			||||||
 | 
					   - Fixes [#1](https://github.com/LabodiDavid/SimplifyTools/issues/1)
 | 
				
			||||||
 - 1.1.0
 | 
					 - 1.1.0
 | 
				
			||||||
   - Updated to 1.18.2
 | 
					   - Updated to 1.18.2
 | 
				
			||||||
   - Minor changes
 | 
					   - Minor changes
 | 
				
			||||||
   - Temporarily reworked Plugin Manager
 | 
					   - Temporarily reworked Plugin Manager
 | 
				
			||||||
   - Added Update Checker (https://github.com/JEFF-Media-GbR/Spigot-UpdateChecker)
 | 
					   - Added Update Checker (https://github.com/JEFF-Media-GbR/Spigot-UpdateChecker)
 | 
				
			||||||
 | 
					   - Implemented Metrics (bStats)
 | 
				
			||||||
 - 1.0.0 - First Release
 | 
					 - 1.0.0 - First Release
 | 
				
			||||||
     - Notice: If the /st reload command not reloading the new settings, you need to restart your MC server.
 | 
					     - Notice: If the /st reload command not reloading the new settings, you need to restart your MC server.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,9 @@
 | 
				
			|||||||
## SimplifyTools Commands
 | 
					## SimplifyTools - Commands
 | 
				
			||||||
You can use the following commands to use the features of SimplifyTools.
 | 
					You can use the following commands to use the features of SimplifyTools.
 | 
				
			||||||
- **/st**: The main SimplifyTools command.<br />Requires `st.st`
 | 
					- **/st**: The main SimplifyTools command.<br />Requires `st.st`
 | 
				
			||||||
- **/st help**: Displays all SimplifyTools related commands.<br />Requires `st.help`
 | 
					- **/st help**: Displays all SimplifyTools related commands.<br />Requires `st.help`
 | 
				
			||||||
- **/st ping**: Displays your ping to the current server.<br />Requires `st.ping`
 | 
					- **/st ping**: Displays your ping to the current server.<br />Requires `st.ping`
 | 
				
			||||||
 | 
					- **/st tps**: Displays plugin calculated TPS.<br />Requires `st.tps`
 | 
				
			||||||
- **/st stats**: Displays your gameplay statistics.<br />Requires `st.stats`
 | 
					- **/st stats**: Displays your gameplay statistics.<br />Requires `st.stats`
 | 
				
			||||||
- **/st save-all**: Saves the players, worlds data on the server.<br />Requires `st.save`
 | 
					- **/st save-all**: Saves the players, worlds data on the server.<br />Requires `st.save`
 | 
				
			||||||
- **/st pmanager** <LOAD/UNLOAD>: A built-in plugin manager.<br />Requires `st.pmanager.*`
 | 
					- **/st pmanager** <LOAD/UNLOAD>: A built-in plugin manager.<br />Requires `st.pmanager.*`
 | 
				
			||||||
@@ -10,7 +11,7 @@ You can use the following commands to use the features of SimplifyTools.
 | 
				
			|||||||
- **/st pmanager unload** <PLUGIN-NAME>: Plugin unload.<br />Requires `st.pmanager.unload  (can be inherited from st.pmanager.*)`
 | 
					- **/st pmanager unload** <PLUGIN-NAME>: Plugin unload.<br />Requires `st.pmanager.unload  (can be inherited from st.pmanager.*)`
 | 
				
			||||||
- **/st reload**: Plugin settings reload.<br />Requires `st.reload`
 | 
					- **/st reload**: Plugin settings reload.<br />Requires `st.reload`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## SimplifyTools Wildcard Permissions
 | 
					## SimplifyTools - Wildcard Permissions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- **st.*** -  Wildcard permission for all commands, permissions for this plugin.
 | 
					- **st.*** -  Wildcard permission for all commands, permissions for this plugin.
 | 
				
			||||||
- **st.pmanager.*** - Wildcard permission for the plugin manager commands.
 | 
					- **st.pmanager.*** - Wildcard permission for the plugin manager commands.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								docs/img/1.gif
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/img/1.gif
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.7 MiB  | 
							
								
								
									
										39
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								pom.xml
									
									
									
									
									
								
							@@ -4,9 +4,9 @@
 | 
				
			|||||||
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
					         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>
 | 
					    <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <groupId>tk.ditservices</groupId>
 | 
					    <groupId>hu.ditservices</groupId>
 | 
				
			||||||
    <artifactId>SimplifyTools</artifactId>
 | 
					    <artifactId>SimplifyTools</artifactId>
 | 
				
			||||||
    <version>1.1.0</version>
 | 
					    <version>1.2.1</version>
 | 
				
			||||||
    <packaging>jar</packaging>
 | 
					    <packaging>jar</packaging>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <name>SimplifyTools</name>
 | 
					    <name>SimplifyTools</name>
 | 
				
			||||||
@@ -42,7 +42,7 @@
 | 
				
			|||||||
            <plugin>
 | 
					            <plugin>
 | 
				
			||||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
					                <groupId>org.apache.maven.plugins</groupId>
 | 
				
			||||||
                <artifactId>maven-compiler-plugin</artifactId>
 | 
					                <artifactId>maven-compiler-plugin</artifactId>
 | 
				
			||||||
                <version>3.7.0</version>
 | 
					                <version>3.10.1</version>
 | 
				
			||||||
                <configuration>
 | 
					                <configuration>
 | 
				
			||||||
                    <source>${java.version}</source>
 | 
					                    <source>${java.version}</source>
 | 
				
			||||||
                    <target>${java.version}</target>
 | 
					                    <target>${java.version}</target>
 | 
				
			||||||
@@ -51,13 +51,17 @@
 | 
				
			|||||||
            <plugin>
 | 
					            <plugin>
 | 
				
			||||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
					                <groupId>org.apache.maven.plugins</groupId>
 | 
				
			||||||
                <artifactId>maven-shade-plugin</artifactId>
 | 
					                <artifactId>maven-shade-plugin</artifactId>
 | 
				
			||||||
                <version>3.1.0</version>
 | 
					                <version>3.2.1</version>
 | 
				
			||||||
                <configuration>
 | 
					                <configuration>
 | 
				
			||||||
                    <relocations>
 | 
					                    <relocations>
 | 
				
			||||||
                        <!-- Using the maven-shade-plugin to shade and relocate the UpdateChecker -->
 | 
					                        <!-- Using the maven-shade-plugin to shade and relocate the UpdateChecker -->
 | 
				
			||||||
                        <relocation>
 | 
					                        <relocation>
 | 
				
			||||||
                            <pattern>com.jeff_media.updatechecker</pattern>
 | 
					                            <pattern>com.jeff_media.updatechecker</pattern>
 | 
				
			||||||
                            <shadedPattern>tk.ditservices.updatechecker</shadedPattern>
 | 
					                            <shadedPattern>hu.ditservices.updatechecker</shadedPattern>
 | 
				
			||||||
 | 
					                        </relocation>
 | 
				
			||||||
 | 
					                        <relocation>
 | 
				
			||||||
 | 
					                            <pattern>org.bstats</pattern>
 | 
				
			||||||
 | 
					                            <shadedPattern>hu.ditservices.bstats</shadedPattern>
 | 
				
			||||||
                        </relocation>
 | 
					                        </relocation>
 | 
				
			||||||
                    </relocations>
 | 
					                    </relocations>
 | 
				
			||||||
                </configuration>
 | 
					                </configuration>
 | 
				
			||||||
@@ -103,6 +107,10 @@
 | 
				
			|||||||
            <id>sonatype</id>
 | 
					            <id>sonatype</id>
 | 
				
			||||||
            <url>https://oss.sonatype.org/content/groups/public/</url>
 | 
					            <url>https://oss.sonatype.org/content/groups/public/</url>
 | 
				
			||||||
        </repository>
 | 
					        </repository>
 | 
				
			||||||
 | 
					        <repository>
 | 
				
			||||||
 | 
					            <id>dmulloy2-repo</id>
 | 
				
			||||||
 | 
					            <url>https://repo.dmulloy2.net/repository/public/</url>
 | 
				
			||||||
 | 
					        </repository>
 | 
				
			||||||
    </repositories>
 | 
					    </repositories>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <dependencies>
 | 
					    <dependencies>
 | 
				
			||||||
@@ -112,24 +120,29 @@
 | 
				
			|||||||
            <version>2.2.0</version>
 | 
					            <version>2.2.0</version>
 | 
				
			||||||
            <scope>compile</scope>
 | 
					            <scope>compile</scope>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>org.bstats</groupId>
 | 
				
			||||||
 | 
					            <artifactId>bstats-bukkit</artifactId>
 | 
				
			||||||
 | 
					            <version>3.0.0</version>
 | 
				
			||||||
 | 
					            <scope>compile</scope>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>org.spigotmc</groupId>
 | 
					            <groupId>org.spigotmc</groupId>
 | 
				
			||||||
            <artifactId>spigot-api</artifactId>
 | 
					            <artifactId>spigot-api</artifactId>
 | 
				
			||||||
            <version>1.18.2-R0.1-SNAPSHOT</version>
 | 
					            <version>1.20.1-R0.1-SNAPSHOT</version>
 | 
				
			||||||
            <scope>provided</scope>
 | 
					            <scope>provided</scope>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
 | 
					        <!-- from downloaded craftbukkit-x.xx.x.jar\META-INF\versions\ -->
 | 
				
			||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>org.bukkit</groupId>
 | 
					            <groupId>org.bukkit</groupId>
 | 
				
			||||||
            <artifactId>craftbukkit</artifactId>
 | 
					            <artifactId>craftbukkit</artifactId>
 | 
				
			||||||
            <version>1.18.2-R0.1-SNAPSHOT</version>
 | 
					            <version>1.20.1-R0.1-SNAPSHOT</version>
 | 
				
			||||||
            <scope>provided</scope>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
        <dependency>
 | 
					 | 
				
			||||||
            <groupId>com.mojang</groupId>
 | 
					 | 
				
			||||||
            <artifactId>brigadier</artifactId>
 | 
					 | 
				
			||||||
            <version>1.0.18</version>
 | 
					 | 
				
			||||||
            <scope>provided</scope>
 | 
					            <scope>provided</scope>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </dependencies>
 | 
					    </dependencies>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										158
									
								
								src/main/java/hu/ditservices/STPlugin.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								src/main/java/hu/ditservices/STPlugin.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,158 @@
 | 
				
			|||||||
 | 
					package hu.ditservices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import hu.ditservices.handlers.DITTabCompleter;
 | 
				
			||||||
 | 
					import hu.ditservices.handlers.SaveHandler;
 | 
				
			||||||
 | 
					import hu.ditservices.handlers.TabHandler;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.*;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.Math;
 | 
				
			||||||
 | 
					import org.bstats.bukkit.Metrics;
 | 
				
			||||||
 | 
					import hu.ditservices.commands.DitCmd;
 | 
				
			||||||
 | 
					import hu.ditservices.listeners.ChatEvents;
 | 
				
			||||||
 | 
					import hu.ditservices.listeners.LogChat;
 | 
				
			||||||
 | 
					import hu.ditservices.listeners.LogCommand;
 | 
				
			||||||
 | 
					import hu.ditservices.listeners.LogConnect;
 | 
				
			||||||
 | 
					import com.tchristofferson.configupdater.ConfigUpdater;
 | 
				
			||||||
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					import org.bukkit.command.CommandExecutor;
 | 
				
			||||||
 | 
					import org.bukkit.command.PluginCommand;
 | 
				
			||||||
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
 | 
					import org.bukkit.event.Listener;
 | 
				
			||||||
 | 
					import org.bukkit.plugin.java.JavaPlugin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.jeff_media.updatechecker.UpdateCheckSource;
 | 
				
			||||||
 | 
					import com.jeff_media.updatechecker.UpdateChecker;
 | 
				
			||||||
 | 
					import com.jeff_media.updatechecker.UserAgentBuilder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.*;
 | 
				
			||||||
 | 
					import java.lang.management.ManagementFactory;
 | 
				
			||||||
 | 
					import java.util.Collections;
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					import java.util.logging.Logger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public final class STPlugin extends JavaPlugin implements CommandExecutor, Listener {
 | 
				
			||||||
 | 
					    private static STPlugin instance;
 | 
				
			||||||
 | 
					    private final Logger log = Bukkit.getLogger();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public FileConfiguration config = getConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public long ServerStartTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onEnable() {
 | 
				
			||||||
 | 
					        instance = this;
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            this.Init();
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            this.log.warning("[SimplifyTools] - INITIALIZATION ERROR: "+e.getMessage());
 | 
				
			||||||
 | 
					            this.log.warning("[SimplifyTools] - Plugin disabled!");
 | 
				
			||||||
 | 
					            this.setEnabled(false);
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        this.log.info(ChatColor.stripColor(this.getPrefix())+"Started running.");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void Init() throws Exception {
 | 
				
			||||||
 | 
					        this.ServerStartTime = ManagementFactory.getRuntimeMXBean().getStartTime();
 | 
				
			||||||
 | 
					        if (Version.ServerVersion.isCurrentLower(Version.ServerVersion.v1_12_R1)){
 | 
				
			||||||
 | 
					            throw new Exception("The server version is not supported! Update to a version between 1.12 - 1.20.1 to run this plugin.");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (this.Reload()){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            TabHandler tab = new TabHandler();
 | 
				
			||||||
 | 
					            PluginCommand ditCmd = this.getCommand("st");
 | 
				
			||||||
 | 
					            ditCmd.setExecutor(new DitCmd(this));
 | 
				
			||||||
 | 
					            ditCmd.setTabCompleter(new DITTabCompleter());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            getServer().getPluginManager().registerEvents(this, this);
 | 
				
			||||||
 | 
					            getServer().getPluginManager().registerEvents(new LogChat(this), this);
 | 
				
			||||||
 | 
					            getServer().getPluginManager().registerEvents(new LogCommand(this), this);
 | 
				
			||||||
 | 
					            getServer().getPluginManager().registerEvents(new LogConnect(this), this);
 | 
				
			||||||
 | 
					            if (this.config.isSet("CustomAdvancement.enabled") && this.config.getBoolean("CustomAdvancement.enabled")){
 | 
				
			||||||
 | 
					                getServer().getPluginManager().registerEvents(new ChatEvents(this), this);
 | 
				
			||||||
 | 
					                this.log.info(ChatColor.stripColor(this.getPrefix()) + "Custom Advancement Messages enabled!");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new TPS(), 0, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (this.config.getBoolean("Saving.enabled") && this.config.getInt("Saving.interval")>0){
 | 
				
			||||||
 | 
					                Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new SaveHandler(), 0L, Math.convert(Math.Convert.SECONDS,Math.Convert.TICKS,instance.config.getInt("Saving.interval")));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            new UpdateChecker(this, UpdateCheckSource.GITHUB_RELEASE_TAG, "LabodiDavid/SimplifyTools")
 | 
				
			||||||
 | 
					                    .setDownloadLink("https://github.com/LabodiDavid/SimplifyTools/releases")
 | 
				
			||||||
 | 
					                    .setDonationLink("https://paypal.me/labodidavid")
 | 
				
			||||||
 | 
					                    .setChangelogLink("https://github.com/LabodiDavid/SimplifyTools/blob/main/docs/ChangeLog.md")
 | 
				
			||||||
 | 
					                    .setNotifyOpsOnJoin(true)
 | 
				
			||||||
 | 
					                    .setNotifyByPermissionOnJoin("st.admin")
 | 
				
			||||||
 | 
					                    .setUserAgent(new UserAgentBuilder().addPluginNameAndVersion())
 | 
				
			||||||
 | 
					                    .checkEveryXHours(24)
 | 
				
			||||||
 | 
					                    .checkNow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Metrics metrics = new Metrics(this, 15108);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public String getPrefix(){
 | 
				
			||||||
 | 
					        if (this.config.isSet("Prefix") && !Objects.requireNonNull(this.config.getString("Prefix")).isEmpty()){
 | 
				
			||||||
 | 
					            return ChatColor.translateAlternateColorCodes('&', this.config.getString("Prefix"));
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            return ChatColor.translateAlternateColorCodes('&',"&a[&fSimplify&7Tools&2] &4- &f");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static STPlugin getInstance(){
 | 
				
			||||||
 | 
					        return instance;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static String getUptime(){
 | 
				
			||||||
 | 
					        int uptime = (int)(System.currentTimeMillis() - instance.ServerStartTime)/1000;
 | 
				
			||||||
 | 
					        String returnText = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Get remaining seconds from total minutes.
 | 
				
			||||||
 | 
					        int seconds = uptime % 60;
 | 
				
			||||||
 | 
					        // Convert to minutes, get remaining minutes from total hours.
 | 
				
			||||||
 | 
					        int minutes = (uptime / 60) % 60;
 | 
				
			||||||
 | 
					        // Convert to hours, get remaining hours from total days.
 | 
				
			||||||
 | 
					        int hours = (uptime / 3600) % 24;
 | 
				
			||||||
 | 
					        // Convert to days.
 | 
				
			||||||
 | 
					        int days = uptime / 86400;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (days>1){
 | 
				
			||||||
 | 
					            returnText = returnText+ days+" days ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (hours>1){
 | 
				
			||||||
 | 
					            returnText = returnText+ hours+ " hours ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (minutes>1){
 | 
				
			||||||
 | 
					            returnText = returnText+ minutes+ " min ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (seconds>1){
 | 
				
			||||||
 | 
					            returnText = returnText+ seconds+ "s ";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return returnText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean Reload(){
 | 
				
			||||||
 | 
					        File configFile = new File(getDataFolder(), "config.yml");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            if (!configFile.exists()){
 | 
				
			||||||
 | 
					                this.saveDefaultConfig();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            ConfigUpdater.update(this, "config.yml", configFile, Collections.emptyList());
 | 
				
			||||||
 | 
					        } catch (IOException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        reloadConfig();
 | 
				
			||||||
 | 
					        this.config = getConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onDisable() {
 | 
				
			||||||
 | 
					        this.log.info(ChatColor.stripColor(this.getPrefix()) + "Started running.");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										128
									
								
								src/main/java/hu/ditservices/commands/DitCmd.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								src/main/java/hu/ditservices/commands/DitCmd.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,128 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import hu.ditservices.utils.TPS;
 | 
				
			||||||
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.Cooldown;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.Version;
 | 
				
			||||||
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					import org.bukkit.command.*;
 | 
				
			||||||
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class DitCmd implements CommandExecutor {
 | 
				
			||||||
 | 
					    private final String noArgMsg;
 | 
				
			||||||
 | 
					    private final STPlugin plugin;
 | 
				
			||||||
 | 
					    private final Cooldown cd;
 | 
				
			||||||
 | 
					    private final FileConfiguration config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public DitCmd(final STPlugin instance){
 | 
				
			||||||
 | 
					        this.plugin = instance;
 | 
				
			||||||
 | 
					        this.noArgMsg = plugin.getPrefix()+ ChatColor.DARK_RED + "To list all SimplifyTools commands use the '/help SIMPLIFYTOOLS' command!";
 | 
				
			||||||
 | 
					        this.cd = new Cooldown(plugin);
 | 
				
			||||||
 | 
					        this.config = plugin.config;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean addToCoolDown(CommandSender sender){
 | 
				
			||||||
 | 
					        if (sender instanceof Player){
 | 
				
			||||||
 | 
					            Player p = (Player) sender;
 | 
				
			||||||
 | 
					            this.cd.Add(p);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
				
			||||||
 | 
					        if (command.getName().equals("st")){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (cd.Check(sender)){
 | 
				
			||||||
 | 
					                if (command.getName().equals("st") && args.length==0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                    sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Version: "+plugin.getDescription().getVersion());
 | 
				
			||||||
 | 
					                    sender.sendMessage(this.noArgMsg);
 | 
				
			||||||
 | 
					                    return true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (command.getName().equals("st") && args[0].contains("help"))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Version: "+plugin.getDescription().getVersion());
 | 
				
			||||||
 | 
					                    sender.sendMessage(this.noArgMsg);
 | 
				
			||||||
 | 
					                    return true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (command.getName().equals("st") && args[0].contains("settings"))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                        this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ ChatColor.GREEN+" === Plugin Information === ");
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Plugin Version: "+plugin.getDescription().getVersion());
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Server Version: "+ Version.ServerVersion.getCurrent().toString());
 | 
				
			||||||
 | 
					                        sender.sendMessage(ChatColor.GREEN+" -------- Features -------- ");
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Tab customization: "+(config.getBoolean("Tab.enabled") ? ChatColor.GREEN+"Enabled" : ChatColor.RED+"Disabled"));
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Custom Advancement Msg: "+(config.getBoolean("CustomAdvancement.enabled") ? ChatColor.GREEN+"Enabled" : ChatColor.RED+"Disabled"));
 | 
				
			||||||
 | 
					                        sender.sendMessage(ChatColor.GREEN+" ========================== ");
 | 
				
			||||||
 | 
					                        return true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (command.getName().equals("st") && args[0].contains("reload") && sender.hasPermission("st.reload")){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if(plugin.Reload()){
 | 
				
			||||||
 | 
					                        this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Successfully reload!");
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ChatColor.RED+"Notice: Restart your server if the settings didn't applied.");
 | 
				
			||||||
 | 
					                        return true;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (command.getName().equals("st") && args[0].contains("tps") && sender.hasPermission("st.tps")){
 | 
				
			||||||
 | 
					                        this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                        sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Plugin Calculated TPS: "+TPS.getColor()+String.format("%.2f", TPS.getTPS()));
 | 
				
			||||||
 | 
					                        return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (command.getName().equalsIgnoreCase("st") && args[0].contains("pmanager")){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (sender.hasPermission("st.pmanager.unload") || sender.hasPermission("st.pmanager.load") || sender.hasPermission("st.pmanager")) {
 | 
				
			||||||
 | 
					                        this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                        if (args.length==1){
 | 
				
			||||||
 | 
					                            sender.sendMessage(plugin.getPrefix()+ChatColor.DARK_RED+"Invalid arguments!");
 | 
				
			||||||
 | 
					                            return true;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        if (config.getBoolean("PluginManager.enabled")) {
 | 
				
			||||||
 | 
					                            if (args[1].equalsIgnoreCase("load")) {
 | 
				
			||||||
 | 
					                                //PluginCmd.handleLoad(sender,args);
 | 
				
			||||||
 | 
					                                PluginCmd.LoadPlugin(sender,args);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            if (args[1].equalsIgnoreCase("unload")) {
 | 
				
			||||||
 | 
					                                //PluginCmd.handleUnload(sender,args);
 | 
				
			||||||
 | 
					                                PluginCmd.UnloadPlugin(sender, args);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        } else {
 | 
				
			||||||
 | 
					                            sender.sendMessage(plugin.getPrefix()+ChatColor.DARK_RED+"Plugin manager commands are disabled in the config!");
 | 
				
			||||||
 | 
					                            return true;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (command.getName().equalsIgnoreCase("st") && args[0].contains("save-all") && sender.hasPermission("st.save")){
 | 
				
			||||||
 | 
					                    this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                    return SaveCmd.Run();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (command.getName().equalsIgnoreCase("st") && args[0].contains("ping") &&  sender.hasPermission("st.ping")){
 | 
				
			||||||
 | 
					                    this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                    return PingCmd.Run(sender);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (command.getName().equalsIgnoreCase("st") && args[0].contains("stats") && sender.hasPermission("st.stats")){
 | 
				
			||||||
 | 
					                    this.addToCoolDown(sender);
 | 
				
			||||||
 | 
					                    return StatCmd.Run(sender);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                cd.CDText(sender);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,25 +1,26 @@
 | 
				
			|||||||
package tk.ditservices.commands;
 | 
					package hu.ditservices.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.Server;
 | 
				
			||||||
import org.bukkit.command.CommandSender;
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
import org.bukkit.command.ConsoleCommandSender;
 | 
					import org.bukkit.command.ConsoleCommandSender;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class PingCmd {
 | 
					public class PingCmd {
 | 
				
			||||||
    public static boolean Run(CommandSender sender) {
 | 
					    public static boolean Run(CommandSender sender) {
 | 
				
			||||||
        DITSystem plugin = DITSystem.getInstance();
 | 
					        STPlugin plugin = STPlugin.getInstance();
 | 
				
			||||||
        if (sender instanceof Player) {
 | 
					        if (sender instanceof Player) {
 | 
				
			||||||
            Player player = (Player) sender;
 | 
					            Player player = (Player) sender;
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                player.sendMessage(plugin.getPrefix() + "Your response time to the server: " + player.getPing() + " ms");
 | 
					                player.sendMessage(plugin.getPrefix() + "Your response time to the server: " + Server.getPlayerPing(player) + " ms");
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            } catch (IllegalArgumentException | SecurityException e) {
 | 
					            } catch (IllegalArgumentException | SecurityException e) {
 | 
				
			||||||
                e.printStackTrace();
 | 
					                e.printStackTrace();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            if (sender instanceof ConsoleCommandSender) {
 | 
					            if (sender instanceof ConsoleCommandSender) {
 | 
				
			||||||
                ConsoleCommandSender konzoladmin = (ConsoleCommandSender) sender;
 | 
					                ConsoleCommandSender consoleCommandSender = (ConsoleCommandSender) sender;
 | 
				
			||||||
                konzoladmin.sendMessage(plugin.getPrefix() + "For this command you have to be a player!");
 | 
					                consoleCommandSender.sendMessage(plugin.getPrefix() + "For this command you have to be a player!");
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
package tk.ditservices.commands;
 | 
					package hu.ditservices.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.plugin.Plugin;
 | 
					import org.bukkit.plugin.Plugin;
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
//import tk.ditservices.DitPluginManager;
 | 
					//import hu.ditservices.DitPluginManager;
 | 
				
			||||||
import org.bukkit.command.CommandSender;
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -11,30 +11,30 @@ public class PluginCmd {
 | 
				
			|||||||
    public static boolean LoadPlugin(CommandSender sender, String[] args){
 | 
					    public static boolean LoadPlugin(CommandSender sender, String[] args){
 | 
				
			||||||
        Plugin plugin = Bukkit.getPluginManager().getPlugin(args[2]);
 | 
					        Plugin plugin = Bukkit.getPluginManager().getPlugin(args[2]);
 | 
				
			||||||
        if (plugin == null) {
 | 
					        if (plugin == null) {
 | 
				
			||||||
            sender.sendMessage(DITSystem.getInstance().getPrefix()+"Plugin not exist!");
 | 
					            sender.sendMessage(STPlugin.getInstance().getPrefix()+"Plugin not exist!");
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (plugin.isEnabled()){
 | 
					        if (plugin.isEnabled()){
 | 
				
			||||||
            sender.sendMessage(DITSystem.getInstance().getPrefix()+"Plugin "+plugin.getName()+" already enabled!");
 | 
					            sender.sendMessage(STPlugin.getInstance().getPrefix()+"Plugin "+plugin.getName()+" already enabled!");
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Bukkit.getPluginManager().enablePlugin(plugin);
 | 
					        Bukkit.getPluginManager().enablePlugin(plugin);
 | 
				
			||||||
        sender.sendMessage(DITSystem.getInstance().getPrefix()+"Plugin "+plugin.getName()+" successfully enabled!");
 | 
					        sender.sendMessage(STPlugin.getInstance().getPrefix()+"Plugin "+plugin.getName()+" successfully enabled!");
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public static boolean UnloadPlugin(CommandSender sender, String[] args){
 | 
					    public static boolean UnloadPlugin(CommandSender sender, String[] args){
 | 
				
			||||||
        Plugin plugin = Bukkit.getPluginManager().getPlugin(args[2]);
 | 
					        Plugin plugin = Bukkit.getPluginManager().getPlugin(args[2]);
 | 
				
			||||||
        if (plugin == null) {
 | 
					        if (plugin == null) {
 | 
				
			||||||
            sender.sendMessage(DITSystem.getInstance().getPrefix()+"Plugin not exist!");
 | 
					            sender.sendMessage(STPlugin.getInstance().getPrefix()+"Plugin not exist!");
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (!plugin.isEnabled()){
 | 
					        if (!plugin.isEnabled()){
 | 
				
			||||||
            sender.sendMessage(DITSystem.getInstance().getPrefix()+"Plugin "+plugin.getName()+" already disabled!");
 | 
					            sender.sendMessage(STPlugin.getInstance().getPrefix()+"Plugin "+plugin.getName()+" already disabled!");
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Bukkit.getPluginManager().disablePlugin(plugin);
 | 
					        Bukkit.getPluginManager().disablePlugin(plugin);
 | 
				
			||||||
        sender.sendMessage(DITSystem.getInstance().getPrefix()+"Plugin "+plugin.getName()+" successfully disabled!");
 | 
					        sender.sendMessage(STPlugin.getInstance().getPrefix()+"Plugin "+plugin.getName()+" successfully disabled!");
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								src/main/java/hu/ditservices/commands/SaveCmd.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/main/java/hu/ditservices/commands/SaveCmd.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
 | 
					import org.bukkit.World;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class SaveCmd {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Saves all worlds and players data.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return boolean
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static boolean Run(){
 | 
				
			||||||
 | 
					        STPlugin plugin = STPlugin.getInstance();
 | 
				
			||||||
 | 
					        String p = plugin.config.getString("Saving.broadcastMsgProgress").replace("{PREFIX}",plugin.getPrefix());
 | 
				
			||||||
 | 
					        String d = plugin.config.getString("Saving.broadcastMsgDone").replace("{PREFIX}",plugin.getPrefix());
 | 
				
			||||||
 | 
					        Bukkit.broadcast(p,"st.st");
 | 
				
			||||||
 | 
					        for(World w : Bukkit.getServer().getWorlds()){
 | 
				
			||||||
 | 
					            w.save();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Bukkit.savePlayers();
 | 
				
			||||||
 | 
					        Bukkit.broadcast(d,"st.st");
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package tk.ditservices.commands;
 | 
					package hu.ditservices.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
import org.bukkit.Statistic;
 | 
					import org.bukkit.Statistic;
 | 
				
			||||||
import org.bukkit.command.CommandSender;
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
@@ -10,7 +10,7 @@ public class StatCmd {
 | 
				
			|||||||
    public static boolean Run(CommandSender sender){
 | 
					    public static boolean Run(CommandSender sender){
 | 
				
			||||||
        Player player = (Player) sender;
 | 
					        Player player = (Player) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        player.sendMessage(DITSystem.getInstance().getPrefix()+ ChatColor.GREEN+" === Your statistics === ");
 | 
					        player.sendMessage(STPlugin.getInstance().getPrefix()+ ChatColor.GREEN+" === Your statistics === ");
 | 
				
			||||||
        player.sendMessage(ChatColor.AQUA+"Connects: "+(player.getStatistic(Statistic.LEAVE_GAME)+1));
 | 
					        player.sendMessage(ChatColor.AQUA+"Connects: "+(player.getStatistic(Statistic.LEAVE_GAME)+1));
 | 
				
			||||||
        player.sendMessage(ChatColor.AQUA+"Deaths: "+player.getStatistic(Statistic.DEATHS));
 | 
					        player.sendMessage(ChatColor.AQUA+"Deaths: "+player.getStatistic(Statistic.DEATHS));
 | 
				
			||||||
        player.sendMessage(ChatColor.AQUA+"Mob kills: "+player.getStatistic(Statistic.MOB_KILLS));
 | 
					        player.sendMessage(ChatColor.AQUA+"Mob kills: "+player.getStatistic(Statistic.MOB_KILLS));
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package tk.ditservices;
 | 
					package hu.ditservices.handlers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.command.*;
 | 
					import org.bukkit.command.*;
 | 
				
			||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
package tk.ditservices;
 | 
					package hu.ditservices.handlers;
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					/*
 | 
				
			||||||
 | 
					import hu.ditservices.DITSystem;
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.command.Command;
 | 
					import org.bukkit.command.Command;
 | 
				
			||||||
import org.bukkit.command.PluginCommand;
 | 
					import org.bukkit.command.PluginCommand;
 | 
				
			||||||
@@ -9,7 +10,8 @@ import org.bukkit.plugin.*;
 | 
				
			|||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.lang.reflect.Field;
 | 
					import java.lang.reflect.Field;
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
/*
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class DitPluginManager {
 | 
					public class DitPluginManager {
 | 
				
			||||||
    private static DITSystem plugin;
 | 
					    private static DITSystem plugin;
 | 
				
			||||||
    public DitPluginManager(DITSystem instance){
 | 
					    public DitPluginManager(DITSystem instance){
 | 
				
			||||||
							
								
								
									
										10
									
								
								src/main/java/hu/ditservices/handlers/SaveHandler.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/main/java/hu/ditservices/handlers/SaveHandler.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.handlers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import hu.ditservices.commands.SaveCmd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class SaveHandler implements Runnable{
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void run() {
 | 
				
			||||||
 | 
					        SaveCmd.Run();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										268
									
								
								src/main/java/hu/ditservices/handlers/TabHandler.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										268
									
								
								src/main/java/hu/ditservices/handlers/TabHandler.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,268 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.handlers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.*;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.Math;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.reflection.ClazzContainer;
 | 
				
			||||||
 | 
					import hu.ditservices.utils.reflection.Reflection;
 | 
				
			||||||
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class TabHandler {
 | 
				
			||||||
 | 
					    public final List<String> headers = new ArrayList<>();
 | 
				
			||||||
 | 
					    public final List<String> footers = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Integer refreshRate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final STPlugin plugin;
 | 
				
			||||||
 | 
					    public List<String> headeranimList = new ArrayList<>();
 | 
				
			||||||
 | 
					    public List<String> footeranimList = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final ArrayList<String> formatArray = new ArrayList<>();
 | 
				
			||||||
 | 
					    public final List<Integer> DynamicHeaders = new ArrayList<>();
 | 
				
			||||||
 | 
					    public final List<Integer> DynamicFooters = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private int count1 = 0; //headers
 | 
				
			||||||
 | 
					    private int count2 = 0; //footers
 | 
				
			||||||
 | 
					    private Object packet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public TabHandler() throws Exception {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.plugin = STPlugin.getInstance();
 | 
				
			||||||
 | 
					        if(this.init()){
 | 
				
			||||||
 | 
					            if (headers.isEmpty() && footers.isEmpty()){
 | 
				
			||||||
 | 
					                plugin.getLogger().warning(plugin.getPrefix()+"TAB customization disabled because empty customization config!");
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            this.updateTab();
 | 
				
			||||||
 | 
					        /*packet = plugin.getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_LIST_HEADER_FOOTER);
 | 
				
			||||||
 | 
					        boolean both = headers.size() > 0 && footers.size() > 0;
 | 
				
			||||||
 | 
					        boolean header = !both && headers.size() > 0;
 | 
				
			||||||
 | 
					        boolean footer = !both && footers.size() > 0;*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //scheduleSyncRepeatingTask
 | 
				
			||||||
 | 
					            //Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new TabRunnable(this),20, Math.convert(Math.Convert.SECONDS,Math.Convert.TICKS,this.refreshRate));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private boolean init() throws Exception {
 | 
				
			||||||
 | 
					        if (plugin.getConfig().getBoolean("Tab.enabled")){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            int availProcessors = Server.getCpuCores();
 | 
				
			||||||
 | 
					            if (availProcessors < 3) {
 | 
				
			||||||
 | 
					                plugin.getLogger().warning("You're currently having " + availProcessors + " CPU processors, which is not enough to run a minecraft server with scheduled plugins including SimplifyTools.");
 | 
				
			||||||
 | 
					                plugin.getLogger().warning("You will be experiencing many lags during the server is running. Consider upgrading your CPU to at least reach 3 cores.");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (plugin.getConfig().isSet("Tab.refreshRate")){
 | 
				
			||||||
 | 
					                this.refreshRate = plugin.getConfig().getInt("Tab.refreshRate");
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                this.refreshRate=1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //Getting the tab lines from the config
 | 
				
			||||||
 | 
					            headeranimList = plugin.getConfig().getStringList("Tab.headerAnimation");
 | 
				
			||||||
 | 
					            footeranimList = plugin.getConfig().getStringList("Tab.footerAnimation");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //Investigating lines where we need to run the formatting every tab refresh for example for the RAM usage.
 | 
				
			||||||
 | 
					            //Only storing those lines indexes.
 | 
				
			||||||
 | 
					            formatArray.add("{TOTALRAM}");
 | 
				
			||||||
 | 
					            formatArray.add("{FREERAM}");
 | 
				
			||||||
 | 
					            formatArray.add("{USEDRAM}");
 | 
				
			||||||
 | 
					            formatArray.add("{AVERAGEPING}");
 | 
				
			||||||
 | 
					            formatArray.add("{ONLINEPLAYERS}");
 | 
				
			||||||
 | 
					            formatArray.add("{MAXPLAYERS}");
 | 
				
			||||||
 | 
					            formatArray.add("{MOTD}");
 | 
				
			||||||
 | 
					            formatArray.add("{UPTIME}");
 | 
				
			||||||
 | 
					            formatArray.add("{TPS}");
 | 
				
			||||||
 | 
					            for (String f: formatArray){
 | 
				
			||||||
 | 
					                for (int i = 0; i<headeranimList.size(); i++){
 | 
				
			||||||
 | 
					                    if (headeranimList.get(i).contains(f) && !DynamicHeaders.contains(i)){
 | 
				
			||||||
 | 
					                        DynamicHeaders.add(i);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                for (int i = 0; i<footeranimList.size(); i++){
 | 
				
			||||||
 | 
					                    if (footeranimList.get(i).contains(f) && !DynamicFooters.contains(i)){
 | 
				
			||||||
 | 
					                        DynamicFooters.add(i);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (String hanim : headeranimList){
 | 
				
			||||||
 | 
					                this.addHeaderFooter(true,hanim,false);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            for (String fanim : footeranimList){
 | 
				
			||||||
 | 
					                this.addHeaderFooter(false,fanim,false);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void updateTab(){
 | 
				
			||||||
 | 
					        Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                if (Bukkit.getOnlinePlayers().size()==0){
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (count1 >= headers.size()) {
 | 
				
			||||||
 | 
					                    count1 = 0;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (count2 >= footers.size()) {
 | 
				
			||||||
 | 
					                    count2 = 0;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                //Re adding all lines  where we replaced something like the RAM usage to every refresh
 | 
				
			||||||
 | 
					                //display current value. (We check those lines in the init())
 | 
				
			||||||
 | 
					                if (DynamicHeaders.size() > 0 && count1 < DynamicHeaders.size()) {
 | 
				
			||||||
 | 
					                    if (DynamicHeaders.get(count1) == count1) {
 | 
				
			||||||
 | 
					                        addHeaderFooter(true, headeranimList.get(count1), true, count1);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (DynamicFooters.size() > 0 && count2 < DynamicFooters.size()) {
 | 
				
			||||||
 | 
					                    if (DynamicFooters.get(count2) == count2) {
 | 
				
			||||||
 | 
					                        addHeaderFooter(false, footeranimList.get(count2), true, count2);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                /*
 | 
				
			||||||
 | 
					                if (both){
 | 
				
			||||||
 | 
					                        plugin.getLogger().info("DEBUG: Sending both (header) JSON: "+WrappedChatComponent.fromHandle(headers.get(count1)).getJson());
 | 
				
			||||||
 | 
					                        plugin.getLogger().info("DEBUG: Sending both (footer) JSON: "+WrappedChatComponent.fromHandle(footers.get(count2)).getJson());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        packet.getChatComponents().write(0, WrappedChatComponent.fromHandle(headers.get(count1))).write(1,WrappedChatComponent.fromHandle(footers.get(count2)));
 | 
				
			||||||
 | 
					                    }else{
 | 
				
			||||||
 | 
					                        if (header){
 | 
				
			||||||
 | 
					                            plugin.getLogger().info("DEBUG: Sending header JSON: "+WrappedChatComponent.fromHandle(headers.get(count1)).getJson());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            packet.getChatComponents().write(0, WrappedChatComponent.fromHandle(headers.get(count1))).write(1,WrappedChatComponent.fromText("{\"text\":\"\"}"));
 | 
				
			||||||
 | 
					                        }else{
 | 
				
			||||||
 | 
					                            if (footer){
 | 
				
			||||||
 | 
					                                plugin.getLogger().info("DEBUG: Sending footer JSON: "+WrappedChatComponent.fromHandle(footers.get(count2)).getJson());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                packet.getChatComponents().write(0,WrappedChatComponent.fromText("{\"text\":\"\"}")).write(1,WrappedChatComponent.fromHandle(footers.get(count2)));
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (Bukkit.getOnlinePlayers().size() > 0) {
 | 
				
			||||||
 | 
					                    for (Player player : Bukkit.getOnlinePlayers()) {
 | 
				
			||||||
 | 
					                        plugin.getProtocolManager().sendServerPacket(player, packet);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (Version.ServerVersion.isCurrentEqualOrLower(Version.ServerVersion.v1_12_R1)) {
 | 
				
			||||||
 | 
					                    packet = ClazzContainer.buildPacketPlayOutPlayerListHeaderFooter(headers.get(count1),footers.get(count2));
 | 
				
			||||||
 | 
					                    for (Player player : Bukkit.getOnlinePlayers()){
 | 
				
			||||||
 | 
					                        Reflection.sendPacket(player,packet);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }else{
 | 
				
			||||||
 | 
					                    for (Player player : Bukkit.getOnlinePlayers()) {
 | 
				
			||||||
 | 
					                        player.setPlayerListHeaderFooter(headers.get(count1),footers.get(count2));
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (headers.size() > 1) {
 | 
				
			||||||
 | 
					                    count1++;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (footers.size() > 1) {
 | 
				
			||||||
 | 
					                    count2++;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            } catch (Exception e) {
 | 
				
			||||||
 | 
					                e.printStackTrace();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },0,Math.convert(Math.Convert.SECONDS,Math.Convert.TICKS,this.refreshRate));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Manages the adding of the tab line and the final formatting of the text.
 | 
				
			||||||
 | 
					     * @param header If true the text will be added to the header, otherwise to the footer.
 | 
				
			||||||
 | 
					     * @param text The formatted tab line text.
 | 
				
			||||||
 | 
					     * @param dynamic If the text contains a replace which need to run every tab refresh then it's true.
 | 
				
			||||||
 | 
					     * @param index Index of the 'dynamic' line. This is an overloading so there we need the index[0] element.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void addHeaderFooter(boolean header,String text,boolean dynamic,int... index) throws Exception {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            //JsonObject json = new JsonObject();
 | 
				
			||||||
 | 
					            //json.addProperty("text",format(text));
 | 
				
			||||||
 | 
					            String Json = "{\"text\": \""+format(text)+"\"}";
 | 
				
			||||||
 | 
					            //String Json = format(text);
 | 
				
			||||||
 | 
					            //Json = Json.trim();
 | 
				
			||||||
 | 
					            //plugin.getLogger().info("JSON!: "+Json);
 | 
				
			||||||
 | 
					            Object tabText = Reflection.asChatSerializer(Json);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //plugin.getLogger().info("DEBUG: Adding JSON: "+Json);
 | 
				
			||||||
 | 
					            if (header){
 | 
				
			||||||
 | 
					                if (dynamic){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    headers.set(index[0], Reflection.getChatSerializerString(tabText));
 | 
				
			||||||
 | 
					                    //headers.set(index[0],Json);
 | 
				
			||||||
 | 
					                }else {
 | 
				
			||||||
 | 
					                    //headers.add(Json);
 | 
				
			||||||
 | 
					                    headers.add(Reflection.getChatSerializerString(tabText));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                if (dynamic){
 | 
				
			||||||
 | 
					                    //footers.set(index[0],Json);
 | 
				
			||||||
 | 
					                    footers.set(index[0], Reflection.getChatSerializerString(tabText));
 | 
				
			||||||
 | 
					                }else {
 | 
				
			||||||
 | 
					                    //footers.add(Json);
 | 
				
			||||||
 | 
					                    footers.add(Reflection.getChatSerializerString(tabText));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } catch (Exception e){
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Replaces the msg values to their represents and recognizes MC color codes.
 | 
				
			||||||
 | 
					     * @param msg The text.
 | 
				
			||||||
 | 
					     * @return Replaced text with recognized MC color codes.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String format(String msg){
 | 
				
			||||||
 | 
					        if (msg.contains("{TOTALRAM}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{TOTALRAM}",String.valueOf(Server.getRAM(Server.RAM.TOTAL)));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{FREERAM}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{FREERAM}",String.valueOf(Server.getRAM(Server.RAM.FREE)));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{USEDRAM}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{USEDRAM}",String.valueOf(Server.getRAM(Server.RAM.USED)));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{AVERAGEPING}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{AVERAGEPING}",String.valueOf(Server.getAveragePing()));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{ONLINEPLAYERS}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{ONLINEPLAYERS}",String.valueOf(plugin.getServer().getOnlinePlayers().size()));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{MAXPLAYERS}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{MAXPLAYERS}",String.valueOf(plugin.getServer().getMaxPlayers()));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{UPTIME}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{UPTIME}", STPlugin.getUptime());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{MOTD}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{MOTD}", plugin.getServer().getMotd()); //LegacyComponentSerializer.legacyAmpersand().serialize(plugin.getServer().motd().asComponent())
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (msg.contains("{TPS}")){
 | 
				
			||||||
 | 
					            msg = msg.replace("{TPS}",String.valueOf(java.lang.Math.round(TPS.getTPS())));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return ChatColor.translateAlternateColorCodes('&',msg);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package tk.ditservices.listeners;
 | 
					package hu.ditservices.listeners;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
@@ -9,26 +9,26 @@ import org.bukkit.event.EventHandler;
 | 
				
			|||||||
import org.bukkit.event.EventPriority;
 | 
					import org.bukkit.event.EventPriority;
 | 
				
			||||||
import org.bukkit.event.Listener;
 | 
					import org.bukkit.event.Listener;
 | 
				
			||||||
import org.bukkit.event.player.PlayerAdvancementDoneEvent;
 | 
					import org.bukkit.event.player.PlayerAdvancementDoneEvent;
 | 
				
			||||||
import tk.ditservices.utils.AdvancementHelper;
 | 
					import hu.ditservices.utils.AdvancementHelper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ChatEvents implements Listener {
 | 
					public class ChatEvents implements Listener {
 | 
				
			||||||
    private DITSystem plugin;
 | 
					    private STPlugin plugin;
 | 
				
			||||||
    private FileConfiguration config;
 | 
					    private FileConfiguration config;
 | 
				
			||||||
    public ChatEvents(DITSystem instance){
 | 
					
 | 
				
			||||||
 | 
					    public ChatEvents(STPlugin instance){
 | 
				
			||||||
        this.plugin = instance;
 | 
					        this.plugin = instance;
 | 
				
			||||||
        this.config = plugin.config;
 | 
					        this.config = plugin.config;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @EventHandler(priority = EventPriority.MONITOR)
 | 
					    @EventHandler(priority = EventPriority.MONITOR)
 | 
				
			||||||
    public void onAdvance(PlayerAdvancementDoneEvent e){
 | 
					    public void onAdvance(PlayerAdvancementDoneEvent e){
 | 
				
			||||||
        if (config.isSet("CustomAdvancement.enabled")){
 | 
					        if (config.isSet("CustomAdvancement.enabled") && config.getBoolean("CustomAdvancement.enabled")){
 | 
				
			||||||
            if (config.getBoolean("CustomAdvancement.enabled")){
 | 
					            AdvancementHelper helper = new AdvancementHelper(this.config);
 | 
				
			||||||
                AdvancementHelper helper = new AdvancementHelper(plugin,this.config);
 | 
					 | 
				
			||||||
                if(helper.check(e.getAdvancement().getKey().getKey())) {
 | 
					                if(helper.check(e.getAdvancement().getKey().getKey())) {
 | 
				
			||||||
                    final Player player = e.getPlayer();
 | 
					                    final Player player = e.getPlayer();
 | 
				
			||||||
                    String title = helper.find(e.getAdvancement().getKey().getKey());
 | 
					                    String title = helper.find(e.getAdvancement().getKey().getKey());
 | 
				
			||||||
                    Bukkit.broadcastMessage(plugin.getPrefix()+ChatColor.translateAlternateColorCodes('&', helper.getText(player.getName(),title)));
 | 
					                    Bukkit.broadcastMessage(plugin.getPrefix()+ChatColor.translateAlternateColorCodes('&', helper.getText(player.getName(),title)));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
package tk.ditservices.listeners;
 | 
					package hu.ditservices.listeners;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITLog;
 | 
					import hu.ditservices.utils.Logger;
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
@@ -11,9 +11,9 @@ import org.bukkit.event.Listener;
 | 
				
			|||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
 | 
					import org.bukkit.event.player.AsyncPlayerChatEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class LogChat implements Listener {
 | 
					public class LogChat implements Listener {
 | 
				
			||||||
    DITSystem plugin;
 | 
					    STPlugin plugin;
 | 
				
			||||||
    FileConfiguration config;
 | 
					    FileConfiguration config;
 | 
				
			||||||
    public LogChat(DITSystem instance){
 | 
					    public LogChat(STPlugin instance){
 | 
				
			||||||
        this.plugin = instance;
 | 
					        this.plugin = instance;
 | 
				
			||||||
        this.config = plugin.config;
 | 
					        this.config = plugin.config;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -22,8 +22,8 @@ public class LogChat implements Listener {
 | 
				
			|||||||
        if (config.getBoolean("Log.Chat")) {
 | 
					        if (config.getBoolean("Log.Chat")) {
 | 
				
			||||||
            Player player = event.getPlayer();
 | 
					            Player player = event.getPlayer();
 | 
				
			||||||
            String format = config.isSet("Log.FormatChat") ? config.getString("Log.FormatChat") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME}: {MSG}";
 | 
					            String format = config.isSet("Log.FormatChat") ? config.getString("Log.FormatChat") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME}: {MSG}";
 | 
				
			||||||
            String LogMsg = format.replace("{DATE}",DITLog.getDate()).replace("{TIME}",DITLog.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{MSG}",event.getMessage()).replace("{ACTION}","[CHAT]");
 | 
					            String LogMsg = format.replace("{DATE}", Logger.getDate()).replace("{TIME}", Logger.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{MSG}",event.getMessage()).replace("{ACTION}","[CHAT]");
 | 
				
			||||||
            DITLog.logLine(ChatColor.stripColor(LogMsg));
 | 
					            Logger.logLine(ChatColor.stripColor(LogMsg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
package tk.ditservices.listeners;
 | 
					package hu.ditservices.listeners;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITLog;
 | 
					import hu.ditservices.utils.Logger;
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
@@ -11,9 +11,9 @@ import org.bukkit.event.Listener;
 | 
				
			|||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
 | 
					import org.bukkit.event.player.PlayerCommandPreprocessEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class LogCommand implements Listener {
 | 
					public class LogCommand implements Listener {
 | 
				
			||||||
    DITSystem plugin;
 | 
					    STPlugin plugin;
 | 
				
			||||||
    FileConfiguration config;
 | 
					    FileConfiguration config;
 | 
				
			||||||
    public LogCommand(DITSystem instance){
 | 
					    public LogCommand(STPlugin instance){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.plugin = instance;
 | 
					        this.plugin = instance;
 | 
				
			||||||
        this.config = plugin.config;
 | 
					        this.config = plugin.config;
 | 
				
			||||||
@@ -23,8 +23,8 @@ public class LogCommand implements Listener {
 | 
				
			|||||||
        if (config.getBoolean("Log.Command")) {
 | 
					        if (config.getBoolean("Log.Command")) {
 | 
				
			||||||
            Player player = event.getPlayer();
 | 
					            Player player = event.getPlayer();
 | 
				
			||||||
            String format = config.isSet("Log.FormatCommand") ? config.getString("Log.FormatCommand") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME}: {COMMAND}";
 | 
					            String format = config.isSet("Log.FormatCommand") ? config.getString("Log.FormatCommand") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME}: {COMMAND}";
 | 
				
			||||||
            String LogMsg = format.replace("{DATE}",DITLog.getDate()).replace("{TIME}",DITLog.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{COMMAND}",event.getMessage()).replace("{ACTION}","[COMMAND]");
 | 
					            String LogMsg = format.replace("{DATE}", Logger.getDate()).replace("{TIME}", Logger.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{COMMAND}",event.getMessage()).replace("{ACTION}","[COMMAND]");
 | 
				
			||||||
            DITLog.logLine(ChatColor.stripColor(LogMsg));
 | 
					            Logger.logLine(ChatColor.stripColor(LogMsg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
package tk.ditservices.listeners;
 | 
					package hu.ditservices.listeners;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITLog;
 | 
					import hu.ditservices.utils.Logger;
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
@@ -13,11 +13,11 @@ import org.bukkit.event.player.PlayerJoinEvent;
 | 
				
			|||||||
import org.bukkit.event.player.PlayerQuitEvent;
 | 
					import org.bukkit.event.player.PlayerQuitEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class LogConnect implements Listener {
 | 
					public class LogConnect implements Listener {
 | 
				
			||||||
    DITSystem plugin;
 | 
					    STPlugin plugin;
 | 
				
			||||||
    private String JoinMsg;
 | 
					    private String JoinMsg;
 | 
				
			||||||
    private String LeaveMsg;
 | 
					    private String LeaveMsg;
 | 
				
			||||||
    FileConfiguration config;
 | 
					    FileConfiguration config;
 | 
				
			||||||
    public LogConnect(DITSystem instance){
 | 
					    public LogConnect(STPlugin instance){
 | 
				
			||||||
        this.plugin = instance;
 | 
					        this.plugin = instance;
 | 
				
			||||||
        this.config = plugin.config;
 | 
					        this.config = plugin.config;
 | 
				
			||||||
        if (config.getBoolean("CustomMsg.enabled")){
 | 
					        if (config.getBoolean("CustomMsg.enabled")){
 | 
				
			||||||
@@ -39,8 +39,8 @@ public class LogConnect implements Listener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (config.getBoolean("Log.Connect")) {
 | 
					        if (config.getBoolean("Log.Connect")) {
 | 
				
			||||||
            String format = config.isSet("Log.FormatConnect") ? config.getString("Log.FormatConnect") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME} UUID: {UUID}";
 | 
					            String format = config.isSet("Log.FormatConnect") ? config.getString("Log.FormatConnect") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME} UUID: {UUID}";
 | 
				
			||||||
            String LogMsg = format.replace("{DATE}",DITLog.getDate()).replace("{TIME}",DITLog.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{UUID}",player.getUniqueId().toString()).replace("{ACTION}","[CONNECT]");
 | 
					            String LogMsg = format.replace("{DATE}", Logger.getDate()).replace("{TIME}", Logger.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{UUID}",player.getUniqueId().toString()).replace("{ACTION}","[CONNECT]");
 | 
				
			||||||
            DITLog.logLine(ChatColor.stripColor(LogMsg));
 | 
					            Logger.logLine(ChatColor.stripColor(LogMsg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @EventHandler(priority = EventPriority.MONITOR)
 | 
					    @EventHandler(priority = EventPriority.MONITOR)
 | 
				
			||||||
@@ -55,8 +55,8 @@ public class LogConnect implements Listener {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        if (config.getBoolean("Log.Connect")) {
 | 
					        if (config.getBoolean("Log.Connect")) {
 | 
				
			||||||
            String format = config.isSet("Log.FormatConnect") ? config.getString("Log.FormatConnect") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME} UUID: {UUID}";
 | 
					            String format = config.isSet("Log.FormatConnect") ? config.getString("Log.FormatConnect") : "[{DATE}] - {TIME} - {ACTION} - {PLAYERNAME} UUID: {UUID}";
 | 
				
			||||||
            String LogMsg = format.replace("{DATE}",DITLog.getDate()).replace("{TIME}",DITLog.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{UUID}",player.getUniqueId().toString()).replace("{ACTION}","[DISCONNECT]");
 | 
					            String LogMsg = format.replace("{DATE}", Logger.getDate()).replace("{TIME}", Logger.getTime()).replace("{PLAYERNAME}",player.getDisplayName()).replace("{UUID}",player.getUniqueId().toString()).replace("{ACTION}","[DISCONNECT]");
 | 
				
			||||||
            DITLog.logLine(ChatColor.stripColor(LogMsg));
 | 
					            Logger.logLine(ChatColor.stripColor(LogMsg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (config.getBoolean("Saving.enabled")){
 | 
					        if (config.getBoolean("Saving.enabled")){
 | 
				
			||||||
            if(config.getBoolean("Saving.onDisconnect")){
 | 
					            if(config.getBoolean("Saving.onDisconnect")){
 | 
				
			||||||
@@ -1,14 +1,21 @@
 | 
				
			|||||||
package tk.ditservices.utils;
 | 
					package hu.ditservices.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITLog;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					import org.bukkit.GameRule;
 | 
				
			||||||
 | 
					import org.bukkit.World;
 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class AdvancementHelper {
 | 
					public class AdvancementHelper {
 | 
				
			||||||
    private DITSystem plugin;
 | 
					    private final STPlugin plugin = STPlugin.getInstance();
 | 
				
			||||||
    private FileConfiguration config;
 | 
					    private final FileConfiguration config;
 | 
				
			||||||
    public AdvancementHelper(DITSystem instance, FileConfiguration c){
 | 
					
 | 
				
			||||||
        this.plugin = instance;
 | 
					    private boolean initialized = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AdvancementHelper(FileConfiguration c){
 | 
				
			||||||
        this.config = c;
 | 
					        this.config = c;
 | 
				
			||||||
        this.initialize();
 | 
					        this.initialize();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -110,6 +117,33 @@ public class AdvancementHelper {
 | 
				
			|||||||
            out_type[2] = config.getString("CustomAdvancement.formats.challenge");
 | 
					            out_type[2] = config.getString("CustomAdvancement.formats.challenge");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            String disableMsg = ChatColor.stripColor(plugin.getPrefix()) + "Disabling vanilla advancement messages for ";
 | 
				
			||||||
 | 
					            List<World> worlds = this.plugin.getServer().getWorlds();
 | 
				
			||||||
 | 
					            Method setRuleMethod, getRuleMethod;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                for (World w : worlds) {
 | 
				
			||||||
 | 
					                    if (Version.ServerVersion.isCurrentEqualOrLower(Version.ServerVersion.v1_12_R1)){
 | 
				
			||||||
 | 
					                        getRuleMethod = w.getClass().getDeclaredMethod("getGameRuleValue", String.class);
 | 
				
			||||||
 | 
					                        if (getRuleMethod.invoke(w,"announceAdvancements")=="true"){
 | 
				
			||||||
 | 
					                            setRuleMethod = w.getClass().getDeclaredMethod("setGameRuleValue", String.class, String.class);
 | 
				
			||||||
 | 
					                            setRuleMethod.invoke(w,"announceAdvancements", "false");
 | 
				
			||||||
 | 
					                            this.plugin.getLogger().info(disableMsg + w.getName());
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }else{
 | 
				
			||||||
 | 
					                        getRuleMethod = w.getClass().getDeclaredMethod("getGameRuleValue", GameRule.class);
 | 
				
			||||||
 | 
					                        if ((boolean)getRuleMethod.invoke(w,GameRule.ANNOUNCE_ADVANCEMENTS)){
 | 
				
			||||||
 | 
					                            setRuleMethod = w.getClass().getDeclaredMethod("setGameRule", GameRule.class, Object.class);
 | 
				
			||||||
 | 
					                            setRuleMethod.invoke(w,GameRule.ANNOUNCE_ADVANCEMENTS,false);
 | 
				
			||||||
 | 
					                            this.plugin.getLogger().info(disableMsg + w.getName());
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    //w.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					        } catch (Exception e){
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public String getText(String PlayerName,String title){
 | 
					    public String getText(String PlayerName,String title){
 | 
				
			||||||
        String rtrn = this.out_type[this.type];
 | 
					        String rtrn = this.out_type[this.type];
 | 
				
			||||||
@@ -1,23 +1,23 @@
 | 
				
			|||||||
package tk.ditservices.utils;
 | 
					package hu.ditservices.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					import hu.ditservices.STPlugin;
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
import org.bukkit.command.CommandSender;
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
import org.bukkit.command.ConsoleCommandSender;
 | 
					 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					import org.bukkit.configuration.file.FileConfiguration;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Cooldown {
 | 
					public class Cooldown {
 | 
				
			||||||
    private int delay = 2; //seconds
 | 
					    STPlugin plugin;
 | 
				
			||||||
    DITSystem plugin;
 | 
					 | 
				
			||||||
    Map<String, Long> cooldowns = new HashMap<>();
 | 
					 | 
				
			||||||
    public long time_left;
 | 
					 | 
				
			||||||
    FileConfiguration config;
 | 
					    FileConfiguration config;
 | 
				
			||||||
    public Cooldown(DITSystem instance){
 | 
					
 | 
				
			||||||
 | 
					    Map<String, Long> cooldowns = new HashMap<>();
 | 
				
			||||||
 | 
					    private int delay = 2; //seconds
 | 
				
			||||||
 | 
					    public long time_left;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Cooldown(STPlugin instance){
 | 
				
			||||||
        this.plugin = instance;
 | 
					        this.plugin = instance;
 | 
				
			||||||
        this.config = plugin.config;
 | 
					        this.config = plugin.config;
 | 
				
			||||||
        if (config.isSet("Cooldown.seconds")){
 | 
					        if (config.isSet("Cooldown.seconds")){
 | 
				
			||||||
@@ -38,21 +38,14 @@ public class Cooldown {
 | 
				
			|||||||
                if (this.cooldowns.containsKey(player.getName())) {
 | 
					                if (this.cooldowns.containsKey(player.getName())) {
 | 
				
			||||||
                    if (this.cooldowns.get(player.getName()) > System.currentTimeMillis()) {
 | 
					                    if (this.cooldowns.get(player.getName()) > System.currentTimeMillis()) {
 | 
				
			||||||
                        this.time_left = (this.cooldowns.get(player.getName()) - System.currentTimeMillis()) / 1000;
 | 
					                        this.time_left = (this.cooldowns.get(player.getName()) - System.currentTimeMillis()) / 1000;
 | 
				
			||||||
                        if (this.time_left == 0) {
 | 
					                        return this.time_left == 0;
 | 
				
			||||||
                            return true;
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        return false;
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    return true;
 | 
					                    return true;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else{
 | 
					            } else {
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (sender instanceof ConsoleCommandSender){
 | 
					 | 
				
			||||||
            return true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public void Add(Player player){
 | 
					    public void Add(Player player){
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package tk.ditservices;
 | 
					package hu.ditservices.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.BufferedWriter;
 | 
					import java.io.BufferedWriter;
 | 
				
			||||||
@@ -10,7 +10,7 @@ import java.util.Calendar;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import org.bukkit.event.Listener;
 | 
					import org.bukkit.event.Listener;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class DITLog implements Listener {
 | 
					public class Logger implements Listener {
 | 
				
			||||||
    public static String Location = "plugins/SimplifyTools/logs/";
 | 
					    public static String Location = "plugins/SimplifyTools/logs/";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -34,9 +34,9 @@ public class DITLog implements Listener {
 | 
				
			|||||||
     * @param text The text to log.
 | 
					     * @param text The text to log.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void logLine(String text){
 | 
					    public static void logLine(String text){
 | 
				
			||||||
        String fileName = DITLog.getDate()+".txt";
 | 
					        String fileName = Logger.getDate()+".txt";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        File file = new File(DITLog.Location+fileName);
 | 
					        File file = new File(Logger.Location+fileName);
 | 
				
			||||||
        if (!file.exists()){ createFile(); }
 | 
					        if (!file.exists()){ createFile(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
@@ -51,12 +51,12 @@ public class DITLog implements Listener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private static void createFile(){
 | 
					    private static void createFile(){
 | 
				
			||||||
        String fileName = getDate() + ".txt";
 | 
					        String fileName = getDate() + ".txt";
 | 
				
			||||||
        File directory = new File(DITLog.Location);
 | 
					        File directory = new File(Logger.Location);
 | 
				
			||||||
        if(!directory.exists()){
 | 
					        if(!directory.exists()){
 | 
				
			||||||
            directory.mkdirs();
 | 
					            directory.mkdirs();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        File file = new File(DITLog.Location + fileName);
 | 
					        File file = new File(Logger.Location + fileName);
 | 
				
			||||||
        if( !file.exists() ){
 | 
					        if( !file.exists() ){
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                file.createNewFile();
 | 
					                file.createNewFile();
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package tk.ditservices.utils;
 | 
					package hu.ditservices.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
package tk.ditservices.utils;
 | 
					package hu.ditservices.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
import java.lang.Math;
 | 
					import java.lang.Math;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.reflect.InvocationTargetException;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Server {
 | 
					public class Server {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public enum RAM {
 | 
					    public enum RAM {
 | 
				
			||||||
        FREE,USED,TOTAL
 | 
					        FREE,USED,TOTAL
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -17,7 +17,6 @@ public class Server {
 | 
				
			|||||||
    public static long getRAM(Server.RAM t) {
 | 
					    public static long getRAM(Server.RAM t) {
 | 
				
			||||||
        long mb = 1048576L;
 | 
					        long mb = 1048576L;
 | 
				
			||||||
        Runtime runtime = Runtime.getRuntime();
 | 
					        Runtime runtime = Runtime.getRuntime();
 | 
				
			||||||
        runtime.gc();
 | 
					 | 
				
			||||||
        if (t == RAM.FREE){
 | 
					        if (t == RAM.FREE){
 | 
				
			||||||
            return runtime.freeMemory() / mb;
 | 
					            return runtime.freeMemory() / mb;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -30,16 +29,27 @@ public class Server {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Get the CPU cores of the MC server.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static int getCpuCores(){
 | 
				
			||||||
 | 
					        return Runtime.getRuntime().availableProcessors();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Get a player's ping.
 | 
					     * Get a player's ping.
 | 
				
			||||||
     * @param player The player object.
 | 
					     * @param player The player object.
 | 
				
			||||||
 | 
					     * @return Returns the player's ping in integer.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static int getPlayerPing(Player player){
 | 
					    public static int getPlayerPing(Player player){
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            //Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
 | 
					            if (Version.ServerVersion.isCurrentLower(Version.ServerVersion.v1_16_R1)){
 | 
				
			||||||
            //return (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
 | 
					                Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
 | 
				
			||||||
 | 
					                return (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            return player.getPing();
 | 
					            return player.getPing();
 | 
				
			||||||
        } catch (IllegalArgumentException | SecurityException e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
            return -1;
 | 
					            return -1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -54,7 +64,7 @@ public class Server {
 | 
				
			|||||||
        if (Bukkit.getOnlinePlayers().size() !=0){
 | 
					        if (Bukkit.getOnlinePlayers().size() !=0){
 | 
				
			||||||
            onlineplayers =Bukkit.getOnlinePlayers().size();
 | 
					            onlineplayers =Bukkit.getOnlinePlayers().size();
 | 
				
			||||||
            for (Player player : Bukkit.getOnlinePlayers()){
 | 
					            for (Player player : Bukkit.getOnlinePlayers()){
 | 
				
			||||||
                sum += player.getPing();
 | 
					                sum += Server.getPlayerPing(player);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            avg = Math.floorDiv(sum,onlineplayers);
 | 
					            avg = Math.floorDiv(sum,onlineplayers);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										61
									
								
								src/main/java/hu/ditservices/utils/TPS.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								src/main/java/hu/ditservices/utils/TPS.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class TPS implements Runnable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static int TICK_COUNT = 0;
 | 
				
			||||||
 | 
					    public static long[] TICKS = new long[600];
 | 
				
			||||||
 | 
					    public static long LAST_TICK = 0L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static double getTPS() {
 | 
				
			||||||
 | 
					        return getTPS(100);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static ChatColor getColor(double... tps){
 | 
				
			||||||
 | 
					        double s = TPS.getTPS();
 | 
				
			||||||
 | 
					        if (tps.length>0){
 | 
				
			||||||
 | 
					            s = tps[0];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (s == 18.0) {
 | 
				
			||||||
 | 
					            return ChatColor.GREEN;
 | 
				
			||||||
 | 
					        } else if (s >= 15.0) {
 | 
				
			||||||
 | 
					            return ChatColor.YELLOW;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return ChatColor.RED;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static double getTPS(int ticks) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            if (TICK_COUNT < ticks) {
 | 
				
			||||||
 | 
					                return 20.0D;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            int target = (TICK_COUNT - 1 - ticks) % TICKS.length;
 | 
				
			||||||
 | 
					            long elapsed = System.currentTimeMillis() - TICKS[target];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return ticks / (elapsed / 1000.0D);
 | 
				
			||||||
 | 
					        } catch (Exception ignored){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static long getElapsed(int tickID) {
 | 
				
			||||||
 | 
					        if (TICK_COUNT - tickID >= TICKS.length) {
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        long time = TICKS[(tickID % TICKS.length)];
 | 
				
			||||||
 | 
					        return System.currentTimeMillis() - time;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void run() {
 | 
				
			||||||
 | 
					        TICKS[(TICK_COUNT % TICKS.length)] = System.currentTimeMillis();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        TICK_COUNT += 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										101
									
								
								src/main/java/hu/ditservices/utils/Version.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								src/main/java/hu/ditservices/utils/Version.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,101 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.regex.Pattern;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Version {
 | 
				
			||||||
 | 
					    public enum ServerVersion {
 | 
				
			||||||
 | 
					        v1_8_R1,
 | 
				
			||||||
 | 
					        v1_8_R2,
 | 
				
			||||||
 | 
					        v1_8_R3,
 | 
				
			||||||
 | 
					        v1_9_R1,
 | 
				
			||||||
 | 
					        v1_9_R2,
 | 
				
			||||||
 | 
					        v1_10_R1,
 | 
				
			||||||
 | 
					        v1_11_R1,
 | 
				
			||||||
 | 
					        v1_12_R1,
 | 
				
			||||||
 | 
					        v1_13_R1,
 | 
				
			||||||
 | 
					        v1_13_R2,
 | 
				
			||||||
 | 
					        v1_14_R1,
 | 
				
			||||||
 | 
					        v1_14_R2,
 | 
				
			||||||
 | 
					        v1_15_R1,
 | 
				
			||||||
 | 
					        v1_15_R2,
 | 
				
			||||||
 | 
					        v1_16_R1,
 | 
				
			||||||
 | 
					        v1_16_R2,
 | 
				
			||||||
 | 
					        v1_16_R3,
 | 
				
			||||||
 | 
					        v1_17_R1,
 | 
				
			||||||
 | 
					        v1_17_R2,
 | 
				
			||||||
 | 
					        v1_18_R1,
 | 
				
			||||||
 | 
					        v1_18_R2,
 | 
				
			||||||
 | 
					        v1_19_R1,
 | 
				
			||||||
 | 
					        v1_19_R2,
 | 
				
			||||||
 | 
					        v1_20_R1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private int value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private static String[] arrayVersion;
 | 
				
			||||||
 | 
					        private static ServerVersion current;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ServerVersion() {
 | 
				
			||||||
 | 
					            value = Integer.valueOf(getNumberEscapeSequence().matcher(name()).replaceAll(""));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static ServerVersion getCurrent() {
 | 
				
			||||||
 | 
					            if (current != null)
 | 
				
			||||||
 | 
					                return current;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            String[] v = getArrayVersion();
 | 
				
			||||||
 | 
					            String vv = v[v.length - 1];
 | 
				
			||||||
 | 
					            for (ServerVersion one : values()) {
 | 
				
			||||||
 | 
					                if (one.name().equalsIgnoreCase(vv)) {
 | 
				
			||||||
 | 
					                    current = one;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (current == null) {
 | 
				
			||||||
 | 
					                current = ServerVersion.v1_16_R3;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return current;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static String[] getArrayVersion() {
 | 
				
			||||||
 | 
					            if (arrayVersion == null) {
 | 
				
			||||||
 | 
					                arrayVersion = org.bukkit.Bukkit.getServer().getClass().getPackage().getName().split("\\.");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return arrayVersion;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static boolean isCurrentEqualOrHigher(ServerVersion v) {
 | 
				
			||||||
 | 
					            return getCurrent().value >= v.value;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static boolean isCurrentHigher(ServerVersion v) {
 | 
				
			||||||
 | 
					            return getCurrent().value > v.value;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static boolean isCurrentLower(ServerVersion v) {
 | 
				
			||||||
 | 
					            return getCurrent().value < v.value;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static boolean isCurrentEqualOrLower(ServerVersion v) {
 | 
				
			||||||
 | 
					            return getCurrent().value <= v.value;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static boolean isCurrentEqual(ServerVersion v) {
 | 
				
			||||||
 | 
					            return getCurrent().value == v.value;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final Pattern COMMA_SPACE_SEPARATED_PATTERN = Pattern.compile(", ");
 | 
				
			||||||
 | 
					    private static final Pattern NUMBER_ESCAPE_SEQUENCE = Pattern.compile("[^\\d]");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Pattern getCommaSpaceSeparatedPattern() {
 | 
				
			||||||
 | 
					        return COMMA_SPACE_SEPARATED_PATTERN;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Pattern getNumberEscapeSequence() {
 | 
				
			||||||
 | 
					        return NUMBER_ESCAPE_SEQUENCE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,93 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.utils.reflection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import hu.ditservices.utils.Version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.reflect.Constructor;
 | 
				
			||||||
 | 
					import java.lang.reflect.Field;
 | 
				
			||||||
 | 
					import java.lang.reflect.InvocationTargetException;
 | 
				
			||||||
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public final class ClazzContainer {
 | 
				
			||||||
 | 
					    private static Class<?> packet, ChatComponentTextClass, CraftPlayerClass, IChatBaseComponentClass, PacketPlayOutPlayerListHeaderFooterClass;
 | 
				
			||||||
 | 
					    private static Object  ChatComponentText, IChatBaseComponent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    static {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            IChatBaseComponentClass = classByName("net.minecraft.network.chat", "IChatBaseComponent");
 | 
				
			||||||
 | 
					            packet = classByName("net.minecraft.network.protocol", "Packet");
 | 
				
			||||||
 | 
					        } catch (Exception e){
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public ClazzContainer(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Class<?> classByName(String newPackageName, String name) throws ClassNotFoundException {
 | 
				
			||||||
 | 
					        if (Version.ServerVersion.isCurrentLower(Version.ServerVersion.v1_17_R1) || newPackageName == null) {
 | 
				
			||||||
 | 
					            newPackageName = "net.minecraft.server." + Version.ServerVersion.getArrayVersion()[3];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return Class.forName(newPackageName + "." + name);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Object buildChatComponentText(String text) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
 | 
				
			||||||
 | 
					        Constructor<?> constructor;
 | 
				
			||||||
 | 
					        if (Version.ServerVersion.isCurrentEqualOrHigher(Version.ServerVersion.v1_17_R1)){
 | 
				
			||||||
 | 
					            if (ChatComponentTextClass == null){
 | 
				
			||||||
 | 
					                ChatComponentTextClass = Reflection.getClass("net.minecraft.network.chat.ChatComponentText");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            constructor = ChatComponentTextClass.getConstructor(String.class);
 | 
				
			||||||
 | 
					            return constructor.newInstance(text);
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            if (ChatComponentTextClass == null){
 | 
				
			||||||
 | 
					                ChatComponentTextClass = Reflection.getClass("net.minecraft.server.%v.ChatComponentText");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            constructor = Reflection.getClass("net.minecraft.server.%v.ChatComponentText").getConstructor(String.class);
 | 
				
			||||||
 | 
					            return constructor.newInstance(text);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Object buildPacketPlayOutPlayerListHeaderFooter(Object header, Object footer) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
 | 
				
			||||||
 | 
					        Constructor<?> constructor;
 | 
				
			||||||
 | 
					        Field headerField;
 | 
				
			||||||
 | 
					        Field footerField;
 | 
				
			||||||
 | 
					        Object packet;
 | 
				
			||||||
 | 
					        if (Version.ServerVersion.isCurrentEqualOrHigher(Version.ServerVersion.v1_17_R1)){
 | 
				
			||||||
 | 
					            if (PacketPlayOutPlayerListHeaderFooterClass == null){
 | 
				
			||||||
 | 
					                PacketPlayOutPlayerListHeaderFooterClass = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            if (PacketPlayOutPlayerListHeaderFooterClass == null){
 | 
				
			||||||
 | 
					                PacketPlayOutPlayerListHeaderFooterClass = Reflection.getClass("net.minecraft.server.%v.PacketPlayOutPlayerListHeaderFooter");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (Version.ServerVersion.isCurrentEqualOrLower(Version.ServerVersion.v1_12_R1)){
 | 
				
			||||||
 | 
					            constructor = PacketPlayOutPlayerListHeaderFooterClass.getConstructor();
 | 
				
			||||||
 | 
					            packet = constructor.newInstance();
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                headerField = packet.getClass().getDeclaredField("a");
 | 
				
			||||||
 | 
					                headerField.setAccessible(true);
 | 
				
			||||||
 | 
					                headerField.set(packet, buildChatComponentText((String) header));
 | 
				
			||||||
 | 
					                footerField = packet.getClass().getDeclaredField("b");
 | 
				
			||||||
 | 
					                footerField.setAccessible(true);
 | 
				
			||||||
 | 
					                footerField.set(packet, buildChatComponentText((String) footer));
 | 
				
			||||||
 | 
					            } catch (Exception e){
 | 
				
			||||||
 | 
					                e.printStackTrace();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            constructor = PacketPlayOutPlayerListHeaderFooterClass.getConstructor(IChatBaseComponentClass,IChatBaseComponentClass);
 | 
				
			||||||
 | 
					            packet = constructor.newInstance(header,footer);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return packet;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Class<?> getIChatBaseComponent() {
 | 
				
			||||||
 | 
					        return IChatBaseComponentClass;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public static Class<?> getPacket() {
 | 
				
			||||||
 | 
					        return packet;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										122
									
								
								src/main/java/hu/ditservices/utils/reflection/Reflection.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								src/main/java/hu/ditservices/utils/reflection/Reflection.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,122 @@
 | 
				
			|||||||
 | 
					package hu.ditservices.utils.reflection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import hu.ditservices.utils.Version;
 | 
				
			||||||
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.reflect.Field;
 | 
				
			||||||
 | 
					import java.lang.reflect.InvocationTargetException;
 | 
				
			||||||
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Reflection {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static Method playerHandleMethod, sendPacketMethod, chatSerializerMethodA,chatSerializerMethodgetString;
 | 
				
			||||||
 | 
					    private static Field playerConnectionField;
 | 
				
			||||||
 | 
					    private static Class<?> chatSerializer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Reflection(){}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Class<?> getClass(String name) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            return Class.forName(name.replace("%v",Version.ServerVersion.getCurrent().toString()));
 | 
				
			||||||
 | 
					        } catch (ClassNotFoundException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					            return null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Class<?> getCraftClass(String className) throws ClassNotFoundException {
 | 
				
			||||||
 | 
					        return Class.forName("org.bukkit.craftbukkit." + Version.ServerVersion.getArrayVersion()[3] + "." + className);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Object getPlayerHandle(Player player) throws Exception {
 | 
				
			||||||
 | 
					        if (playerHandleMethod == null) {
 | 
				
			||||||
 | 
					            playerHandleMethod = player.getClass().getDeclaredMethod("getHandle");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return playerHandleMethod.invoke(player);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void sendPacket(Player player, Object packet) {
 | 
				
			||||||
 | 
					        if (player == null) {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            Object playerHandle = getPlayerHandle(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (playerConnectionField == null) {
 | 
				
			||||||
 | 
					                playerConnectionField = playerHandle.getClass().getDeclaredField(
 | 
				
			||||||
 | 
					                        (Version.ServerVersion.isCurrentEqualOrHigher(Version.ServerVersion.v1_17_R1) ? "b" : "playerConnection"));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Object playerConnection = playerConnectionField.get(playerHandle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (sendPacketMethod == null) {
 | 
				
			||||||
 | 
					                sendPacketMethod = playerConnection.getClass().getDeclaredMethod(
 | 
				
			||||||
 | 
					                        Version.ServerVersion.isCurrentEqualOrHigher(Version.ServerVersion.v1_18_R1) ? "a" : "sendPacket",
 | 
				
			||||||
 | 
					                        ClazzContainer.getPacket());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            sendPacketMethod.invoke(playerConnection, packet);
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static String getChatSerializerString(Object serializer) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
 | 
				
			||||||
 | 
					        if (chatSerializerMethodgetString==null){
 | 
				
			||||||
 | 
					            if (Version.ServerVersion.isCurrentEqualOrLower(Version.ServerVersion.v1_12_R1)){
 | 
				
			||||||
 | 
					                chatSerializerMethodgetString = ClazzContainer.getIChatBaseComponent().getDeclaredMethod("getText");
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                chatSerializerMethodgetString = ClazzContainer.getIChatBaseComponent().getDeclaredMethod("getString");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return (String) chatSerializerMethodgetString.invoke(serializer);
 | 
				
			||||||
 | 
					        //return (String) ClazzContainer.getIChatBaseComponent().cast(chatSerializerMethodgetString.invoke(serializer));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static Object asChatSerializer(String json) throws Exception {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            if (Version.ServerVersion.isCurrentEqualOrHigher(Version.ServerVersion.v1_17_R1)){
 | 
				
			||||||
 | 
					                if (chatSerializer==null){
 | 
				
			||||||
 | 
					                    chatSerializer = Class.forName("net.minecraft.network.chat.IChatBaseComponent$ChatSerializer");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                if (chatSerializer==null){
 | 
				
			||||||
 | 
					                    chatSerializer = Class.forName("net.minecraft.server." + Version.ServerVersion.getArrayVersion()[3] + ".IChatBaseComponent$ChatSerializer");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (chatSerializerMethodA == null) {
 | 
				
			||||||
 | 
					                chatSerializerMethodA = chatSerializer.getMethod("a", String.class);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } catch (Exception e){
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return chatSerializerMethodA.invoke(chatSerializer,json);
 | 
				
			||||||
 | 
					        //return ClazzContainer.getIChatBaseComponent().cast(chatSerializerMethodA.invoke(chatSerializer, json));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*public static Class<?> getNMSClassRegex(String nmsClass) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String version = null;
 | 
				
			||||||
 | 
					        Pattern pat = Pattern.compile("net\\.minecraft\\.(?:server)?\\.(v(?:\\d_)+R\\d)");
 | 
				
			||||||
 | 
					        for (Package p : Package.getPackages()) {
 | 
				
			||||||
 | 
					            String name = p.getName();
 | 
				
			||||||
 | 
					            Matcher m = pat.matcher(name);
 | 
				
			||||||
 | 
					            if (m.matches()) version = m.group(1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (version == null) return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            return Class.forName(String.format(nmsClass, version));
 | 
				
			||||||
 | 
					        } catch (ClassNotFoundException e) {
 | 
				
			||||||
 | 
					            return null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }*/
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,135 +0,0 @@
 | 
				
			|||||||
package tk.ditservices;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.bukkit.scheduler.BukkitScheduler;
 | 
					 | 
				
			||||||
//import org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftScheduler;
 | 
					 | 
				
			||||||
import tk.ditservices.commands.DitCmd;
 | 
					 | 
				
			||||||
import tk.ditservices.listeners.ChatEvents;
 | 
					 | 
				
			||||||
import tk.ditservices.listeners.LogChat;
 | 
					 | 
				
			||||||
import tk.ditservices.listeners.LogCommand;
 | 
					 | 
				
			||||||
import tk.ditservices.listeners.LogConnect;
 | 
					 | 
				
			||||||
import com.tchristofferson.configupdater.ConfigUpdater;
 | 
					 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					 | 
				
			||||||
import org.bukkit.GameRule;
 | 
					 | 
				
			||||||
import org.bukkit.World;
 | 
					 | 
				
			||||||
import org.bukkit.command.CommandExecutor;
 | 
					 | 
				
			||||||
import org.bukkit.command.PluginCommand;
 | 
					 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					 | 
				
			||||||
import org.bukkit.event.Listener;
 | 
					 | 
				
			||||||
import org.bukkit.plugin.java.JavaPlugin;
 | 
					 | 
				
			||||||
import tk.ditservices.utils.Math;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jeff_media.updatechecker.UpdateCheckSource;
 | 
					 | 
				
			||||||
import com.jeff_media.updatechecker.UpdateChecker;
 | 
					 | 
				
			||||||
import com.jeff_media.updatechecker.UserAgentBuilder;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.io.*;
 | 
					 | 
				
			||||||
import java.util.Collections;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.logging.Logger;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public final class DITSystem extends JavaPlugin implements CommandExecutor, Listener {
 | 
					 | 
				
			||||||
    private static DITSystem instance;
 | 
					 | 
				
			||||||
    Logger log = Bukkit.getLogger();
 | 
					 | 
				
			||||||
    //private DitPluginManager dplug;
 | 
					 | 
				
			||||||
    public TabManager tab;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public FileConfiguration config;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void onEnable() {
 | 
					 | 
				
			||||||
        saveDefaultConfig();
 | 
					 | 
				
			||||||
        instance = this;
 | 
					 | 
				
			||||||
        this.DIT_initialize();
 | 
					 | 
				
			||||||
        this.tab = new TabManager(this,this.config);
 | 
					 | 
				
			||||||
        //this.dplug = new DitPluginManager(this);
 | 
					 | 
				
			||||||
        System.out.println(this.getPrefix()+"Started running.");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        new UpdateChecker(this, UpdateCheckSource.GITHUB_RELEASE_TAG, "LabodiDavid/SimplifyTools")
 | 
					 | 
				
			||||||
                .setDownloadLink("https://github.com/LabodiDavid/SimplifyTools/releases")
 | 
					 | 
				
			||||||
                .setDonationLink("https://paypal.me/labodidavid")
 | 
					 | 
				
			||||||
                .setChangelogLink("https://github.com/LabodiDavid/SimplifyTools/blob/main/docs/ChangeLog.md")
 | 
					 | 
				
			||||||
                .setNotifyOpsOnJoin(true)
 | 
					 | 
				
			||||||
                .setNotifyByPermissionOnJoin("st.admin")
 | 
					 | 
				
			||||||
                .setUserAgent(new UserAgentBuilder().addPluginNameAndVersion())
 | 
					 | 
				
			||||||
                .checkEveryXHours(24)
 | 
					 | 
				
			||||||
                .checkNow();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private void DIT_initialize() {
 | 
					 | 
				
			||||||
        if  (this.Reload()){
 | 
					 | 
				
			||||||
            initOptions();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            PluginCommand ditCmd = this.getCommand("st");
 | 
					 | 
				
			||||||
            ditCmd.setExecutor(new DitCmd(this));
 | 
					 | 
				
			||||||
            ditCmd.setTabCompleter(new DITTabCompleter());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            getServer().getPluginManager().registerEvents(this, this);
 | 
					 | 
				
			||||||
            getServer().getPluginManager().registerEvents(new LogChat(this), this);
 | 
					 | 
				
			||||||
            getServer().getPluginManager().registerEvents(new LogCommand(this), this);
 | 
					 | 
				
			||||||
            getServer().getPluginManager().registerEvents(new LogConnect(this), this);
 | 
					 | 
				
			||||||
            getServer().getPluginManager().registerEvents(new ChatEvents(this), this);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    public String getPrefix(){
 | 
					 | 
				
			||||||
        if (this.config.isSet("Prefix")){
 | 
					 | 
				
			||||||
            return ChatColor.translateAlternateColorCodes('&', this.config.getString("Prefix"));
 | 
					 | 
				
			||||||
        }else{
 | 
					 | 
				
			||||||
            return ChatColor.translateAlternateColorCodes('&',"&a[&fSimplify&7Tools&2] &4- &f");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    public static DITSystem getInstance(){
 | 
					 | 
				
			||||||
        return instance;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    public void initOptions(){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (config.getBoolean("Saving.enabled") && config.getInt("Saving.interval")>0){
 | 
					 | 
				
			||||||
            BukkitScheduler scheduler = getServer().getScheduler();
 | 
					 | 
				
			||||||
            scheduler.scheduleSyncRepeatingTask(instance, new Runnable() {
 | 
					 | 
				
			||||||
                @Override
 | 
					 | 
				
			||||||
                public void run() {
 | 
					 | 
				
			||||||
                    String p = config.isSet("Saving.broadcastMsgProgress") ? config.getString("Saving.broadcastMsgProgress").replace("{PREFIX}",instance.getPrefix()) : instance.getPrefix()+"Auto save in progress..";
 | 
					 | 
				
			||||||
                    String d = config.isSet("Saving.broadcastMsgDone") ? config.getString("Saving.broadcastMsgDone").replace("{PREFIX}",instance.getPrefix()) : instance.getPrefix()+"Auto save done.";
 | 
					 | 
				
			||||||
                    Bukkit.broadcast(p,"st.st");
 | 
					 | 
				
			||||||
                    for(World w : Bukkit.getServer().getWorlds()){
 | 
					 | 
				
			||||||
                        w.save();
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    Bukkit.savePlayers();
 | 
					 | 
				
			||||||
                    Bukkit.broadcast(d,"st.st");
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }, 0L, Math.convert(Math.Convert.SECONDS,Math.Convert.TICKS,instance.config.getInt("Saving.interval")));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (this.config.isSet("CustomAdvancement.enabled")) {
 | 
					 | 
				
			||||||
            if(config.getBoolean("CustomAdvancement.enabled")){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                List<World> worlds = getServer().getWorlds();
 | 
					 | 
				
			||||||
                for (World w : worlds) {
 | 
					 | 
				
			||||||
                    if(w.getGameRuleValue(GameRule.ANNOUNCE_ADVANCEMENTS)) {
 | 
					 | 
				
			||||||
                        w.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false);
 | 
					 | 
				
			||||||
                        log.info(this.getPrefix()+"Disabling vanilla advancement messages for " + w.getName());
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    public boolean Reload(){
 | 
					 | 
				
			||||||
        File configFile = new File(getDataFolder(), "config.yml");
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            ConfigUpdater.update(this, "config.yml", configFile, Collections.emptyList());
 | 
					 | 
				
			||||||
        } catch (IOException e) {
 | 
					 | 
				
			||||||
            e.printStackTrace();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        reloadConfig();
 | 
					 | 
				
			||||||
        this.config = getConfig();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return true;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void onDisable() {
 | 
					 | 
				
			||||||
        System.out.println(this.getPrefix()+" stopped.");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,208 +0,0 @@
 | 
				
			|||||||
package tk.ditservices;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import net.minecraft.network.chat.ChatComponentText;
 | 
					 | 
				
			||||||
import net.minecraft.network.chat.IChatBaseComponent;
 | 
					 | 
				
			||||||
import net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter;
 | 
					 | 
				
			||||||
import net.minecraft.server.network.PlayerConnection;
 | 
					 | 
				
			||||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
 | 
					 | 
				
			||||||
import tk.ditservices.utils.Math;
 | 
					 | 
				
			||||||
import tk.ditservices.utils.Server;
 | 
					 | 
				
			||||||
/*import net.minecraft.server.v1_16_R3.ChatComponentText;
 | 
					 | 
				
			||||||
import net.minecraft.server.v1_16_R3.IChatBaseComponent;
 | 
					 | 
				
			||||||
import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerListHeaderFooter;
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					 | 
				
			||||||
//import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
 | 
					 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					 | 
				
			||||||
import java.lang.reflect.Field;
 | 
					 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class TabManager {
 | 
					 | 
				
			||||||
    private List<ChatComponentText> headers = new ArrayList<>();
 | 
					 | 
				
			||||||
    private List<ChatComponentText> footers = new ArrayList<>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private Integer refreshRate;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private DITSystem plugin;
 | 
					 | 
				
			||||||
    private FileConfiguration config;
 | 
					 | 
				
			||||||
    private List<String> headeranimList = new ArrayList<String>();
 | 
					 | 
				
			||||||
    private List<String> footeranimList = new ArrayList<String>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private ArrayList<String> formatArray = new ArrayList<>();
 | 
					 | 
				
			||||||
    private List<Integer> DynamicHeaders = new ArrayList<>();
 | 
					 | 
				
			||||||
    private List<Integer> DynamicFooters = new ArrayList<>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private enum AddLine {
 | 
					 | 
				
			||||||
        HEADER, FOOTER
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public TabManager(DITSystem instance,FileConfiguration c){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        this.plugin = instance;
 | 
					 | 
				
			||||||
        this.config = c;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(this.init()){
 | 
					 | 
				
			||||||
            this.showTab();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void showTab(){
 | 
					 | 
				
			||||||
        if (headers.isEmpty() && footers.isEmpty()){
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
 | 
					 | 
				
			||||||
            int count1 = 0; //headers
 | 
					 | 
				
			||||||
            int count2 = 0; //footers
 | 
					 | 
				
			||||||
            @Override
 | 
					 | 
				
			||||||
            public void run() {
 | 
					 | 
				
			||||||
                try {
 | 
					 | 
				
			||||||
                    //Tab code
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if (count1>=headers.size()){
 | 
					 | 
				
			||||||
                        count1=0;
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    if (count2>=footers.size()){
 | 
					 | 
				
			||||||
                        count2=0;
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    //Re adding all lines  where we replaced something like the RAM usage to every refresh
 | 
					 | 
				
			||||||
                    //display current value. (We check those lines in the init())
 | 
					 | 
				
			||||||
                    if (DynamicHeaders.size()>0 && count1 < DynamicHeaders.size()){
 | 
					 | 
				
			||||||
                        if (DynamicHeaders.get(count1) == count1){
 | 
					 | 
				
			||||||
                            addHeaderFooter(AddLine.HEADER,headeranimList.get(count1),true,count1);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    if (DynamicFooters.size()>0 && count2 < DynamicFooters.size()){
 | 
					 | 
				
			||||||
                        if (DynamicFooters.get(count2) == count2){
 | 
					 | 
				
			||||||
                            addHeaderFooter(AddLine.FOOTER,footeranimList.get(count2),true,count2);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(headers.get(count1),footers.get(count2));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if (Bukkit.getOnlinePlayers().size() !=0){
 | 
					 | 
				
			||||||
                        for (Player player : Bukkit.getOnlinePlayers()){
 | 
					 | 
				
			||||||
                            PlayerConnection pConn = ((CraftPlayer)player).getHandle().b;
 | 
					 | 
				
			||||||
                            //((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
 | 
					 | 
				
			||||||
                            pConn.a(packet);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    if (headers.size()>1){
 | 
					 | 
				
			||||||
                        count1++;
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    if (footers.size()>1){
 | 
					 | 
				
			||||||
                        count2++;
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            } catch (Exception e){
 | 
					 | 
				
			||||||
                    e.printStackTrace();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        },10, Math.convert(Math.Convert.SECONDS,Math.Convert.TICKS,this.refreshRate));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private boolean init(){
 | 
					 | 
				
			||||||
        if (config.getBoolean("Tab.enabled")){
 | 
					 | 
				
			||||||
            if (config.isSet("Tab.refreshRate")){
 | 
					 | 
				
			||||||
                this.refreshRate = config.getInt("Tab.refreshRate");
 | 
					 | 
				
			||||||
            }else{
 | 
					 | 
				
			||||||
                this.refreshRate=40;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                //Getting the tab lines from the config
 | 
					 | 
				
			||||||
                headeranimList = config.getStringList("Tab.headerAnimation");
 | 
					 | 
				
			||||||
                footeranimList = config.getStringList("Tab.footerAnimation");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                //Investigating lines where we need to run the formatting every tab refresh for example for the RAM usage.
 | 
					 | 
				
			||||||
                //Only storing those lines indexes.
 | 
					 | 
				
			||||||
                formatArray.add("{TOTALRAM}");
 | 
					 | 
				
			||||||
                formatArray.add("{FREERAM}");
 | 
					 | 
				
			||||||
                formatArray.add("{USEDRAM}");
 | 
					 | 
				
			||||||
                formatArray.add("{AVERAGEPING}");
 | 
					 | 
				
			||||||
                formatArray.add("{ONLINEPLAYERS}");
 | 
					 | 
				
			||||||
                formatArray.add("{MAXPLAYERS}");
 | 
					 | 
				
			||||||
                for (String f: formatArray){
 | 
					 | 
				
			||||||
                    for (int i = 0; i<headeranimList.size(); i++){
 | 
					 | 
				
			||||||
                        if (headeranimList.get(i).contains(f) && !DynamicHeaders.contains(i)){
 | 
					 | 
				
			||||||
                            DynamicHeaders.add(i);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    for (int i = 0; i<footeranimList.size(); i++){
 | 
					 | 
				
			||||||
                        if (footeranimList.get(i).contains(f) && !DynamicFooters.contains(i)){
 | 
					 | 
				
			||||||
                            DynamicFooters.add(i);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                for (String hanim : headeranimList){
 | 
					 | 
				
			||||||
                        this.addHeaderFooter(AddLine.HEADER,hanim,false);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                for (String fanim : footeranimList){
 | 
					 | 
				
			||||||
                        this.addHeaderFooter(AddLine.FOOTER,fanim,false);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Manages the adding of the tab line and the final formatting of the text.
 | 
					 | 
				
			||||||
     * @param head_or_footer AddLine Enum value to choose where to add a tab line.
 | 
					 | 
				
			||||||
     * @param text The formatted tab line text.
 | 
					 | 
				
			||||||
     * @param dynamic If the text contains a replace which need to run every tab refresh then it's true.
 | 
					 | 
				
			||||||
     * @param index Index of the 'dynamic' line. This is an overloading so there we need the index[0] element.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public void addHeaderFooter(AddLine head_or_footer,String text,boolean dynamic,int... index){
 | 
					 | 
				
			||||||
        IChatBaseComponent tabText = IChatBaseComponent.ChatSerializer.a("{\"text\":\"" + format(text) +"\"}");
 | 
					 | 
				
			||||||
        if (head_or_footer==AddLine.HEADER){
 | 
					 | 
				
			||||||
            if (dynamic){
 | 
					 | 
				
			||||||
                headers.set(index[0],new ChatComponentText(tabText.getString()));
 | 
					 | 
				
			||||||
            }else {
 | 
					 | 
				
			||||||
                headers.add(new ChatComponentText(tabText.getString()));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }else{
 | 
					 | 
				
			||||||
            if (head_or_footer==AddLine.FOOTER){
 | 
					 | 
				
			||||||
                if (dynamic){
 | 
					 | 
				
			||||||
                    footers.set(index[0],new ChatComponentText(tabText.getString()));
 | 
					 | 
				
			||||||
                }else {
 | 
					 | 
				
			||||||
                    footers.add(new ChatComponentText(tabText.getString()));
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Replaces the msg values to their represents and recognizes MC color codes.
 | 
					 | 
				
			||||||
     * @param msg The text.
 | 
					 | 
				
			||||||
     * @return Replaced text with recognized MC color codes.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private String format(String msg){
 | 
					 | 
				
			||||||
        if (msg.contains("{TOTALRAM}")){
 | 
					 | 
				
			||||||
            msg = msg.replace("{TOTALRAM}",String.valueOf(Server.getRAM(Server.RAM.TOTAL)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (msg.contains("{FREERAM}")){
 | 
					 | 
				
			||||||
            msg = msg.replace("{FREERAM}",String.valueOf(Server.getRAM(Server.RAM.FREE)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (msg.contains("{USEDRAM}")){
 | 
					 | 
				
			||||||
            msg = msg.replace("{USEDRAM}",String.valueOf(Server.getRAM(Server.RAM.USED)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (msg.contains("{AVERAGEPING}")){
 | 
					 | 
				
			||||||
            msg = msg.replace("{AVERAGEPING}",String.valueOf(Server.getAveragePing()));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (msg.contains("{ONLINEPLAYERS}")){
 | 
					 | 
				
			||||||
            msg = msg.replace("{ONLINEPLAYERS}",String.valueOf(plugin.getServer().getOnlinePlayers().size()));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (msg.contains("{MAXPLAYERS}")){
 | 
					 | 
				
			||||||
            msg = msg.replace("{MAXPLAYERS}",String.valueOf(plugin.getServer().getMaxPlayers()));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return ChatColor.translateAlternateColorCodes('&', msg);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,141 +0,0 @@
 | 
				
			|||||||
package tk.ditservices.commands;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					 | 
				
			||||||
import org.bukkit.World;
 | 
					 | 
				
			||||||
import tk.ditservices.DITSystem;
 | 
					 | 
				
			||||||
import tk.ditservices.utils.Cooldown;
 | 
					 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					 | 
				
			||||||
import org.bukkit.command.*;
 | 
					 | 
				
			||||||
import org.bukkit.configuration.file.FileConfiguration;
 | 
					 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class DitCmd implements CommandExecutor {
 | 
					 | 
				
			||||||
    String noArgMsg;
 | 
					 | 
				
			||||||
    DITSystem plugin;
 | 
					 | 
				
			||||||
    Cooldown cd;
 | 
					 | 
				
			||||||
    FileConfiguration config;
 | 
					 | 
				
			||||||
    public DitCmd(DITSystem instance){
 | 
					 | 
				
			||||||
        this.plugin = instance;
 | 
					 | 
				
			||||||
        this.noArgMsg = plugin.getPrefix()+ ChatColor.DARK_RED +"To list all SimplifyTools commands use the '/help SIMPLIFYTOOLS' command!";
 | 
					 | 
				
			||||||
        this.cd = new Cooldown(plugin);
 | 
					 | 
				
			||||||
        this.config = plugin.config;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
					 | 
				
			||||||
        if (command.getName().equals("st")){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (cd.Check(sender)){
 | 
					 | 
				
			||||||
                if (command.getName().equals("st") && args.length==0)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    if (sender instanceof Player)
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        Player p = (Player) sender;
 | 
					 | 
				
			||||||
                        p.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Version: "+plugin.getDescription().getVersion());
 | 
					 | 
				
			||||||
                        p.sendMessage(this.noArgMsg);
 | 
					 | 
				
			||||||
                        cd.Add(p);
 | 
					 | 
				
			||||||
                        return true;
 | 
					 | 
				
			||||||
                    }else {
 | 
					 | 
				
			||||||
                        if (sender instanceof ConsoleCommandSender){
 | 
					 | 
				
			||||||
                            sender.sendMessage(this.noArgMsg);
 | 
					 | 
				
			||||||
                            return true;
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                if (command.getName().equals("st") && args[0].contains("help"))
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    if (sender instanceof Player)
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        Player p = (Player) sender;
 | 
					 | 
				
			||||||
                        cd.Add(p);
 | 
					 | 
				
			||||||
                        p.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Version: "+plugin.getDescription().getVersion());
 | 
					 | 
				
			||||||
                        p.sendMessage(this.noArgMsg);
 | 
					 | 
				
			||||||
                        return true;
 | 
					 | 
				
			||||||
                    }else{
 | 
					 | 
				
			||||||
                        if (sender instanceof ConsoleCommandSender) {
 | 
					 | 
				
			||||||
                            ConsoleCommandSender consoleadmin = (ConsoleCommandSender) sender;
 | 
					 | 
				
			||||||
                            consoleadmin.sendMessage(this.noArgMsg);
 | 
					 | 
				
			||||||
                            return true;
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (command.getName().equals("st") && args[0].contains("reload") && sender.hasPermission("st.reload")){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if(plugin.Reload()){
 | 
					 | 
				
			||||||
                        if (sender instanceof Player){
 | 
					 | 
				
			||||||
                            Player p = (Player) sender;
 | 
					 | 
				
			||||||
                            cd.Add(p);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        sender.sendMessage(plugin.getPrefix()+ChatColor.GREEN+"Successfully reload!");
 | 
					 | 
				
			||||||
                        sender.sendMessage(plugin.getPrefix()+ChatColor.RED+"Notice: Restart your server if the settings didn't applied.");
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (command.getName().equalsIgnoreCase("st") && args[0].contains("pmanager")){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if (sender.hasPermission("st.pmanager.unload") || sender.hasPermission("st.pmanager.load") || sender.hasPermission("st.pmanager")) {
 | 
					 | 
				
			||||||
                        if (sender instanceof Player){
 | 
					 | 
				
			||||||
                            Player p = (Player) sender;
 | 
					 | 
				
			||||||
                            cd.Add(p);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        if (args.length==1){
 | 
					 | 
				
			||||||
                            String msg = plugin.getPrefix()+ChatColor.DARK_RED+"Invalid command!";
 | 
					 | 
				
			||||||
                            if (sender instanceof Player){
 | 
					 | 
				
			||||||
                                Player p = (Player) sender;
 | 
					 | 
				
			||||||
                                p.sendMessage(msg);
 | 
					 | 
				
			||||||
                            }else{
 | 
					 | 
				
			||||||
                                ConsoleCommandSender c = (ConsoleCommandSender) sender;
 | 
					 | 
				
			||||||
                                c.sendMessage(msg);
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            return true;
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        if (args[1].equalsIgnoreCase("load")) {
 | 
					 | 
				
			||||||
                            //PluginCmd.handleLoad(sender,args);
 | 
					 | 
				
			||||||
                            PluginCmd.LoadPlugin(sender,args);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        if (args[1].equalsIgnoreCase("unload")) {
 | 
					 | 
				
			||||||
                            //PluginCmd.handleUnload(sender,args);
 | 
					 | 
				
			||||||
                            PluginCmd.UnloadPlugin(sender, args);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (command.getName().equalsIgnoreCase("st") && args[0].contains("save-all") && sender.hasPermission("st.save")){
 | 
					 | 
				
			||||||
                    if (sender instanceof Player){
 | 
					 | 
				
			||||||
                        Player p = (Player) sender;
 | 
					 | 
				
			||||||
                        cd.Add(p);
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    String p = plugin.config.getString("Saving.broadcastMsgProgress").replace("{PREFIX}",plugin.getPrefix());
 | 
					 | 
				
			||||||
                    String d = plugin.config.getString("Saving.broadcastMsgDone").replace("{PREFIX}",plugin.getPrefix());
 | 
					 | 
				
			||||||
                    Bukkit.broadcast(p,"st.st");
 | 
					 | 
				
			||||||
                    for(World w : Bukkit.getServer().getWorlds()){
 | 
					 | 
				
			||||||
                        w.save();
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    Bukkit.savePlayers();
 | 
					 | 
				
			||||||
                    Bukkit.broadcast(d,"st.st");
 | 
					 | 
				
			||||||
                    return true;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (command.getName().equalsIgnoreCase("st") && args[0].contains("ping") &&  sender.hasPermission("st.ping")){
 | 
					 | 
				
			||||||
                    if (sender instanceof Player){
 | 
					 | 
				
			||||||
                        Player p = (Player) sender;
 | 
					 | 
				
			||||||
                        cd.Add(p);
 | 
					 | 
				
			||||||
                    } return PingCmd.Run(sender);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                if (command.getName().equalsIgnoreCase("st") && args[0].contains("stats") && sender.hasPermission("st.stats")){
 | 
					 | 
				
			||||||
                    if (sender instanceof Player){
 | 
					 | 
				
			||||||
                        Player p = (Player) sender;
 | 
					 | 
				
			||||||
                        cd.Add(p);
 | 
					 | 
				
			||||||
                    } return StatCmd.Run(sender);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }else{
 | 
					 | 
				
			||||||
                cd.CDText(sender);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return true;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -41,23 +41,21 @@ CustomAdvancement:
 | 
				
			|||||||
# example: header: &cThis server is using SimplifyTools by &1SimplifyDave
 | 
					# example: header: &cThis server is using SimplifyTools by &1SimplifyDave
 | 
				
			||||||
# Note: Use \n to add a new line
 | 
					# Note: Use \n to add a new line
 | 
				
			||||||
# Note: The RAM values are in MB.
 | 
					# Note: The RAM values are in MB.
 | 
				
			||||||
# {USEDRAM} {TOTALRAM} {FREERAM} {AVERAGEPING} {ONLINEPLAYERS} {MAXPLAYERS} represents their values.
 | 
					# {USEDRAM} {TOTALRAM} {FREERAM} {AVERAGEPING} {ONLINEPLAYERS} {MAXPLAYERS} {MOTD} represents their values.
 | 
				
			||||||
 | 
					# {UPTIME} will be replaced with the server's uptime in the following format: "xx days xx hours xx minutes"
 | 
				
			||||||
# NOTICE: You will need a full MC server restart when you want to apply new settings here.
 | 
					# NOTICE: You will need a full MC server restart when you want to apply new settings here.
 | 
				
			||||||
Tab:
 | 
					Tab:
 | 
				
			||||||
  enabled: false # If you want to enable customization on the tab
 | 
					  enabled: false # If you want to enable customization on the tab
 | 
				
			||||||
  refreshRate: 2 # The refresh rate in SECONDS
 | 
					  refreshRate: 1 # The refresh rate in SECONDS
 | 
				
			||||||
  headerAnimation: #If animation set to true, you can set the animations per line.
 | 
					  headerAnimation:
 | 
				
			||||||
#If you don't want animations, just leave one line text here!
 | 
					    - '&e&n{MOTD}\n&r&eOnline Players: &6{MAXPLAYERS}/{ONLINEPLAYERS}\n&eAverage ping: &6{AVERAGEPING} ms'
 | 
				
			||||||
 | 
					    - '&6&l&n{MOTD}\n&r&6Online Players: &e{MAXPLAYERS}/{ONLINEPLAYERS}\n&6Average ping: &e{AVERAGEPING} ms'
 | 
				
			||||||
 | 
					    #If you don't want animations, just leave one line text here!
 | 
				
			||||||
    #- '&l&cThis is an example header text without animation\nAnd this is a new line!'
 | 
					    #- '&l&cThis is an example header text without animation\nAnd this is a new line!'
 | 
				
			||||||
  - '&cThis server is using SimplifyTools by &1SimplifyDave \nAverage ping: {AVERAGEPING} ms'
 | 
					 | 
				
			||||||
  - '&bThis server is using SimplifyTools by &9SimplifyDave \nAverage ping: {AVERAGEPING} ms'
 | 
					 | 
				
			||||||
  - '&b&lThis server is using SimplifyTools by &9SimplifyDave \nAverage ping: {AVERAGEPING} ms'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  footerAnimation:
 | 
					  footerAnimation:
 | 
				
			||||||
#If you don't want animations, just leave one line text here!
 | 
					    - '&l&7Server Statistics:\n&e&lRAM Usage: &6{TOTALRAM}MB / {USEDRAM}MB\n&e&lUptime: &6{UPTIME}\n&e&lTPS: &6{TPS}'
 | 
				
			||||||
    #- '&l&cThis is an example footer text without animation\n with multiple lines in one element!'
 | 
					    - '&l&7Server Statistics:\n&6&lRAM Usage: &e{TOTALRAM}MB / {USEDRAM}MB\n&6&lUptime: &e{UPTIME}\n&6&lTPS: &e{TPS}'
 | 
				
			||||||
  - '&l&4Server RAM Usage: {TOTALRAM}MB / {USEDRAM}MB\nOnline players: {MAXPLAYERS}/{ONLINEPLAYERS}'
 | 
					 | 
				
			||||||
  - '&l&aServer RAM Usage: {TOTALRAM}MB / {USEDRAM}MB\nOnline players: {MAXPLAYERS}/{ONLINEPLAYERS}'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Custom Connect/Disconnect messages
 | 
					# Custom Connect/Disconnect messages
 | 
				
			||||||
CustomMsg:
 | 
					CustomMsg:
 | 
				
			||||||
@@ -82,6 +80,12 @@ Cooldown:
 | 
				
			|||||||
  # The time must be passed between using this plugin commands.
 | 
					  # The time must be passed between using this plugin commands.
 | 
				
			||||||
  seconds: 2 #The command cooldown in seconds
 | 
					  seconds: 2 #The command cooldown in seconds
 | 
				
			||||||
  Msg: '{PREFIX} Please wait {SECONDS} seconds!' # The message when the user spamming a command
 | 
					  Msg: '{PREFIX} Please wait {SECONDS} seconds!' # The message when the user spamming a command
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Plugin Manager - Enable/Disable plugins without server restart
 | 
				
			||||||
 | 
					# Attention! It may cause errors in other plugins if you use this feature, not recommended!
 | 
				
			||||||
 | 
					# If this is set to 'true' you can use the /st pmanager commands. Set it to 'false' to prevent its use.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					PluginManager:
 | 
				
			||||||
 | 
					  enabled: false
 | 
				
			||||||
# Miscellaneous
 | 
					# Miscellaneous
 | 
				
			||||||
Prefix: '&a[&fSimplify&7Tools&2] &4- &f'
 | 
					Prefix: '&a[&fSimplify&7Tools&2] &4- &f'  # The prefix which is inserted to the beginning of every plugin message.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,13 @@
 | 
				
			|||||||
name: SimplifyTools
 | 
					name: SimplifyTools
 | 
				
			||||||
version: ${project.version}
 | 
					version: ${project.version}
 | 
				
			||||||
main: tk.ditservices.DITSystem
 | 
					main: hu.ditservices.STPlugin
 | 
				
			||||||
api-version: 1.13
 | 
					api-version: 1.13
 | 
				
			||||||
prefix: SimplifyTools
 | 
					prefix: SimplifyTools
 | 
				
			||||||
load: POSTWORLD
 | 
					load: POSTWORLD
 | 
				
			||||||
description: SimplifyTools - An All-in-one helper plugin.
 | 
					description: SimplifyTools - An All-in-one helper plugin.
 | 
				
			||||||
author: SimplifyDave
 | 
					author: SimplifyDave
 | 
				
			||||||
website: https://dit-services.tk
 | 
					website: https://ditservices.hu
 | 
				
			||||||
 | 
					#depend: [ProtocolLib]
 | 
				
			||||||
commands:
 | 
					commands:
 | 
				
			||||||
  st:
 | 
					  st:
 | 
				
			||||||
    description: The default command for the plugin.
 | 
					    description: The default command for the plugin.
 | 
				
			||||||
@@ -20,10 +21,18 @@ commands:
 | 
				
			|||||||
    description: Displays your ping to the current server.
 | 
					    description: Displays your ping to the current server.
 | 
				
			||||||
    usage: "/st ping"
 | 
					    usage: "/st ping"
 | 
				
			||||||
    permission: st.ping
 | 
					    permission: st.ping
 | 
				
			||||||
 | 
					  st tps:
 | 
				
			||||||
 | 
					    description: Displays plugin, and server calculated TPS.
 | 
				
			||||||
 | 
					    usage: "/st tps"
 | 
				
			||||||
 | 
					    permission: st.tps
 | 
				
			||||||
  st stats:
 | 
					  st stats:
 | 
				
			||||||
    description: Displays your gameplay statistics.
 | 
					    description: Displays your gameplay statistics.
 | 
				
			||||||
    usage: "/st stats"
 | 
					    usage: "/st stats"
 | 
				
			||||||
    permission: st.stats
 | 
					    permission: st.stats
 | 
				
			||||||
 | 
					  st settings:
 | 
				
			||||||
 | 
					    description: Displays plugin settings.
 | 
				
			||||||
 | 
					    usage: "/st settings"
 | 
				
			||||||
 | 
					    permission: st.admin
 | 
				
			||||||
  st save-all:
 | 
					  st save-all:
 | 
				
			||||||
    description: Saves the players, worlds data on the server.
 | 
					    description: Saves the players, worlds data on the server.
 | 
				
			||||||
    usage: "/st save-all"
 | 
					    usage: "/st save-all"
 | 
				
			||||||
@@ -55,6 +64,9 @@ permissions:
 | 
				
			|||||||
  st.ping:
 | 
					  st.ping:
 | 
				
			||||||
    description: Enables the ping command.
 | 
					    description: Enables the ping command.
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
 | 
					  st.tps:
 | 
				
			||||||
 | 
					    description: Enables the tps command.
 | 
				
			||||||
 | 
					    default: true
 | 
				
			||||||
  st.reload:
 | 
					  st.reload:
 | 
				
			||||||
    description: Enables the reload command.
 | 
					    description: Enables the reload command.
 | 
				
			||||||
    default: op
 | 
					    default: op
 | 
				
			||||||
@@ -73,13 +85,13 @@ permissions:
 | 
				
			|||||||
  st.save:
 | 
					  st.save:
 | 
				
			||||||
    description: Enables the save-all command.
 | 
					    description: Enables the save-all command.
 | 
				
			||||||
    default: op
 | 
					    default: op
 | 
				
			||||||
    st.admin:
 | 
					  st.admin:
 | 
				
			||||||
      description: An admin permission for the maintenance commands and for update notifies.
 | 
					      description: An admin permission for the maintenance commands and for update notifies.
 | 
				
			||||||
      default: op
 | 
					      default: op
 | 
				
			||||||
      children:
 | 
					      children:
 | 
				
			||||||
        st.save: true
 | 
					        st.save: true
 | 
				
			||||||
        st.pmanager.*: true
 | 
					        st.pmanager.*: true
 | 
				
			||||||
    st.*:
 | 
					  st.*:
 | 
				
			||||||
      description: Wildcard permission for all commands.
 | 
					      description: Wildcard permission for all commands.
 | 
				
			||||||
      default: op
 | 
					      default: op
 | 
				
			||||||
      children:
 | 
					      children:
 | 
				
			||||||
@@ -90,7 +102,7 @@ permissions:
 | 
				
			|||||||
        st.save: true
 | 
					        st.save: true
 | 
				
			||||||
        st.stats: true
 | 
					        st.stats: true
 | 
				
			||||||
        st.settings: true
 | 
					        st.settings: true
 | 
				
			||||||
    st.pmanager.*:
 | 
					  st.pmanager.*:
 | 
				
			||||||
      description: The plugin manager commands.
 | 
					      description: The plugin manager commands.
 | 
				
			||||||
      default: op
 | 
					      default: op
 | 
				
			||||||
      children:
 | 
					      children:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user