Created
November 19, 2020 00:41
-
-
Save jonagamerpro1234/e1fbb1b9e50a018dbaee474fc2c6387a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="ProjectCodeStyleConfiguration"> | |
<state> | |
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> | |
</state> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="CompilerConfiguration"> | |
<annotationProcessing> | |
<profile name="Maven default annotation processors profile" enabled="true"> | |
<sourceOutputDir name="target/generated-sources/annotations" /> | |
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> | |
<outputRelativeToContentRoot value="true" /> | |
<module name="AdvancedChat" /> | |
</profile> | |
</annotationProcessing> | |
<bytecodeTargetLevel> | |
<module name="AdvancedChat" target="1.8" /> | |
</bytecodeTargetLevel> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Encoding" addBOMForNewFiles="with NO BOM"> | |
<file url="file://$PROJECT_DIR$" charset="UTF-8" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="libraryTable"> | |
<library name="Maven: com.google.code.gson:gson:2.8.0"> | |
<CLASSES> | |
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar!/" /> | |
</CLASSES> | |
<JAVADOC> | |
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0-javadoc.jar!/" /> | |
</JAVADOC> | |
<SOURCES> | |
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0-sources.jar!/" /> | |
</SOURCES> | |
</library> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="libraryTable"> | |
<library name="Maven: com.google.guava:guava:21.0"> | |
<CLASSES> | |
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0.jar!/" /> | |
</CLASSES> | |
<JAVADOC> | |
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0-javadoc.jar!/" /> | |
</JAVADOC> | |
<SOURCES> | |
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0-sources.jar!/" /> | |
</SOURCES> | |
</library> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="libraryTable"> | |
<library name="Maven: commons-lang:commons-lang:2.6"> | |
<CLASSES> | |
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/" /> | |
</CLASSES> | |
<JAVADOC> | |
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-javadoc.jar!/" /> | |
</JAVADOC> | |
<SOURCES> | |
<root url="jar://$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar!/" /> | |
</SOURCES> | |
</library> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="libraryTable"> | |
<library name="Maven: net.md-5:bungeecord-chat:1.16-R0.3"> | |
<CLASSES> | |
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.16-R0.3/bungeecord-chat-1.16-R0.3.jar!/" /> | |
</CLASSES> | |
<JAVADOC> | |
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.16-R0.3/bungeecord-chat-1.16-R0.3-javadoc.jar!/" /> | |
</JAVADOC> | |
<SOURCES> | |
<root url="jar://$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.16-R0.3/bungeecord-chat-1.16-R0.3-sources.jar!/" /> | |
</SOURCES> | |
</library> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="libraryTable"> | |
<library name="Maven: org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT"> | |
<CLASSES> | |
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.4-R0.1-SNAPSHOT/spigot-api-1.16.4-R0.1-20201118.232026-23.jar!/" /> | |
</CLASSES> | |
<JAVADOC> | |
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.4-R0.1-SNAPSHOT/spigot-api-1.16.4-R0.1-20201118.232026-23-javadoc.jar!/" /> | |
</JAVADOC> | |
<SOURCES> | |
<root url="jar://$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.16.4-R0.1-SNAPSHOT/spigot-api-1.16.4-R0.1-20201118.232026-23-sources.jar!/" /> | |
</SOURCES> | |
</library> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="libraryTable"> | |
<library name="Maven: org.yaml:snakeyaml:1.26"> | |
<CLASSES> | |
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.26/snakeyaml-1.26.jar!/" /> | |
</CLASSES> | |
<JAVADOC> | |
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.26/snakeyaml-1.26-javadoc.jar!/" /> | |
</JAVADOC> | |
<SOURCES> | |
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.26/snakeyaml-1.26-sources.jar!/" /> | |
</SOURCES> | |
</library> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="EntryPointsManager"> | |
<list size="1"> | |
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" /> | |
</list> | |
</component> | |
<component name="MavenProjectsManager"> | |
<option name="originalFiles"> | |
<list> | |
<option value="$PROJECT_DIR$/pom.xml" /> | |
</list> | |
</option> | |
</component> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/AdvancedChat.iml" filepath="$PROJECT_DIR$/AdvancedChat.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | |
<component name="FacetManager"> | |
<facet type="minecraft" name="Minecraft"> | |
<configuration> | |
<autoDetectTypes> | |
<platformType>SPIGOT</platformType> | |
</autoDetectTypes> | |
</configuration> | |
</facet> | |
</component> | |
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> | |
<output url="file://$MODULE_DIR$/target/classes" /> | |
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | |
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | |
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | |
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> | |
<excludeFolder url="file://$MODULE_DIR$/target" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT" level="project" /> | |
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" /> | |
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" /> | |
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" /> | |
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" /> | |
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>jss.advancedchat</groupId> | |
<artifactId>AdvancedChat</artifactId> | |
<version>1.4.0</version> | |
<packaging>jar</packaging> | |
<name>AdvancedChat</name> | |
<description>Its main function is to modify the chat so that it can be personalized and add different options | |
</description> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<url>https://www.spigotmc.org/resources/advancedchat-1-7-x-1-16-x.83889/</url> | |
<build> | |
<defaultGoal>clean package</defaultGoal> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.7.0</version> | |
<configuration> | |
<source>1.8</source> | |
<target>1.8</target> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>3.1.0</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> | |
<configuration> | |
<createDependencyReducedPom>false</createDependencyReducedPom> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
<resources> | |
<resource> | |
<directory>src/main/resources</directory> | |
<filtering>true</filtering> | |
</resource> | |
</resources> | |
</build> | |
<repositories> | |
<repository> | |
<id>spigotmc-repo</id> | |
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url> | |
</repository> | |
<repository> | |
<id>sonatype</id> | |
<url>https://oss.sonatype.org/content/groups/public/</url> | |
</repository> | |
</repositories> | |
<dependencies> | |
<dependency> | |
<groupId>org.spigotmc</groupId> | |
<artifactId>spigot-api</artifactId> | |
<version>1.16.4-R0.1-SNAPSHOT</version> | |
<scope>provided</scope> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat; | |
import java.util.ArrayList; | |
import org.bukkit.Bukkit; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.plugin.PluginDescriptionFile; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import jss.advancedchat.commands.AdvancedChatCmd; | |
import jss.advancedchat.commands.ClearChatCmd; | |
import jss.advancedchat.events.ChatListener; | |
import jss.advancedchat.events.EventLoader; | |
import jss.advancedchat.events.JoinListener; | |
import jss.advancedchat.utils.FileManager; | |
import jss.advancedchat.utils.Logger; | |
import jss.advancedchat.utils.Logger.Level; | |
import jss.advancedchat.utils.Settings; | |
import jss.advancedchat.utils.UpdateChecker; | |
import jss.advancedchat.utils.Utils; | |
public class AdvancedChat extends JavaPlugin{ | |
PluginDescriptionFile jss = getDescription(); | |
public String name = this.jss.getName(); | |
public String version = this.jss.getVersion(); | |
public Metrics metrics; | |
public String latestversion; | |
public boolean placeholders = false; | |
private CommandSender c= Bukkit.getConsoleSender(); | |
private boolean debug = false; | |
private FileManager filemanager = new FileManager(this); | |
private PlayerDataFile playerdata = new PlayerDataFile(this, "Data", "players.data"); | |
private ConfigFile configfile = new ConfigFile(this, "config.yml"); | |
public String nmsversion; | |
public boolean uselegacyversion = false; | |
private Logger logger = new Logger(this); | |
public ArrayList<String> mute = new ArrayList<String>(); | |
public void onEnable() { | |
Utils.getEnable(version);; | |
nmsversion = Bukkit.getServer().getClass().getPackage().getName(); | |
nmsversion = nmsversion.substring(nmsversion.lastIndexOf(".") + 1); | |
if (nmsversion.equalsIgnoreCase("v1_8_R3")) { | |
uselegacyversion = true; | |
if(uselegacyversion == true) { | |
Utils.sendColorMessage(c, Utils.getPrefixConsole() + " " + "&7Use " + nmsversion + " &cdisabled &7method &b1.16"); | |
} | |
}else if(nmsversion.equalsIgnoreCase("v1_16_R2")){ | |
Utils.sendColorMessage(c, Utils.getPrefixConsole() + " " + "&7Use " + nmsversion + " &aenabled &7method &b1.16"); | |
} | |
configfile.saveDefaultConfig(); | |
configfile.create(); | |
filemanager.createVoidFolder("Data"); | |
playerdata.create(); | |
metrics = new Metrics(this); | |
setupCommands(); | |
setupEvents(); | |
SetupSoftDepends(); | |
new UpdateChecker(this, 83889).getUpdateVersion(version ->{ | |
if(this.getDescription().getVersion().equalsIgnoreCase(version)) { | |
logger.Log(Level.SUCCESS, "&a" + this.name + " is up to date!"); | |
}else { | |
logger.Log(Level.OUTLINE, "&5<|" + Utils.getLine("&5")); | |
logger.Log(Level.WARNING, "&5<|" + "&b"+ this.name + " is outdated!"); | |
logger.Log(Level.WARNING, "&5<|" + "&bNewest version: &a" + version); | |
logger.Log(Level.WARNING, "&5<|" + "&bYour version: &d" + Settings.VERSION); | |
logger.Log(Level.WARNING, "&5<|" + "&bPlease Update Here: &e" + Settings.URL_PLUGIN); | |
logger.Log(Level.OUTLINE, "&5<|" + Utils.getLine("&5")); | |
} | |
}); | |
} | |
public void onDisable() { | |
Utils.getDisable(version); | |
this.placeholders = false; | |
this.metrics = null; | |
this.uselegacyversion = false; | |
} | |
public void setupCommands() { | |
new AdvancedChatCmd(this); | |
new ClearChatCmd(this); | |
//new MuteCmd(this); | |
} | |
public void setupEvents() { | |
new JoinListener(this); | |
new ChatListener(this); | |
EventLoader loader = new EventLoader(this); | |
loader.runClearChat(); | |
} | |
public PlayerDataFile getPlayerDataFile() { | |
return this.playerdata; | |
} | |
public ConfigFile getConfigfile() { | |
return configfile; | |
} | |
public boolean getPlaceHolderState() { | |
return this.placeholders; | |
} | |
public boolean setupPlaceHolderAPI(){ | |
if (getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) { | |
this.placeholders = true; | |
} | |
return this.placeholders; | |
} | |
public void SetupSoftDepends() { | |
if(setupPlaceHolderAPI()) { | |
Utils.sendColorMessage(c, "&e[&d"+ name +"&e] &5 <|============================================|>"); | |
Utils.sendColorMessage(c, Utils.getPrefixConsole() + " &5<| &ePlaceHolderAPI:&b" + " " + placeholders); | |
Utils.sendColorMessage(c, Utils.getPrefixConsole() + " &5<| &eVars PlaceHolderAPI:&a true"); | |
Utils.sendColorMessage(c, "&e[&d"+ name +"&e] &5 <|============================================|>"); | |
}else { | |
Utils.sendColorMessage(c, "&e[&d"+ name +"&e] &5 <|============================================|>"); | |
Utils.sendColorMessage(c, Utils.getPrefixConsole() + " &5<| &ePlaceHolderAPI:&b" + " " + placeholders); | |
Utils.sendColorMessage(c, Utils.getPrefixConsole() + " &5<| &eVars PlaceHolderAPI:&c false"); | |
Utils.sendColorMessage(c, "&e[&d"+ name +"&e] &5 <|============================================|>"); | |
} | |
} | |
public boolean isDebug() { | |
return debug; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.commands; | |
import java.util.List; | |
import org.bukkit.Bukkit; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandExecutor; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.entity.Player; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.utils.Utils; | |
import net.md_5.bungee.api.ChatColor; | |
import net.md_5.bungee.api.chat.ComponentBuilder; | |
import net.md_5.bungee.api.chat.HoverEvent; | |
import net.md_5.bungee.api.chat.TextComponent; | |
public class AdvancedChatCmd implements CommandExecutor{ | |
private AdvancedChat plugin; | |
private CommandSender c = Bukkit.getConsoleSender(); | |
public AdvancedChatCmd(AdvancedChat plugin) { | |
this.plugin = plugin; | |
plugin.getCommand("AdvancedChat").setExecutor(this); | |
} | |
@SuppressWarnings("deprecation") | |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | |
FileConfiguration config = plugin.getConfig(); | |
if(!(sender instanceof Player)) { | |
Utils.sendColorMessage(c, Utils.getPrefixConsole() +" "+ config.getString("AdvancedChat.Error-Console")); | |
return false; | |
} | |
Player j = (Player) sender; | |
if(args.length >= 1) { | |
if(args[0].equalsIgnoreCase("info")) { | |
Utils.sendColorMessage(j, "&5-=-=-=-=-=[&b"+plugin.name+"&5]=-=-=-=-=-=-"); | |
Utils.sendColorMessage(j, "&5> &3Name: &b"+plugin.name); | |
Utils.sendColorMessage(j, "&5> &3Author: &6jonagamerpro1234"); | |
Utils.sendColorMessage(j, "&5> &3Version: &6"+plugin.version); | |
Utils.sendColorMessage(j, "&5> &3Update: &a" + plugin.latestversion); | |
Utils.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); | |
return true; | |
} | |
if(args[0].equalsIgnoreCase("help")) { | |
if(!(j.hasPermission("AdvancedChat.Commands.Help")) || !(j.isOp())) { | |
TextComponent msg = new TextComponent(); | |
msg.setText(Utils.color(config.getString("AdvancedChat.No-Permission"))); | |
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT , new ComponentBuilder(config.getString("AdvancedChat.No-Permission-Label")).color(ChatColor.YELLOW).create())); | |
j.spigot().sendMessage(msg); | |
return true; | |
} | |
List<String> help = config.getStringList("AdvancedChat.Help-Msg"); | |
Utils.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d"+plugin.name+"&6]&5=-=-=-=-=-=-=-=-=-=-=-"); | |
for(int i = 0; i < help.size(); i++) { | |
String text = (String) help.get(i); | |
Utils.sendColorMessage(j, text); | |
} | |
Utils.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); | |
return true; | |
} | |
if(args[0].equalsIgnoreCase("reload")) { | |
if(!(j.hasPermission("AdvancedChat.Commands.Reload")) || !(j.isOp())) { | |
TextComponent msg = new TextComponent(); | |
msg.setText(Utils.color(config.getString("AdvancedChat.No-Permission"))); | |
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT , new ComponentBuilder(config.getString("AdvancedChat.No-Permission-Label")).color(ChatColor.YELLOW).create())); | |
j.spigot().sendMessage(msg); | |
return true; | |
} | |
plugin.reloadConfig(); | |
if(config.getString("Settings.Use-Default-Prefix").equals("true")) { | |
Utils.sendColorMessage(j, Utils.getPrefixPlayer() + " " + config.getString("AdvancedChat.Reload")); | |
}else if(config.getString("Settings.Use-Default-Prefix").equals("false")) { | |
Utils.sendColorMessage(j, config.getString("Settings.Prefix") + " " + config.getString("AdvancedChat.Reload")); | |
} | |
return true; | |
} | |
if(config.getString("Settings.Use-Default-Prefix").equals("true")) { | |
Utils.sendColorMessage(j, Utils.getPrefixPlayer() + " " + config.getString("AdvancedChat.Error-Args")); | |
}else if(config.getString("Settings.Use-Default-Prefix").equals("false")) { | |
Utils.sendColorMessage(j, config.getString("Settings.Prefix") + " " + config.getString("AdvancedChat.Error-Args")); | |
} | |
return true; | |
} | |
if(config.getString("Settings.Use-Default-Prefix").equals("true")) { | |
Utils.sendColorMessage(j, Utils.getPrefixPlayer() + " " + config.getString("AdvancedChat.Help-Cmd")); | |
}else if(config.getString("Settings.Use-Default-Prefix").equals("false")) { | |
Utils.sendColorMessage(j, config.getString("Settings.Prefix") + " " + config.getString("AdvancedChat.Help-Cmd")); | |
} | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.commands; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandExecutor; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.entity.Player; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.utils.EventsUtils; | |
import jss.advancedchat.utils.Utils; | |
import net.md_5.bungee.api.ChatColor; | |
import net.md_5.bungee.api.chat.ComponentBuilder; | |
import net.md_5.bungee.api.chat.HoverEvent; | |
import net.md_5.bungee.api.chat.TextComponent; | |
public class ClearChatCmd implements CommandExecutor{ | |
private AdvancedChat plugin; | |
private EventsUtils eventsUtils = new EventsUtils(plugin); | |
public ClearChatCmd(AdvancedChat plugin) { | |
this.plugin = plugin; | |
plugin.getCommand("ClearChat").setExecutor(this); | |
} | |
@SuppressWarnings("deprecation") | |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | |
FileConfiguration config = plugin.getConfig(); | |
if(!(sender instanceof Player)) { | |
Utils.sendColorMessage(eventsUtils.getConsoleSender(), Utils.getPrefixConsole() +" "+ config.getString("AdvancedChat.Error-Console")); | |
return false; | |
} | |
Player j = (Player) sender; | |
if(!(j.hasPermission("AdvancedChat.Commands.ClearChat")) || !(j.isOp())) { | |
TextComponent msg = new TextComponent(); | |
msg.setText(Utils.color(config.getString("AdvancedChat.No-Permission"))); | |
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT , new ComponentBuilder(config.getString("AdvancedChat.No-Permission-Label")).color(ChatColor.YELLOW).create())); | |
j.spigot().sendMessage(msg); | |
return true; | |
} | |
eventsUtils.getClearChatAction(j, "player"); | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.commands; | |
import org.bukkit.Bukkit; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandExecutor; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.entity.Player; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.utils.Utils; | |
public class MuteCmd implements CommandExecutor { | |
private AdvancedChat plugin; | |
public MuteCmd(AdvancedChat plugin) { | |
this.plugin = plugin; | |
plugin.getCommand("Mute").setExecutor(this); | |
} | |
@SuppressWarnings("null") | |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | |
Player j = (Player) sender; | |
if (sender instanceof Player) { | |
FileConfiguration config = plugin.getConfigfile().getConfig(); | |
Player p = Bukkit.getPlayer(args[0]); | |
if (p == null) { | |
Utils.sendColorMessage(j, config.getString("AdvancedChat.No-Online-Player").replace("<name>", p.getName())); | |
} | |
if (!plugin.mute.contains(p.getName())) { | |
Utils.sendColorMessage(!plugin.mute.contains(p.getName())+""); | |
} else { | |
plugin.mute.add(p.getName()); | |
} | |
} else { | |
Utils.sendColorMessage(j, "Test Use /mute <player>"); | |
} | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.commands; | |
import org.bukkit.Bukkit; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandExecutor; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.entity.Player; | |
import jss.advancedchat.AdvancedChat; | |
public class UnMuteCmd implements CommandExecutor { | |
private AdvancedChat plugin; | |
public UnMuteCmd(AdvancedChat plugin) { | |
this.plugin = plugin; | |
plugin.getCommand("UnMute").setExecutor(this); | |
} | |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | |
if (sender instanceof Player) { | |
Player p = Bukkit.getPlayer(args[0]); | |
if (p == null) { | |
} | |
if (plugin.mute.contains(p.getName())) { | |
plugin.mute.remove(p.getName()); | |
} else { | |
} | |
} else { | |
} | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.Reader; | |
import java.io.UnsupportedEncodingException; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.configuration.file.YamlConfiguration; | |
import jss.advancedchat.utils.FileManager; | |
import jss.advancedchat.utils.interfaces.FileHelper; | |
public class ConfigFile extends FileManager implements FileHelper { | |
private AdvancedChat plugin; | |
private File file; | |
private FileConfiguration config; | |
private String path; | |
public ConfigFile(AdvancedChat plugin, String path) { | |
super(plugin); | |
this.plugin = plugin; | |
this.file = null; | |
this.config = null; | |
this.path = path; | |
} | |
public void create() { | |
this.file = new File(getDataFolder(), this.path); | |
if(!this.file.exists()) { | |
getConfig().options().copyDefaults(true); | |
saveConfig(); | |
} | |
} | |
public FileConfiguration getConfig() { | |
if(this.config == null) { | |
reloadConfig(); | |
} | |
return this.config; | |
} | |
public void saveConfig() { | |
try { | |
this.config.save(this.file); | |
}catch(IOException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
public void reloadConfig() { | |
if(this.config == null) { | |
this.file = new File(getDataFolder(), this.path); | |
} | |
this.config = YamlConfiguration.loadConfiguration(this.file); | |
Reader defaultConfigStream; | |
try { | |
defaultConfigStream = new InputStreamReader(getResources(this.path), "UTF8"); | |
if(defaultConfigStream != null) { | |
YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(defaultConfigStream); | |
config.setDefaults(defaultConfig); | |
} | |
}catch(UnsupportedEncodingException ex) { | |
ex.printStackTrace(); | |
}catch(NullPointerException e) { | |
e.printStackTrace(); | |
} | |
} | |
public String getPath() { | |
return this.path; | |
} | |
public AdvancedChat getPlugin() { | |
return plugin; | |
} | |
public void saveDefaultConfig() { | |
if(this.file == null) { | |
this.file = new File(getDataFolder(), this.path); | |
} | |
if(!this.file.exists()) { | |
saveResources(this.path, false); | |
} | |
} | |
public void resetConfig() { | |
if(this.file == null) { | |
this.file = new File(getDataFolder(), this.path); | |
} | |
if(!this.file.exists()) { | |
saveResources(this.path, true); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.events; | |
import java.lang.reflect.InvocationTargetException; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import org.bukkit.Bukkit; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.entity.Player; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.player.AsyncPlayerChatEvent; | |
import org.bukkit.scheduler.BukkitScheduler; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.ConfigFile; | |
import jss.advancedchat.utils.Utils; | |
import jss.advancedchat.utils.EventsUtils; | |
import me.clip.placeholderapi.PlaceholderAPI; | |
import net.md_5.bungee.api.chat.BaseComponent; | |
import net.md_5.bungee.api.chat.ComponentBuilder; | |
import net.md_5.bungee.api.chat.HoverEvent; | |
import net.md_5.bungee.api.chat.TextComponent; | |
public class ChatListener implements Listener { | |
private AdvancedChat plugin; | |
public Map<String,Long> delaywords = new HashMap<String,Long>(); | |
private EventsUtils eventsUtils = new EventsUtils(plugin); | |
public ChatListener(AdvancedChat plugin) { | |
this.plugin = plugin; | |
eventsUtils.addEventList(this); | |
} | |
@SuppressWarnings("deprecation") | |
@EventHandler | |
public void onChatFormat(AsyncPlayerChatEvent e) { | |
ConfigFile configFile = plugin.getConfigfile(); | |
FileConfiguration config = configFile.getConfig(); | |
Player j = e.getPlayer(); | |
try { | |
String path = "Settings.ChatFormat-Type"; | |
if(config.getString(path).equals("Default")) { | |
e.setFormat("<"+j.getName()+">" + " " + e.getMessage()); | |
}else if(config.getString(path).equals("Custom")) { | |
String format = config.getString("Custom-Format.Text"); | |
String pathtype = "Custom-Format.Type"; | |
String hovertext = config.getString("Custom-Format.HoverEvent.Text"); | |
String hovermode = config.getString("Custom-Format.HoverEvent.Mode"); | |
format = replacePlaceholderAPI(j, format); | |
format = getAllVars(j, format); | |
format = format.replace("<msg>", e.getMessage()); | |
hovertext = replacePlaceholderAPI(j, hovertext); | |
hovertext = getAllVars(j, hovertext); | |
//format = format.replace("<name>", FormatChatHover(j, hovertext, hovermode, hovercolor)); | |
if(!(j.hasPermission("AdvancedChat.Chat.Color")) || !(j.isOp())) { | |
format = Utils.hexcolor(format); | |
} | |
if(config.getString(pathtype).equals("Normal")) { | |
e.setFormat(format.replace("<name>", j.getName()).replace("<msg>", e.getMessage())); | |
}else if(config.getString(pathtype).equals("Experimental")) { | |
TextComponent tc = new TextComponent(e.getFormat()); | |
HoverEvent hover = new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(hovermode)), new ComponentBuilder(Utils.color(hovertext)).create()); | |
tc.setHoverEvent(hover); | |
tc.setText(format); | |
e.setCancelled(true); | |
sendAllPlayer(tc); | |
} | |
}else if(config.getString(path).equals("Group")) { | |
for(String key : config.getConfigurationSection("Groups").getKeys(false)) { | |
String pathtype = config.getString("Groups."+key+".Type"); | |
String format = config.getString("Groups."+key+".Format"); | |
String perm = config.getString("Groups."+key+".Permission"); | |
String hovertext = config.getString("Groups."+key+"HoverEvent.Text"); | |
String hovermode = config.getString("Groups."+key+"HoverEvent.Mode"); | |
hovertext = replacePlaceholderAPI(j, hovertext); | |
hovertext = getAllVars(j, hovertext); | |
format = replacePlaceholderAPI(j, format); | |
format = getAllVars(j, format); | |
format = format.replace("<msg>", e.getMessage()); | |
if(!(j.hasPermission("AdvancedChat.Chat.Color")) || !(j.isOp())) { | |
format = Utils.hexcolor(format); | |
} | |
if(config.getString(pathtype).equals("Normal")) { | |
if(j.hasPermission(perm)) { | |
e.setFormat(format.replace("<name>", j.getName()).replace("<msg>", e.getMessage())); | |
} | |
}else if(config.getString(pathtype).equals("Experimental")) { | |
if(j.hasPermission(perm)) {} | |
TextComponent tc = new TextComponent(e.getFormat()); | |
HoverEvent hover = new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(hovermode)), new ComponentBuilder(Utils.color(hovertext)).create()); | |
tc.setHoverEvent(hover); | |
tc.setText(format); | |
e.setCancelled(true); | |
sendAllPlayer(tc); | |
} | |
} | |
}else { | |
e.setFormat(Utils.color(config.getString("Default-Format").replace("<name>", j.getName()).replace("<msg>", e.getMessage()))); | |
} | |
}catch(NullPointerException ex) { } | |
} | |
@SuppressWarnings("unused") | |
@EventHandler | |
public void onChatFilter(AsyncPlayerChatEvent e) { | |
Player j = e.getPlayer(); | |
FileConfiguration config = plugin.getConfig(); | |
try { | |
String path = "Filter-Chat."; | |
List<String> list = config.getStringList(path+"BadWords"); | |
String censorship = config.getString(path+"Form-Of-Censorship"); | |
String msg = config.getString(path+"Message"); | |
String usemsg = config.getString(path+"Use-Custom-Msg"); | |
int time = config.getInt(path+"Delay"); | |
if(config.getString(path+"Enabled").equals("true")) { | |
if(usemsg.equals("true")) { | |
for(int i = 0; i < list.size(); i++) { | |
BukkitScheduler scheduler = plugin.getServer().getScheduler(); | |
scheduler.scheduleSyncDelayedTask(plugin, new Runnable() { | |
@Override | |
public void run() { | |
} | |
}, 20L * time); | |
} | |
}else if(usemsg.equals("false")){ | |
for(int i = 0; i < list.size(); i++) { | |
} | |
} | |
} | |
}catch(NullPointerException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
@EventHandler | |
public void onChat(AsyncPlayerChatEvent e) { | |
Player j = e.getPlayer(); | |
if(plugin.mute.contains(j.getName())) { | |
e.setCancelled(true); | |
} | |
} | |
public void sendAllPlayer(BaseComponent component) { | |
for(Player player : Bukkit.getOnlinePlayers()) { | |
player.spigot().sendMessage(component); | |
} | |
} | |
public String getActionHoverType(String arg) { | |
String temp = arg; | |
if(temp.equalsIgnoreCase("text")) { | |
return "SHOW_TEXT"; | |
} | |
if(temp.equalsIgnoreCase("item")) { | |
return "SHOW_ITEM"; | |
} | |
if(temp.equalsIgnoreCase("entity")) { | |
return "SHOW_ENTITY"; | |
} | |
return null; | |
} | |
public String getActionClickType(String arg) { | |
String temp = arg; | |
if(temp.equalsIgnoreCase("url")) { | |
return "OPER_URL"; | |
} | |
if(temp.equalsIgnoreCase("cmd")) { | |
return "RUN_COMMAND"; | |
} | |
return null; | |
} | |
@Deprecated | |
public String FormatChatHover(Player player, String hovertext, String hovermode, String hovercolor) { | |
TextComponent msg = new TextComponent(); | |
msg.setText(player.getName()); | |
msg.setColor(Utils.fixcolor(hovercolor)); | |
return null; | |
} | |
public String replacePlaceholderAPI(Player p, String message){ | |
String holders = message; | |
if ((plugin.placeholders) && (PlaceholderAPI.containsPlaceholders(holders))) { | |
holders = PlaceholderAPI.setPlaceholders(p, holders); | |
} | |
return holders; | |
} | |
public String getAllVars(Player j, String msg) { | |
int playersOnline = 0; | |
try | |
{ | |
if (Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).getReturnType() == Collection.class) { | |
playersOnline = ((Collection<?>)Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).size(); | |
} else { | |
playersOnline = ((Player[])Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).length; | |
} | |
} | |
catch (NoSuchMethodException ex) {}catch (InvocationTargetException ex) {}catch (IllegalAccessException ex) {} | |
try { | |
msg = msg.replace("<Name>", j.getName()); | |
msg = msg.replace("<Displayname>", j.getDisplayName()); | |
msg = msg.replace("<MaxPlayer>", "" + plugin.getServer().getMaxPlayers()); | |
msg = msg.replace("<Online>", "" + playersOnline); | |
msg = msg.replace("<Version>", plugin.getServer().getBukkitVersion()); | |
msg = msg.replace("<World>", j.getWorld().getName()); | |
msg = msg.replace("<Player_Ip>", j.getAddress().getHostName()); | |
msg = msg.replace("<name>", j.getName()); | |
msg = msg.replace("<displayname>", j.getDisplayName()); | |
msg = msg.replace("<maxPlayer>", "" + plugin.getServer().getMaxPlayers()); | |
msg = msg.replace("<online>", "" + playersOnline); | |
msg = msg.replace("<version>", plugin.getServer().getBukkitVersion()); | |
msg = msg.replace("<world>", j.getWorld().getName()); | |
}catch(Exception e) {} | |
return msg; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.events; | |
import org.bukkit.Bukkit; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.scheduler.BukkitScheduler; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.utils.EventsUtils; | |
public class EventLoader { | |
private AdvancedChat plugin; | |
private int taskId; | |
private EventsUtils eventsUtils = new EventsUtils(plugin); | |
public EventLoader(AdvancedChat plugin) { | |
this.plugin = plugin; | |
} | |
public void runClearChat() { | |
FileConfiguration config = plugin.getConfig(); | |
BukkitScheduler scheduler = Bukkit.getServer().getScheduler(); | |
try{ | |
Long tick = (long) config.getInt("Settings.ClearChat.Tick"); | |
String path = "Settings.ClearChat.AutoClear"; | |
taskId = scheduler.scheduleSyncRepeatingTask(plugin, new Runnable() { | |
public void run() { | |
if(config.getString(path).equals("true")) { | |
eventsUtils.getClearChatAction(null, "server"); | |
}else { | |
scheduler.cancelTask(taskId); | |
} | |
} | |
}, 6000L, tick); | |
}catch(NullPointerException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.events; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.PlayerDataFile; | |
import jss.advancedchat.utils.EventsUtils; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.entity.Player; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.player.PlayerJoinEvent; | |
public class JoinListener implements Listener { | |
private AdvancedChat plugin; | |
private EventsUtils eventsUtils = new EventsUtils(plugin); | |
public JoinListener(AdvancedChat plugin) { | |
this.plugin = plugin; | |
eventsUtils.addEventList(this); | |
} | |
@EventHandler | |
public void onJoinPlayer(PlayerJoinEvent e) { | |
PlayerDataFile dataFile = plugin.getPlayerDataFile(); | |
FileConfiguration config = dataFile.getConfig(); | |
Player j = e.getPlayer(); | |
if(!config.contains(j.getName())) { | |
config.set("Players-List."+j.getName()+".UUID", j.getUniqueId().toString()); | |
} | |
} | |
@EventHandler | |
public void onUpdatePlayer(PlayerJoinEvent e) { | |
Player j = e.getPlayer(); | |
if ((!j.hasPermission("AdvancedChat.Update.Notify")) || (!j.isOp())) { | |
return; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonObject; | |
import com.google.gson.JsonParser; | |
import com.google.gson.JsonPrimitive; | |
import org.bukkit.Bukkit; | |
import org.bukkit.configuration.file.YamlConfiguration; | |
import org.bukkit.entity.Player; | |
import org.bukkit.plugin.Plugin; | |
import org.bukkit.plugin.RegisteredServiceProvider; | |
import org.bukkit.plugin.ServicePriority; | |
import javax.net.ssl.HttpsURLConnection; | |
import java.io.*; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.net.URL; | |
import java.nio.charset.StandardCharsets; | |
import java.util.*; | |
import java.util.concurrent.Callable; | |
import java.util.logging.Level; | |
import java.util.zip.GZIPOutputStream; | |
/** | |
* bStats collects some data for plugin authors. | |
* <p> | |
* Check out https://bStats.org/ to learn more about bStats! | |
*/ | |
public class Metrics { | |
static { | |
// You can use the property to disable the check in your test environment | |
if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) { | |
// Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D | |
final String defaultPackage = new String( | |
new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'}); | |
final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'}); | |
// We want to make sure nobody just copy & pastes the example and use the wrong package names | |
if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) { | |
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); | |
} | |
} | |
} | |
// The version of this bStats class | |
public static final int B_STATS_VERSION = 1; | |
// The url to which the data is sent | |
private static final String URL = "https://bStats.org/submitData/bukkit"; | |
// Is bStats enabled on this server? | |
private boolean enabled; | |
// Should failed requests be logged? | |
private static boolean logFailedRequests; | |
// Should the sent data be logged? | |
private static boolean logSentData; | |
// Should the response text be logged? | |
private static boolean logResponseStatusText; | |
// The uuid of the server | |
private static String serverUUID; | |
// The plugin | |
private final Plugin plugin; | |
// The plugin id | |
private final int pluginId = 8826; | |
// A list with all custom charts | |
private final List<CustomChart> charts = new ArrayList<>(); | |
/** | |
* Class constructor. | |
* | |
* @param plugin The plugin which stats should be submitted. | |
* @param pluginId The id of the plugin. | |
* It can be found at <a href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a> | |
*/ | |
public Metrics(Plugin plugin) { | |
if (plugin == null) { | |
throw new IllegalArgumentException("Plugin cannot be null!"); | |
} | |
this.plugin = plugin; | |
// Get the config file | |
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); | |
File configFile = new File(bStatsFolder, "config.yml"); | |
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); | |
// Check if the config file exists | |
if (!config.isSet("serverUuid")) { | |
// Add default values | |
config.addDefault("enabled", true); | |
// Every server gets it's unique random id. | |
config.addDefault("serverUuid", UUID.randomUUID().toString()); | |
// Should failed request be logged? | |
config.addDefault("logFailedRequests", false); | |
// Should the sent data be logged? | |
config.addDefault("logSentData", false); | |
// Should the response text be logged? | |
config.addDefault("logResponseStatusText", false); | |
// Inform the server owners about bStats | |
config.options().header( | |
"bStats collects some data for plugin authors like how many servers are using their plugins.\n" + | |
"To honor their work, you should not disable it.\n" + | |
"This has nearly no effect on the server performance!\n" + | |
"Check out https://bStats.org/ to learn more :)" | |
).copyDefaults(true); | |
try { | |
config.save(configFile); | |
} catch (IOException ignored) { } | |
} | |
// Load the data | |
enabled = config.getBoolean("enabled", true); | |
serverUUID = config.getString("serverUuid"); | |
logFailedRequests = config.getBoolean("logFailedRequests", false); | |
logSentData = config.getBoolean("logSentData", false); | |
logResponseStatusText = config.getBoolean("logResponseStatusText", false); | |
if (enabled) { | |
boolean found = false; | |
// Search for all other bStats Metrics classes to see if we are the first one | |
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) { | |
try { | |
service.getField("B_STATS_VERSION"); // Our identifier :) | |
found = true; // We aren't the first | |
break; | |
} catch (NoSuchFieldException ignored) { } | |
} | |
// Register our service | |
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); | |
if (!found) { | |
// We are the first! | |
startSubmitting(); | |
} | |
} | |
} | |
/** | |
* Checks if bStats is enabled. | |
* | |
* @return Whether bStats is enabled or not. | |
*/ | |
public boolean isEnabled() { | |
return enabled; | |
} | |
/** | |
* Adds a custom chart. | |
* | |
* @param chart The chart to add. | |
*/ | |
public void addCustomChart(CustomChart chart) { | |
if (chart == null) { | |
throw new IllegalArgumentException("Chart cannot be null!"); | |
} | |
charts.add(chart); | |
} | |
/** | |
* Starts the Scheduler which submits our data every 30 minutes. | |
*/ | |
private void startSubmitting() { | |
final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags | |
timer.scheduleAtFixedRate(new TimerTask() { | |
@Override | |
public void run() { | |
if (!plugin.isEnabled()) { // Plugin was disabled | |
timer.cancel(); | |
return; | |
} | |
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler | |
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) | |
Bukkit.getScheduler().runTask(plugin, () -> submitData()); | |
} | |
}, 1000 * 60 * 5, 1000 * 60 * 30); | |
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start | |
// WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! | |
// WARNING: Just don't do it! | |
} | |
/** | |
* Gets the plugin specific data. | |
* This method is called using Reflection. | |
* | |
* @return The plugin specific data. | |
*/ | |
public JsonObject getPluginData() { | |
JsonObject data = new JsonObject(); | |
String pluginName = plugin.getDescription().getName(); | |
String pluginVersion = plugin.getDescription().getVersion(); | |
data.addProperty("pluginName", pluginName); // Append the name of the plugin | |
data.addProperty("id", pluginId); // Append the id of the plugin | |
data.addProperty("pluginVersion", pluginVersion); // Append the version of the plugin | |
JsonArray customCharts = new JsonArray(); | |
for (CustomChart customChart : charts) { | |
// Add the data of the custom charts | |
JsonObject chart = customChart.getRequestJsonObject(); | |
if (chart == null) { // If the chart is null, we skip it | |
continue; | |
} | |
customCharts.add(chart); | |
} | |
data.add("customCharts", customCharts); | |
return data; | |
} | |
/** | |
* Gets the server specific data. | |
* | |
* @return The server specific data. | |
*/ | |
private JsonObject getServerData() { | |
// Minecraft specific data | |
int playerAmount; | |
try { | |
// Around MC 1.8 the return type was changed to a collection from an array, | |
// This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection; | |
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers"); | |
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class) | |
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size() | |
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length; | |
} catch (Exception e) { | |
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed | |
} | |
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0; | |
String bukkitVersion = Bukkit.getVersion(); | |
String bukkitName = Bukkit.getName(); | |
// OS/Java specific data | |
String javaVersion = System.getProperty("java.version"); | |
String osName = System.getProperty("os.name"); | |
String osArch = System.getProperty("os.arch"); | |
String osVersion = System.getProperty("os.version"); | |
int coreCount = Runtime.getRuntime().availableProcessors(); | |
JsonObject data = new JsonObject(); | |
data.addProperty("serverUUID", serverUUID); | |
data.addProperty("playerAmount", playerAmount); | |
data.addProperty("onlineMode", onlineMode); | |
data.addProperty("bukkitVersion", bukkitVersion); | |
data.addProperty("bukkitName", bukkitName); | |
data.addProperty("javaVersion", javaVersion); | |
data.addProperty("osName", osName); | |
data.addProperty("osArch", osArch); | |
data.addProperty("osVersion", osVersion); | |
data.addProperty("coreCount", coreCount); | |
return data; | |
} | |
/** | |
* Collects the data and sends it afterwards. | |
*/ | |
private void submitData() { | |
final JsonObject data = getServerData(); | |
JsonArray pluginData = new JsonArray(); | |
// Search for all other bStats Metrics classes to get their plugin data | |
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) { | |
try { | |
service.getField("B_STATS_VERSION"); // Our identifier :) | |
for (RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) { | |
try { | |
Object plugin = provider.getService().getMethod("getPluginData").invoke(provider.getProvider()); | |
if (plugin instanceof JsonObject) { | |
pluginData.add((JsonObject) plugin); | |
} else { // old bstats version compatibility | |
try { | |
Class<?> jsonObjectJsonSimple = Class.forName("org.json.simple.JSONObject"); | |
if (plugin.getClass().isAssignableFrom(jsonObjectJsonSimple)) { | |
Method jsonStringGetter = jsonObjectJsonSimple.getDeclaredMethod("toJSONString"); | |
jsonStringGetter.setAccessible(true); | |
String jsonString = (String) jsonStringGetter.invoke(plugin); | |
JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject(); | |
pluginData.add(object); | |
} | |
} catch (ClassNotFoundException e) { | |
// minecraft version 1.14+ | |
if (logFailedRequests) { | |
this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception", e); | |
} | |
} | |
} | |
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { } | |
} | |
} catch (NoSuchFieldException ignored) { } | |
} | |
data.add("plugins", pluginData); | |
// Create a new thread for the connection to the bStats server | |
new Thread(() -> { | |
try { | |
// Send the data | |
sendData(plugin, data); | |
} catch (Exception e) { | |
// Something went wrong! :( | |
if (logFailedRequests) { | |
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e); | |
} | |
} | |
}).start(); | |
} | |
/** | |
* Sends the data to the bStats server. | |
* | |
* @param plugin Any plugin. It's just used to get a logger instance. | |
* @param data The data to send. | |
* @throws Exception If the request failed. | |
*/ | |
private static void sendData(Plugin plugin, JsonObject data) throws Exception { | |
if (data == null) { | |
throw new IllegalArgumentException("Data cannot be null!"); | |
} | |
if (Bukkit.isPrimaryThread()) { | |
throw new IllegalAccessException("This method must not be called from the main thread!"); | |
} | |
if (logSentData) { | |
plugin.getLogger().info("Sending data to bStats: " + data); | |
} | |
HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection(); | |
// Compress the data to save bandwidth | |
byte[] compressedData = compress(data.toString()); | |
// Add headers | |
connection.setRequestMethod("POST"); | |
connection.addRequestProperty("Accept", "application/json"); | |
connection.addRequestProperty("Connection", "close"); | |
connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request | |
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length)); | |
connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format | |
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION); | |
// Send data | |
connection.setDoOutput(true); | |
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { | |
outputStream.write(compressedData); | |
} | |
StringBuilder builder = new StringBuilder(); | |
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { | |
String line; | |
while ((line = bufferedReader.readLine()) != null) { | |
builder.append(line); | |
} | |
} | |
if (logResponseStatusText) { | |
plugin.getLogger().info("Sent data to bStats and received response: " + builder); | |
} | |
} | |
/** | |
* Gzips the given String. | |
* | |
* @param str The string to gzip. | |
* @return The gzipped String. | |
* @throws IOException If the compression failed. | |
*/ | |
private static byte[] compress(final String str) throws IOException { | |
if (str == null) { | |
return null; | |
} | |
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | |
try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) { | |
gzip.write(str.getBytes(StandardCharsets.UTF_8)); | |
} | |
return outputStream.toByteArray(); | |
} | |
/** | |
* Represents a custom chart. | |
*/ | |
public static abstract class CustomChart { | |
// The id of the chart | |
final String chartId; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
*/ | |
CustomChart(String chartId) { | |
if (chartId == null || chartId.isEmpty()) { | |
throw new IllegalArgumentException("ChartId cannot be null or empty!"); | |
} | |
this.chartId = chartId; | |
} | |
private JsonObject getRequestJsonObject() { | |
JsonObject chart = new JsonObject(); | |
chart.addProperty("chartId", chartId); | |
try { | |
JsonObject data = getChartData(); | |
if (data == null) { | |
// If the data is null we don't send the chart. | |
return null; | |
} | |
chart.add("data", data); | |
} catch (Throwable t) { | |
if (logFailedRequests) { | |
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t); | |
} | |
return null; | |
} | |
return chart; | |
} | |
protected abstract JsonObject getChartData() throws Exception; | |
} | |
/** | |
* Represents a custom simple pie. | |
*/ | |
public static class SimplePie extends CustomChart { | |
private final Callable<String> callable; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
* @param callable The callable which is used to request the chart data. | |
*/ | |
public SimplePie(String chartId, Callable<String> callable) { | |
super(chartId); | |
this.callable = callable; | |
} | |
@Override | |
protected JsonObject getChartData() throws Exception { | |
JsonObject data = new JsonObject(); | |
String value = callable.call(); | |
if (value == null || value.isEmpty()) { | |
// Null = skip the chart | |
return null; | |
} | |
data.addProperty("value", value); | |
return data; | |
} | |
} | |
/** | |
* Represents a custom advanced pie. | |
*/ | |
public static class AdvancedPie extends CustomChart { | |
private final Callable<Map<String, Integer>> callable; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
* @param callable The callable which is used to request the chart data. | |
*/ | |
public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) { | |
super(chartId); | |
this.callable = callable; | |
} | |
@Override | |
protected JsonObject getChartData() throws Exception { | |
JsonObject data = new JsonObject(); | |
JsonObject values = new JsonObject(); | |
Map<String, Integer> map = callable.call(); | |
if (map == null || map.isEmpty()) { | |
// Null = skip the chart | |
return null; | |
} | |
boolean allSkipped = true; | |
for (Map.Entry<String, Integer> entry : map.entrySet()) { | |
if (entry.getValue() == 0) { | |
continue; // Skip this invalid | |
} | |
allSkipped = false; | |
values.addProperty(entry.getKey(), entry.getValue()); | |
} | |
if (allSkipped) { | |
// Null = skip the chart | |
return null; | |
} | |
data.add("values", values); | |
return data; | |
} | |
} | |
/** | |
* Represents a custom drilldown pie. | |
*/ | |
public static class DrilldownPie extends CustomChart { | |
private final Callable<Map<String, Map<String, Integer>>> callable; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
* @param callable The callable which is used to request the chart data. | |
*/ | |
public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>> callable) { | |
super(chartId); | |
this.callable = callable; | |
} | |
@Override | |
public JsonObject getChartData() throws Exception { | |
JsonObject data = new JsonObject(); | |
JsonObject values = new JsonObject(); | |
Map<String, Map<String, Integer>> map = callable.call(); | |
if (map == null || map.isEmpty()) { | |
// Null = skip the chart | |
return null; | |
} | |
boolean reallyAllSkipped = true; | |
for (Map.Entry<String, Map<String, Integer>> entryValues : map.entrySet()) { | |
JsonObject value = new JsonObject(); | |
boolean allSkipped = true; | |
for (Map.Entry<String, Integer> valueEntry : map.get(entryValues.getKey()).entrySet()) { | |
value.addProperty(valueEntry.getKey(), valueEntry.getValue()); | |
allSkipped = false; | |
} | |
if (!allSkipped) { | |
reallyAllSkipped = false; | |
values.add(entryValues.getKey(), value); | |
} | |
} | |
if (reallyAllSkipped) { | |
// Null = skip the chart | |
return null; | |
} | |
data.add("values", values); | |
return data; | |
} | |
} | |
/** | |
* Represents a custom single line chart. | |
*/ | |
public static class SingleLineChart extends CustomChart { | |
private final Callable<Integer> callable; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
* @param callable The callable which is used to request the chart data. | |
*/ | |
public SingleLineChart(String chartId, Callable<Integer> callable) { | |
super(chartId); | |
this.callable = callable; | |
} | |
@Override | |
protected JsonObject getChartData() throws Exception { | |
JsonObject data = new JsonObject(); | |
int value = callable.call(); | |
if (value == 0) { | |
// Null = skip the chart | |
return null; | |
} | |
data.addProperty("value", value); | |
return data; | |
} | |
} | |
/** | |
* Represents a custom multi line chart. | |
*/ | |
public static class MultiLineChart extends CustomChart { | |
private final Callable<Map<String, Integer>> callable; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
* @param callable The callable which is used to request the chart data. | |
*/ | |
public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) { | |
super(chartId); | |
this.callable = callable; | |
} | |
@Override | |
protected JsonObject getChartData() throws Exception { | |
JsonObject data = new JsonObject(); | |
JsonObject values = new JsonObject(); | |
Map<String, Integer> map = callable.call(); | |
if (map == null || map.isEmpty()) { | |
// Null = skip the chart | |
return null; | |
} | |
boolean allSkipped = true; | |
for (Map.Entry<String, Integer> entry : map.entrySet()) { | |
if (entry.getValue() == 0) { | |
continue; // Skip this invalid | |
} | |
allSkipped = false; | |
values.addProperty(entry.getKey(), entry.getValue()); | |
} | |
if (allSkipped) { | |
// Null = skip the chart | |
return null; | |
} | |
data.add("values", values); | |
return data; | |
} | |
} | |
/** | |
* Represents a custom simple bar chart. | |
*/ | |
public static class SimpleBarChart extends CustomChart { | |
private final Callable<Map<String, Integer>> callable; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
* @param callable The callable which is used to request the chart data. | |
*/ | |
public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) { | |
super(chartId); | |
this.callable = callable; | |
} | |
@Override | |
protected JsonObject getChartData() throws Exception { | |
JsonObject data = new JsonObject(); | |
JsonObject values = new JsonObject(); | |
Map<String, Integer> map = callable.call(); | |
if (map == null || map.isEmpty()) { | |
// Null = skip the chart | |
return null; | |
} | |
for (Map.Entry<String, Integer> entry : map.entrySet()) { | |
JsonArray categoryValues = new JsonArray(); | |
categoryValues.add(new JsonPrimitive(entry.getValue())); | |
values.add(entry.getKey(), categoryValues); | |
} | |
data.add("values", values); | |
return data; | |
} | |
} | |
/** | |
* Represents a custom advanced bar chart. | |
*/ | |
public static class AdvancedBarChart extends CustomChart { | |
private final Callable<Map<String, int[]>> callable; | |
/** | |
* Class constructor. | |
* | |
* @param chartId The id of the chart. | |
* @param callable The callable which is used to request the chart data. | |
*/ | |
public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) { | |
super(chartId); | |
this.callable = callable; | |
} | |
@Override | |
protected JsonObject getChartData() throws Exception { | |
JsonObject data = new JsonObject(); | |
JsonObject values = new JsonObject(); | |
Map<String, int[]> map = callable.call(); | |
if (map == null || map.isEmpty()) { | |
// Null = skip the chart | |
return null; | |
} | |
boolean allSkipped = true; | |
for (Map.Entry<String, int[]> entry : map.entrySet()) { | |
if (entry.getValue().length == 0) { | |
continue; // Skip this invalid | |
} | |
allSkipped = false; | |
JsonArray categoryValues = new JsonArray(); | |
for (int categoryValue : entry.getValue()) { | |
categoryValues.add(new JsonPrimitive(categoryValue)); | |
} | |
values.add(entry.getKey(), categoryValues); | |
} | |
if (allSkipped) { | |
// Null = skip the chart | |
return null; | |
} | |
data.add("values", values); | |
return data; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.Reader; | |
import java.io.UnsupportedEncodingException; | |
//import org.bukkit.configuration.InvalidConfigurationException; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.configuration.file.YamlConfiguration; | |
import jss.advancedchat.utils.FileManager; | |
import jss.advancedchat.utils.interfaces.FileHelper; | |
import jss.advancedchat.utils.interfaces.FolderHelper; | |
public class PlayerDataFile extends FileManager implements FileHelper, FolderHelper { | |
private AdvancedChat plugin; | |
private File file; | |
private FileConfiguration config; | |
private String path; | |
private String folderpath; | |
public PlayerDataFile(AdvancedChat plugin, String path, String folderpath) { | |
super(plugin); | |
this.plugin = plugin; | |
this.path = path; | |
this.folderpath = folderpath; | |
this.config = null; | |
this.file = null; | |
} | |
public String getFolderPath() { | |
return this.folderpath; | |
} | |
public void create() { | |
this.file = new File(getDataFolder() + File.separator + this.folderpath, this.path); | |
if(!this.file.exists()) { | |
getConfig().options().copyDefaults(true); | |
saveConfig(); | |
} | |
} | |
public FileConfiguration getConfig() { | |
if(this.config == null) { | |
reloadConfig(); | |
} | |
return this.config; | |
} | |
public void reloadConfig() { | |
if(this.config == null) { | |
this.file = new File(getDataFolder() + File.separator + this.folderpath, this.path); | |
} | |
this.config = YamlConfiguration.loadConfiguration(this.file); | |
Reader defaultConfigStream; | |
try { | |
defaultConfigStream = new InputStreamReader(getResources(this.path), "UTF8"); | |
if(defaultConfigStream != null) { | |
YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(defaultConfigStream); | |
config.setDefaults(defaultConfig); | |
} | |
}catch(UnsupportedEncodingException ex) { | |
ex.printStackTrace(); | |
}catch(NullPointerException e) { | |
e.printStackTrace(); | |
} | |
} | |
public void saveConfig() { | |
try { | |
this.config.save(this.file); | |
}catch(IOException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
public void saveDefaultConfig() { | |
if(this.file == null) { | |
this.file = new File(getDataFolder(), this.path); | |
} | |
if(!this.file.exists()) { | |
saveResources(this.path, false); | |
} | |
} | |
public void resetConfig() { | |
if(this.file == null) { | |
this.file = new File(getDataFolder(), this.path); | |
} | |
if(!this.file.exists()) { | |
saveResources(this.path, true); | |
} | |
} | |
public String getPath() { | |
return this.path; | |
} | |
public AdvancedChat getPlugin() { | |
return plugin; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils; | |
import org.bukkit.Bukkit; | |
import org.bukkit.command.ConsoleCommandSender; | |
import org.bukkit.configuration.file.FileConfiguration; | |
import org.bukkit.entity.Player; | |
import org.bukkit.event.Listener; | |
import org.bukkit.plugin.PluginManager; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.ConfigFile; | |
import me.clip.placeholderapi.PlaceholderAPI; | |
public class EventsUtils { | |
private AdvancedChat plugin; | |
public EventsUtils(AdvancedChat plugin) { | |
this.plugin = plugin; | |
} | |
public void addEventList(Listener listener) { | |
getEventManager().registerEvents(listener, plugin); | |
} | |
public PluginManager getEventManager() { | |
return Bukkit.getPluginManager(); | |
} | |
public ConsoleCommandSender getConsoleSender() { | |
return Bukkit.getConsoleSender(); | |
} | |
public boolean getClearChatAction(Object object, String type) { | |
ConfigFile configFile = plugin.getConfigfile(); | |
FileConfiguration config = configFile.getConfig(); | |
String tmp = type; | |
if(tmp.equalsIgnoreCase("player")) { | |
Player player = (Player) object; | |
loopVoidChat(100); | |
try { | |
String path = "Settings.Use-Default-Prefix"; | |
String text = config.getString("AdvancedChat.ClearChat.Player"); | |
text = replacePlaceholderAPI(plugin, player, text); | |
if(config.getString(path).equals("true")) { | |
Utils.sendColorMessage(Utils.getPrefixPlayer() + " " + text); | |
}else if(config.getString(path).equals("false")){ | |
Utils.sendColorMessage(config.getString("Settings.Prefix") + " " + text); | |
} | |
}catch(NullPointerException ex) { | |
ex.printStackTrace(); | |
} | |
return true; | |
}else if(tmp.equalsIgnoreCase("server")) { | |
loopVoidChat(100); | |
try { | |
String path = "Settings.Use-Default-Prefix"; | |
String text = config.getString("AdvancedChat.ClearChat.Server"); | |
if(config.getString(path).equals("true")) { | |
Utils.sendColorMessage(Utils.getPrefixPlayer() + " " + text); | |
}else if(config.getString(path).equals("false")){ | |
Utils.sendColorMessage(config.getString("Settings.Prefix") + " " + text); | |
} | |
}catch(NullPointerException ex) { | |
ex.printStackTrace(); | |
} | |
return true; | |
} | |
return false; | |
} | |
public void loopVoidChat(int value) { | |
try { | |
for(int i = 0; i < value; i++) { | |
Bukkit.broadcastMessage(" "); | |
if(i == value) { | |
break; | |
} | |
} | |
}catch(NullPointerException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
public String replacePlaceholderAPI(AdvancedChat plugin, Player p, String message){ | |
String holders = message; | |
if ((plugin.placeholders) && (PlaceholderAPI.containsPlaceholders(holders))) { | |
holders = PlaceholderAPI.setPlaceholders(p, holders); | |
} | |
return holders; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils; | |
import java.io.File; | |
import java.io.InputStream; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import jss.advancedchat.AdvancedChat; | |
public class FileManager { | |
private AdvancedChat plugin; | |
public FileManager(AdvancedChat plugin) { | |
this.plugin = plugin; | |
} | |
public void createVoidFolder(String name) { | |
File folder = new File(getDataFolder(), name); | |
if(!folder.exists()){ | |
try { | |
folder.mkdir(); | |
}catch(Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
public void createFolderAndFile(String namefolder, String namefile) { | |
File folder = new File(getDataFolder(), namefolder); | |
if(!folder.exists()) { | |
try { | |
folder.mkdir(); | |
}catch(Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
File file = new File(folder, namefile); | |
if(!file.exists()) { | |
try { | |
file.createNewFile(); | |
}catch(Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
@Deprecated | |
public JavaPlugin getJavaPlugin() { | |
return plugin; | |
} | |
public void saveResources(String filename, boolean replace) { | |
plugin.saveResource(filename, replace); | |
} | |
public InputStream getResources(String filename) { | |
return plugin.getResource(filename); | |
} | |
public File getDataFolder() { | |
return plugin.getDataFolder(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils.interfaces; | |
import org.bukkit.configuration.file.FileConfiguration; | |
public interface FileHelper { | |
public void create(); | |
public FileConfiguration getConfig(); | |
public void saveConfig(); | |
public void reloadConfig(); | |
public String getPath(); | |
public void saveDefaultConfig(); | |
public void resetConfig(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils.interfaces; | |
public interface FolderHelper { | |
public String getFolderPath(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils.interfaces; | |
import org.bukkit.Material; | |
import org.bukkit.entity.Player; | |
import org.bukkit.inventory.Inventory; | |
import org.bukkit.inventory.meta.ItemMeta; | |
public interface InventoryHelper { | |
public int getSize(); | |
public void setSize(int size); | |
public String getTitle(); | |
public void setTitle(String title); | |
public void setRow(int row); | |
public int getRow(); | |
public void setDefaultSize(int defaultsize); | |
public int getDefaultSize(); | |
public void setLegacyItemRow(Inventory inventory, Material material, int data, int amount, int slot0, int slot1, String name); | |
public void setItemRow(Inventory inventory, Material material, int amount, int slot0, int slot1, String name); | |
public boolean CheckVersion(); | |
public boolean setGlowItem(ItemMeta meta); | |
public String getId(); | |
public void setId(String id); | |
public String getTexture(); | |
public void setTexture(String texture); | |
public void open(Player player, Inventory inventory); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils.interfaces; | |
public interface PlayerHelper { | |
public String getName(); | |
public void setName(String name); | |
public String getColor(); | |
public void setColor(String color); | |
public boolean isMuted(); | |
public void setMuted(boolean value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils.interfaces; | |
import java.util.function.Consumer; | |
public interface UpdateHelper { | |
public void getUpdateVersion(Consumer<String> consumer); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils; | |
import org.bukkit.Bukkit; | |
import org.bukkit.Material; | |
import org.bukkit.entity.Player; | |
import org.bukkit.inventory.Inventory; | |
import org.bukkit.inventory.meta.ItemMeta; | |
import jss.advancedchat.utils.interfaces.InventoryHelper; | |
public class InventoryUtils implements InventoryHelper { | |
private int size; | |
private int defaultsize; | |
private int row; | |
private String title; | |
private String id; | |
private String texture; | |
public InventoryUtils(Player player, int size, String title) { | |
this.size = 0; | |
this.defaultsize = 9; | |
this.row = 1; | |
this.title = title; | |
this.id = null; | |
this.texture = null; | |
Inventory inv = Bukkit.createInventory(null, getSize()); | |
open(player, inv); | |
} | |
public Build build(){ | |
return new Build(); | |
} | |
private final class Build{ | |
public Build() {} | |
} | |
@Override | |
public int getSize() { | |
return this.size; | |
} | |
@Override | |
public void setSize(int size) { | |
this.size = size; | |
} | |
@Override | |
public String getTitle() { | |
return this.title; | |
} | |
@Override | |
public void setTitle(String title) { | |
this.title = title; | |
} | |
@Override | |
public void setRow(int row) { | |
this.row = 9*row; | |
} | |
@Override | |
public int getRow() { | |
return this.row; | |
} | |
@Override | |
public void setDefaultSize(int defaultsize) { | |
this.defaultsize = defaultsize; | |
} | |
@Override | |
public int getDefaultSize() { | |
return this.defaultsize; | |
} | |
@Override | |
public void setLegacyItemRow(Inventory inventory, Material material, int data, int amount, int slot0, int slot1, String name) { | |
} | |
@Override | |
public void setItemRow(Inventory inventory, Material material, int amount, int slot0, int slot1, String name) { | |
} | |
@Override | |
public boolean CheckVersion() { | |
return false; | |
} | |
@Override | |
public boolean setGlowItem(ItemMeta meta) { | |
return false; | |
} | |
@Override | |
public String getId() { | |
return this.id; | |
} | |
@Override | |
public void setId(String id) { | |
this.id = id; | |
} | |
@Override | |
public String getTexture() { | |
return this.texture; | |
} | |
@Override | |
public void setTexture(String texture) { | |
this.texture = texture; | |
} | |
@Override | |
public void open(Player player, Inventory inventory) { | |
player.openInventory(inventory); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils; | |
import jss.advancedchat.AdvancedChat; | |
public class Logger { | |
private AdvancedChat plugin; | |
private EventsUtils eventsUtils = new EventsUtils(plugin); | |
public Logger(AdvancedChat plugin) { | |
super(); | |
this.plugin = plugin; | |
} | |
public void Log(Level level, String msg) { | |
if(msg == null) { | |
return; | |
} | |
switch (level) { | |
case ERROR: | |
Utils.sendColorMessage(eventsUtils.getConsoleSender(), "&e[&cERROR&e]&7" + " " +msg); | |
break; | |
case WARNING: | |
Utils.sendColorMessage(eventsUtils.getConsoleSender(), "&e[&dWARNING&e]&7" + " " +msg); | |
break; | |
case INFO: | |
Utils.sendColorMessage(eventsUtils.getConsoleSender(), "&e[&9INFO&e]&7" + " " +msg); | |
break; | |
case OUTLINE: | |
Utils.sendColorMessage(eventsUtils.getConsoleSender(), "&e[&bOUTLINE&e]&7" + " " +msg); | |
break; | |
case SUCCESS: | |
Utils.sendColorMessage(eventsUtils.getConsoleSender(), "&e[&aSUCCESS&e]&7" + " " +msg); | |
break; | |
case DEBUG: | |
Utils.sendColorMessage(eventsUtils.getConsoleSender(), "&e[&dDEBUG&e]&7" + " " +msg); | |
break; | |
} | |
} | |
public enum Level{ | |
ERROR, WARNING, INFO, SUCCESS, OUTLINE, DEBUG | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils; | |
public class Settings { | |
public static String URL_PLUGIN = "https://www.spigotmc.org/resources/advancedchat-1-7-x-1-16-x.83889/"; | |
public static String VERSION = "1.4.0"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.URL; | |
import java.util.Scanner; | |
import java.util.function.Consumer; | |
import org.bukkit.Bukkit; | |
import jss.advancedchat.AdvancedChat; | |
import jss.advancedchat.utils.Logger.Level; | |
import jss.advancedchat.utils.interfaces.UpdateHelper; | |
public class UpdateChecker implements UpdateHelper{ | |
private AdvancedChat plugin; | |
private Logger logger = new Logger(plugin); | |
private int ID; | |
public UpdateChecker(AdvancedChat plugin, int ID) { | |
this.plugin = plugin; | |
this.ID = ID; | |
} | |
public void getUpdateVersion(Consumer<String> consumer) { | |
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> { | |
try(InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.ID).openStream(); Scanner scanner = new Scanner(inputStream)){ | |
if(scanner.hasNext()) { | |
consumer.accept(scanner.next()); | |
} | |
}catch(IOException e) { | |
logger.Log(Level.INFO, "Could not check for updates:&c" + e.getMessage()); | |
} | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jss.advancedchat.utils; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
import org.bukkit.Bukkit; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.entity.Player; | |
import net.md_5.bungee.api.ChatColor; | |
import net.md_5.bungee.api.chat.ClickEvent; | |
import net.md_5.bungee.api.chat.ComponentBuilder; | |
import net.md_5.bungee.api.chat.HoverEvent; | |
import net.md_5.bungee.api.chat.TextComponent; | |
public class Utils { | |
private static String prefix = getPrefixConsole(); | |
private final static Pattern hexcolor = Pattern.compile("<#[a-fA-F0-9]{6}>"); | |
public static String formatColor(String msg) { | |
if(Bukkit.getVersion().contains("1.16")) { | |
Matcher matcher = hexcolor.matcher(msg); | |
while(matcher.find()) { | |
String color = msg.substring(matcher.start(), matcher.end()); | |
msg = msg.replace(color, fixcolor(color) + ""); | |
matcher = hexcolor.matcher(msg); | |
} | |
} | |
return color(msg); | |
} | |
public static String getCustomLine(String arg, String color) { | |
return color(color+"-=-=-=-=-=-=-=-=-=-=-="+arg+"=-=-=-=-=-=-=-=-=-=-=-"); | |
} | |
public static String getVoidLine(String color) { | |
return color(color + " "); | |
} | |
public static String getLine(String color) { | |
return color(color + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); | |
} | |
public static String getLine() { | |
return "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; | |
} | |
public static ChatColor fixcolor(String color) { | |
return ChatColor.of(color); | |
} | |
public static ChatColor fixcolor2(String color) { | |
return ChatColor.of(hexcolor(color)); | |
} | |
public static String hexcolor(String msg) { | |
return formatColor(msg); | |
} | |
public static String color(String msg) { | |
return ChatColor.translateAlternateColorCodes('&', msg); | |
} | |
public static String colorless(String msg) { | |
return ChatColor.stripColor(msg); | |
} | |
public static void sendColorMessage(Player player, String msg) { | |
player.sendMessage(color(msg)); | |
} | |
public static void sendColorMessage(CommandSender sender, String msg) { | |
sender.sendMessage(color(msg)); | |
} | |
public static void sendColorMessage(String msg) { | |
Bukkit.broadcastMessage(color(msg)); | |
} | |
public static void sendHexColorMessage(String msg) { | |
Bukkit.broadcastMessage(hexcolor(msg)); | |
} | |
public static void sendHexColorMessage(Player player, String msg) { | |
player.sendMessage(hexcolor(msg)); | |
} | |
public static void sendHexColorMessage(CommandSender sender, String msg) { | |
sender.sendMessage(hexcolor(msg)); | |
} | |
public static String getPrefixConsole() { | |
return color("&e[&dAdvancedChat&e] &7"); | |
} | |
public static String getPrefixPlayer() { | |
return color("&6[&dAdvancedChat&6] &7"); | |
} | |
@SuppressWarnings("deprecation") | |
public static String sendTextComponent(Player j, String action, String message, String submessage, String color) { | |
TextComponent msg = new TextComponent(); | |
msg.setText(Utils.color(message)); | |
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(action) , new ComponentBuilder(submessage).color(ChatColor.valueOf(color)).create())); | |
return msg.toString(); | |
} | |
public static void sendTextComponent(Player j, String action, String message, String arg0) { | |
TextComponent msg = new TextComponent(); | |
msg.setText(Utils.color(message)); | |
msg.setClickEvent(new ClickEvent(ClickEvent.Action.valueOf(action) , arg0)); | |
j.spigot().sendMessage(msg); | |
} | |
private static void sendEnable(String prefix , String message) { | |
CommandSender c = Bukkit.getConsoleSender(); | |
sendColorMessage(c, prefix + message); | |
} | |
public static void getEnable(String version) { | |
sendEnable(prefix , "&5 <|============================================|>"); | |
sendEnable(prefix , "&5 <|&3The plugin is &a|Successfully activated|"); | |
sendEnable(prefix , "&5 <|&bVersion: &d|" + version + "|"); | |
sendEnable(prefix , "&5 <|&3By: &b|jonagamerpro1234|"); | |
sendEnable(prefix , "&5 <|============================================|>"); | |
sendEnable(null ,"&b[&eTested Versions&b] &3|&d1.7.x&3|&a1.8.x&3|&a1.9.x&3|&a1.10.x&3|&a1.11.x&3|&a1.12.x&3|&a1.13.x&3|&a1.14.x&3|&a1.15.x&3|&a1.16.x"); | |
} | |
public static void getDisable(String version) { | |
sendEnable(prefix ,"&5 <|================================================|>"); | |
sendEnable(prefix ,"&5 <|&3The plugin is &c|Successfully disabled|"); | |
sendEnable(prefix ,"&5 <|&bVersion: &d|" + version + "|"); | |
sendEnable(prefix ,"&5 <|&3By: &e|jonagamerpro1234|"); | |
sendEnable(prefix ,"&5 <|================================================|>"); | |
sendEnable(null ,"&b[&eTested Versions&b] &3|&d1.7.x&3|&a1.8.x&3|&a1.9.x&3|&a1.10.x&3|&a1.11.x&3|&a1.12.x&3|&a1.13.x&3|&a1.14.x&3|&a1.15.x&3|&a1.16.x"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | AdvancedChat | | |
# | By jonagamerpro1234 | | |
# | Version 1.4.0 | | |
# |_____________________| | |
# | |
# | |
# | |
Title: '&6&lColors' | |
Decoration: | |
Glass-Color: | |
Item: 'WHITE_STAINED_PANE_GLASS' | |
Legacy-Item: 'STAINED_PANE_GLASS' | |
Back: | |
Item: '' | |
Legacy-Item: '' | |
Use-Custom-Comand: false | |
Command: 'menu' | |
Items: | |
Dark_Red: | |
Name: '&4&lDark Red' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Red: | |
Name: '&c&lRed' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Dark_Blue: | |
Name: '&1&lDark Blue' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Blue: | |
Name: '&9&lBlue' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Dark_Green: | |
Name: '&2&lDark Green' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Green: | |
Name: '&a&lGreen' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Yellow: | |
Name: '&e&lYellow' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Gold: | |
Name: '&6&lGold' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Dark_Aqua: | |
Name: '&3&lDark Aqua' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Aqua: | |
Name: '&b&lAqua' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Light_Purple: | |
Name: '&d&lLight Purple' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Dark_Purple: | |
Name: '&5&lDark Purple' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
White: | |
Name: '&f&lWhite' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Gray: | |
Name: '&7&lGray' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Dark_Gray: | |
Name: '&8&lDark Gray' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] | |
Black: | |
Name: '&0&lBlack' | |
Use-Custom-Skull: true | |
Texture: '' | |
ID: '' | |
Item: '' | |
Legacy-Item: '' | |
Amount: 1 | |
Lore: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | AdvancedChat | | |
# | By jonagamerpro1234 | | |
# | Version 1.4.0 | | |
# |_____________________| | |
# | |
# |Type| the types are the modes that exist according to the function they can be different or the same these are all the types that exist | |
# [Default | Custom | Group ] , this options only works on certain options not all [Normal |Experimental] | |
# | |
Config: | |
Update: | |
Enabled: true #allows to send an update message available on the console [ Default| true ] | |
Lang: en #[ en | es ] there are 2 languages available at the moment [English|Spanish] | |
Notify: true #allows to send an update message available on the player [ Default| true ] | |
# | |
# |Use default prefix| | |
# if it is true it will use the prefix of the plugin itself, but if it is false it will use the prefix that you define in [Prefix: 'my server'] | |
# |ChatForma Type| | |
# [Default] use default chat by minecraft | |
# [Custom] use the chat defined in [Custom-Format] | |
# [Group] use the chat defined in [Group.<name>] but you need to add the permission that you defined for the group | |
# |ClearChat| | |
# [AutoClear] you can activate the automatic cleaning of the chat according to the number of ticks [Default | true] | |
# [Ticks] here you can define the time that the actions are automatically executed [Default | 24000], 24000 tick = 20 min | |
Settings: | |
Use-Default-Prefix: true | |
Prefix: '&6[&bMy Server&6]&7' | |
ChatFormat-Type: Default | |
ClearChat: | |
AutoClear: true | |
Tick: 24000 | |
# | |
# | Default | | |
# | This section serves as an emergency backup in case any of the other functions do not work properly. | | |
Default-Format: '<&f<name>&f> &f<msg>' | |
# | |
# | Custom | | |
# | here you can customize the chat in a general way that affects both ranks, groups, and has all players | | |
# | in custom we have a new function which is hover text this option only works if the type is in experimental its format is | |
# | |
# |this option only works in experimental to return to normal the chat change the type to [Normal] | |
# HoverEvent: | |
# Text: 'hello <name>' | |
# Color: AQUA | |
# Mode: Text there are three different modes which are [ Text | Entity | Item] the second and third are for testing, they can be removed at any time | |
Custom-Format: | |
Text: '&6[&c<name>&6]&8 &7<msg>' | |
Type: Normal | |
HoverEvent: | |
Text: '&ahello &d<name>' | |
Mode: Text | |
# | |
# |World Chat| | |
# |A chat system that can separate the chat by regions or worlds as needed or you can also let the chat be global | |
# | | |
# World-Chat: | |
# Enabled: true | |
# World-List: | |
# <world name>: | |
# Type: Global | |
# Range: 15 | |
# | |
# [World-List] here you will find the worlds that will use the chat function [Local] serves to limit the chat to a range of players according to the distance that is defined. This option depends on the [Range] | [Global] will allow all players to talk to each other | |
# [World Name] Here will be the name of the world in which the function can be activated but it is important that the world exists or that the name is not incorrect | |
# [Type] There are only two existing types which are [Local] | [Global] | |
# [Local] serves to limit the chat to a range of players according to the distance that is defined. This option depends on the [Range] | |
# [Global] will allow all players to talk to each other | |
# [Range] here you can define the distance between each player that could receive the message from another [this option only works with the type | local] | |
# | |
World-Chat: | |
Enabled: true | |
World-List: | |
World: | |
Type: Global | |
Range: 15 | |
# | |
# | Groups | | |
# | here you can customize the chat of different groups or ranks in a more specific way | | |
# | with this format you can add more groups | |
# | in group we have a new function which is hover text this option only works if the type is in experimental its format is | |
# Groups: | |
# Default: | |
# Format: '&9|&e<name>&9|&8> &7<msg>' | |
# Permission: 'advancedchat.group.default' | |
# Type: Experimental [Default | Type: Normal ] | |
# | |
# |this option only works in experimental to return to normal the chat change the type to [Normal] | |
# HoverEvent: | |
# Text: 'hello <name>' | |
# Color: AQUA | |
# | |
Groups: | |
Default: | |
Format: '&9|&e<name>&9|&8> &7<msg>' | |
Permission: 'advancedchat.group.default' | |
Type: Normal | |
HoverEvent: | |
Text: '&6hello &b<name>' | |
Mode: Text | |
Admin: | |
Format: '&9|&e<name>&9|&8> &e<msg>' | |
Permission: 'advancedchat.group.admin' | |
Owner: | |
Format: '&9|&e<name>&9|&8> &c<msg>' | |
Permission: 'advancedchat.group.owner' | |
# | |
# |Filter Chat| | |
# |here you can filter the unwanted words on your server and have a little more control over the chat | |
# | |
# [Use-Custom-Msg] will use a custom message found in the [Message] section instead of using [Form Of Censorship] [Default | false] | |
# [Message] here you can define a personalized message that will be sent to the player | |
# [Form-Of-Censorship] this is the format that the word will be censored, for example [noob = ****] this will depend on the number of characters that the word has | |
# [Delay] It is the waiting time that the message will have before it is sent so that spam does not form in the player's chat [Defalt | 100 ] | |
# | |
# |The format is very simple, you just have to add the word you want to censor to the list | |
# Words: | |
# - 'noob' | |
# - 'stupid' | |
# - '<word>' | |
# | |
Filter-Chat: | |
Enabled: true | |
Use-Custom-Msg: false | |
Message: 'you cannot use this word, it is blocked!' | |
Form-Of-Censorship: '*' | |
Delay: 5 | |
BadWords: | |
- 'noob' | |
- 'stupid' | |
- 'fuck' | |
# | |
# |Translation of messages from AdvancedChat| | |
# |Version: 1.4| | |
# | |
AdvancedChat: | |
ClearChat: | |
Server: '&7The chat has been cleaned' | |
Player: '&7The chat has been cleaned by &b[&e<name>&b]' | |
No-Permission: '&cYou dont have permission to do that!' | |
No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' | |
Error-Args: '&cUnknown Arguments' | |
Error-Console: '&cYou cannot use this command in the console' | |
Reload: '&aReload Completed' | |
Help-Cmd: '&b/AdvanceChat &8| &9/Ac &6Help &7 show more information of plugin' | |
Help-Msg: | |
- '&5> &b/AdvancedChat &8| &9/Ac &7these are the variants of the main plugin command' | |
- '&5> &b/AdvancedChat &6help &7show this same message' | |
- '&5> &b/AdvancedChat &6reload &7reload the plugin files' | |
- '&5> &b/AdvancedChat &6info &7shows information about the plugin' | |
Mute-Player: '&e[&b<name>&e] &cis now muted!' | |
UnMute-Player: '&e[&b<name>&e] &ais now unmuted!' | |
Alert-Mute: '&e[!] &cright now you are muted' | |
No-Online-Player: '' | |
# | |
# This is the end of the configuration ... [-_-] more things coming soon | |
# | |
# | Config File | |
# | Version 1.4.0-Pre-Alpha[3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | AdvancedChat | | |
# | By jonagamerpro1234 | | |
# | Version 1.4.0 | | |
# |_____________________| | |
# | |
Players-List: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AdvancedChat | |
version: ${project.version} | |
main: jss.advancedchat.AdvancedChat | |
author: jonagamerpro1234 | |
api-version: 1.13 | |
prefix: AdvancedChat | |
softdepend: [PlaceholderAPI] | |
description: Its main function is to modify the chat so that it can be personalized and add different options | |
website: https://www.spigotmc.org/resources/advancedchat-1-7-x-1-16-x.83889/ | |
commands: | |
AdvancedChat: | |
description: --- | |
aliases: | |
- ac | |
ClearChat: | |
description: --- | |
aliases: | |
- cc | |
permissions: | |
AdvancedChat.*: | |
descriprion: --- | |
children: | |
AdvancedChat.Update.Notify: true | |
AdvancedChat.Commands.Reload: true | |
AdvancedChat.Commands.Help: true | |
AdvancedChat.Tab: true | |
AdvancedChat.Chat.Color: true | |
default: op | |
AdvancedChat.Update.Notify: | |
description: --- | |
default: op | |
AdvancedChat.Commands.Relaod: | |
description: --- | |
default: op | |
AdvancedChat.Commands.Help: | |
description: --- | |
default: op | |
AdvancedChat.Tab: | |
description: --- | |
default: op | |
AdvancedChat.Commands.ClearChat: | |
description: --- | |
default: op | |
AdvancedChat.Chat.Color: | |
description: --- | |
default: op |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment