001 package org.bukkit.plugin; 002 003 /** 004 * A registered service provider. 005 * 006 * @param <T> Service 007 */ 008 public class RegisteredServiceProvider<T> implements Comparable<RegisteredServiceProvider<?>> { 009 010 private Class<T> service; 011 private Plugin plugin; 012 private T provider; 013 private ServicePriority priority; 014 015 public RegisteredServiceProvider(Class<T> service, T provider, ServicePriority priority, Plugin plugin) { 016 017 this.service = service; 018 this.plugin = plugin; 019 this.provider = provider; 020 this.priority = priority; 021 } 022 023 public Class<T> getService() { 024 return service; 025 } 026 027 public Plugin getPlugin() { 028 return plugin; 029 } 030 031 public T getProvider() { 032 return provider; 033 } 034 035 public ServicePriority getPriority() { 036 return priority; 037 } 038 039 public int compareTo(RegisteredServiceProvider<?> other) { 040 if (priority.ordinal() == other.getPriority().ordinal()) { 041 return 0; 042 } else { 043 return priority.ordinal() < other.getPriority().ordinal() ? 1 : -1; 044 } 045 } 046 }