Modify the about command
This commit is contained in:
26
pom.xml
26
pom.xml
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>net.knarcraft</groupId>
|
||||
<artifactId>Stargate</artifactId>
|
||||
<version>0.11.5.5</version>
|
||||
<version>0.11.5.6</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
@@ -39,6 +39,10 @@
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>minebench-repo</id>
|
||||
<url>https://repo.minebench.de/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -96,6 +100,18 @@
|
||||
<version>3.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.3.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.themoep</groupId>
|
||||
<artifactId>minedown</artifactId>
|
||||
<version>1.7.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -120,6 +136,7 @@
|
||||
<includes>
|
||||
<include>org.bstats:*</include>
|
||||
<include>net.knarcraft:knarlib</include>
|
||||
<include>de.themoep:minedown</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
@@ -139,6 +156,13 @@
|
||||
<pattern>net.knarcraft</pattern>
|
||||
<shadedPattern>net.knarcraft</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>net.kyori</pattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>de.themoep.minedown</pattern>
|
||||
<shadedPattern>net.knarcraft.stargate.minedown</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
<filter>
|
||||
|
@@ -460,7 +460,7 @@ public class Stargate extends JavaPlugin {
|
||||
private void registerCommands() {
|
||||
PluginCommand stargateCommand = this.getCommand("stargate");
|
||||
if (stargateCommand != null) {
|
||||
stargateCommand.setExecutor(new CommandStarGate());
|
||||
stargateCommand.setExecutor(new CommandStarGate(this));
|
||||
stargateCommand.setTabCompleter(new StarGateTabCompleter());
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,18 @@
|
||||
package net.knarcraft.stargate.command;
|
||||
|
||||
import de.themoep.minedown.MineDown;
|
||||
import net.knarcraft.stargate.Stargate;
|
||||
import net.knarcraft.stargate.utility.FileHelper;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* This command represents the plugin's about command
|
||||
*/
|
||||
@@ -18,10 +24,14 @@ public class CommandAbout implements CommandExecutor {
|
||||
|
||||
ChatColor textColor = ChatColor.GOLD;
|
||||
ChatColor highlightColor = ChatColor.GREEN;
|
||||
commandSender.sendMessage(textColor + "Stargate Plugin originally created by " + highlightColor +
|
||||
"Drakia" + textColor + ", and revived by " + highlightColor + "EpicKnarvik97");
|
||||
commandSender.sendMessage(textColor + "Go to " + highlightColor +
|
||||
"https://git.knarcraft.net/EpicKnarvik97/Stargate " + textColor + "for the official repository");
|
||||
|
||||
try(InputStream inputStream = Stargate.class.getResourceAsStream("/messages/about.md")){
|
||||
String aboutMessageString = FileHelper.readStreamToString(inputStream);
|
||||
BaseComponent[] component = MineDown.parse(aboutMessageString);
|
||||
commandSender.spigot().sendMessage(component);
|
||||
} catch (IOException ioException){
|
||||
commandSender.sendMessage("Internal error");
|
||||
}
|
||||
String author = Stargate.getStargateConfig().getLanguageLoader().getString("author");
|
||||
if (!author.isEmpty()) {
|
||||
commandSender.sendMessage(textColor + "Language created by " + highlightColor + author);
|
||||
|
30
src/main/java/net/knarcraft/stargate/utility/FileHelper.java
Normal file
30
src/main/java/net/knarcraft/stargate/utility/FileHelper.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package net.knarcraft.stargate.utility;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class 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>
|
||||
*/
|
||||
public static String readStreamToString(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();
|
||||
}
|
||||
}
|
6
src/main/resources/messages/about.md
Normal file
6
src/main/resources/messages/about.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Stargate Unified Legacy v. @version@ (maintained by [sgrewritten.org](https://sgrewritten.org)).
|
||||
A Hmod transportation concept by [Dinnerbone](https://github.com/Dinnerbone) and [Sturmeh](https://github.com/Sturmeh). Ported to bukkit by Drakia(https://github.com/DrakiaXYZ).
|
||||
Revived by [EpicKnarvik97](https://sgrewritten.org/knarvik), now incorporating features from all other Stargate forks.
|
||||
|
||||
For more information, visit [sgrewritten.org/legacy](https://sgrewritten.org/legacy)
|
||||
For current versions, visit [sgrewritten.org/download](https://sgrewritten.org/download)
|
Reference in New Issue
Block a user