mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
Add API packages (#3938)
Adds packages for future EssentialsX 2.x API and services.
This commit is contained in:
parent
9ce839c9d8
commit
eee1c0628b
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* API classes, services, and events provided by EssentialsX 2.x.
|
||||
*/
|
||||
package net.essentialsx.api.v2;
|
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* API services provided by EssentialsX. These are registered with Bukkit's ServicesManager, and can be accessed from there without getting an instance of EssentialsX first.
|
||||
*
|
||||
* @see org.bukkit.Server#getServicesManager()
|
||||
* @see org.bukkit.plugin.ServicesManager#load(java.lang.Class)
|
||||
*/
|
||||
package net.essentialsx.api.v2.services;
|
@ -56,6 +56,8 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.ServicesManager;
|
||||
import org.bukkit.plugin.UnknownDependencyException;
|
||||
import org.bukkit.plugin.messaging.Messenger;
|
||||
@ -80,10 +82,11 @@ import java.util.concurrent.Future;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@SuppressWarnings({"NullableProblems", "ConstantConditions", "Contract"})
|
||||
public class FakeServer implements Server {
|
||||
private final List<World> worlds = new ArrayList<>();
|
||||
private final PluginManager pluginManager = new FakePluginManager();
|
||||
private List<Player> players = new ArrayList<>();
|
||||
private final List<Player> players = new ArrayList<>();
|
||||
|
||||
FakeServer() {
|
||||
if (Bukkit.getServer() == null) {
|
||||
@ -106,10 +109,6 @@ public class FakeServer implements Server {
|
||||
return players;
|
||||
}
|
||||
|
||||
public void setOnlinePlayers(final List<Player> players) {
|
||||
this.players = players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPlayers() {
|
||||
return 100;
|
||||
@ -355,7 +354,57 @@ public class FakeServer implements Server {
|
||||
|
||||
@Override
|
||||
public ServicesManager getServicesManager() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
return new ServicesManager() {
|
||||
@Override
|
||||
public <T> void register(Class<T> service, T provider, Plugin plugin, ServicePriority priority) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterAll(Plugin plugin) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(Class<?> service, Object provider) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(Object provider) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T load(Class<T> service) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> RegisteredServiceProvider<T> getRegistration(Class<T> service) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegisteredServiceProvider<?>> getRegistrations(Plugin plugin) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<RegisteredServiceProvider<T>> getRegistrations(Class<T> service) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Class<?>> getKnownServices() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean isProvidedFor(Class<T> service) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -369,12 +418,6 @@ public class FakeServer implements Server {
|
||||
return w;
|
||||
}
|
||||
|
||||
public World createWorld(final String string, final Environment e, final long l) {
|
||||
final World w = new FakeWorld(string, e);
|
||||
worlds.add(w);
|
||||
return w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(final String string) {
|
||||
for (final World world : worlds) {
|
||||
@ -459,10 +502,6 @@ public class FakeServer implements Server {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public World getWorld(final long l) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld(final UUID uuid) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
Loading…
Reference in New Issue
Block a user