Class ComparisonUtils

java.lang.Object
dev.ua.theroer.magicutils.commands.ComparisonUtils

public final class ComparisonUtils extends Object
Helper methods for comparing argument values without Bukkit dependencies.
  • Method Details

    • isEqual

      public static boolean isEqual(Object first, Object second, CompareMode mode)
      Compare two objects using the configured mode.
      Parameters:
      first - left value
      second - right value
      mode - compare strategy
      Returns:
      true if equal under the chosen mode
    • isSender

      public static boolean isSender(Object sender, Object value, CompareMode mode)
      Check if a value represents the sender using the chosen mode.
      Parameters:
      sender - command sender
      value - value to compare
      mode - compare strategy
      Returns:
      true if matches sender
    • extractUuid

      public static UUID extractUuid(Object obj)
      Extract UUID via common patterns (UUID, OfflinePlayer, getUniqueId).
      Parameters:
      obj - target object
      Returns:
      UUID or null
    • extractName

      public static String extractName(Object obj)
      Extract name via getName() or toString().
      Parameters:
      obj - target object
      Returns:
      name or null