Skip to content

Commit

Permalink
rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gab4000 committed Nov 3, 2024
1 parent 51da5a2 commit 6ace335
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/main/java/fr/communaywen/core/Managers.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void init(AywenCraftPlugin plugin) {
guidelineManager = new GuidelineManager(plugin);
contestCache = new ContestCache(plugin);
contestManager = new ContestManager(plugin, contestCache);
this.teamManager = new TeamManager(plugin);
teamManager = new TeamManager(plugin);
scoreboardManager = new ScoreboardManager(plugin);
dreamdimManager = new DimensionManager(plugin);
homeManager = new HomeManager(plugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SendingLetter extends MailboxInv {
// private final TeamManager teamManager;
// private final List<String> playerFriends; -> Temporaire

int mail_accept;
int mailAccept;

public SendingLetter(Player player, OfflinePlayer receiver, AywenCraftPlugin plugin) {
super(player);
Expand All @@ -33,7 +33,7 @@ public SendingLetter(Player player, OfflinePlayer receiver, AywenCraftPlugin plu
// this.teamManager = plugin.getManagers().getTeamManager();
// FriendsManager friendsManager = plugin.getManagers().getFriendsManager();
// playerFriends = (List<String>) friendsManager.getFriendsAsync(player.getName());
this.mail_accept = SettingsCache.settingsMap.get(receiver.getUniqueId().toString()).mail_accept();
mailAccept = SettingsCache.settingsMap.get(receiver.getUniqueId().toString()).mailAccept();
inventory = Bukkit.createInventory(this, 54, MailboxMenuManager.getInvTitle(INV_NAME));
inventory.setItem(49, getHead(receiver));
inventory.setItem(45, homeBtn());
Expand All @@ -45,7 +45,7 @@ public SendingLetter(Player player, OfflinePlayer receiver, AywenCraftPlugin plu

@Override
public void openInventory() {
player.openInventory(this.inventory);
player.openInventory(inventory);
}

public ItemStack[] getItems() {
Expand All @@ -65,8 +65,8 @@ public void sendLetter() {
sendFailureMessage(player, "Vous ne pouvez pas envoyer de lettre vide");
return;
}
plugin.getLogger().info("Mail Accept" + mail_accept);
switch (mail_accept) {
plugin.getLogger().info("Mail Accept" + mailAccept);
switch (mailAccept) {
case 0:
sendFailureMessage(player, "Ce joueur n'accepte pas les lettres");
for (ItemStack item : items) player.getWorld().dropItemNaturally(player.getLocation(), item);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package fr.communaywen.core.settings;

public record PlayerSettings(String uuid, int mail_accept, int trade_accept, int tpa_accept) {}
public record PlayerSettings(String uuid, int mailAccept, int tradeAccept, int tpaAccept) {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

public class SettingsCache {

public static Map<String, PlayerSettings> settingsMap = new HashMap<>();
public static Map<String, PlayerSettings> settingsMap = new HashMap<>(); // UUID; PlayerSettings

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public void createPlayerSettings(PlayerSettings settings) {
String sql = "INSERT INTO settings (player, mail_accept, trade_accept, tpa_accept) VALUES (?, ?, ?, ?)";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, settings.uuid());
statement.setInt(2, settings.mail_accept());
statement.setInt(3, settings.trade_accept());
statement.setInt(4, settings.tpa_accept());
statement.setInt(2, settings.mailAccept());
statement.setInt(3, settings.tradeAccept());
statement.setInt(4, settings.tpaAccept());

statement.executeUpdate();
statement.close();
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/fr/communaywen/core/settings/SettingsMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ public class SettingsMenu extends Menu {

@Getter
@Setter
private int mail_accept, trade_accept, tpa_accept;
private int mailAccept, tradeAccept, tpaAccept;

public SettingsMenu(AywenCraftPlugin plugin, Player owner, SettingsManager manager) {
super(owner);
this.plugin = plugin;
this.owner = owner;
this.manager = manager;
this.mail_accept = SettingsCache.settingsMap.get(owner.getUniqueId().toString()).mail_accept();
this.trade_accept = SettingsCache.settingsMap.get(owner.getUniqueId().toString()).trade_accept();
this.tpa_accept = SettingsCache.settingsMap.get(owner.getUniqueId().toString()).tpa_accept();
mailAccept = SettingsCache.settingsMap.get(owner.getUniqueId().toString()).mailAccept();
tradeAccept = SettingsCache.settingsMap.get(owner.getUniqueId().toString()).tradeAccept();
tpaAccept = SettingsCache.settingsMap.get(owner.getUniqueId().toString()).tpaAccept();
}

@Override
Expand All @@ -63,15 +63,15 @@ public void onInventoryClick(InventoryClickEvent inventoryClickEvent) {

map.put(22, new ItemBuilder(this, CustomStack.getInstance("settings:mailbox_settings_btn").getItemStack(), itemMeta -> {
itemMeta.setDisplayName(ChatColor.GOLD + "Mailbox");
itemMeta.setLore(List.of(SettingsUtils.getMailStatus(this.mail_accept)));
itemMeta.setLore(List.of(SettingsUtils.getMailStatus(mailAccept)));
}).setNextMenu(new MailboxManagerMenu(owner, this)));
map.put(45, new ItemBuilder(this, CustomStack.getInstance("settings:close_btn").getItemStack(), itemMeta -> {
itemMeta.setDisplayName(ChatColor.DARK_RED + "Fermer");
}).setCloseButton());
map.put(53, new ItemBuilder(this, CustomStack.getInstance("settings:save_btn").getItemStack(), itemMeta -> {
itemMeta.setDisplayName(ChatColor.GREEN + "Sauvegarder");
}).setOnClick(inventoryClickEvent -> {
SettingsCache.settingsMap.replace(owner.getUniqueId().toString(), new PlayerSettings(owner.getUniqueId().toString(), mail_accept, trade_accept, tpa_accept));
SettingsCache.settingsMap.replace(owner.getUniqueId().toString(), new PlayerSettings(owner.getUniqueId().toString(), mailAccept, tradeAccept, tpaAccept));
MessageManager.sendMessageType(owner, "Settings enregistrés", Prefix.SETTINGS, MessageType.INFO, false);
}));
return map;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/fr/communaywen/core/settings/SettingsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

public class SettingsUtils {

public static String getMailStatus(int mail_accept) {
return switch (mail_accept) {
public static String getMailStatus(int mailAccept) {
return switch (mailAccept) {
case 0 -> ChatColor.RED + "Personne";
case 1 -> ChatColor.GOLD + "Amis seulement";
case 2 -> ChatColor.YELLOW + "Team seulement";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MailboxManagerMenu extends Menu {

public MailboxManagerMenu(Player owner, SettingsMenu settingsMenu) {
super(owner);
this.player = owner;
player = owner;
this.settingsMenu = settingsMenu;
}

Expand All @@ -47,30 +47,30 @@ public void onInventoryClick(InventoryClickEvent inventoryClickEvent) {

map.put(1, new ItemBuilder(this, Material.RED_WOOL, itemMeta -> {
itemMeta.setDisplayName(ChatColor.DARK_RED + "Personne");
itemMeta.setEnchantmentGlintOverride(settingsMenu.getMail_accept() == 0);
itemMeta.setEnchantmentGlintOverride(settingsMenu.getMailAccept() == 0);
}).setOnClick(inventoryClickEvent -> {
settingsMenu.setMail_accept(0);
settingsMenu.setMailAccept(0);
back();
}));
// map.put(3, new ItemBuilder(this, Material.ORANGE_WOOL, itemMeta -> {
// itemMeta.setDisplayName(ChatColor.GOLD + "Amis seulement");
// itemMeta.setEnchantmentGlintOverride(settingsMenu.getMail_accept() == 1);
// itemMeta.setEnchantmentGlintOverride(settingsMenu.getMailAccept() == 1);
// }).setOnClick(inventoryClickEvent -> {
// settingsMenu.setMail_accept(1);
// settingsMenu.setMailAccept(1);
// back();
// }));
// map.put(5, new ItemBuilder(this, Material.YELLOW_WOOL, itemMeta -> {
// itemMeta.setDisplayName(ChatColor.YELLOW + "Team seulement");
// itemMeta.setEnchantmentGlintOverride(settingsMenu.getMail_accept() == 2);
// itemMeta.setEnchantmentGlintOverride(settingsMenu.getMaiLAccept() == 2);
// }).setOnClick(inventoryClickEvent -> {
// settingsMenu.setMail_accept(2);
// settingsMenu.setMailAccept(2);
// back();
// }));
map.put(7, new ItemBuilder(this, Material.GREEN_WOOL, itemMeta -> {
itemMeta.setDisplayName(ChatColor.GREEN + "Tout le monde");
itemMeta.setEnchantmentGlintOverride(settingsMenu.getMail_accept() == 3);
itemMeta.setEnchantmentGlintOverride(settingsMenu.getMailAccept() == 3);
}).setOnClick(inventoryClickEvent -> {
settingsMenu.setMail_accept(3);
settingsMenu.setMailAccept(3);
back();
}));
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* }</pre>
* </li>
* <li>Create the commands that you would like to display the help menu in. Send the help
* menu using {@link InteractiveHelpMenu#sendInteractiveMenu(Audience, CommandHelp, int, ExecutableCommand)}.
* menu using @link InteractiveHelpMenu#sendInteractiveMenu(Audience, CommandHelp, int, ExecutableCommand).
* All the parameters should be parameters in the help method, and Lamp will resolve them automatically
* to the appropriate values.
* <pre>{@code
Expand Down Expand Up @@ -74,7 +74,7 @@
* <li>/foo bar help: Lists all commands in /foo bar</li>
* <li>/foo buzz bar help: Lists all commands in /foo buzz bar</li>
* </ul>
* This is why {@link #sendInteractiveMenu(Audience, CommandHelp, int, ExecutableCommand)} requires
* This is why @link #sendInteractiveMenu(Audience, CommandHelp, int, ExecutableCommand) requires
* an {@link ExecutableCommand}, as it uses it to resolve sibling commands that should be
* listed in the help menu.
*/
Expand Down

0 comments on commit 6ace335

Please sign in to comment.