Skip to content

Commit

Permalink
Update 1.0.4 to add command /community setup
Browse files Browse the repository at this point in the history
  • Loading branch information
luluxe committed May 20, 2023
1 parent d551576 commit 338cd45
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>net</groupId>
<artifactId>communityanalytics</artifactId>
<name>communityanalytics</name>
<version>1.0.3</version>
<version>1.0.4</version>
<url>http://maven.apache.org</url>
<build>
<plugins>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net</groupId>
<artifactId>communityanalytics</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<packaging>jar</packaging>

<name>communityanalytics</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.List;

public class DispatchCommand implements CommandExecutor {

private final SpigotPlugin plugin;

public DispatchCommand(SpigotPlugin plugin) {
Expand All @@ -34,7 +33,6 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
break;
case "setup":
new SetupCommand("setup", getArgs(args,1), sender).execute(plugin);
main_command.execute(plugin);
break;
case "help":
new HelpCommand("help", getArgs(args,1), sender).execute(plugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
public class HelpCommand extends Command {
public HelpCommand(String name, List<String> args, @NotNull CommandSender sender) {
super(name, args, sender);

}

@Override
protected void execute(SpigotPlugin plugin) {
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §aCommands:");
sender.sendMessage(f(§b§lCommunityAnalytics§f) §a- /communityanalytics setup <key> <server_id>");
sender.sendMessage(f(§b§lCommunityAnalytics§f) §a- /communityanalytics reload");
sender.sendMessage(f(§b§lCommunityAnalytics§f) §a- /communityanalytics help");
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §7List of commands:");
sender.sendMessage( §a/communityanalytics setup §b<key> [server_id]");
sender.sendMessage( §a/communityanalytics reload");
sender.sendMessage( §a/communityanalytics help");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.bukkit.command.CommandSender;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class SetupCommand extends Command {
Expand All @@ -15,31 +16,30 @@ public SetupCommand(String name, List<String> args, CommandSender sender) {

@Override
protected void execute(SpigotPlugin plugin) {
// /setup <key> <server_id>
if (args.size() == 0) {
sender.sendMessage(f(§b§lCommunityAnalytics§f) §cYou need to specify a key when entering the command !");
sender.sendMessage(7Missing arg usage: §a/community setup §b<key> [server_id]");
return;
}

// Parsing
String server_id = "";
String server_id = null;
if (args.size() == 2)
server_id = args.get(1);
String path_name = "plugins/CommunityAnalytics/config.yml";

String path_name = "plugins/CommunityAnalytics/config.yml";
try {
FileUtil.replace(path_name, "platform-api-token:", "platform-api-token: '" + args.get(0)+ "'");
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §aToken has been set!");

if (args.size() == 2)
if (server_id != null)
FileUtil.replace(path_name, "server-id:", "server-id: '" + server_id + "'");
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §aServer id has been set!");
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §aConfig.yml was updated!");

plugin.reload();
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §aConfig reload!");

new MainCommand("communityanalytics", new ArrayList<>(), sender).execute(SpigotPlugin.instance);
} catch(IOException exception) {
exception.printStackTrace();
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §cError: " + exception.getMessage());
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §cError was occurred: " + exception.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class PlatformManager {
public boolean success = false;
public String version = "1.0.3";
public String version = "1.0.4";

public void getPlatformInfo() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.bstats.velocity.Metrics;
import org.slf4j.Logger;

@Plugin(id = "communityanalytics", name = "CommunityAnalytics", version = "1.0.3")
@Plugin(id = "communityanalytics", name = "CommunityAnalytics", version = "1.0.4")
public class VelocityPlugin {
public static VelocityPlugin instance;
private final ChannelIdentifier channel = new LegacyChannelIdentifier(CommunityAnalytics.CHANNEL_INFO);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/bungee.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CommunityAnalytics
author: FNetwork
main: net.communityanalytics.bungee.BungeePlugin
version: 1.0.3
version: 1.0.4
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CommunityAnalytics
author: FNetwork
main: net.communityanalytics.spigot.SpigotPlugin
website: https://communityanalytics.net
version: 1.0.3
version: 1.0.4
api-version: 1.13
commands:
communityanalytics:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/velocity-plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "communityanalytics",
"name": "CommunityAnalytics",
"version": "1.0.3",
"version": "1.0.4",
"authors": [
"FNetwork"
],
Expand Down

0 comments on commit 338cd45

Please sign in to comment.