mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Implement SuperAdmin service
This commit is contained in:
parent
4ca3593653
commit
73ee1f3624
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
@ -24,6 +25,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_AdminList
|
||||
{
|
||||
public static final Function<Player, Boolean> SUPERADMIN_SERVICE;
|
||||
private static final Map<UUID, TFM_Admin> adminList;
|
||||
private static final Set<UUID> superUUIDs;
|
||||
private static final Set<UUID> telnetUUIDs;
|
||||
@ -40,6 +42,15 @@ public class TFM_AdminList
|
||||
seniorUUIDs = new HashSet<UUID>();
|
||||
seniorConsoleNames = new HashSet<String>();
|
||||
superIps = new HashSet<String>();
|
||||
|
||||
SUPERADMIN_SERVICE = new Function<Player, Boolean>() {
|
||||
|
||||
@Override
|
||||
public Boolean apply(Player f)
|
||||
{
|
||||
return isSuperAdmin(f);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private TFM_AdminList()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -25,6 +26,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.mcstats.Metrics;
|
||||
@ -111,6 +113,9 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
TFM_ProtectedArea.autoAddSpawnpoints();
|
||||
}
|
||||
|
||||
// Start SuperAdmin service
|
||||
server.getServicesManager().register(Function.class, TFM_AdminList.SUPERADMIN_SERVICE, plugin, ServicePriority.Normal);
|
||||
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
pm.registerEvents(new TFM_EntityListener(), plugin);
|
||||
pm.registerEvents(new TFM_BlockListener(), plugin);
|
||||
|
Loading…
Reference in New Issue
Block a user