mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-11 17:15:07 +02:00
Splitting permissions and ranks (renamed from groups)
Deleted all old permissions handlers, since we fully use superperms now
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.api.*;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.settings.MoneyHolder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
@@ -21,7 +21,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.*;
|
||||
import com.earth2me.essentials.listener.*;
|
||||
import com.earth2me.essentials.register.payment.Methods;
|
||||
import com.earth2me.essentials.settings.GroupsHolder;
|
||||
import com.earth2me.essentials.ranks.RanksStorage;
|
||||
import com.earth2me.essentials.settings.SettingsHolder;
|
||||
import com.earth2me.essentials.settings.SpawnsHolder;
|
||||
import com.earth2me.essentials.user.UserMap;
|
||||
@@ -64,7 +64,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
private transient List<IReload> reloadList;
|
||||
private transient IBackup backup;
|
||||
private transient IItemDb itemDb;
|
||||
private transient IGroups groups;
|
||||
private transient IRanks groups;
|
||||
private transient SpawnsHolder spawns;
|
||||
private transient final Methods paymentMethod = new Methods();
|
||||
//private transient PermissionsHandler permissionsHandler;
|
||||
@@ -156,8 +156,8 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
userMap = new UserMap(this);
|
||||
reloadList.add(userMap);
|
||||
execTimer.mark("Init(Usermap)");
|
||||
groups = new GroupsHolder(this);
|
||||
reloadList.add((GroupsHolder)groups);
|
||||
groups = new RanksStorage(this);
|
||||
reloadList.add((RanksStorage)groups);
|
||||
warps = new Warps(this);
|
||||
reloadList.add(warps);
|
||||
execTimer.mark("Init(Spawn/Warp)");
|
||||
@@ -406,7 +406,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGroups getGroups()
|
||||
public IRanks getRanks()
|
||||
{
|
||||
return groups;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroups(final IGroups groups)
|
||||
public void setRanks(final IRanks groups)
|
||||
{
|
||||
this.groups = groups;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@@ -5,7 +5,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IItemDb;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@@ -5,7 +5,7 @@ import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.ITeleport;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.CooldownException;
|
||||
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||
import java.util.Calendar;
|
||||
@@ -153,7 +153,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
{
|
||||
try
|
||||
{
|
||||
user.checkCooldown(TimestampType.LASTTELEPORT, ess.getGroups().getTeleportCooldown(user), !check, Permissions.TELEPORT_COOLDOWN_BYPASS);
|
||||
user.checkCooldown(TimestampType.LASTTELEPORT, ess.getRanks().getTeleportCooldown(user), !check, Permissions.TELEPORT_COOLDOWN_BYPASS);
|
||||
}
|
||||
catch (CooldownException ex)
|
||||
{
|
||||
@@ -204,7 +204,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
|
||||
private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
double delay = ess.getGroups().getTeleportDelay(user);
|
||||
double delay = ess.getRanks().getTeleportDelay(user);
|
||||
|
||||
if (chargeFor != null)
|
||||
{
|
||||
|
@@ -7,8 +7,8 @@ import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.craftbukkit.SetExpFix;
|
||||
import com.earth2me.essentials.perm.NoCommandCostPermissions;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.NoCommandCostPermissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
@@ -21,7 +21,7 @@ public interface IEssentials extends Plugin
|
||||
|
||||
ISettings getSettings();
|
||||
|
||||
IGroups getGroups();
|
||||
IRanks getRanks();
|
||||
|
||||
IJails getJails();
|
||||
|
||||
@@ -56,7 +56,7 @@ public interface IEssentials extends Plugin
|
||||
|
||||
TntExplodeListener getTNTListener();
|
||||
|
||||
void setGroups(IGroups groups);
|
||||
void setRanks(IRanks groups);
|
||||
|
||||
void removeReloadListener(IReload groups);
|
||||
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.api;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
|
||||
public interface IGroups
|
||||
public interface IRanks
|
||||
{
|
||||
String getMainGroup(IUser player);
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.Ban;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.Locale;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -4,7 +4,7 @@ import com.earth2me.essentials.Enchantments;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.EnchantPermissions;
|
||||
import com.earth2me.essentials.permissions.EnchantPermissions;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.GivePermissions;
|
||||
import com.earth2me.essentials.permissions.GivePermissions;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||
import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -17,13 +17,13 @@ public class Commandheal extends EssentialsCommand
|
||||
|
||||
if (args.length > 0 && Permissions.HEAL_OTHERS.isAuthorized(user))
|
||||
{
|
||||
user.checkCooldown(TimestampType.LASTHEAL, ess.getGroups().getHealCooldown(user), true, Permissions.HEAL_COOLDOWN_BYPASS);
|
||||
user.checkCooldown(TimestampType.LASTHEAL, ess.getRanks().getHealCooldown(user), true, Permissions.HEAL_COOLDOWN_BYPASS);
|
||||
|
||||
healOtherPlayers(user, args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
user.checkCooldown(TimestampType.LASTHEAL, ess.getGroups().getHealCooldown(user), true, Permissions.HEAL_COOLDOWN_BYPASS);
|
||||
user.checkCooldown(TimestampType.LASTHEAL, ess.getRanks().getHealCooldown(user), true, Permissions.HEAL_COOLDOWN_BYPASS);
|
||||
|
||||
user.setHealth(20);
|
||||
user.setFoodLevel(20);
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Location;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.ItemPermissions;
|
||||
import com.earth2me.essentials.permissions.ItemPermissions;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.KitPermissions;
|
||||
import com.earth2me.essentials.permissions.KitPermissions;
|
||||
import com.earth2me.essentials.settings.Kit;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -62,7 +62,7 @@ public class Commandlist extends EssentialsCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final String group = ess.getGroups().getMainGroup(player);
|
||||
final String group = ess.getRanks().getMainGroup(player);
|
||||
List<IUser> list = sort.get(group);
|
||||
if (list == null)
|
||||
{
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
|
||||
|
||||
public class Commandme extends EssentialsCommand
|
||||
|
@@ -3,8 +3,8 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.ItemPermissions;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.ItemPermissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IReplyTo;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.List;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.Locale;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.Server;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.DescParseTickFormat;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.*;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -5,7 +5,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IReplyTo;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import lombok.Cleanup;
|
||||
@@ -29,7 +29,7 @@ public class Commandsethome extends EssentialsCommand
|
||||
if ("bed".equals(args[0].toLowerCase(Locale.ENGLISH))) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
if ((user.getHomes().size() < ess.getGroups().getHomeLimit(user))
|
||||
if ((user.getHomes().size() < ess.getRanks().getHomeLimit(user))
|
||||
|| (user.getHomes().contains(args[0].toLowerCase(Locale.ENGLISH))))
|
||||
{
|
||||
user.acquireWriteLock();
|
||||
@@ -41,7 +41,7 @@ public class Commandsethome extends EssentialsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(_("maxHomes", ess.getGroups().getHomeLimit(user)));
|
||||
throw new Exception(_("maxHomes", ess.getRanks().getHomeLimit(user)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.settings.SpawnsHolder;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -49,7 +49,7 @@ public class Commandspawn extends EssentialsCommand
|
||||
private void respawn(final IUser user, final Trade charge) throws Exception
|
||||
{
|
||||
final SpawnsHolder spawns = (SpawnsHolder)this.module;
|
||||
final Location spawn = spawns.getSpawn(ess.getGroups().getMainGroup(user));
|
||||
final Location spawn = spawns.getSpawn(ess.getRanks().getMainGroup(user));
|
||||
user.getTeleport().teleport(spawn, charge, TeleportCause.COMMAND);
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.SpawnerPermissions;
|
||||
import com.earth2me.essentials.permissions.SpawnerPermissions;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@@ -6,7 +6,7 @@ import com.earth2me.essentials.Mob.MobException;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.SpawnmobPermissions;
|
||||
import com.earth2me.essentials.permissions.SpawnmobPermissions;
|
||||
import java.util.*;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -4,7 +4,7 @@ import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.Ban;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.DescParseTickFormat;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.*;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@@ -4,7 +4,7 @@ import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
|
||||
|
@@ -3,8 +3,8 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.perm.UnlimitedItemPermissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.permissions.UnlimitedItemPermissions;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import lombok.Cleanup;
|
||||
|
@@ -5,8 +5,8 @@ import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.api.IWarps;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.perm.WarpPermissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.permissions.WarpPermissions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.user.UserData;
|
||||
import java.util.Locale;
|
||||
import lombok.Cleanup;
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.WorldPermissions;
|
||||
import com.earth2me.essentials.permissions.WorldPermissions;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@@ -5,7 +5,7 @@ import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IEssentialsModule;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.AbstractSuperpermsPermission;
|
||||
import com.earth2me.essentials.permissions.AbstractSuperpermsPermission;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Server;
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.List;
|
||||
import lombok.Cleanup;
|
||||
import org.bukkit.Material;
|
||||
|
@@ -5,7 +5,7 @@ import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.textreader.IText;
|
||||
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||
import com.earth2me.essentials.textreader.TextInput;
|
||||
|
@@ -3,11 +3,11 @@ package com.earth2me.essentials.listener;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IReload;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.perm.GMGroups;
|
||||
import com.earth2me.essentials.perm.VaultGroups;
|
||||
import com.earth2me.essentials.ranks.GMGroups;
|
||||
import com.earth2me.essentials.ranks.VaultGroups;
|
||||
import com.earth2me.essentials.register.payment.Methods;
|
||||
import com.earth2me.essentials.settings.General;
|
||||
import com.earth2me.essentials.settings.GroupsHolder;
|
||||
import com.earth2me.essentials.ranks.RanksStorage;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -78,33 +78,33 @@ public class EssentialsPluginListener implements Listener, IReload
|
||||
if (storage == General.GroupStorage.GROUPMANAGER)
|
||||
{
|
||||
Plugin groupManager = ess.getServer().getPluginManager().getPlugin("GroupManager");
|
||||
if (groupManager != null && groupManager.isEnabled() && !(ess.getGroups() instanceof GMGroups))
|
||||
if (groupManager != null && groupManager.isEnabled() && !(ess.getRanks() instanceof GMGroups))
|
||||
{
|
||||
if (ess.getGroups() instanceof GroupsHolder)
|
||||
if (ess.getRanks() instanceof RanksStorage)
|
||||
{
|
||||
ess.removeReloadListener((GroupsHolder)ess.getGroups());
|
||||
ess.removeReloadListener((RanksStorage)ess.getRanks());
|
||||
}
|
||||
ess.setGroups(new GMGroups(ess, groupManager));
|
||||
ess.setRanks(new GMGroups(ess, groupManager));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (storage == General.GroupStorage.VAULT)
|
||||
{
|
||||
Plugin vault = ess.getServer().getPluginManager().getPlugin("Vault");
|
||||
if (vault != null && vault.isEnabled() && !(ess.getGroups() instanceof VaultGroups))
|
||||
if (vault != null && vault.isEnabled() && !(ess.getRanks() instanceof VaultGroups))
|
||||
{
|
||||
if (ess.getGroups() instanceof GroupsHolder)
|
||||
if (ess.getRanks() instanceof RanksStorage)
|
||||
{
|
||||
ess.removeReloadListener((GroupsHolder)ess.getGroups());
|
||||
ess.removeReloadListener((RanksStorage)ess.getRanks());
|
||||
}
|
||||
ess.setGroups(new VaultGroups(ess));
|
||||
ess.setRanks(new VaultGroups(ess));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!(ess.getGroups() instanceof GroupsHolder))
|
||||
if (!(ess.getRanks() instanceof RanksStorage))
|
||||
{
|
||||
ess.setGroups(new GroupsHolder(ess));
|
||||
ess.addReloadListener((GroupsHolder)ess.getGroups());
|
||||
ess.setRanks(new RanksStorage(ess));
|
||||
ess.addReloadListener((RanksStorage)ess.getRanks());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
|
||||
public abstract class AbstractPermissionsHandler implements IPermissionsHandler
|
||||
{
|
||||
@Override
|
||||
public void checkPermissions()
|
||||
{
|
||||
}
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import de.bananaco.bpermissions.api.ApiLayer;
|
||||
import de.bananaco.bpermissions.api.util.CalculableType;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class BPermissions2Handler extends SuperpermsHandler
|
||||
{
|
||||
public BPermissions2Handler()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
final List<String> groups = getGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return groups.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
final String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName());
|
||||
return Arrays.asList(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return ApiLayer.hasGroup(base.getWorld().getName(), CalculableType.USER, base.getName(), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix");
|
||||
}
|
||||
}
|
@@ -1,73 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import de.bananaco.permissions.Permissions;
|
||||
import de.bananaco.permissions.info.InfoReader;
|
||||
import de.bananaco.permissions.interfaces.PermissionSet;
|
||||
import de.bananaco.permissions.worlds.WorldPermissionsManager;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class BPermissionsHandler extends SuperpermsHandler
|
||||
{
|
||||
private final transient WorldPermissionsManager wpm;
|
||||
private final transient InfoReader info;
|
||||
|
||||
public BPermissionsHandler()
|
||||
{
|
||||
wpm = Permissions.getWorldPermissionsManager();
|
||||
info = new InfoReader();
|
||||
info.instantiate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
final List<String> groups = getGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return groups.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
final PermissionSet pset = wpm.getPermissionSet(base.getWorld());
|
||||
if (pset == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return pset.getGroups(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
final List<String> groups = getGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return groups.contains(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return info.getPrefix(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return info.getSuffix(base);
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
/*public class ConfigPermissionsHandler extends AbstractPermissionsHandler
|
||||
{
|
||||
private final transient IEssentials ess;
|
||||
|
||||
public ConfigPermissionsHandler(final Plugin ess)
|
||||
{
|
||||
this.ess = (IEssentials)ess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
final String[] cmds = node.split("\\.", 2);
|
||||
return !ess.getSettings().isCommandRestricted(cmds[cmds.length - 1])
|
||||
&& ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}*/
|
@@ -1,96 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
public class GroupManagerHandler extends AbstractPermissionsHandler
|
||||
{
|
||||
private final transient GroupManager groupManager;
|
||||
|
||||
public GroupManagerHandler(final Plugin permissionsPlugin)
|
||||
{
|
||||
groupManager = ((GroupManager)permissionsPlugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base);
|
||||
if (handler == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return handler.getGroup(base.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base);
|
||||
if (handler == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Arrays.asList(handler.getGroups(base.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base);
|
||||
if (handler == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return handler.canUserBuild(base.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base);
|
||||
if (handler == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return handler.inGroup(base.getName(), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base);
|
||||
if (handler == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return handler.has(base, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base);
|
||||
if (handler == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return handler.getUserPrefix(base.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base);
|
||||
if (handler == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return handler.getUserSuffix(base.getName());
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public interface IPermissionsHandler
|
||||
{
|
||||
String getGroup(Player base);
|
||||
|
||||
List<String> getGroups(Player base);
|
||||
|
||||
boolean canBuild(Player base, String group);
|
||||
|
||||
boolean inGroup(Player base, String group);
|
||||
|
||||
boolean hasPermission(Player base, String node);
|
||||
|
||||
String getPrefix(Player base);
|
||||
|
||||
String getSuffix(Player base);
|
||||
|
||||
public void checkPermissions();
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class NullPermissionsHandler extends AbstractPermissionsHandler
|
||||
{
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import com.platymuus.bukkit.permissions.Group;
|
||||
import com.platymuus.bukkit.permissions.PermissionInfo;
|
||||
import com.platymuus.bukkit.permissions.PermissionsPlugin;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
public class PermissionsBukkitHandler extends SuperpermsHandler
|
||||
{
|
||||
private final transient PermissionsPlugin plugin;
|
||||
|
||||
public PermissionsBukkitHandler(final Plugin plugin)
|
||||
{
|
||||
this.plugin = (PermissionsPlugin)plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
final List<Group> groups = getPBGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return groups.get(0).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
final List<Group> groups = getPBGroups(base);
|
||||
if (groups.size() == 1)
|
||||
{
|
||||
return Collections.singletonList(groups.get(0).getName());
|
||||
}
|
||||
final List<String> groupNames = new ArrayList<String>(groups.size());
|
||||
for (Group group : groups)
|
||||
{
|
||||
groupNames.add(group.getName());
|
||||
}
|
||||
return groupNames;
|
||||
}
|
||||
|
||||
private List<Group> getPBGroups(final Player base)
|
||||
{
|
||||
final PermissionInfo info = plugin.getPlayerInfo(base.getName());
|
||||
if (info == null)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final List<Group> groups = info.getGroups();
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
final List<Group> groups = getPBGroups(base);
|
||||
for (Group group1 : groups)
|
||||
{
|
||||
if (group1.getName().equalsIgnoreCase(group))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player base, String group)
|
||||
{
|
||||
return base.hasPermission("essentials.build") || base.hasPermission("permissions.build");
|
||||
}
|
||||
}
|
@@ -1,94 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
import ru.tehkode.permissions.PermissionManager;
|
||||
import ru.tehkode.permissions.PermissionUser;
|
||||
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||
|
||||
|
||||
public class PermissionsExHandler extends AbstractPermissionsHandler
|
||||
{
|
||||
private final transient PermissionManager manager;
|
||||
|
||||
public PermissionsExHandler()
|
||||
{
|
||||
manager = PermissionsEx.getPermissionManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
final PermissionUser user = manager.getUser(base.getName());
|
||||
if (user == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return user.getGroupsNames()[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
final PermissionUser user = manager.getUser(base.getName());
|
||||
if (user == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Arrays.asList(user.getGroupsNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
final PermissionUser user = manager.getUser(base.getName());
|
||||
if (user == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return user.getOptionBoolean("build", base.getWorld().getName(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
final PermissionUser user = manager.getUser(base.getName());
|
||||
if (user == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return user.inGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
return manager.has(base.getName(), node, base.getWorld().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
final PermissionUser user = manager.getUser(base.getName());
|
||||
if (user == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return user.getPrefix(base.getWorld().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
final PermissionUser user = manager.getUser(base.getName());
|
||||
if (user == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return user.getSuffix(base.getWorld().getName());
|
||||
}
|
||||
}
|
@@ -1,193 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
|
||||
public class PermissionsHandler implements IPermissionsHandler
|
||||
{
|
||||
private transient IPermissionsHandler handler = new NullPermissionsHandler();
|
||||
private transient String defaultGroup = "default";
|
||||
private final transient Plugin plugin;
|
||||
private final static Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
//private transient boolean useSuperperms = false;
|
||||
|
||||
public PermissionsHandler(final Plugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/*public PermissionsHandler(final Plugin plugin, final boolean useSuperperms)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.useSuperperms = useSuperperms;
|
||||
}*/
|
||||
|
||||
public PermissionsHandler(final Plugin plugin, final String defaultGroup)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.defaultGroup = defaultGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
String group = handler.getGroup(base);
|
||||
if (group == null)
|
||||
{
|
||||
group = defaultGroup;
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
List<String> groups = handler.getGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
groups = Collections.singletonList(defaultGroup);
|
||||
}
|
||||
return Collections.unmodifiableList(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return handler.canBuild(base, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return handler.inGroup(base, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
return handler.hasPermission(base, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
String prefix = handler.getPrefix(base);
|
||||
if (prefix == null)
|
||||
{
|
||||
prefix = "";
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
String suffix = handler.getSuffix(base);
|
||||
if (suffix == null)
|
||||
{
|
||||
suffix = "";
|
||||
}
|
||||
return suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkPermissions()
|
||||
{
|
||||
final PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
|
||||
final Plugin permExPlugin = pluginManager.getPlugin("PermissionsEx");
|
||||
if (permExPlugin != null && permExPlugin.isEnabled())
|
||||
{
|
||||
if (!(handler instanceof PermissionsExHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using PermissionsEx based permissions.");
|
||||
handler = new PermissionsExHandler();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin GMplugin = pluginManager.getPlugin("GroupManager");
|
||||
if (GMplugin != null && GMplugin.isEnabled())
|
||||
{
|
||||
if (!(handler instanceof GroupManagerHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using GroupManager based permissions.");
|
||||
handler = new GroupManagerHandler(GMplugin);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin permBukkitPlugin = pluginManager.getPlugin("PermissionsBukkit");
|
||||
if (permBukkitPlugin != null && permBukkitPlugin.isEnabled())
|
||||
{
|
||||
if (!(handler instanceof PermissionsBukkitHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using PermissionsBukkit based permissions.");
|
||||
handler = new PermissionsBukkitHandler(permBukkitPlugin);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin privPlugin = pluginManager.getPlugin("Privileges");
|
||||
if (privPlugin != null && privPlugin.isEnabled())
|
||||
{
|
||||
if (!(handler instanceof PrivilegesHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using Privileges based permissions.");
|
||||
handler = new PrivilegesHandler(privPlugin);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
|
||||
if (bPermPlugin != null && bPermPlugin.isEnabled())
|
||||
{
|
||||
final String bVer = bPermPlugin.getDescription().getVersion().replace(".", "");
|
||||
if (Util.isInt(bVer) && Integer.parseInt(bVer) < 284)
|
||||
{
|
||||
if (!(handler instanceof BPermissionsHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
|
||||
handler = new BPermissionsHandler();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!(handler instanceof BPermissions2Handler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions2 based permissions.");
|
||||
handler = new BPermissions2Handler();
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//if (useSuperperms)
|
||||
//{
|
||||
if (!(handler instanceof SuperpermsHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using superperms based permissions.");
|
||||
handler = new SuperpermsHandler();
|
||||
}
|
||||
/*}
|
||||
else
|
||||
{
|
||||
if (!(handler instanceof ConfigPermissionsHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using config based permissions. Enable superperms in config.");
|
||||
handler = new ConfigPermissionsHandler(plugin);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/*public void setUseSuperperms(final boolean useSuperperms)
|
||||
{
|
||||
this.useSuperperms = useSuperperms;
|
||||
}*/
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.krinsoft.privileges.Privileges;
|
||||
import net.krinsoft.privileges.groups.Group;
|
||||
import net.krinsoft.privileges.groups.GroupManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class PrivilegesHandler extends SuperpermsHandler
|
||||
{
|
||||
private final transient Privileges plugin;
|
||||
private final GroupManager manager;
|
||||
|
||||
public PrivilegesHandler(final Plugin plugin)
|
||||
{
|
||||
this.plugin = (Privileges) plugin;
|
||||
this.manager = this.plugin.getGroupManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
Group group = manager.getGroup(base);
|
||||
if (group == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
Group group = manager.getGroup(base);
|
||||
if (group == null)
|
||||
{
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
return group.getGroupTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
Group pGroup = manager.getGroup(base);
|
||||
if (pGroup == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pGroup.isMemberOf(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player base, String group)
|
||||
{
|
||||
return base.hasPermission("essentials.build") || base.hasPermission("privileges.build");
|
||||
}
|
||||
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class SuperpermsHandler extends AbstractPermissionsHandler
|
||||
{
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return hasPermission(base, "essentials.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return hasPermission(base, "group." + group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
if (base.hasPermission("-" + node))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final String[] parts = node.split("\\.");
|
||||
final StringBuilder builder = new StringBuilder(node.length());
|
||||
for (String part : parts)
|
||||
{
|
||||
builder.append('*');
|
||||
if (base.hasPermission(builder.toString()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
builder.deleteCharAt(builder.length() - 1);
|
||||
builder.append(part).append('.');
|
||||
}
|
||||
return base.hasPermission(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IPermission;
|
@@ -1,12 +1,12 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
public class BasePermission extends AbstractSuperpermsPermission {
|
||||
protected String permission;
|
||||
|
||||
public BasePermission(String base, String permission)
|
||||
{
|
||||
super();
|
||||
this.permission = base + permission;
|
||||
|
||||
}
|
||||
|
||||
public String getPermission()
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.EnumMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.EnumMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IPermission;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.EnumMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.permissions;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import java.util.HashMap;
|
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.ranks;
|
||||
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IGroups;
|
||||
import com.earth2me.essentials.api.IRanks;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import java.text.MessageFormat;
|
||||
@@ -11,7 +11,7 @@ import org.anjocaido.groupmanager.GroupManager;
|
||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class GMGroups implements IGroups {
|
||||
public class GMGroups implements IRanks {
|
||||
private final transient IEssentials ess;
|
||||
private final transient GroupManager groupManager;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
package com.earth2me.essentials.ranks;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
@@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class GroupOptions implements StorageObject
|
||||
public class RankOptions implements StorageObject
|
||||
{
|
||||
@Comment("Message format of chat messages")
|
||||
private String messageFormat;
|
28
Essentials/src/com/earth2me/essentials/ranks/Ranks.java
Normal file
28
Essentials/src/com/earth2me/essentials/ranks/Ranks.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.earth2me.essentials.ranks;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.MapValueType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.util.LinkedHashMap;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Ranks implements StorageObject
|
||||
{
|
||||
public Ranks()
|
||||
{
|
||||
final RankOptions defaultOptions = new RankOptions();
|
||||
ranks.put("default", defaultOptions);
|
||||
}
|
||||
@Comment(
|
||||
{
|
||||
"The order of the ranks matters, the ranks are checked from top to bottom.",
|
||||
"All rank names have to be lower case.",
|
||||
"The ranks can be connected to users using the permission essentials.ranks.rankname"
|
||||
})
|
||||
@MapValueType(RankOptions.class)
|
||||
private LinkedHashMap<String, RankOptions> ranks = new LinkedHashMap<String, RankOptions>();
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
package com.earth2me.essentials.ranks;
|
||||
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IGroups;
|
||||
import com.earth2me.essentials.api.IRanks;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.GroupsPermissions;
|
||||
import com.earth2me.essentials.permissions.GroupsPermissions;
|
||||
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
@@ -17,32 +17,32 @@ import java.util.Map.Entry;
|
||||
import lombok.Cleanup;
|
||||
|
||||
|
||||
public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IGroups
|
||||
public class RanksStorage extends AsyncStorageObjectHolder<Ranks> implements IRanks
|
||||
{
|
||||
public GroupsHolder(final IEssentials ess)
|
||||
public RanksStorage(final IEssentials ess)
|
||||
{
|
||||
super(ess, Groups.class);
|
||||
super(ess, Ranks.class);
|
||||
onReload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getStorageFile()
|
||||
{
|
||||
return new File(ess.getDataFolder(), "groups.yml");
|
||||
return new File(ess.getDataFolder(), "ranks.yml");
|
||||
}
|
||||
|
||||
public Collection<Entry<String, GroupOptions>> getGroups(final IUser player)
|
||||
public Collection<Entry<String, RankOptions>> getGroups(final IUser player)
|
||||
{
|
||||
acquireReadLock();
|
||||
try
|
||||
{
|
||||
final Map<String, GroupOptions> groups = getData().getGroups();
|
||||
final Map<String, RankOptions> groups = getData().getRanks();
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final ArrayList<Entry<String, GroupOptions>> list = new ArrayList();
|
||||
for (Entry<String, GroupOptions> entry : groups.entrySet())
|
||||
final ArrayList<Entry<String, RankOptions>> list = new ArrayList();
|
||||
for (Entry<String, RankOptions> entry : groups.entrySet())
|
||||
{
|
||||
if (GroupsPermissions.getPermission(entry.getKey()).isAuthorized(player))
|
||||
{
|
||||
@@ -63,7 +63,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public double getHealCooldown(final IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getValue().getHealCooldown() != null)
|
||||
{
|
||||
@@ -76,7 +76,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public double getTeleportCooldown(final IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getValue().getTeleportCooldown() != null)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public double getTeleportDelay(final IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getValue().getTeleportDelay() != null)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public String getPrefix(final IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getValue().getPrefix() != null)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public String getSuffix(final IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getValue().getSuffix() != null)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public int getHomeLimit(final IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getValue().getHomes() != null)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
|
||||
private String getRawChatFormat(final IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getValue().getMessageFormat() != null)
|
||||
{
|
||||
@@ -172,7 +172,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public boolean inGroup(IUser player, String groupname)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
if (groupOptions.getKey().equalsIgnoreCase(groupname))
|
||||
{
|
||||
@@ -185,7 +185,7 @@ public class GroupsHolder extends AsyncStorageObjectHolder<Groups> implements IG
|
||||
@Override
|
||||
public String getMainGroup(IUser player)
|
||||
{
|
||||
for (Entry<String, GroupOptions> groupOptions : getGroups(player))
|
||||
for (Entry<String, RankOptions> groupOptions : getGroups(player))
|
||||
{
|
||||
return groupOptions.getKey();
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
package com.earth2me.essentials.ranks;
|
||||
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IGroups;
|
||||
import com.earth2me.essentials.api.IRanks;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import java.text.MessageFormat;
|
||||
@@ -11,7 +11,7 @@ import net.milkbowl.vault.chat.Chat;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
|
||||
public class VaultGroups implements IGroups
|
||||
public class VaultGroups implements IRanks
|
||||
{
|
||||
private final IEssentials ess;
|
||||
|
@@ -1,28 +0,0 @@
|
||||
package com.earth2me.essentials.settings;
|
||||
|
||||
import com.earth2me.essentials.storage.Comment;
|
||||
import com.earth2me.essentials.storage.MapValueType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import java.util.LinkedHashMap;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Groups implements StorageObject
|
||||
{
|
||||
public Groups()
|
||||
{
|
||||
GroupOptions defaultOptions = new GroupOptions();
|
||||
groups.put("default", defaultOptions);
|
||||
}
|
||||
@Comment(
|
||||
{
|
||||
"The order of the groups matters, the groups are checked from top to bottom.",
|
||||
"All group names have to be lower case.",
|
||||
"The groups can be connected to users using the permission essentials.groups.groupname"
|
||||
})
|
||||
@MapValueType(GroupOptions.class)
|
||||
private LinkedHashMap<String, GroupOptions> groups = new LinkedHashMap<String, GroupOptions>();
|
||||
}
|
@@ -167,7 +167,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
|
||||
acquireReadLock();
|
||||
try
|
||||
{
|
||||
return getData().getNewPlayerAnnouncement().replace('&', '<27>').replace("<EFBFBD><EFBFBD>", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", ess.getGroups().getMainGroup(user)).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
|
||||
return getData().getNewPlayerAnnouncement().replace('&', '<27>').replace("<EFBFBD><EFBFBD>", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", ess.getRanks().getMainGroup(user)).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -242,7 +242,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Location spawn = spawns.getSpawn(ess.getGroups().getMainGroup(user));
|
||||
final Location spawn = spawns.getSpawn(ess.getRanks().getMainGroup(user));
|
||||
if (spawn != null)
|
||||
{
|
||||
event.setRespawnLocation(spawn);
|
||||
|
@@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.HelpPermissions;
|
||||
import com.earth2me.essentials.permissions.HelpPermissions;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
@@ -33,7 +33,7 @@ public class TextInput implements IText
|
||||
file = new File(ess.getDataFolder(), filename + "_" + Util.sanitizeFileName(user.getName()) + ".txt");
|
||||
if (!file.exists())
|
||||
{
|
||||
file = new File(ess.getDataFolder(), filename + "_" + Util.sanitizeFileName(ess.getGroups().getMainGroup(user)) + ".txt");
|
||||
file = new File(ess.getDataFolder(), filename + "_" + Util.sanitizeFileName(ess.getRanks().getMainGroup(user)) + ".txt");
|
||||
}
|
||||
}
|
||||
catch (InvalidNameException ex)
|
||||
@@ -85,9 +85,9 @@ public class TextInput implements IText
|
||||
if (line.length() > 0 && line.charAt(0) == '#')
|
||||
{
|
||||
bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-f]", ""), lineNumber);
|
||||
chapters.add(line.substring(1).replace('&', '<27>').replace("<EFBFBD>", "&"));
|
||||
chapters.add(line.substring(1).replace('&', '<27>').replace("<EFBFBD>", "&"));
|
||||
}
|
||||
lines.add(line.replace('&', '<27>').replace("<EFBFBD>", "&"));
|
||||
lines.add(line.replace('&', '<27>').replace("<EFBFBD>", "&"));
|
||||
lineNumber++;
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import com.earth2me.essentials.Teleport;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.*;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
@@ -208,7 +208,7 @@ public class User extends UserBase implements IUser
|
||||
@Cleanup
|
||||
final ISettings settings = ess.getSettings();
|
||||
settings.acquireReadLock();
|
||||
final IGroups groups = ess.getGroups();
|
||||
final IRanks groups = ess.getRanks();
|
||||
// default: {PREFIX}{NICKNAMEPREFIX}{NAME}{SUFFIX}
|
||||
String displayname = settings.getData().getChat().getDisplaynameFormat();
|
||||
if (settings.getData().getCommands().isDisabled("nick") || nick == null || nick.isEmpty() || nick.equals(getName()))
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.chat;
|
||||
|
||||
import com.earth2me.essentials.api.IPermission;
|
||||
import com.earth2me.essentials.perm.BasePermission;
|
||||
import com.earth2me.essentials.permissions.BasePermission;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
@@ -5,10 +5,10 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IGroups;
|
||||
import com.earth2me.essentials.api.IRanks;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
@@ -82,10 +82,10 @@ public abstract class EssentialsChatPlayer implements Listener
|
||||
{
|
||||
event.setMessage(Util.stripColor(event.getMessage()));
|
||||
}
|
||||
String group = ess.getGroups().getMainGroup(user);
|
||||
String group = ess.getRanks().getMainGroup(user);
|
||||
String world = user.getWorld().getName();
|
||||
|
||||
IGroups groupSettings = ess.getGroups();
|
||||
IRanks groupSettings = ess.getRanks();
|
||||
event.setFormat(groupSettings.getChatFormat(user).format(new Object[]
|
||||
{
|
||||
group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH)
|
||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.chat;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.perm.Permissions;
|
||||
import com.earth2me.essentials.permissions.Permissions;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user