Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public void initialize() {
// ==============================================
// Handles clicking on a surgery menu item
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void handleItemClick(Player player, ItemStack clickedItem, int slot) {
if (clickedItem == null || clickedItem.getType().isAir()) {
return;
Expand Down Expand Up @@ -135,6 +137,8 @@ public void handleItemClick(Player player, ItemStack clickedItem, int slot) {
// ==============================================
// Updates the menu when specific items are clicked
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
private void updateMenu(Player player, int clickedSlot) {
Inventory menu = player.getOpenInventory().getTopInventory();
UUID playerId = player.getUniqueId();
Expand Down Expand Up @@ -209,6 +213,8 @@ private String handleLabKit(Player player, Inventory menu, UUID playerId, boolea
// ==============================================
// Ultrasound functionality: reveals diagnosis and sets temperature for flu diagnoses
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
private String handleUltrasound(Player player, Inventory menu, UUID playerId, boolean skillFail) {
if (skillFail) {
return getRandomSkillFail(skillFailUltrasound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public void buildAndOpenMenu(Player player) {
// ==============================================
// Initializes player state when opening menu
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
private void initializePlayerState(Player player, Inventory menu) {
UUID playerId = player.getUniqueId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class SurgeryMenuHolder implements InventoryHolder {

private final Inventory inventory;

// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public SurgeryMenuHolder() {
this.inventory = Bukkit.createInventory(this, 54, "Surgery Menu");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.tfminecraft.surgery.managers;

import net.tfminecraft.tlibs.enums.APIType;
import net.tfminecraft.tlibs.objects.api.ItemAPI;
import net.tfminecraft.tlibs.TLibs;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -36,7 +35,7 @@ public SurgeryMenuManager(JavaPlugin plugin, SurgeryItemsConfig itemsConfig) {
// ==============================================
public void initialize() {
plugin.getLogger().info("[Surgery] Loading TLibs API...");
api = (ItemAPI) TLibs.getApiInstance(APIType.ITEM_API);
api = TLibs.getItemAPI();
if (api == null) {
plugin.getLogger().severe("[Surgery] TLibs ItemAPI is unavailable - disabling plugin.");
plugin.getServer().getPluginManager().disablePlugin(plugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ private void loadMessages() {
// ==============================================
// Creates an info block with material, name, and description
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public ItemStack createInfoBlock(Material material, String name, String description) {
ItemStack block = new ItemStack(material);
ItemMeta meta = block.getItemMeta();
Expand All @@ -58,6 +60,8 @@ public ItemStack createInfoBlock(Material material, String name, String descript
// ==============================================
// Creates an info block with material, name, and lore list
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public ItemStack createInfoBlock(Material material, String name, java.util.List<String> lore) {
ItemStack block = new ItemStack(material);
ItemMeta meta = block.getItemMeta();
Expand All @@ -72,6 +76,8 @@ public ItemStack createInfoBlock(Material material, String name, java.util.List<
// ==============================================
// Updates the incision block
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void updateIncisionBlock(Inventory menu, UUID playerId, int incisions) {
Material incisionColor = SurgeryConstants.getIncisionColor(incisions);
ItemStack incisionBlock = createInfoBlock(incisionColor, ChatColor.GOLD + "Incisions", ChatColor.GRAY + String.valueOf(incisions));
Expand All @@ -81,6 +87,8 @@ public void updateIncisionBlock(Inventory menu, UUID playerId, int incisions) {
// ==============================================
// Updates the temperature block
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void updateTemperatureBlock(Inventory menu, UUID playerId, double temp) {
Material tempColor = SurgeryConstants.getTemperatureColor(temp);
String tempDisplay = SurgeryConstants.formatTemperature(temp);
Expand All @@ -91,6 +99,8 @@ public void updateTemperatureBlock(Inventory menu, UUID playerId, double temp) {
// ==============================================
// Updates the operation site block
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void updateOperationSiteBlock(Inventory menu, UUID playerId, String status) {
Material siteColor = SurgeryConstants.getOperationSiteColor(status);
ItemStack siteBlock = createInfoBlock(siteColor, ChatColor.GOLD + "Operation Site", ChatColor.GRAY + status);
Expand All @@ -100,6 +110,8 @@ public void updateOperationSiteBlock(Inventory menu, UUID playerId, String statu
// ==============================================
// Updates the status block
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void updateStatusBlock(Inventory menu, UUID playerId, String status) {
Material statusColor = SurgeryConstants.getStatusColor(status);
ItemStack statusBlock = createInfoBlock(statusColor, ChatColor.GOLD + "Status", ChatColor.GRAY + status);
Expand All @@ -109,6 +121,8 @@ public void updateStatusBlock(Inventory menu, UUID playerId, String status) {
// ==============================================
// Updates the pulse block
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void updatePulseBlock(Inventory menu, UUID playerId, String pulse) {
Material pulseColor = SurgeryConstants.getPulseColor(pulse);
ItemStack pulseBlock = createInfoBlock(pulseColor, ChatColor.GOLD + "Pulse", ChatColor.GRAY + pulse);
Expand All @@ -118,6 +132,8 @@ public void updatePulseBlock(Inventory menu, UUID playerId, String pulse) {
// ==============================================
// Updates the diagnosis block
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void updateDiagnosisBlock(Inventory menu, UUID playerId) {
String diagnosis = stateManager.getDiagnosis(playerId);
boolean cured = stateManager.isCured(playerId);
Expand Down Expand Up @@ -149,6 +165,8 @@ public void updateDiagnosisBlock(Inventory menu, UUID playerId) {
// ==============================================
// Sends a numbered message to the player
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public void sendNumberedMessage(Player player, String message) {
UUID playerId = player.getUniqueId();
int moveNumber = stateManager.getMoveCount(playerId) + 1;
Expand All @@ -159,13 +177,17 @@ public void sendNumberedMessage(Player player, String message) {
// ==============================================
// Gets a message from messages.yml and translates color codes
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public String getMessage(String path) {
return ChatColor.translateAlternateColorCodes('&', messages.getString(path, ""));
}

// ==============================================
// Gets a message with a fallback default, translating color codes
// ==============================================
// Keep the existing legacy text representation, formatting, and exact-string comparisons.
@SuppressWarnings("deprecation")
public String getMessage(String path, String def) {
return ChatColor.translateAlternateColorCodes('&', messages.getString(path, def));
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/tfminecraft/surgery/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

public class Utils {

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