mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added config.yml based superadmin list.
This commit is contained in:
parent
f528d5be97
commit
770db8d594
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -9,14 +10,29 @@ 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.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
public class TotalFreedomMod extends JavaPlugin
|
public class TotalFreedomMod extends JavaPlugin
|
||||||
{
|
{
|
||||||
private Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
protected static Configuration CONFIG;
|
||||||
|
private List<String> superadmins = new ArrayList<String>();
|
||||||
|
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
|
CONFIG = getConfiguration();
|
||||||
|
CONFIG.load();
|
||||||
|
if (CONFIG.getString("superadmins", null) == null)
|
||||||
|
{
|
||||||
|
log.log(Level.INFO, "[Total Freedom Mod] - Generating default config file (plugins/TotalFreedomMod/config.yml)...");
|
||||||
|
CONFIG.setProperty("superadmins", new String[] {"madgeek1450", "markbyron"});
|
||||||
|
CONFIG.save();
|
||||||
|
CONFIG.load();
|
||||||
|
}
|
||||||
|
superadmins = CONFIG.getStringList("superadmins", null);
|
||||||
|
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
||||||
|
log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmins: " + superadmins.toString());
|
||||||
|
|
||||||
if (!Bukkit.getOnlineMode())
|
if (!Bukkit.getOnlineMode())
|
||||||
{
|
{
|
||||||
@ -204,15 +220,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
private boolean isUserSuperadmin(String userName)
|
private boolean isUserSuperadmin(String userName)
|
||||||
{
|
{
|
||||||
if (!Bukkit.getOnlineMode())
|
if (!Bukkit.getOnlineMode()) return false;
|
||||||
{
|
return superadmins.contains(userName);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Arrays.asList(
|
|
||||||
"miwojedk",
|
|
||||||
"markbyron",
|
|
||||||
"madgeek1450"
|
|
||||||
).contains(userName.toLowerCase());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: TotalFreedomMod
|
name: TotalFreedomMod
|
||||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||||
version: 1.0.2
|
version: 1.1.2
|
||||||
description: Plugin for the Total Freedom server
|
description: Plugin for the Total Freedom server
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user