Skip to content

Commit

Permalink
Revert "Action command added"
Browse files Browse the repository at this point in the history
This reverts commit 82a5b7b.
  • Loading branch information
luluxe committed Oct 3, 2023
1 parent 82a5b7b commit 22b96f2
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 132 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
case "help":
new HelpCommand("help", getArgs(args,1), sender).execute(plugin);
break;
case "action":
new ActionCommand("action", getArgs(args,1), sender).execute(plugin);
break;
default:
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §cUnknown command ! type /communityanalytics help for more informations");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public HelpCommand(String name, List<String> args, @NotNull CommandSender sender
protected void execute(SpigotPlugin plugin) {
sender.sendMessage("§f(§b§lCommunityAnalytics§f) §7List of commands:");
sender.sendMessage("§e» §a/communityanalytics setup §b<key> [server_id]");
sender.sendMessage("§e» §a/communityanalytics action §b<name/uuid> <action>");
sender.sendMessage("§e» §a/communityanalytics reload");
sender.sendMessage("§e» §a/communityanalytics help");
}
Expand Down
29 changes: 0 additions & 29 deletions src/main/java/net/communityanalytics/spigot/data/Action.java

This file was deleted.

31 changes: 2 additions & 29 deletions src/main/java/net/communityanalytics/spigot/data/Session.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package net.communityanalytics.spigot.data;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.communityanalytics.spigot.SpigotPlugin;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.UUID;

public class Session {

private final UUID uuid;
private final String name;
private final LocalDateTime join_at;
private String ip_connect;
private String ip_user;
private final List<Action> actions;
private final LocalDateTime join_at;
private LocalDateTime quit_at = null;

/**
Expand All @@ -31,17 +29,12 @@ public Session(UUID uuid, String name, String ip_connect, String ip_user) {
this.ip_connect = ip_connect;
this.ip_user = ip_user;
this.join_at = LocalDateTime.now();
this.actions = new ArrayList<>();
}
// Getters

public UUID getUuid() {
return uuid;
}

public String getName() {
return name;
}
// Use when proxy send player info

public void setIp_connect(String ip_connect) {
Expand All @@ -52,16 +45,6 @@ public void setIp_user(String ip_user) {
this.ip_user = ip_user;
}

// Actions

/**
* Add an action to the session
*
* @param action Action
*/
public void addAction(Action action) {
this.actions.add(action);
}
/**
* Check if a session is finish, for a session to be finished the end date must not be null
*
Expand All @@ -84,15 +67,6 @@ public JsonObject toJSONObject() {
session.addProperty("ip_user", this.ip_user);
session.addProperty("join_at", this.join_at.toString());
session.addProperty("quit_at", this.quit_at.toString());

JsonArray actions = new JsonArray();
this.actions.forEach(action -> {
JsonObject actionObject = new JsonObject();
actionObject.addProperty("name", action.getName());
actionObject.addProperty("date", action.getDate().toString());
actions.add(actionObject);
});
session.add("actions", actions);
return session;
}

Expand Down Expand Up @@ -125,7 +99,6 @@ public String toString() {
", ipPlayer='" + ip_user + '\'' +
", firstDate=" + join_at +
", endDate=" + quit_at +
", actions=" + actions +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.*;

public class SessionManager {
private final List<Session> sessions = new ArrayList<>();
private final List<Session> sessions = new ArrayList<Session>();
private BukkitTask scheduledFuture = null;

public SessionManager() {
Expand All @@ -39,17 +39,6 @@ public Optional<Session> find(UUID uuid) {
return this.sessions.stream().filter(session -> session.getUuid().equals(uuid)).findFirst();
}

/**
* Recovers a session based on a player name, if no session is found then the
* optional will be empty
*
* @param name User's name
* @return Optional<Session> Optional that can contain the session
*/
public Optional<Session> find(String name) {
return this.sessions.stream().filter(session -> session.getName().equals(name)).findFirst();
}

/**
* Add a session to the list
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class FileUtil {
* @param path_name String
* @param line_to_replace String
* @param replace_with String
* @throws IOException IOException
* @throws IOException
*/
public static void replace(String path_name, String line_to_replace, String replace_with) throws IOException {
File file = new File(path_name);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ commands:
permission: "communityanalytics.admin"
permission-message: "You don't have permission for this command."
description: "Reload, Debug and more..."
usage: "/communityanalytics <reload|setup|help|action> "
usage: "/communityanalytics <reload|setup|help> "
aliases:
- "ca"
- "community"
Expand Down

0 comments on commit 22b96f2

Please sign in to comment.