Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
RegisteredServiceProvider.java
1 package org.bukkit.plugin;
2 
3 /**
4  * A registered service provider.
5  *
6  * @param <T> Service
7  */
8 public class RegisteredServiceProvider<T> implements Comparable<RegisteredServiceProvider<?>> {
9 
10  private Class<T> service;
11  private Plugin plugin;
12  private T provider;
13  private ServicePriority priority;
14 
15  public RegisteredServiceProvider(Class<T> service, T provider, ServicePriority priority, Plugin plugin) {
16 
17  this.service = service;
18  this.plugin = plugin;
19  this.provider = provider;
20  this.priority = priority;
21  }
22 
23  public Class<T> getService() {
24  return service;
25  }
26 
27  public Plugin getPlugin() {
28  return plugin;
29  }
30 
31  public T getProvider() {
32  return provider;
33  }
34 
35  public ServicePriority getPriority() {
36  return priority;
37  }
38 
39  public int compareTo(RegisteredServiceProvider<?> other) {
40  if (priority.ordinal() == other.getPriority().ordinal()) {
41  return 0;
42  } else {
43  return priority.ordinal() < other.getPriority().ordinal() ? 1 : -1;
44  }
45  }
46 }