Skip to content

Commit

Permalink
Rework
Browse files Browse the repository at this point in the history
  • Loading branch information
Florianpal1 committed Jan 7, 2022
1 parent 9d7ade4 commit 4dfe0ca
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public class ChatListener implements Listener, PluginMessageListener {

private FMessage plugin;
private final FMessage plugin;
public ChatListener(FMessage plugin) {
this.plugin = plugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import java.io.File;

public class ConfigurationManager {
private FMessage core;
private final FMessage core;

private ChatConfig chat = new ChatConfig();
private File chatFile;
private FileConfiguration chatConfig;
private final ChatConfig chat = new ChatConfig();
private final File chatFile;
private final FileConfiguration chatConfig;

public ConfigurationManager(FMessage core) {
this.core = core;
Expand Down
2 changes: 2 additions & 0 deletions FMessageBukkit/src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chatFormat: "&7{displayName}&7: &r{message}"
ignoreFormat: "&7Ceci est un message que vous avez décidé d'ignorer."
5 changes: 5 additions & 0 deletions FMessageBukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: FMessageBukkit
main: fr.florianpal.fmessage.FMessage
author: florianpal
version: 1.0
api-version: 1.16
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class FMessage extends Plugin {

private Map<Integer,Group> groups = new HashMap<>();
private Map<UUID, List<UUID>> ignores = new HashMap<>();
private Map<UUID, UUID> playerMessage = new HashMap<>();
private List<UUID> playerSpy = new ArrayList<>();
private final Map<UUID, UUID> playerMessage = new HashMap<>();
private final List<UUID> playerSpy = new ArrayList<>();

@Override
public void onEnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
@CommandAlias("group")
public class GroupCommand extends BaseCommand {

private FMessage plugin;
private CommandManager commandManager;
private GroupCommandManager groupCommandManager;
private GroupMemberCommandManager groupMemberCommandManager;
private final FMessage plugin;
private final CommandManager commandManager;
private final GroupCommandManager groupCommandManager;
private final GroupMemberCommandManager groupMemberCommandManager;

public GroupCommand(FMessage plugin) {
this.plugin = plugin;
Expand All @@ -28,8 +28,8 @@ public GroupCommand(FMessage plugin) {
}

@Subcommand("create")
@CommandPermission("hc.group.create")
@Description("{@@hypercraft.group_create_help_description}")
@CommandPermission("fmessage.group.create")
@Description("{@@fmessage.group_create_help_description}")
public void onCreate(ProxiedPlayer playerSender, String groupName) {
if(groupCommandManager.groupExist(playerSender, groupName)) {
CommandIssuer issuerTarget = commandManager.getCommandIssuer(playerSender);
Expand All @@ -45,8 +45,8 @@ public void onCreate(ProxiedPlayer playerSender, String groupName) {
}

@Subcommand("remove")
@CommandPermission("hc.group.remove")
@Description("{@@hypercraft.group_create_help_description}")
@CommandPermission("fmessage.group.remove")
@Description("{@@fmessage.group_create_help_description}")
public void onRemove(ProxiedPlayer playerSender, String groupName) {
if(groupCommandManager.groupExist(playerSender, groupName)) {
CommandIssuer issuerTarget = commandManager.getCommandIssuer(playerSender);
Expand All @@ -62,8 +62,8 @@ public void onRemove(ProxiedPlayer playerSender, String groupName) {
}

@Subcommand("member add")
@CommandPermission("hc.group.member.add")
@Description("{@@hypercraft.group_member_create_help_description}")
@CommandPermission("fmessage.group.member.add")
@Description("{@@fmessage.group_member_create_help_description}")
public void onAddMember(ProxiedPlayer playerSender, String groupName, String playerTargetName) {
ProxiedPlayer playerTarget = plugin.getProxy().getPlayer(playerTargetName);

Expand Down Expand Up @@ -91,8 +91,8 @@ public void onAddMember(ProxiedPlayer playerSender, String groupName, String pla
}

@Subcommand("member kick")
@CommandPermission("hc.group.member.kick")
@Description("{@@hypercraft.group_member_kickv_help_description}")
@CommandPermission("fmessage.group.member.kick")
@Description("{@@fmessage.group_member_kickv_help_description}")
public void onRemoveMember(ProxiedPlayer playerSender, String groupName, String playerTargetName) {
ProxiedPlayer playerTarget = plugin.getProxy().getPlayer(playerTargetName);
if(playerTarget != null) {
Expand All @@ -118,8 +118,8 @@ public void onRemoveMember(ProxiedPlayer playerSender, String groupName, String
}

@Subcommand("msg")
@CommandPermission("hc.group.msg")
@Description("{@@hypercraft.group_msg_help_description}")
@CommandPermission("fmessage.group.msg")
@Description("{@@fmessage.group_msg_help_description}")
public void onMSG(ProxiedPlayer playerSender, String groupName, String message) {
if (groupCommandManager.groupExist(groupName)) {
int id_group = groupCommandManager.getGroupId(groupName);
Expand All @@ -143,8 +143,8 @@ public void onMSG(ProxiedPlayer playerSender, String groupName, String message)
}

@Subcommand("toggle")
@CommandPermission("hc.group.toggle")
@Description("{@@hypercraft.group_toggle_help_description}")
@CommandPermission("fmessage.group.toggle")
@Description("{@@fmessage.group_toggle_help_description}")
public void onToggle(ProxiedPlayer playerSender, String groupName) {
if (groupCommandManager.groupExist(groupName)) {
int id_group = groupCommandManager.getGroupId(groupName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
@CommandAlias("ignore")
public class IgnoreCommand extends BaseCommand {

private FMessage plugin;
private CommandManager commandManager;
private IgnoreCommandManager ignoreCommandManager;
private final FMessage plugin;
private final CommandManager commandManager;
private final IgnoreCommandManager ignoreCommandManager;

public IgnoreCommand(FMessage plugin) {
this.plugin = plugin;
Expand All @@ -23,8 +23,8 @@ public IgnoreCommand(FMessage plugin) {
}

@Default
@CommandPermission("hc.ignore")
@Description("{@@hypercraft.ignore_help_description}")
@CommandPermission("fmessage.ignore")
@Description("{@@fmessage.ignore_help_description}")
@CommandCompletion("@players")
public void onIgnore(ProxiedPlayer playerSender, String playerTargetName) {
ProxiedPlayer playerTarget = plugin.getProxy().getPlayer(playerTargetName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

@CommandAlias("m|msg")
public class MSGCommand extends BaseCommand {
private FMessage plugin;
private CommandManager commandManager;
private IgnoreCommandManager ignoreCommandManager;
private final FMessage plugin;
private final CommandManager commandManager;
private final IgnoreCommandManager ignoreCommandManager;

public MSGCommand(FMessage plugin) {
this.plugin = plugin;
Expand All @@ -28,8 +28,8 @@ public MSGCommand(FMessage plugin) {
}

@Default
@CommandPermission("hc.msg")
@Description("{@@hypercraft.msg_help_description}")
@CommandPermission("fmessage.msg")
@Description("{@@fmessage.msg_help_description}")
@CommandCompletion("@players")
public void onMSG(ProxiedPlayer playerSender, String playerTargetName, String message) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@

@CommandAlias("chatspy")
public class MSGSpyCommand extends BaseCommand {
private FMessage plugin;
private CommandManager commandManager;
private final FMessage plugin;
private final CommandManager commandManager;

public MSGSpyCommand(FMessage plugin) {
this.plugin = plugin;
this.commandManager = plugin.getCommandManager();
}

@Default
@CommandPermission("hc.chatspy")
@Description("{@@hypercraft.msgspy_help_description}")
@CommandPermission("fmessage.chatspy")
@Description("{@@fmessage.msgspy_help_description}")
public void onMSGSpy(ProxiedPlayer playerSender) {
CommandIssuer issuerTarget = commandManager.getCommandIssuer(playerSender);
if(plugin.isPlayerSpy(playerSender.getUniqueId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@

@CommandAlias("r")
public class RCommand extends BaseCommand {
private FMessage plugin;
private CommandManager commandManager;
private final FMessage plugin;
private final CommandManager commandManager;

public RCommand(FMessage plugin) {
this.plugin = plugin;
this.commandManager = plugin.getCommandManager();
}

@Default
@CommandPermission("hc.r")
@Description("{@@hypercraft.r_help_description}")
@CommandPermission("fmessage.r")
@Description("{@@fmessage.r_help_description}")
public void onR(ProxiedPlayer playerSender, String message){
if(!plugin.havePreviousPlayer(playerSender)) {
CommandIssuer issuerTarget = commandManager.getCommandIssuer(playerSender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
@CommandAlias("unignore")
public class UnIgnoreCommand extends BaseCommand {

private FMessage plugin;
private CommandManager commandManager;
private IgnoreCommandManager ignoreCommandManager;
private final FMessage plugin;
private final CommandManager commandManager;
private final IgnoreCommandManager ignoreCommandManager;

public UnIgnoreCommand(FMessage plugin) {
this.plugin = plugin;
Expand All @@ -25,13 +25,10 @@ public UnIgnoreCommand(FMessage plugin) {
}

@Default
@CommandPermission("hc.unignore")
@Description("{@@hypercraft.unignore_help_description}")
@CommandPermission("fmessage.unignore")
@Description("{@@fmessage.unignore_help_description}")
@CommandCompletion("@players")
public void onUnIgnore(ProxiedPlayer playerSender, String playerTargetName) {



ProxiedPlayer playerTarget = plugin.getProxy().getPlayer(playerTargetName);
if(playerTarget != null) {
if(ignoreCommandManager.ignoreExist(playerSender, playerTarget)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public enum MessageKeys implements MessageKeyProvider {

IGNORE_NOT_EXIST;

private static final String PREFIX = "hypercraft";
private static final String PREFIX = "fmessage";

private final MessageKey key = MessageKey.of(PREFIX + "." + this.name().toLowerCase());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class GroupeMemberQueries implements IDatabaseTable {
private static final String REMOVE_GROUP = "DELETE FROM hcm_groupMembers WHERE id_group=?";
private static final String UPDATE_GROUP_MEMBER_TOGGLE = "UPDATE hcm_groupMembers SET toggle=? WHERE id_group=? and playerMemberUuid=?";

private DatabaseManager databaseManager;
private final DatabaseManager databaseManager;

public GroupeMemberQueries(FMessage plugin) {
this.databaseManager = plugin.getDatabaseManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class GroupeQueries implements IDatabaseTable {
private static final String ADD_GROUP = "INSERT INTO hcm_groups (playerOwnerUuid, name) VALUES(?,?)";
private static final String REMOVE_GROUP = "DELETE FROM hcm_groups WHERE id=?";

private DatabaseManager databaseManager;
private final DatabaseManager databaseManager;

public GroupeQueries(FMessage plugin) {
this.databaseManager = plugin.getDatabaseManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class IgnoreQueries implements IDatabaseTable {
private static final String ADD_IGNORE = "INSERT INTO hcm_ignores (playerSenderUuid, playerTargetUuid) VALUES(?,?)";
private static final String REMOVE_IGNORE = "DELETE FROM hcm_ignores WHERE playerSenderUuid=? and playerTargetUuid=?";

private DatabaseManager databaseManager;
private final DatabaseManager databaseManager;

public IgnoreQueries(FMessage plugin) {
this.databaseManager = plugin.getDatabaseManager();
Expand Down
8 changes: 8 additions & 0 deletions FMessageBungee/src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
database:
url: "jdbc:mysql://localhost:3306/test"
user: "root"
password: ""
format:
senderChatFormat: "&f[&7me &f => &7 {target}&f]&7: &r{message}"
targetChatFormat: "&f[&7{sender} &f => &7 me&f]&7: &r{message}"
spyChatFormat: "&f[&7{sender} &f => &7 {target}&f]&7: &r{message}"
79 changes: 79 additions & 0 deletions FMessageBungee/src/main/resources/lang_fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
fmessage:

help_description: "Afficher l'aide des différentes commandes"
no_previous_player: "Vous ne parliez avec aucun joueur."
player_offline: "Le joueur n'est pas connecté."
spy_activate: "Vous avez activé le spy."
spy_desactivate: "Vous avez désactivé le spy."
ignore_success: "Vous ignorez désormais le joueur {player}."
ignore_already: "Vous ignorez déjà le joueur {player}."

sender_ignore_message: "Vous ne pouvez pas envoyé de message à une personne que vous ignorez !"
target_ignore_message: "La personne que vous essayez de joindre vous ignore !"

cannot_ignore: "Vous ne pouvez pas ignoré cette personne."

unignore_success: "Vous n'ignorez plus le joueur {player}."
unignore_already: "Vous n'ignorez pas le joueur {player}."

ignore_not_exist: "Le joueur {player} ne sait jamais connecté sur le serveur."

group_already_exist: "Le groupe {group} existe déjà."
group_create_success: "Vous avez réussi à créer le groupe {group}"

group_cannot_exist: "Le groupe {group} n'existe pas."
group_remove_success: "Vous avez réussi à enlever le joueur {player} du groupe {group}."

group_already_in_group: "Le joueur {player} est déjà dans le groupe"
group_addmember_success: "Vous avez ajouté le joueur {player} au groupe {group}."

group_member_not_ingroup: "Vous n'êtes actuellement pas dans le groupe."
group_removemember_success: "Vous avez kick le joueur {player} du groupe {group}"

group_toggle_desactivate: "Vous avez desactivé le toggle sur le groupe {group}."
group_toggle_activate: "Vous avez activé le toggle sur le groupe {group}."

group_already_toggle: "Votre toggle est déjà activé sur un groupe."

group_msg: "[{group}] {player} : {message}"
acf-minecraft:
invalid_world: "Ce monde n'existe pas !"
you_must_be_holding_item: "Vous devez avoir un item dans votre main !"
acf-minecraft.player_is_vanished_confirm: " Attention: <c2>{vanished}</c2> est vanish. Ne le démasquez pas !
Pour confirmer, ajoutez <c2>:confirm</c2> à la fin de son nom.
Ex = <c2>{vanished}:confirm</c2>"
username_too_short: "Pseudo trop court, il doit faire au moins trois caractères !"
is_not_a_valid_name: "<c2>{name}</c2> n'est pas un pseudo valide !"
multiple_players_match: "Plusieurs joueurs correspondent à <c2>{search}</c2> (<c2>{all}</c2>), soyez plus spécifique !"
no_player_found_server: "Aucun joueur correspondant à <c2>{search}</c2> n'est connecté sur ce serveur !"
no_player_found_offline: "Aucun joueur correspondant à <c2>{search}</c2> n'a été trouvé !"
no_player_found: "Aucun joueur correspondant à <c2>{search}</c2> n'a été trouvé !"
location_please_specify_world: "Veuillez spécifier le monde. Exemple: <c2>world:x,y,z</c2> !"
location_please_specify_xyz: "Merci d'indiquer au format x,y,z. Exemple: <c2>world:x,y,z</c2> !"
location_console_not_relative: "La console ne peut pas utiliser des coordonnées relatives pour la location !"
acf-core:
permission_denied: "Vous n'avez pas la permission d'exécuter cette commande !"
error_generic_logged: "Une erreur est survenue ! Ce problème a été enregistré. Désolé pour le dérangement."
unknown_command: "Commande inconnue, merci de faire <c2>/help </c2>!"
invalid_syntax: "Syntaxe invalide ! Usage: <c2>{command} </c2>{syntax}."
error_prefix: "{message}"
error_performing_command: "Une erreur est survenue lors de l'exécution de cette commande !"
info_message: "{message}"
please_specify_one_of: "Veuillez choisir parmi (<c2>{valid})</c2> !"
must_be_a_number: "<c2>{num}</c2> doit être un nombre !"
must_be_min_length: "Doit faire au moins <c2>{min}</c2> &ccaractères !"
must_be_max_length: "Doit faire moins de <c2>{max}</c2> caractères!"
please_specify_at_most: "Veuillez spécifier une valeur inférieure à <c2>{max}</c2> !"
please_specify_at_least: "Veuillez spécifier une valeur supérieure à <c2>{min}</c2> !"
not_allowed_on_console: "La console ne peut pas exécuter cette commande !"
could_not_find_player: "Impossible de trouver un joueur avec le nom: <c2>{search}</c2> !"
no_command_matched_search: "Aucune commande correspondant à <c2>{search}</c2> !"
help_page_information: "- Page <c2>{page} de <c2>{totalpages}</c2> (<c2>{results}</c2> résultats)."
help_no_results: "Plus aucun résultats."
help_header: "Affichage de l'aide pour la commande <c2>{commandprefix}{command}</c2>: "
help_format: "<c2>{command}</c2> <c3>{parameters}</c3> <c2>{separator}</c2> {description}"
help_detailed_header: "Affichage de l'aide détaillée pour <c2>{commandprefix}{command}</c2>: "
help_detailed_command_format: "<c2>{command}</c2> {parameters} <c2>{separator}</c2> {description}"
help_detailed_parameter_format: "<c2>{name}:</c2> {description}"
help_search_header: "Résultats de la recherche pour <c2>{commandprefix}{command}</c2>: <c2>{search}</c2>"
permission_denied_parameter: "Vous n'avez pas la permission d'effectuer cette commande."
4 changes: 4 additions & 0 deletions FMessageBungee/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: FMessageBungee
main: fr.florianpal.fmessage.FMessage
version: 1.0
author: florianpal

0 comments on commit 4dfe0ca

Please sign in to comment.