diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 13a17a5..dffde19 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -28,8 +28,4 @@ jobs:
distribution: 'temurin'
cache: maven
- name: Build with Maven
- run: mvn -B package --file pom.xml
-
- # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- - name: Update dependency graph
- uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
+ run: mvn -B package --file pom.xml
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index fafd452..9e87aea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
de.tubyoub
VelocityPteroPower
- 0.9.1
+ 0.9.2
jar
VelocityPteroPower
diff --git a/src/main/java/de/tubyoub/velocitypteropower/PteroCommand.java b/src/main/java/de/tubyoub/velocitypteropower/PteroCommand.java
index e26ad59..8d19813 100644
--- a/src/main/java/de/tubyoub/velocitypteropower/PteroCommand.java
+++ b/src/main/java/de/tubyoub/velocitypteropower/PteroCommand.java
@@ -75,10 +75,9 @@ public void execute(Invocation invocation) {
CommandSource sender = invocation.source();
String[] args = invocation.arguments();
- Player player = (Player) sender;
if (args.length == 0) {
- displayHelp(player);
+ displayHelp(sender);
return;
}
@@ -86,41 +85,41 @@ public void execute(Invocation invocation) {
switch (subCommand) {
case "start":
- if (player.hasPermission("ptero.start")) {
- startServer(player, args);
+ if (sender.hasPermission("ptero.start")) {
+ startServer(invocation.source(), args);
} else {
- player.sendMessage(getSPPPrefix().append(Component.text("You do not have permission to use this command.",TextColor.color(255,0,0))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("You do not have permission to use this command.",TextColor.color(255,0,0))));
}
break;
case "stop":
- if (player.hasPermission("ptero.stop")) {
- stopServer(player, args);
+ if (sender.hasPermission("ptero.stop")) {
+ stopServer(sender, args);
} else {
- player.sendMessage(getSPPPrefix().append(Component.text("You do not have permission to use this command.",TextColor.color(255,0,0))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("You do not have permission to use this command.",TextColor.color(255,0,0))));
}
break;
case "reload":
- if (player.hasPermission("ptero.reload")) {
- reloadConfig(player);
+ if (sender.hasPermission("ptero.reload")) {
+ reloadConfig(sender);
} else {
- player.sendMessage(getSPPPrefix().append(Component.text("You do not have permission to use this command.",TextColor.color(255,0,0))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("You do not have permission to use this command.",TextColor.color(255,0,0))));
}
break;
default:
- player.sendMessage(getSPPPrefix().append(Component.text("Unknown subcommand: " + subCommand)));
- displayHelp(player);
+ sender.sendMessage(getSPPPrefix().append(Component.text("Unknown subcommand: " + subCommand)));
+ displayHelp(sender);
}
}
/**
* This method is called to start a server.
*
- * @param player the player who executed the command
+ * @param sender the player who executed the command
* @param args the command arguments
*/
- private void startServer(Player player, String[] args) {
+ private void startServer(CommandSource sender, String[] args) {
if (args.length < 2) {
- player.sendMessage(getSPPPrefix().append(Component.text("Usage: /ptero start ", NamedTextColor.RED)));
+ sender.sendMessage(getSPPPrefix().append(Component.text("Usage: /ptero start ", NamedTextColor.RED)));
return;
}
String serverName = args[1];
@@ -128,7 +127,7 @@ private void startServer(Player player, String[] args) {
if (serverInfoMap.containsKey(serverName)) {
PteroServerInfo serverInfo = serverInfoMap.get(serverName);
apiClient.powerServer(serverInfo.getServerId(), "start");
- player.sendMessage(getSPPPrefix().append(Component.text("The server: "+ serverName + " is starting")));
+ sender.sendMessage(getSPPPrefix().append(Component.text("The server: "+ serverName + " is starting")));
} else {
}
}
@@ -136,12 +135,12 @@ private void startServer(Player player, String[] args) {
/**
* This method is called to stop a server.
*
- * @param player the player who executed the command
+ * @param sender the player who executed the command
* @param args the command arguments
*/
- private void stopServer(Player player, String[] args) {
+ private void stopServer(CommandSource sender, String[] args) {
if (args.length < 2) {
- player.sendMessage(getSPPPrefix().append(Component.text("Usage: /ptero stop ", TextColor.color(66,135,245))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("Usage: /ptero stop ", TextColor.color(66,135,245))));
return;
}
String serverName = args[1];
@@ -149,7 +148,7 @@ private void stopServer(Player player, String[] args) {
if (serverInfoMap.containsKey(serverName)) {
PteroServerInfo serverInfo = serverInfoMap.get(serverName);
apiClient.powerServer(serverInfo.getServerId(), "stop");
- player.sendMessage(getSPPPrefix().append(Component.text("The server: "+ serverName + " is stopping")));
+ sender.sendMessage(getSPPPrefix().append(Component.text("The server: "+ serverName + " is stopping")));
} else {
}
}
@@ -157,11 +156,11 @@ private void stopServer(Player player, String[] args) {
/**
* This method is called to reload the configuration.
*
- * @param player the player who executed the command
+ * @param sender the player who executed the command
*/
- private void reloadConfig(Player player) {
+ private void reloadConfig(CommandSource sender) {
plugin.reloadConfig();
- player.sendMessage(getSPPPrefix().append(Component.text("Configuration reloaded.",TextColor.color(0,255,0))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("Configuration reloaded.",TextColor.color(0,255,0))));
}
/**
@@ -195,12 +194,12 @@ public List suggest(Invocation invocation) {
return null;
}
- private void displayHelp(Player player) {
- player.sendMessage(getSPPPrefix().append(Component.text("Available commands:", NamedTextColor.GREEN)));
- player.sendMessage(getSPPPrefix().append(Component.text("/ptero start ", TextColor.color(66,135,245))));
- player.sendMessage(getSPPPrefix().append(Component.text("/ptero stop ", TextColor.color(66,135,245))));
- player.sendMessage(getSPPPrefix().append(Component.text("/ptero reload", TextColor.color(66,135,245))));
- player.sendMessage(getSPPPrefix().append(Component.text("/ptero help", TextColor.color(66,135,245))));
+ private void displayHelp(CommandSource sender) {
+ sender.sendMessage(getSPPPrefix().append(Component.text("Available commands:", NamedTextColor.GREEN)));
+ sender.sendMessage(getSPPPrefix().append(Component.text("/ptero start ", TextColor.color(66,135,245))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("/ptero stop ", TextColor.color(66,135,245))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("/ptero reload", TextColor.color(66,135,245))));
+ sender.sendMessage(getSPPPrefix().append(Component.text("/ptero help", TextColor.color(66,135,245))));
}
private Component getSPPPrefix() {