Skip to content

Commit 54f6d12

Browse files
authored
fix: resolve build warnings (#18)
1 parent f4e0de0 commit 54f6d12

6 files changed

Lines changed: 35 additions & 2 deletions

File tree

‎src/main/java/net/tfminecraft/surgery/managers/SurgeryItemHandler.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public void initialize() {
8484
// ==============================================
8585
// Handles clicking on a surgery menu item
8686
// ==============================================
87+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
88+
@SuppressWarnings("deprecation")
8789
public void handleItemClick(Player player, ItemStack clickedItem, int slot) {
8890
if (clickedItem == null || clickedItem.getType().isAir()) {
8991
return;
@@ -135,6 +137,8 @@ public void handleItemClick(Player player, ItemStack clickedItem, int slot) {
135137
// ==============================================
136138
// Updates the menu when specific items are clicked
137139
// ==============================================
140+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
141+
@SuppressWarnings("deprecation")
138142
private void updateMenu(Player player, int clickedSlot) {
139143
Inventory menu = player.getOpenInventory().getTopInventory();
140144
UUID playerId = player.getUniqueId();
@@ -209,6 +213,8 @@ private String handleLabKit(Player player, Inventory menu, UUID playerId, boolea
209213
// ==============================================
210214
// Ultrasound functionality: reveals diagnosis and sets temperature for flu diagnoses
211215
// ==============================================
216+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
217+
@SuppressWarnings("deprecation")
212218
private String handleUltrasound(Player player, Inventory menu, UUID playerId, boolean skillFail) {
213219
if (skillFail) {
214220
return getRandomSkillFail(skillFailUltrasound);

‎src/main/java/net/tfminecraft/surgery/managers/SurgeryMenuBuilder.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public void buildAndOpenMenu(Player player) {
8181
// ==============================================
8282
// Initializes player state when opening menu
8383
// ==============================================
84+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
85+
@SuppressWarnings("deprecation")
8486
private void initializePlayerState(Player player, Inventory menu) {
8587
UUID playerId = player.getUniqueId();
8688

‎src/main/java/net/tfminecraft/surgery/managers/SurgeryMenuHolder.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public class SurgeryMenuHolder implements InventoryHolder {
1313

1414
private final Inventory inventory;
1515

16+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
17+
@SuppressWarnings("deprecation")
1618
public SurgeryMenuHolder() {
1719
this.inventory = Bukkit.createInventory(this, 54, "Surgery Menu");
1820
}

‎src/main/java/net/tfminecraft/surgery/managers/SurgeryMenuManager.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package net.tfminecraft.surgery.managers;
22

3-
import net.tfminecraft.tlibs.enums.APIType;
43
import net.tfminecraft.tlibs.objects.api.ItemAPI;
54
import net.tfminecraft.tlibs.TLibs;
65
import org.bukkit.entity.Player;
@@ -36,7 +35,7 @@ public SurgeryMenuManager(JavaPlugin plugin, SurgeryItemsConfig itemsConfig) {
3635
// ==============================================
3736
public void initialize() {
3837
plugin.getLogger().info("[Surgery] Loading TLibs API...");
39-
api = (ItemAPI) TLibs.getApiInstance(APIType.ITEM_API);
38+
api = TLibs.getItemAPI();
4039
if (api == null) {
4140
plugin.getLogger().severe("[Surgery] TLibs ItemAPI is unavailable - disabling plugin.");
4241
plugin.getServer().getPluginManager().disablePlugin(plugin);

‎src/main/java/net/tfminecraft/surgery/managers/SurgeryUIUpdater.java‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ private void loadMessages() {
4444
// ==============================================
4545
// Creates an info block with material, name, and description
4646
// ==============================================
47+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
48+
@SuppressWarnings("deprecation")
4749
public ItemStack createInfoBlock(Material material, String name, String description) {
4850
ItemStack block = new ItemStack(material);
4951
ItemMeta meta = block.getItemMeta();
@@ -58,6 +60,8 @@ public ItemStack createInfoBlock(Material material, String name, String descript
5860
// ==============================================
5961
// Creates an info block with material, name, and lore list
6062
// ==============================================
63+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
64+
@SuppressWarnings("deprecation")
6165
public ItemStack createInfoBlock(Material material, String name, java.util.List<String> lore) {
6266
ItemStack block = new ItemStack(material);
6367
ItemMeta meta = block.getItemMeta();
@@ -72,6 +76,8 @@ public ItemStack createInfoBlock(Material material, String name, java.util.List<
7276
// ==============================================
7377
// Updates the incision block
7478
// ==============================================
79+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
80+
@SuppressWarnings("deprecation")
7581
public void updateIncisionBlock(Inventory menu, UUID playerId, int incisions) {
7682
Material incisionColor = SurgeryConstants.getIncisionColor(incisions);
7783
ItemStack incisionBlock = createInfoBlock(incisionColor, ChatColor.GOLD + "Incisions", ChatColor.GRAY + String.valueOf(incisions));
@@ -81,6 +87,8 @@ public void updateIncisionBlock(Inventory menu, UUID playerId, int incisions) {
8187
// ==============================================
8288
// Updates the temperature block
8389
// ==============================================
90+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
91+
@SuppressWarnings("deprecation")
8492
public void updateTemperatureBlock(Inventory menu, UUID playerId, double temp) {
8593
Material tempColor = SurgeryConstants.getTemperatureColor(temp);
8694
String tempDisplay = SurgeryConstants.formatTemperature(temp);
@@ -91,6 +99,8 @@ public void updateTemperatureBlock(Inventory menu, UUID playerId, double temp) {
9199
// ==============================================
92100
// Updates the operation site block
93101
// ==============================================
102+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
103+
@SuppressWarnings("deprecation")
94104
public void updateOperationSiteBlock(Inventory menu, UUID playerId, String status) {
95105
Material siteColor = SurgeryConstants.getOperationSiteColor(status);
96106
ItemStack siteBlock = createInfoBlock(siteColor, ChatColor.GOLD + "Operation Site", ChatColor.GRAY + status);
@@ -100,6 +110,8 @@ public void updateOperationSiteBlock(Inventory menu, UUID playerId, String statu
100110
// ==============================================
101111
// Updates the status block
102112
// ==============================================
113+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
114+
@SuppressWarnings("deprecation")
103115
public void updateStatusBlock(Inventory menu, UUID playerId, String status) {
104116
Material statusColor = SurgeryConstants.getStatusColor(status);
105117
ItemStack statusBlock = createInfoBlock(statusColor, ChatColor.GOLD + "Status", ChatColor.GRAY + status);
@@ -109,6 +121,8 @@ public void updateStatusBlock(Inventory menu, UUID playerId, String status) {
109121
// ==============================================
110122
// Updates the pulse block
111123
// ==============================================
124+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
125+
@SuppressWarnings("deprecation")
112126
public void updatePulseBlock(Inventory menu, UUID playerId, String pulse) {
113127
Material pulseColor = SurgeryConstants.getPulseColor(pulse);
114128
ItemStack pulseBlock = createInfoBlock(pulseColor, ChatColor.GOLD + "Pulse", ChatColor.GRAY + pulse);
@@ -118,6 +132,8 @@ public void updatePulseBlock(Inventory menu, UUID playerId, String pulse) {
118132
// ==============================================
119133
// Updates the diagnosis block
120134
// ==============================================
135+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
136+
@SuppressWarnings("deprecation")
121137
public void updateDiagnosisBlock(Inventory menu, UUID playerId) {
122138
String diagnosis = stateManager.getDiagnosis(playerId);
123139
boolean cured = stateManager.isCured(playerId);
@@ -149,6 +165,8 @@ public void updateDiagnosisBlock(Inventory menu, UUID playerId) {
149165
// ==============================================
150166
// Sends a numbered message to the player
151167
// ==============================================
168+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
169+
@SuppressWarnings("deprecation")
152170
public void sendNumberedMessage(Player player, String message) {
153171
UUID playerId = player.getUniqueId();
154172
int moveNumber = stateManager.getMoveCount(playerId) + 1;
@@ -159,13 +177,17 @@ public void sendNumberedMessage(Player player, String message) {
159177
// ==============================================
160178
// Gets a message from messages.yml and translates color codes
161179
// ==============================================
180+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
181+
@SuppressWarnings("deprecation")
162182
public String getMessage(String path) {
163183
return ChatColor.translateAlternateColorCodes('&', messages.getString(path, ""));
164184
}
165185

166186
// ==============================================
167187
// Gets a message with a fallback default, translating color codes
168188
// ==============================================
189+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
190+
@SuppressWarnings("deprecation")
169191
public String getMessage(String path, String def) {
170192
return ChatColor.translateAlternateColorCodes('&', messages.getString(path, def));
171193
}

‎src/main/java/net/tfminecraft/surgery/utils/Utils.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
public class Utils {
88

9+
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
10+
@SuppressWarnings("deprecation")
911
public static String colorize(String msg) {
1012
Matcher match = Pattern.compile("#[a-fA-F0-9]{6}").matcher(msg);
1113
while (match.find()) {

0 commit comments

Comments
 (0)