1.2.1
This commit is contained in:
		| @@ -1,7 +1,12 @@ | ||||
| # SimplifyTools   | ||||
| ### An 'All-in-one' plugin for MC servers.  | ||||
| #### TabList Customizing, Custom Advancement, Connect messages, AutoSave, Logger | ||||
|  [](https://ci.ditservices.hu/job/SimplifyTools/)     [](https://bstats.org/plugin/bukkit/SimplifyTools/15108)  | ||||
|  [](https://ci.ditservices.hu/job/SimplifyTools/)     [](https://bstats.org/plugin/bukkit/SimplifyTools/15108)  | ||||
| <br>[Changelog](docs/ChangeLog.md) | ||||
| <hr> | ||||
|  | ||||
|  | ||||
|  | ||||
| ## Features | ||||
|  | ||||
|  - **Tab Manager** - Allows you to specify colored texts, with animations on the tab window. | ||||
| @@ -10,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. | ||||
|  - **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. | ||||
|  (Note: The plugin just shows the stats not recording itself, so stats before installing this plugin are counted too.) | ||||
|    | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
|     <orderEntry type="library" name="Maven: com.jeff_media:SpigotUpdateChecker:2.2.0" level="project" /> | ||||
|     <orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:3.0.0" level="project" /> | ||||
|     <orderEntry type="library" name="Maven: org.bstats:bstats-base:3.0.0" level="project" /> | ||||
|     <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT" 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:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" /> | ||||
| @@ -36,8 +36,9 @@ | ||||
|     <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.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: org.yaml:snakeyaml:1.33" level="project" /> | ||||
|     <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.19.3-R0.1-SNAPSHOT" 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.20.1-R0.1-SNAPSHOT" level="project" /> | ||||
|   </component> | ||||
| </module> | ||||
| @@ -1,4 +1,11 @@ | ||||
| # 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  | ||||
|   | ||||
							
								
								
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -6,7 +6,7 @@ | ||||
|  | ||||
|     <groupId>hu.ditservices</groupId> | ||||
|     <artifactId>SimplifyTools</artifactId> | ||||
|     <version>1.2.0</version> | ||||
|     <version>1.2.1</version> | ||||
|     <packaging>jar</packaging> | ||||
|  | ||||
|     <name>SimplifyTools</name> | ||||
| @@ -130,14 +130,14 @@ | ||||
|         <dependency> | ||||
|             <groupId>org.spigotmc</groupId> | ||||
|             <artifactId>spigot-api</artifactId> | ||||
|             <version>1.19.3-R0.1-SNAPSHOT</version> | ||||
|             <version>1.20.1-R0.1-SNAPSHOT</version> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|         <!-- from downloaded craftbukkit-x.xx.x.jar\META-INF\versions\ --> | ||||
|         <dependency> | ||||
|             <groupId>org.bukkit</groupId> | ||||
|             <artifactId>craftbukkit</artifactId> | ||||
|             <version>1.19.3-R0.1-SNAPSHOT</version> | ||||
|             <version>1.20.1-R0.1-SNAPSHOT</version> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|  | ||||
|   | ||||
| @@ -49,15 +49,14 @@ public final class STPlugin extends JavaPlugin implements CommandExecutor, Liste | ||||
|             this.setEnabled(false); | ||||
|             return; | ||||
|         } | ||||
|         //this.dplug = new DitPluginManager(this); | ||||
|         this.log.info(this.getPrefix()+"Started running."); | ||||
|         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.19.3 to run this plugin."); | ||||
|             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()){ | ||||
|  | ||||
| @@ -73,7 +72,7 @@ public final class STPlugin extends JavaPlugin implements CommandExecutor, Liste | ||||
|             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(this.getPrefix()+"Custom Advancement Messages enabled!"); | ||||
|                 this.log.info(ChatColor.stripColor(this.getPrefix()) + "Custom Advancement Messages enabled!"); | ||||
|             } | ||||
|             Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new TPS(), 0, 1); | ||||
|  | ||||
| @@ -154,6 +153,6 @@ public final class STPlugin extends JavaPlugin implements CommandExecutor, Liste | ||||
|     } | ||||
|     @Override | ||||
|     public void onDisable() { | ||||
|         System.out.println(this.getPrefix()+" stopped."); | ||||
|         this.log.info(ChatColor.stripColor(this.getPrefix()) + "Started running."); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -87,13 +87,18 @@ public class DitCmd implements CommandExecutor { | ||||
|                             sender.sendMessage(plugin.getPrefix()+ChatColor.DARK_RED+"Invalid arguments!"); | ||||
|                             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 (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; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
| @@ -101,7 +106,7 @@ public class DitCmd implements CommandExecutor { | ||||
|  | ||||
|                 if (command.getName().equalsIgnoreCase("st") && args[0].contains("save-all") && sender.hasPermission("st.save")){ | ||||
|                     this.addToCoolDown(sender); | ||||
|                     return SaveCmd.Run(sender); | ||||
|                     return SaveCmd.Run(); | ||||
|                 } | ||||
|  | ||||
|                 if (command.getName().equalsIgnoreCase("st") && args[0].contains("ping") &&  sender.hasPermission("st.ping")){ | ||||
|   | ||||
| @@ -3,10 +3,14 @@ package hu.ditservices.commands; | ||||
| import hu.ditservices.STPlugin; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.World; | ||||
| import org.bukkit.command.CommandSender; | ||||
|  | ||||
| public class SaveCmd { | ||||
|     public static boolean Run(CommandSender sender){ | ||||
|     /** | ||||
|      * 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()); | ||||
|   | ||||
| @@ -1,33 +1,10 @@ | ||||
| package hu.ditservices.handlers; | ||||
|  | ||||
| import hu.ditservices.STPlugin; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.World; | ||||
| import org.bukkit.entity.Player; | ||||
| import hu.ditservices.commands.SaveCmd; | ||||
|  | ||||
| public class SaveHandler implements Runnable{ | ||||
|     STPlugin plugin = STPlugin.getInstance(); | ||||
|     @Override | ||||
|     public void run() { | ||||
|  | ||||
|         String p = plugin.config.isSet("Saving.broadcastMsgProgress") ? plugin.config.getString("Saving.broadcastMsgProgress").replace("{PREFIX}",plugin.getPrefix()) : plugin.getPrefix()+"Auto save in progress.."; | ||||
|         String d = plugin.config.isSet("Saving.broadcastMsgDone") ? plugin.config.getString("Saving.broadcastMsgDone").replace("{PREFIX}",plugin.getPrefix()) : plugin.getPrefix()+"Auto save done."; | ||||
|         if (Bukkit.getOnlinePlayers().size()>0){ | ||||
|             for (Player player : Bukkit.getOnlinePlayers()){ | ||||
|                 player.sendMessage(p); | ||||
|             } | ||||
|         } | ||||
|         plugin.getLogger().info(p); | ||||
|         for(World w : Bukkit.getServer().getWorlds()){ | ||||
|             w.save(); | ||||
|         } | ||||
|         Bukkit.savePlayers(); | ||||
|         if (Bukkit.getOnlinePlayers().size()>0){ | ||||
|             for (Player player : Bukkit.getOnlinePlayers()){ | ||||
|                 player.sendMessage(d); | ||||
|             } | ||||
|         } | ||||
|         plugin.getLogger().info(d); | ||||
|  | ||||
|         SaveCmd.Run(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -261,7 +261,7 @@ public class TabHandler { | ||||
|             msg = msg.replace("{MOTD}", plugin.getServer().getMotd()); //LegacyComponentSerializer.legacyAmpersand().serialize(plugin.getServer().motd().asComponent()) | ||||
|         } | ||||
|         if (msg.contains("{TPS}")){ | ||||
|             msg = msg.replace("{TPS}",String.format("%.2f", TPS.getTPS())); | ||||
|             msg = msg.replace("{TPS}",String.valueOf(java.lang.Math.round(TPS.getTPS()))); | ||||
|         } | ||||
|         return ChatColor.translateAlternateColorCodes('&',msg); | ||||
|     } | ||||
|   | ||||
| @@ -14,10 +14,12 @@ import hu.ditservices.utils.AdvancementHelper; | ||||
| public class ChatEvents implements Listener { | ||||
|     private STPlugin plugin; | ||||
|     private FileConfiguration config; | ||||
|  | ||||
|     public ChatEvents(STPlugin instance){ | ||||
|         this.plugin = instance; | ||||
|         this.config = plugin.config; | ||||
|     } | ||||
|  | ||||
|     @EventHandler(priority = EventPriority.MONITOR) | ||||
|     public void onAdvance(PlayerAdvancementDoneEvent e){ | ||||
|         if (config.isSet("CustomAdvancement.enabled") && config.getBoolean("CustomAdvancement.enabled")){ | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package hu.ditservices.utils; | ||||
|  | ||||
| import hu.ditservices.STPlugin; | ||||
| import org.bukkit.ChatColor; | ||||
| import org.bukkit.GameRule; | ||||
| import org.bukkit.World; | ||||
| import org.bukkit.configuration.file.FileConfiguration; | ||||
| @@ -115,24 +116,26 @@ public class AdvancementHelper { | ||||
|         if (config.isSet("CustomAdvancement.formats.challenge")) { | ||||
|             out_type[2] = config.getString("CustomAdvancement.formats.challenge"); | ||||
|         } | ||||
|         String disablemsg = plugin.getPrefix()+"Disabling vanilla advancement messages for "; | ||||
|         List<World> worlds = this.plugin.getServer().getWorlds(); | ||||
|         Method setRuleMethod, getRuleMethod; | ||||
|  | ||||
|         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()); | ||||
|                             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()); | ||||
|                             this.plugin.getLogger().info(disableMsg + w.getName()); | ||||
|                         } | ||||
|  | ||||
|                     } | ||||
|   | ||||
| @@ -26,7 +26,8 @@ public class Version { | ||||
|         v1_18_R1, | ||||
|         v1_18_R2, | ||||
|         v1_19_R1, | ||||
|         v1_19_R2; | ||||
|         v1_19_R2, | ||||
|         v1_20_R1; | ||||
|  | ||||
|         private int value; | ||||
|  | ||||
|   | ||||
| @@ -80,6 +80,12 @@ Cooldown: | ||||
|   # The time must be passed between using this plugin commands. | ||||
|   seconds: 2 #The command cooldown in seconds | ||||
|   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 | ||||
| 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. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user