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