Class ClassSourceValidator

java.lang.Object
com.sk89q.worldguard.bukkit.util.ClassSourceValidator

public class ClassSourceValidator extends Object
Validates that certain specified classes came from the same source as a plugin. This is copied from the same class in WorldEdit because unfortunately trying to use WorldEdit's means we're susceptible to getting a bad version of this class if another plugin shades it....which is exactly what we're trying to detect and report.
  • Constructor Details

    • ClassSourceValidator

      public ClassSourceValidator(org.bukkit.plugin.Plugin plugin)
      Create a new instance.
      Parameters:
      plugin - The plugin
  • Method Details

    • findMismatches

      public Map<Class<?>,org.bukkit.plugin.Plugin> findMismatches(List<Class<?>> classes)
      Return a map of classes that been loaded from a different source.
      Parameters:
      classes - A list of classes to check
      Returns:
      The results
    • reportMismatches

      public void reportMismatches(List<Class<?>> classes)
      Reports classes that have come from a different source.

      The warning is emitted to the log.

      Parameters:
      classes - The list of classes to check