Updates dependencies, and removes some redundant code
This commit is contained in:
		
							
								
								
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							@@ -65,13 +65,13 @@
 | 
				
			|||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>org.jetbrains</groupId>
 | 
					            <groupId>org.jetbrains</groupId>
 | 
				
			||||||
            <artifactId>annotations</artifactId>
 | 
					            <artifactId>annotations</artifactId>
 | 
				
			||||||
            <version>24.0.1</version>
 | 
					            <version>26.0.0</version>
 | 
				
			||||||
            <scope>provided</scope>
 | 
					            <scope>provided</scope>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>us.dynmap</groupId>
 | 
					            <groupId>us.dynmap</groupId>
 | 
				
			||||||
            <artifactId>dynmap-api</artifactId>
 | 
					            <artifactId>dynmap-api</artifactId>
 | 
				
			||||||
            <version>3.1-beta-2</version>
 | 
					            <version>3.5</version>
 | 
				
			||||||
            <scope>provided</scope>
 | 
					            <scope>provided</scope>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
@@ -112,7 +112,7 @@
 | 
				
			|||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>org.junit.jupiter</groupId>
 | 
					            <groupId>org.junit.jupiter</groupId>
 | 
				
			||||||
            <artifactId>junit-jupiter</artifactId>
 | 
					            <artifactId>junit-jupiter</artifactId>
 | 
				
			||||||
            <version>5.9.2</version>
 | 
					            <version>5.11.4</version>
 | 
				
			||||||
            <scope>test</scope>
 | 
					            <scope>test</scope>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
    </dependencies>
 | 
					    </dependencies>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
package net.knarcraft.stargate.command;
 | 
					package net.knarcraft.stargate.command;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import de.themoep.minedown.MineDown;
 | 
					import de.themoep.minedown.MineDown;
 | 
				
			||||||
 | 
					import net.knarcraft.knarlib.util.FileHelper;
 | 
				
			||||||
import net.knarcraft.stargate.Stargate;
 | 
					import net.knarcraft.stargate.Stargate;
 | 
				
			||||||
import net.knarcraft.stargate.config.Message;
 | 
					import net.knarcraft.stargate.config.Message;
 | 
				
			||||||
import net.knarcraft.stargate.utility.FileHelper;
 | 
					 | 
				
			||||||
import net.md_5.bungee.api.ChatColor;
 | 
					import net.md_5.bungee.api.ChatColor;
 | 
				
			||||||
import net.md_5.bungee.api.chat.BaseComponent;
 | 
					import net.md_5.bungee.api.chat.BaseComponent;
 | 
				
			||||||
import org.bukkit.command.Command;
 | 
					import org.bukkit.command.Command;
 | 
				
			||||||
@@ -13,6 +13,7 @@ import org.jetbrains.annotations.NotNull;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.io.InputStream;
 | 
					import java.io.InputStream;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This command represents the plugin's about command
 | 
					 * This command represents the plugin's about command
 | 
				
			||||||
@@ -26,9 +27,11 @@ public class CommandAbout implements CommandExecutor {
 | 
				
			|||||||
        ChatColor textColor = ChatColor.GOLD;
 | 
					        ChatColor textColor = ChatColor.GOLD;
 | 
				
			||||||
        ChatColor highlightColor = ChatColor.GREEN;
 | 
					        ChatColor highlightColor = ChatColor.GREEN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try (InputStream inputStream = Stargate.class.getResourceAsStream("/messages/about.md")) {
 | 
					
 | 
				
			||||||
 | 
					        try (InputStream inputStream = FileHelper.getInputStreamForInternalFile("/messages/about.md")) {
 | 
				
			||||||
            if (inputStream != null) {
 | 
					            if (inputStream != null) {
 | 
				
			||||||
                String aboutMessageString = FileHelper.readStreamToString(inputStream);
 | 
					                List<String> lines = FileHelper.readLines(FileHelper.getBufferedReaderFromInputStream(inputStream));
 | 
				
			||||||
 | 
					                String aboutMessageString = String.join("\n", lines);
 | 
				
			||||||
                BaseComponent[] component = MineDown.parse(aboutMessageString);
 | 
					                BaseComponent[] component = MineDown.parse(aboutMessageString);
 | 
				
			||||||
                commandSender.spigot().sendMessage(component);
 | 
					                commandSender.spigot().sendMessage(component);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,36 +0,0 @@
 | 
				
			|||||||
package net.knarcraft.stargate.utility;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.jetbrains.annotations.NotNull;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.io.BufferedReader;
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
import java.io.InputStream;
 | 
					 | 
				
			||||||
import java.io.InputStreamReader;
 | 
					 | 
				
			||||||
import java.nio.charset.StandardCharsets;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public final class FileHelper {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private FileHelper() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Converts the stream directly into a string, includes the newline character
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param stream <p> The stream to read from </p>
 | 
					 | 
				
			||||||
     * @return <p> A String of the file read </p>
 | 
					 | 
				
			||||||
     * @throws IOException <p>If unable to read the stream</p>
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @NotNull
 | 
					 | 
				
			||||||
    public static String readStreamToString(@NotNull InputStream stream) throws IOException {
 | 
					 | 
				
			||||||
        InputStreamReader inputStreamReader = new InputStreamReader(stream, StandardCharsets.UTF_8);
 | 
					 | 
				
			||||||
        BufferedReader reader = new BufferedReader(inputStreamReader);
 | 
					 | 
				
			||||||
        String line = reader.readLine();
 | 
					 | 
				
			||||||
        StringBuilder lines = new StringBuilder();
 | 
					 | 
				
			||||||
        while (line != null) {
 | 
					 | 
				
			||||||
            lines.append(line).append("\n");
 | 
					 | 
				
			||||||
            line = reader.readLine();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return lines.toString();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user