Skip to content

Commit f37a067

Browse files
authored
Merge pull request #1493 from BenCodez/copilot/fix-javadoc-warnings-again
Add javadoc documentation for 56 missing methods across 15 files
2 parents 42af35a + 47bdadf commit f37a067

96 files changed

Lines changed: 4070 additions & 47 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

VotingPlugin/src/main/java/com/bencodez/votingplugin/BungeeHandler.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747

4848
import lombok.Getter;
4949

50+
/**
51+
* Handler for Bungee/proxy server integration.
52+
*/
5053
public class BungeeHandler implements Listener {
5154
@Getter
5255
private ClientHandler clientHandler;
@@ -86,10 +89,18 @@ public class BungeeHandler implements Listener {
8689
@Getter
8790
private MqttHandler mqttHandler;
8891

92+
/**
93+
* Constructs a new BungeeHandler.
94+
*
95+
* @param plugin the main plugin instance
96+
*/
8997
public BungeeHandler(VotingPluginMain plugin) {
9098
this.plugin = plugin;
9199
}
92100

101+
/**
102+
* Checks and processes global data from the global data handler.
103+
*/
93104
public void checkGlobalData() {
94105
HashMap<String, DataValue> data = globalDataHandler.getExact(plugin.getBungeeSettings().getServer());
95106

@@ -126,6 +137,13 @@ public void checkGlobalData() {
126137
}
127138
}
128139

140+
/**
141+
* Checks global data for a time type change.
142+
*
143+
* @param type the time type to check
144+
* @param data the global data map
145+
* @return true if currently processing a time change
146+
*/
129147
public boolean checkGlobalDataTime(TimeType type, HashMap<String, DataValue> data) {
130148
boolean isProcessing = false;
131149
if (data.containsKey(type.toString())) {
@@ -157,13 +175,22 @@ public boolean checkGlobalDataTime(TimeType type, HashMap<String, DataValue> dat
157175
return isProcessing;
158176
}
159177

178+
/**
179+
* Checks and extracts the boolean value from a DataValue.
180+
*
181+
* @param data the data value
182+
* @return the boolean value
183+
*/
160184
public boolean checkGlobalDataTimeValue(DataValue data) {
161185
if (data.isBoolean()) {
162186
return data.getBoolean();
163187
}
164188
return Boolean.valueOf(data.getString());
165189
}
166190

191+
/**
192+
* Closes and cleans up all handlers and connections.
193+
*/
167194
public void close() {
168195
if (backendMysqlMessenger != null) {
169196
backendMysqlMessenger.shutdown();
@@ -182,6 +209,9 @@ public void close() {
182209
}
183210
}
184211

212+
/**
213+
* Loads and initializes the bungee handler with the configured method.
214+
*/
185215
public void load() {
186216
plugin.debug("Loading bungee handler");
187217

@@ -576,6 +606,9 @@ private void handleWireVote(JsonEnvelope msg) {
576606
int _ignored = v.numberOfVotes;
577607
}
578608

609+
/**
610+
* Loads the global MySQL handler for cross-server data synchronization.
611+
*/
579612
public void loadGlobalMysql() {
580613
if (plugin.getBungeeSettings().isGloblalDataEnabled()) {
581614
if (timer != null) {

VotingPlugin/src/main/java/com/bencodez/votingplugin/broadcast/BroadcastHandler.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ public final class BroadcastHandler {
5858
private final ConcurrentHashMap<UUID, LinkedHashSet<String>> intervalSites = new ConcurrentHashMap<UUID, LinkedHashSet<String>>();
5959
private volatile BukkitTask intervalTask;
6060

61+
/**
62+
* Constructs a new BroadcastHandler.
63+
*
64+
* @param plugin the main plugin instance
65+
* @param settings the broadcast settings
66+
* @param zoneId the time zone ID, or null to use system default
67+
*/
6168
public BroadcastHandler(VotingPluginMain plugin, BroadcastSettings settings, ZoneId zoneId) {
6269
this.plugin = plugin;
6370
this.settings = settings;
@@ -66,6 +73,11 @@ public BroadcastHandler(VotingPluginMain plugin, BroadcastSettings settings, Zon
6673
rescheduleIntervalIfNeeded();
6774
}
6875

76+
/**
77+
* Updates the broadcast settings and reschedules interval task if needed.
78+
*
79+
* @param settings the new broadcast settings
80+
*/
6981
public void setSettings(BroadcastSettings settings) {
7082
this.settings = settings;
7183
rescheduleIntervalIfNeeded();
@@ -77,6 +89,7 @@ public void setSettings(BroadcastSettings settings) {
7789
* @param uuid player's uuid
7890
* @param playerName player name (optional; if null/empty, resolved from Bukkit)
7991
* @param siteName vote site name (display name)
92+
* @param wasOnline whether the player was online when the vote was received
8093
*/
8194
public void broadcastVote(UUID uuid, String playerName, String siteName, boolean wasOnline) {
8295
BroadcastSettings s = settings;

VotingPlugin/src/main/java/com/bencodez/votingplugin/broadcast/BroadcastSettings.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ public final class BroadcastSettings {
1818
private final int maxSitesListed;
1919
private final BroadcastFormat format;
2020

21+
/**
22+
* Constructs a BroadcastSettings with the specified parameters.
23+
*
24+
* @param type the broadcast type
25+
* @param duration the broadcast duration
26+
* @param maxSitesListed the maximum number of sites to list
27+
* @param format the broadcast format
28+
*/
2129
public BroadcastSettings(VoteBroadcastType type, ParsedDuration duration, int maxSitesListed,
2230
BroadcastFormat format) {
2331
this.type = type == null ? VoteBroadcastType.NONE : type;
@@ -26,22 +34,47 @@ public BroadcastSettings(VoteBroadcastType type, ParsedDuration duration, int ma
2634
this.format = format == null ? new BroadcastFormat("", "", "") : format;
2735
}
2836

37+
/**
38+
* Returns the broadcast type.
39+
*
40+
* @return the broadcast type
41+
*/
2942
public VoteBroadcastType getType() {
3043
return type;
3144
}
3245

46+
/**
47+
* Returns the broadcast duration.
48+
*
49+
* @return the broadcast duration
50+
*/
3351
public ParsedDuration getDuration() {
3452
return duration;
3553
}
3654

55+
/**
56+
* Returns the maximum number of sites to list.
57+
*
58+
* @return the maximum number of sites to list
59+
*/
3760
public int getMaxSitesListed() {
3861
return maxSitesListed;
3962
}
4063

64+
/**
65+
* Returns the broadcast format.
66+
*
67+
* @return the broadcast format
68+
*/
4169
public BroadcastFormat getFormat() {
4270
return format;
4371
}
4472

73+
/**
74+
* Returns whether broadcasting is disabled.
75+
*
76+
* @return true if broadcasting is disabled
77+
*/
4578
public boolean isDisabled() {
4679
return type == VoteBroadcastType.NONE;
4780
}
@@ -51,6 +84,9 @@ public boolean isDisabled() {
5184
*
5285
* Expected structure: VoteBroadcast: Type: EVERY_VOTE Duration: 2m
5386
* MaxSitesListed: 0 Format: BroadcastMsg: '...' Header: '...' ListLine: '...'
87+
*
88+
* @param sec the configuration section to load from
89+
* @return the loaded broadcast settings
5490
*/
5591
public static BroadcastSettings load(ConfigurationSection sec) {
5692
VoteBroadcastType type = VoteBroadcastType.parse(sec == null ? null : sec.getString("Type"),

VotingPlugin/src/main/java/com/bencodez/votingplugin/broadcast/VoteBroadcastType.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*/
1010
public enum VoteBroadcastType {
1111

12+
/**
13+
* No vote broadcasting.
14+
*/
1215
NONE,
1316

1417
/**
@@ -47,6 +50,12 @@ public enum VoteBroadcastType {
4750
*/
4851
INTERVAL_SUMMARY_GLOBAL;
4952

53+
/**
54+
* Parses a vote broadcast type from a string.
55+
* @param s the string to parse
56+
* @param def the default value if parsing fails
57+
* @return the parsed broadcast type or default
58+
*/
5059
public static VoteBroadcastType parse(String s, VoteBroadcastType def) {
5160
if (s == null || s.trim().isEmpty()) {
5261
return def;

VotingPlugin/src/main/java/com/bencodez/votingplugin/commands/CommandLoader.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ public class CommandLoader {
101101

102102
private VotingPluginMain plugin;
103103

104+
/**
105+
* Constructs a new CommandLoader.
106+
*
107+
* @param plugin the main plugin instance
108+
*/
104109
public CommandLoader(VotingPluginMain plugin) {
105110
this.plugin = plugin;
106111
}
@@ -112,6 +117,12 @@ public String getAdminPerm() {
112117
return adminPerm;
113118
}
114119

120+
/**
121+
* Gets the back button for inventory navigation.
122+
*
123+
* @param user the voting plugin user
124+
* @return the back button
125+
*/
115126
public BInventoryButton getBackButton(VotingPluginUser user) {
116127
ConfigurationSection sec = plugin.getGui().getCHESTBackButton();
117128
boolean a = false;
@@ -181,6 +192,13 @@ public String getPlayerPerm() {
181192
return playerPerm;
182193
}
183194

195+
/**
196+
* Checks if a player has permission for a command.
197+
*
198+
* @param player the player
199+
* @param cmd the command
200+
* @return true if player has permission
201+
*/
184202
public boolean hasPermission(Player player, String cmd) {
185203
if (cmd.startsWith("votingplugin:")) {
186204
cmd = cmd.substring("votingplugin:".length());
@@ -230,6 +248,13 @@ public boolean hasPermission(Player player, String cmd) {
230248
return false;
231249
}
232250

251+
/**
252+
* Checks if a command belongs to the VotingPlugin.
253+
*
254+
* @param player the player
255+
* @param cmd the command
256+
* @return true if it's a VotingPlugin command
257+
*/
233258
public boolean isVotingPluginCommand(Player player, String cmd) {
234259
if (plugin.getCommand(cmd) != null || cmd.startsWith("votingplugin")) {
235260
return true;
@@ -2321,6 +2346,11 @@ public void execute(CommandSender sender, String[] args) {
23212346

23222347
private final Set<String> aliasCommandNames = new HashSet<>();
23232348

2349+
/**
2350+
* Gets the set of alias command names.
2351+
*
2352+
* @return set of alias command names
2353+
*/
23242354
public Set<String> getAliasCommandNames() {
23252355
return aliasCommandNames;
23262356
}
@@ -3300,6 +3330,13 @@ public void run() {
33003330
}
33013331
}
33023332

3333+
/**
3334+
* Processes a slot click action from a GUI.
3335+
*
3336+
* @param player the player
3337+
* @param user the voting plugin user
3338+
* @param slot the slot identifier
3339+
*/
33033340
public void processSlotClick(Player player, VotingPluginUser user, String slot) {
33043341
if (MessageAPI.startsWithIgnoreCase(slot, "url")) {
33053342
new VoteURL(plugin, player, user, true).open();

VotingPlugin/src/main/java/com/bencodez/votingplugin/commands/executers/CommandAdminVote.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public class CommandAdminVote implements CommandExecutor {
1616

1717
private VotingPluginMain plugin;
1818

19+
/**
20+
* Constructs a new CommandAdminVote instance.
21+
*
22+
* @param plugin the main plugin instance
23+
*/
1924
public CommandAdminVote(VotingPluginMain plugin) {
2025
this.plugin = plugin;
2126
}

VotingPlugin/src/main/java/com/bencodez/votingplugin/commands/executers/CommandAliases.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ public class CommandAliases implements CommandExecutor {
2525
/** The plugin. */
2626
private VotingPluginMain plugin = VotingPluginMain.plugin;
2727

28+
/**
29+
* Constructs a new CommandAliases instance.
30+
*
31+
* @param cmdHandle the command handler
32+
* @param adminCommand whether this is an admin command
33+
*/
2834
public CommandAliases(CommandHandler cmdHandle, boolean adminCommand) {
2935
this.cmdHandle = cmdHandle;
3036
this.adminCommand = adminCommand;

VotingPlugin/src/main/java/com/bencodez/votingplugin/commands/gui/player/VoteBest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,20 @@
1818
import com.bencodez.votingplugin.VotingPluginMain;
1919
import com.bencodez.votingplugin.user.VotingPluginUser;
2020

21+
/**
22+
* GUI handler for vote best/streak display.
23+
*/
2124
public class VoteBest extends GUIHandler {
2225

2326
private VotingPluginMain plugin;
2427
private VotingPluginUser user;
2528

29+
/**
30+
* Constructs a new vote best GUI.
31+
* @param plugin the plugin instance
32+
* @param player the command sender
33+
* @param user the voting plugin user
34+
*/
2635
public VoteBest(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
2736
super(plugin, player);
2837
this.plugin = plugin;

VotingPlugin/src/main/java/com/bencodez/votingplugin/commands/gui/player/VoteGUI.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,20 @@
1919
import com.bencodez.votingplugin.VotingPluginMain;
2020
import com.bencodez.votingplugin.user.VotingPluginUser;
2121

22+
/**
23+
* GUI handler for vote interface.
24+
*/
2225
public class VoteGUI extends GUIHandler {
2326

2427
private VotingPluginMain plugin;
2528
private VotingPluginUser user;
2629

30+
/**
31+
* Constructs a new vote GUI.
32+
* @param plugin the plugin instance
33+
* @param player the command sender
34+
* @param user the voting plugin user
35+
*/
2736
public VoteGUI(VotingPluginMain plugin, CommandSender player, VotingPluginUser user) {
2837
super(plugin, player);
2938
this.plugin = plugin;
@@ -35,6 +44,12 @@ public ArrayList<String> getChat(CommandSender arg0) {
3544
return null;
3645
}
3746

47+
/**
48+
* Gets the item for a specific GUI slot.
49+
* @param slot the slot name
50+
* @param player the player
51+
* @return the item builder for the slot
52+
*/
3853
private ItemBuilder getItemSlot(String slot, Player player) {
3954
ItemBuilder builder = new ItemBuilder(plugin.getGui().getChestVoteGUISlotSection(slot));
4055

0 commit comments

Comments
 (0)