v1.2.3
This commit is contained in:
parent
7eff18257d
commit
ffe27ee24c
10
README.md
10
README.md
@ -1,7 +1,7 @@
|
|||||||
# SimplifyTools
|
![SimplifyTools logo](docs/img/SimplifyTools.png)
|
||||||
### An 'All-in-one' plugin for MC servers.
|
### An 'All-in-one' plugin for MC servers.
|
||||||
#### TabList Customizing, Custom Advancement, Connect messages, AutoSave, Logger
|
#### TabList Customizing, Custom Advancement, Connect messages, AutoSave, Logger
|
||||||
[![Build Status](https://ci.ditservices.hu/job/SimplifyTools/badge/icon)](https://ci.ditservices.hu/job/SimplifyTools/) ![ MC Version](https://ci.ditservices.hu/job/SimplifyTools/badge/icon?subject=MC&status=1.12%20-%201.20.1&color=darkblue) ![Git latest release](https://img.shields.io/github/v/release/LabodiDavid/SimplifyTools) [![bStats](https://ci.ditservices.hu/job/SimplifyTools/badge/icon?subject=bStats&status=3.0&color=brightgreen)](https://bstats.org/plugin/bukkit/SimplifyTools/15108) ![Lines of code](https://tokei.rs/b1/github/LabodiDavid/SimplifyTools?category=code)
|
[![Build Status](https://ci.ditservices.hu/job/SimplifyTools/badge/icon)](https://ci.ditservices.hu/job/SimplifyTools/) ![ MC Version](https://ci.ditservices.hu/job/SimplifyTools/badge/icon?subject=MC&status=1.12%20-%201.21.4&color=darkblue) ![Git latest release](https://img.shields.io/github/v/release/LabodiDavid/SimplifyTools) [![bStats](https://ci.ditservices.hu/job/SimplifyTools/badge/icon?subject=bStats&status=3.0&color=brightgreen)](https://bstats.org/plugin/bukkit/SimplifyTools/15108) ![Lines of code](https://tokei.rs/b1/github/LabodiDavid/SimplifyTools?category=code)
|
||||||
<br>[Changelog](docs/ChangeLog.md)
|
<br>[Changelog](docs/ChangeLog.md)
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -23,6 +23,11 @@
|
|||||||
(Note: The advancement names are currently only can be displayed in english. In future versions there will be a feature to translate to any languages.)
|
(Note: The advancement names are currently only can be displayed in english. In future versions there will be a feature to translate to any languages.)
|
||||||
![Advancement Messages preview](docs/img/4.gif)
|
![Advancement Messages preview](docs/img/4.gif)
|
||||||
- **Logging** - A logger with fully customizable format for dis/connect, chat, commands actions.
|
- **Logging** - A logger with fully customizable format for dis/connect, chat, commands actions.
|
||||||
|
_________________
|
||||||
|
### Dependencies
|
||||||
|
#### From version [v1.2.3](https://github.com/LabodiDavid/SimplifyTools/releases/tag/1.2.3) the plugin requires [ProtocolLib](https://github.com/dmulloy2/ProtocolLib/)
|
||||||
|
_________________
|
||||||
|
|
||||||
### [Check the config file for more explanation and examples](https://github.com/LabodiDavid/SimplifyTools/blob/main/src/main/resources/config.yml)
|
### [Check the config file for more explanation and examples](https://github.com/LabodiDavid/SimplifyTools/blob/main/src/main/resources/config.yml)
|
||||||
_________________
|
_________________
|
||||||
### [Commands & Permissions](docs/cmd_perms.md)
|
### [Commands & Permissions](docs/cmd_perms.md)
|
||||||
@ -35,5 +40,6 @@ _________________
|
|||||||
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.
|
||||||
_________________
|
_________________
|
||||||
## 3rd party libraries used by this plugin
|
## 3rd party libraries used by this plugin
|
||||||
|
### [ProtocolLib by dmulloy2](https://github.com/dmulloy2/ProtocolLib/)
|
||||||
### [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)
|
@ -1,21 +1,29 @@
|
|||||||
# SimplifyTools - Changelog
|
# SimplifyTools - Changelog
|
||||||
|
|
||||||
- 1.2.1
|
- **1.2.3**
|
||||||
|
- Added support for version up to 1.21.4
|
||||||
|
- The plugin now depends on, <b>requires ProtocolLib</b> (https://github.com/dmulloy2/ProtocolLib/)
|
||||||
|
- Tab feature adjustments, refactor for ProtocolLib
|
||||||
|
- Removed Reflection (~300 lines of code)
|
||||||
|
- Showing more feature setting statuses in `/st settings`
|
||||||
|
- **1.2.2**
|
||||||
|
- Added support for version up to 1.20.2
|
||||||
|
- **1.2.1**
|
||||||
- Added support for version up to 1.20.1
|
- Added support for version up to 1.20.1
|
||||||
- Plugin manager added setting, now disabled by default in the config.
|
- Plugin manager added setting, now disabled by default in the config.
|
||||||
- Removed coloring of the logs in the server console
|
- Removed coloring of the logs in the server console
|
||||||
- TPS number displayed in the TAB now rounded to the nearest integer.
|
- TPS number displayed in the TAB now rounded to the nearest integer.
|
||||||
- Minor code refactors
|
- Minor code refactors
|
||||||
- 1.2.0
|
- **1.2.0**
|
||||||
- Added TPS command `/st tps`
|
- Added TPS command `/st tps`
|
||||||
- Added `{MOTD}`, `{TPS}` variable for TAB customization in the config
|
- Added `{MOTD}`, `{TPS}` variable for TAB customization in the config
|
||||||
- Refactored code for multi version support (1.12 - 1.19.3)
|
- Refactored code for multi version support (1.12 - 1.19.3)
|
||||||
- Fixes [#1](https://github.com/LabodiDavid/SimplifyTools/issues/1)
|
- 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)
|
- 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.
|
||||||
|
BIN
docs/img/ST.png
Normal file
BIN
docs/img/ST.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
docs/img/SimplifyTools.png
Normal file
BIN
docs/img/SimplifyTools.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@ -5,10 +5,9 @@ import com.comphenix.protocol.ProtocolManager;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import hu.ditservices.STPlugin;
|
import hu.ditservices.STPlugin;
|
||||||
import hu.ditservices.utils.*;
|
|
||||||
import hu.ditservices.utils.Math;
|
import hu.ditservices.utils.Math;
|
||||||
import hu.ditservices.utils.reflection.ClazzContainer;
|
import hu.ditservices.utils.Server;
|
||||||
import hu.ditservices.utils.reflection.Reflection;
|
import hu.ditservices.utils.TPS;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,9 +16,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TabHandler {
|
public class TabHandler {
|
||||||
public final List<String> headers = new ArrayList<>();
|
|
||||||
public final List<String> footers = new ArrayList<>();
|
|
||||||
|
|
||||||
public final List<WrappedChatComponent> headerComponents = new ArrayList<>();
|
public final List<WrappedChatComponent> headerComponents = new ArrayList<>();
|
||||||
public final List<WrappedChatComponent> footerComponents = new ArrayList<>();
|
public final List<WrappedChatComponent> footerComponents = new ArrayList<>();
|
||||||
|
|
||||||
@ -37,31 +33,20 @@ public class TabHandler {
|
|||||||
private int count2 = 0; //footers
|
private int count2 = 0; //footers
|
||||||
private Object packet;
|
private Object packet;
|
||||||
|
|
||||||
private boolean isNewerThan1_20_2;
|
public TabHandler() {
|
||||||
|
|
||||||
public TabHandler() throws Exception {
|
|
||||||
|
|
||||||
this.plugin = STPlugin.getInstance();
|
this.plugin = STPlugin.getInstance();
|
||||||
this.isNewerThan1_20_2 = Version.ServerVersion.isCurrentHigher(Version.ServerVersion.v1_20_R2);
|
|
||||||
if(this.init()){
|
if(this.init()){
|
||||||
if ((headers.isEmpty() && footers.isEmpty() && !isNewerThan1_20_2)
|
if (headerComponents.isEmpty() && footerComponents.isEmpty()){
|
||||||
|| (headerComponents.isEmpty() && footerComponents.isEmpty() && isNewerThan1_20_2)){
|
plugin.getLogger().warning(plugin.getPrefix()+"TAB customization disabled because empty customization config or feature related errors!");
|
||||||
plugin.getLogger().warning(plugin.getPrefix()+"TAB customization disabled because empty customization config!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.updateTab();
|
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() {
|
||||||
private boolean init() throws Exception {
|
|
||||||
if (plugin.getConfig().getBoolean("Tab.enabled")){
|
if (plugin.getConfig().getBoolean("Tab.enabled")){
|
||||||
|
|
||||||
int availProcessors = Server.getCpuCores();
|
int availProcessors = Server.getCpuCores();
|
||||||
@ -124,21 +109,13 @@ public class TabHandler {
|
|||||||
if (Bukkit.getOnlinePlayers().isEmpty()){
|
if (Bukkit.getOnlinePlayers().isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isNewerThan1_20_2) {
|
|
||||||
if (count1 >= headerComponents.size()) {
|
if (count1 >= headerComponents.size()) {
|
||||||
count1 = 0;
|
count1 = 0;
|
||||||
}
|
}
|
||||||
if (count2 >= footerComponents.size()) {
|
if (count2 >= footerComponents.size()) {
|
||||||
count2 = 0;
|
count2 = 0;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
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
|
//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())
|
//display current value. (We check those lines in the init())
|
||||||
@ -153,36 +130,21 @@ public class TabHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 if (Version.ServerVersion.isCurrentHigher(Version.ServerVersion.v1_20_R2)) {
|
|
||||||
// Use ProtocolLib for versions higher than 1.20.2
|
|
||||||
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
||||||
PacketContainer packet = protocolManager.createPacket(com.comphenix.protocol.PacketType.Play.Server.PLAYER_LIST_HEADER_FOOTER);
|
PacketContainer packet = protocolManager.createPacket(com.comphenix.protocol.PacketType.Play.Server.PLAYER_LIST_HEADER_FOOTER);
|
||||||
|
|
||||||
// Set header and footer
|
|
||||||
packet.getChatComponents().write(0, headerComponents.get(count1));
|
packet.getChatComponents().write(0, headerComponents.get(count1));
|
||||||
packet.getChatComponents().write(1, footerComponents.get(count2));
|
packet.getChatComponents().write(1, footerComponents.get(count2));
|
||||||
|
|
||||||
// Send the packet to all players
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
protocolManager.sendServerPacket(player, packet);
|
protocolManager.sendServerPacket(player, packet);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Use the built-in Spigot API for versions between 1.13 and 1.20.1
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
player.setPlayerListHeaderFooter(headers.get(count1), footers.get(count2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (headers.size() > 1 || headerComponents.size() > 1) {
|
if (headerComponents.size() > 1) {
|
||||||
count1++;
|
count1++;
|
||||||
}
|
}
|
||||||
if (footers.size() > 1 || footerComponents.size() > 1) {
|
if (footerComponents.size() > 1) {
|
||||||
count2++;
|
count2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,15 +161,12 @@ public class TabHandler {
|
|||||||
* Manages the adding of the tab line and the final formatting of the text.
|
* 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 header If true the text will be added to the header, otherwise to the footer.
|
||||||
* @param text The formatted tab line text.
|
* @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 dynamic If the text contains a replacement 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.
|
* @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) {
|
private void addHeaderFooter(boolean header,String text,boolean dynamic,int... index) {
|
||||||
try {
|
try {
|
||||||
String Json = "{\"text\": \""+format(text)+"\"}";
|
String Json = "{\"text\": \""+format(text)+"\"}";
|
||||||
boolean isNewerThan1202 = Version.ServerVersion.isCurrentHigher(Version.ServerVersion.v1_20_R2);
|
|
||||||
|
|
||||||
if (isNewerThan1202) {
|
|
||||||
WrappedChatComponent tabText = WrappedChatComponent.fromJson(Json);
|
WrappedChatComponent tabText = WrappedChatComponent.fromJson(Json);
|
||||||
|
|
||||||
if (header){
|
if (header){
|
||||||
@ -223,23 +182,7 @@ public class TabHandler {
|
|||||||
footerComponents.add(tabText);
|
footerComponents.add(tabText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Object tabText = Reflection.asChatSerializer(Json);
|
|
||||||
|
|
||||||
if (header){
|
|
||||||
if (dynamic){
|
|
||||||
headers.set(index[0], Reflection.getChatSerializerString(tabText));
|
|
||||||
}else {
|
|
||||||
headers.add(Reflection.getChatSerializerString(tabText));
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if (dynamic){
|
|
||||||
footers.set(index[0], Reflection.getChatSerializerString(tabText));
|
|
||||||
}else {
|
|
||||||
footers.add(Reflection.getChatSerializerString(tabText));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
package hu.ditservices.utils.reflection;
|
package hu.ditservices.utils.reflection;
|
||||||
|
|
||||||
import hu.ditservices.utils.Version;
|
import hu.ditservices.utils.Version;
|
||||||
@ -91,3 +92,4 @@ public final class ClazzContainer {
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
package hu.ditservices.utils.reflection;
|
package hu.ditservices.utils.reflection;
|
||||||
|
|
||||||
import hu.ditservices.utils.Version;
|
import hu.ditservices.utils.Version;
|
||||||
@ -100,6 +101,7 @@ public class Reflection {
|
|||||||
//return ClazzContainer.getIChatBaseComponent().cast(chatSerializerMethodA.invoke(chatSerializer, json));
|
//return ClazzContainer.getIChatBaseComponent().cast(chatSerializerMethodA.invoke(chatSerializer, json));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
/*public static Class<?> getNMSClassRegex(String nmsClass) {
|
/*public static Class<?> getNMSClassRegex(String nmsClass) {
|
||||||
|
|
||||||
String version = null;
|
String version = null;
|
||||||
@ -118,5 +120,7 @@ public class Reflection {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -7,7 +7,7 @@ load: POSTWORLD
|
|||||||
description: SimplifyTools - An All-in-one helper plugin.
|
description: SimplifyTools - An All-in-one helper plugin.
|
||||||
author: SimplifyDave
|
author: SimplifyDave
|
||||||
website: https://ditservices.hu
|
website: https://ditservices.hu
|
||||||
#depend: [ProtocolLib]
|
depend: [ ProtocolLib ]
|
||||||
commands:
|
commands:
|
||||||
st:
|
st:
|
||||||
description: The default command for the plugin.
|
description: The default command for the plugin.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user