Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.mattyhd0</groupId>
<artifactId>ChatColor</artifactId>
<version>2.7.11</version>
<version>2.7.12</version>
<packaging>jar</packaging>

<properties>
Expand All @@ -16,20 +16,34 @@
</properties>

<repositories>
<!-- PlaceholderAPI Repo -->
<!-- Maven Central (should be first) -->
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>

<!-- Spigot repository -->
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>

<!-- PlaceholderAPI repository -->
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<!-- Spigot Repo -->

<!-- Sonatype repository for Adventure API -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<id>sonatype-oss-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>

<!-- JetBrains repository for annotations -->
<repository>
<id>minecraft-libraries</id>
<name>Minecraft Libraries</name>
<url>https://libraries.minecraft.net/</url>
<id>jetbrains</id>
<url>https://www.jetbrains.com/intellij-repository/releases/</url>
</repository>
</repositories>

Expand All @@ -52,7 +66,7 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<version>2.11.6</version>
<scope>provided</scope>
</dependency>
<!-- bStats -->
Expand All @@ -63,12 +77,12 @@
<scope>compile</scope>
</dependency>
<!-- Required for XSeries -->
<dependency>
<!--<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>6.0.54</version>
<scope>compile</scope>
</dependency>
</dependency>-->
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/mattyhd0/chatcolor/MyChatColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static String applyHex(String textToTranslate, Player player){
Pattern pattern = Pattern.compile("&#[a-fA-F0-9]{6}");
Matcher matcher = pattern.matcher(textToTranslate);

if(textToTranslate.length() > 0){
if(!textToTranslate.isEmpty()){

while (matcher.find()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -25,7 +26,7 @@ public ChatColorAdminCommand(ChatColorPlugin plugin) {
this.plugin = plugin;
}

public boolean onCommand(CommandSender sender, Command command, String s, String[] arg) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, String[] arg) {


if (!(arg.length > 0)) {
Expand Down Expand Up @@ -53,7 +54,7 @@ public boolean onCommand(CommandSender sender, Command command, String s, String


@Override
public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] strings) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, String[] strings) {

List<String> completions = new ArrayList<>();

Expand Down Expand Up @@ -134,7 +135,7 @@ public void setPattern(CommandSender sender, String[] arg) {
.replaceAll("%sender%", sender.getName())
.replaceAll("%pattern%", patternName);

if (!messagePlayer.equals("")) player.sendMessage(messagePlayer);
if (!messagePlayer.isEmpty()) player.sendMessage(messagePlayer);

} else {

Expand Down Expand Up @@ -215,7 +216,7 @@ public void disable(CommandSender sender, String[] arg) {
.replaceAll("%pattern%", patternName)
.replaceAll("%sender%", sender.getName());

if (!messagePlayer.equals("")) player.sendMessage(messagePlayer);
if (!messagePlayer.isEmpty()) player.sendMessage(messagePlayer);

} else {
sender.sendMessage(
Expand Down Expand Up @@ -271,7 +272,7 @@ public void gui(CommandSender sender, String[] arg) {
String messagePlayer = messagesYMLFile.getMessage("commands.chatcoloradmin.gui.gui-opened-target")
.replaceAll("%sender%", sender.getName());

if (!messagePlayer.equals("")) player.sendMessage(messagePlayer);
if (!messagePlayer.isEmpty()) player.sendMessage(messagePlayer);

ChatColorGUI.openGui(player);
}else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
import org.bukkit.command.CommandSender;
import me.mattyhd0.chatcolor.ChatColorPlugin;
import org.bukkit.command.CommandExecutor;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public class ChatColorCommand implements CommandExecutor, TabCompleter {

private ChatColorPlugin plugin;
private final ChatColorPlugin plugin;

public ChatColorCommand(ChatColorPlugin plugin) {
this.plugin = plugin;
}

public boolean onCommand(CommandSender sender, Command command, String s, String[] arg) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, String[] arg) {

ConfigurationManager configurationManager = plugin.getConfigurationManager();

Expand Down Expand Up @@ -299,7 +300,7 @@ public void unknownCommand(Player player) {
}

@Override
public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] strings) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, String[] strings) {

List<String> completions = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

public class ConfigurationManager {

private SimpleYMLConfiguration config;
private SimpleYMLConfiguration gui;
private MessagesYMLFile messages;
private SimpleYMLConfiguration patterns;
private SimpleYMLConfiguration data;
private final SimpleYMLConfiguration config;
private final SimpleYMLConfiguration gui;
private final MessagesYMLFile messages;
private final SimpleYMLConfiguration patterns;
private final SimpleYMLConfiguration data;
public ConfigurationManager() {
this.config = new SimpleYMLConfiguration("config.yml");
this.gui = new SimpleYMLConfiguration("gui.yml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class SimpleYMLConfiguration extends YamlConfiguration {

private File file;
private final File file;

public SimpleYMLConfiguration(String fileName) {
super();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/mattyhd0/chatcolor/gui/ChatColorGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void openGui(Player player){
Placeholders.setPlaceholders(actionsStr, null, player)
);

if(slots.size() > 0){
if(!slots.isEmpty()){
for(int s: slots){
builder = builder.setGuiItem(s, Util.getItemFromConfig(file, key), actions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class ConsoleCommandAction implements GuiClickAction {

private String command;
private final String command;

public ConsoleCommandAction(String command){
this.command = command;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class PlayerCommandAction implements GuiClickAction {

private String command;
private final String command;

public PlayerCommandAction(String command){
this.command = command;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class SendMessageAction implements GuiClickAction {

private String message;
private final String message;

public SendMessageAction(String message){
this.message = message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class SetPatternAction implements GuiClickAction {

private String patternName;
private final String patternName;

public SetPatternAction(String patternName){
this.patternName = patternName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,30 @@ public static GuiClickAction getClickActionFromString(String string){

String[] splitted = string.split(":", 2);

if(splitted[0].equals("MESSAGE")){
switch (splitted[0]) {
case "MESSAGE":
return new SendMessageAction(splitted[1]);

return new SendMessageAction(splitted[1]);
case "CONSOLE-COMMAND":
return new ConsoleCommandAction(splitted[1]);

case "PLAYER-COMMAND":
return new PlayerCommandAction(splitted[1]);

} else if (splitted[0].equals("CONSOLE-COMMAND")){
case "SET-PATTERN":
return new SetPatternAction(splitted[1]);

return new ConsoleCommandAction(splitted[1]);
case "CLOSE-INVENTORY":
return new CloseInventoryAction();

} else if (splitted[0].equals("PLAYER-COMMAND")){

return new PlayerCommandAction(splitted[1]);

} else if (splitted[0].equals("SET-PATTERN")){

return new SetPatternAction(splitted[1]);

} else if (splitted[0].equals("CLOSE-INVENTORY")){

return new CloseInventoryAction();

} else if (splitted[0].equals("SOUND")){

String[] arg = splitted[1].split(" ");
try {
return new PlaySoundAction(Sound.valueOf(arg[0]), Float.parseFloat(arg[1]), Float.parseFloat(arg[2]));
} catch (IllegalArgumentException ignored){}
case "SOUND":
String[] arg = splitted[1].split(" ");
try {
return new PlaySoundAction(Sound.valueOf(arg[0]), Float.parseFloat(arg[1]), Float.parseFloat(arg[2]));
} catch (IllegalArgumentException ignored) {
}

break;
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.jetbrains.annotations.NotNull;

public class ChatListener implements EventExecutor {
private ChatColorPlugin plugin;
private final ChatColorPlugin plugin;

public ChatListener(ChatColorPlugin plugin) {
this.plugin = plugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.UUID;

public class ConnectionListener implements Listener {
private ChatColorPlugin plugin;
private HashMap<UUID, BukkitTask> playersBeingLoaded = new HashMap<>();
private final ChatColorPlugin plugin;
private final HashMap<UUID, BukkitTask> playersBeingLoaded = new HashMap<>();

public ConnectionListener(ChatColorPlugin plugin) {
this.plugin = plugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public String gradient(String text, List<ChatColor> colors, TextFormatOptions fo

for(float i = 0; i <= text.length()+divideEveryChars; i += divideEveryChars){

if(i+divideEveryChars > text.length() && text.length() > 0) {
if(i+divideEveryChars > text.length() && !text.isEmpty()) {
int lastSub = substrings.size()-1;
String latestStr = substrings.get(lastSub);
substrings.set(lastSub, latestStr+text.substring(Math.round(i)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public List<ChatColor> getFormats() {
}

public String setFormat(String text) {
if(text.length() == 0 || formats.size() == 0){
if(text.isEmpty() || formats.isEmpty()){
return text;
}
String[] splitText = text.split("");
Expand All @@ -47,7 +47,7 @@ public String setFormat(String text) {
}

public String setFormat(char character) {
if(formats.size() == 0){
if(formats.isEmpty()){
return String.valueOf(character);
}
StringBuilder formattedChar = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class PatternManager {

private Map<String, BasePattern> loadedPatternsMap;
private final Map<String, BasePattern> loadedPatternsMap;

public PatternManager(){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum PatternType {
GRADIENT(GradientPattern.class),
GRADIENT_RANDOM(RandomGradientPattern.class);

private Class clazz;
private final Class clazz;
PatternType(Class<? extends BasePattern> clazz){
this.clazz = clazz;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import me.mattyhd0.chatcolor.ChatColorPlugin;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;

public class ChatColorPlaceholders extends PlaceholderExpansion
{
public class ChatColorPlaceholders extends PlaceholderExpansion {
private Plugin plugin;

public ChatColorPlaceholders() {
Expand All @@ -19,19 +19,19 @@ public boolean canRegister() {
return true;
}

public String getAuthor() {
public @NotNull String getAuthor() {
return "MattyHD0";
}

public String getIdentifier() {
public @NotNull String getIdentifier() {
return "chatcolor";
}

public String getRequiredPlugin() {
return "ChatColor";
}

public String getVersion() {
public @NotNull String getVersion() {
return "1.0";
}

Expand Down
Loading