Eliminate GroupPermission
This commit is contained in:
parent
987de21b3e
commit
994f957bc3
@ -7,7 +7,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.serverdata.Utility;
|
||||
|
||||
@ -93,24 +93,19 @@ public class CoreClient
|
||||
return _extra;
|
||||
}
|
||||
|
||||
public PermissionGroup getLastPrimaryGroup()
|
||||
public boolean inheritsFrom(PermissionGroup group)
|
||||
{
|
||||
if (_lastPrimary == null)
|
||||
{
|
||||
return _primary;
|
||||
}
|
||||
|
||||
return _lastPrimary;
|
||||
return _primary.inheritsFrom(group) || _extra.stream().anyMatch(memberGroup -> memberGroup.inheritsFrom(group));
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPermission(Permission permission)
|
||||
{
|
||||
return _primary.hasPermission(permission) || _extra.stream().anyMatch(memberGroup -> memberGroup.hasPermission(permission));
|
||||
}
|
||||
|
||||
public boolean isMemberOf(PermissionGroup group)
|
||||
{
|
||||
if (_extra.contains(group))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return group.equals(_primary);
|
||||
return group == _primary || _extra.contains(group);
|
||||
}
|
||||
|
||||
public void setPrimaryGroup(PermissionGroup group)
|
||||
|
@ -39,9 +39,9 @@ import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.account.event.OnlineGroupAddEvent;
|
||||
import mineplex.core.account.event.OnlineGroupRemoveEvent;
|
||||
import mineplex.core.account.event.OnlinePrimaryGroupUpdateEvent;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.account.permissions.PermissionGroupHelper;
|
||||
import mineplex.core.account.redis.AddPermissionGroup;
|
||||
import mineplex.core.account.redis.AddPermissionGroupHandler;
|
||||
import mineplex.core.account.redis.ClearGroups;
|
||||
@ -68,20 +68,22 @@ import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
public class CoreClientManager extends MiniPlugin
|
||||
{
|
||||
public static final String JOIN_FULL_PERMISSION = "mineplex.core.account.joinfull";
|
||||
public static final String RANK_COMMAND_PERMISSION = "mineplex.core.account.rankcommand";
|
||||
public static final String ADD_RANK_COMMAND_PERMISSION = "mineplex.core.account.addrank";
|
||||
public static final String RANK_INFO_COMMAND_PERMISSION = "mineplex.core.account.rankinfo";
|
||||
public static final String LIST_RANKS_COMMAND_PERMISSION = "mineplex.core.account.listranks";
|
||||
public static final String REMOVE_RANK_COMMAND_PERMISSION = "mineplex.core.account.removerank";
|
||||
public static final String RESET_PLAYER_COMMAND_PERMISSION = "mineplex.core.account.resetplayer";
|
||||
public static final String SET_RANK_COMMAND_PERMISSION = "mineplex.core.account.setrank";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
JOIN_FULL,
|
||||
RANK_COMMAND,
|
||||
ADD_RANK_COMMAND,
|
||||
RANK_INFO_COMMAND,
|
||||
LIST_RANKS_COMMAND,
|
||||
REMOVE_RANK_COMMAND,
|
||||
RESET_PLAYER_COMMAND,
|
||||
SET_RANK_COMMAND,
|
||||
}
|
||||
|
||||
private static final Map<String, Object> CLIENT_LOGIN_LOCKS = new ConcurrentHashMap<>();
|
||||
|
||||
private JavaPlugin _plugin;
|
||||
private AccountRepository _repository;
|
||||
private PermissionManager _perm;
|
||||
private Map<UUID, CoreClient> _clientList = new HashMap<>();
|
||||
private Set<UUID> _duplicateLoginGlitchPreventionList = new HashSet<>();
|
||||
|
||||
@ -100,7 +102,6 @@ public class CoreClientManager extends MiniPlugin
|
||||
|
||||
_plugin = plugin;
|
||||
_repository = new AccountRepository();
|
||||
_perm = new PermissionManager(plugin, this);
|
||||
|
||||
UtilScheduler.runEvery(UpdateType.TICK, this::checkForIllegalAccounts);
|
||||
|
||||
@ -114,14 +115,14 @@ public class CoreClientManager extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
_perm.setPermission(PermissionGroup.ULTRA, GroupPermission.of(JOIN_FULL_PERMISSION), true, true);
|
||||
_perm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(RANK_COMMAND_PERMISSION), true, true);
|
||||
_perm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(ADD_RANK_COMMAND_PERMISSION), true, true);
|
||||
_perm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(RANK_INFO_COMMAND_PERMISSION), true, true);
|
||||
_perm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(LIST_RANKS_COMMAND_PERMISSION), true, true);
|
||||
_perm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(REMOVE_RANK_COMMAND_PERMISSION), true, true);
|
||||
_perm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(RESET_PLAYER_COMMAND_PERMISSION), true, true);
|
||||
_perm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(SET_RANK_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.ULTRA.setPermission(Perm.JOIN_FULL, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.RANK_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.ADD_RANK_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.RANK_INFO_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.LIST_RANKS_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.REMOVE_RANK_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.RESET_PLAYER_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.SET_RANK_COMMAND, true, true);
|
||||
}
|
||||
|
||||
private void checkForIllegalAccounts()
|
||||
@ -142,11 +143,6 @@ public class CoreClientManager extends MiniPlugin
|
||||
return _repository;
|
||||
}
|
||||
|
||||
public PermissionManager getPermissionManager()
|
||||
{
|
||||
return _perm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
@ -317,7 +313,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
client.setAccountId(result.getLeft());
|
||||
if (result.getRight().getLeft() == null)
|
||||
{
|
||||
PermissionGroup newGroup = _perm.getGroupFromLegacy(token.Rank);
|
||||
PermissionGroup newGroup = PermissionGroupHelper.getGroupFromLegacy(token.Rank);
|
||||
client.setPrimaryGroup(newGroup);
|
||||
_repository.setPrimaryGroup(client.getAccountId(), newGroup, null);
|
||||
}
|
||||
@ -392,7 +388,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
client.setAccountId(result.getLeft());
|
||||
if (result.getRight().getLeft() == null)
|
||||
{
|
||||
PermissionGroup newGroup = _perm.getGroupFromLegacy(token.Rank);
|
||||
PermissionGroup newGroup = PermissionGroupHelper.getGroupFromLegacy(token.Rank);
|
||||
client.setPrimaryGroup(newGroup);
|
||||
_repository.setPrimaryGroup(client.getAccountId(), newGroup, null);
|
||||
}
|
||||
@ -467,7 +463,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
client.setAccountId(result.getLeft());
|
||||
if (result.getRight().getLeft() == null)
|
||||
{
|
||||
PermissionGroup newGroup = _perm.getGroupFromLegacy(token.Rank);
|
||||
PermissionGroup newGroup = PermissionGroupHelper.getGroupFromLegacy(token.Rank);
|
||||
client.setPrimaryGroup(newGroup);
|
||||
_repository.setPrimaryGroup(client.getAccountId(), newGroup, null);
|
||||
}
|
||||
@ -567,7 +563,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
if (client.getRawPrimaryGroup() == null)
|
||||
{
|
||||
String mssqlRank = token.Rank;
|
||||
PermissionGroup newGroup = _perm.getGroupFromLegacy(mssqlRank);
|
||||
PermissionGroup newGroup = PermissionGroupHelper.getGroupFromLegacy(mssqlRank);
|
||||
client.setPrimaryGroup(newGroup);
|
||||
_repository.setPrimaryGroup(client.getAccountId(), newGroup, null);
|
||||
}
|
||||
@ -619,7 +615,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
// Reserved Slot Check
|
||||
if (Bukkit.getOnlinePlayers().size() + _reservedSlots.size() >= Bukkit.getServer().getMaxPlayers())
|
||||
{
|
||||
if (_perm.hasPermission(client, GroupPermission.of(JOIN_FULL_PERMISSION)))
|
||||
if (client.hasPermission(Perm.JOIN_FULL))
|
||||
{
|
||||
event.allow();
|
||||
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
||||
@ -807,7 +803,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
{
|
||||
String legacy = loadOfflineClient(uuid).Rank;
|
||||
PermissionGroup defaultGroup = PermissionGroup.PLAYER;
|
||||
PermissionGroup loaded = _perm.getGroupFromLegacy(legacy);
|
||||
PermissionGroup loaded = PermissionGroupHelper.getGroupFromLegacy(legacy);
|
||||
if (loaded == null)
|
||||
{
|
||||
primaryReference.compareAndSet(null, defaultGroup);
|
||||
|
@ -19,7 +19,7 @@ public class AddRankCommand extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public AddRankCommand(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, CoreClientManager.ADD_RANK_COMMAND_PERMISSION, "add");
|
||||
super(plugin, CoreClientManager.Perm.ADD_RANK_COMMAND, "add");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,7 @@ public class InfoPlayerCommand extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public InfoPlayerCommand(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, CoreClientManager.RANK_INFO_COMMAND_PERMISSION, "info");
|
||||
super(plugin, CoreClientManager.Perm.RANK_INFO_COMMAND, "info");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class ListRanksCommand extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public ListRanksCommand(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, CoreClientManager.LIST_RANKS_COMMAND_PERMISSION, "list");
|
||||
super(plugin, CoreClientManager.Perm.LIST_RANKS_COMMAND, "list");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ public class RanksCommand extends MultiCommandBase<CoreClientManager>
|
||||
{
|
||||
public RanksCommand(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, CoreClientManager.RANK_COMMAND_PERMISSION, "rank", "ranks", "permissions");
|
||||
super(plugin, CoreClientManager.Perm.RANK_COMMAND, "rank", "ranks", "permissions");
|
||||
|
||||
AddCommand(new AddRankCommand(plugin));
|
||||
AddCommand(new InfoPlayerCommand(plugin));
|
||||
|
@ -19,7 +19,7 @@ public class RemoveRankCommand extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public RemoveRankCommand(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, CoreClientManager.REMOVE_RANK_COMMAND_PERMISSION, "remove");
|
||||
super(plugin, CoreClientManager.Perm.REMOVE_RANK_COMMAND, "remove");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ public class ResetPlayerCommand extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public ResetPlayerCommand(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, CoreClientManager.RESET_PLAYER_COMMAND_PERMISSION, "clear");
|
||||
super(plugin, CoreClientManager.Perm.RESET_PLAYER_COMMAND, "clear");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,7 @@ public class SetRankCommand extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public SetRankCommand(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, CoreClientManager.SET_RANK_COMMAND_PERMISSION, "set");
|
||||
super(plugin, CoreClientManager.Perm.SET_RANK_COMMAND, "set");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,35 +0,0 @@
|
||||
package mineplex.core.account.permissions;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class GroupPermission
|
||||
{
|
||||
private final String _identifier;
|
||||
|
||||
public GroupPermission(String identifier)
|
||||
{
|
||||
_identifier = Objects.requireNonNull(identifier, "Permission identifier cannot be null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return _identifier.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (o == null || !(o instanceof GroupPermission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _identifier.equals(((GroupPermission)o)._identifier);
|
||||
}
|
||||
|
||||
public static GroupPermission of(String identifier)
|
||||
{
|
||||
return new GroupPermission(identifier);
|
||||
}
|
||||
}
|
@ -3,9 +3,11 @@ package mineplex.core.account.permissions;
|
||||
/**
|
||||
* A Permission that can be assigned to {@link PermissionGroup}s
|
||||
*
|
||||
* <p>
|
||||
* This interface is intended to be paired with enum data types, as only
|
||||
* enum-based permissions are accepted by {@link PermissionGroup#setPermission(Enum, boolean, boolean)}
|
||||
*
|
||||
* <p>
|
||||
* Example usage:
|
||||
* <pre>
|
||||
* {@code
|
||||
@ -14,5 +16,12 @@ package mineplex.core.account.permissions;
|
||||
* PermissionGroup.PLAYER.setPermission(ExamplePerm.EXAMPLE_ONE, true, true);
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* Permissions can either be inheritable (passed on to child groups) or group-specific. Group-specific permissions
|
||||
* override inherited permissions, but still allow the inherited permission to be propagated to children.
|
||||
*
|
||||
* <p>
|
||||
* In the case that two parents share the same inheritable permission, the values will be merged with logical OR
|
||||
*/
|
||||
public interface Permission {}
|
||||
|
@ -118,7 +118,7 @@ public enum PermissionGroup
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getPermission(Permission permission)
|
||||
public boolean hasPermission(Permission permission)
|
||||
{
|
||||
synchronized(PERMS_LOCK)
|
||||
{
|
||||
@ -126,6 +126,19 @@ public enum PermissionGroup
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inheritsFrom(PermissionGroup group)
|
||||
{
|
||||
for (PermissionGroup parent : _parentGroups)
|
||||
{
|
||||
if (parent == group || parent.inheritsFrom(group))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return this == group;
|
||||
}
|
||||
|
||||
private void bakePermissions()
|
||||
{
|
||||
// Calculate inherited permissions
|
||||
@ -206,11 +219,6 @@ public enum PermissionGroup
|
||||
return _canBePrimary;
|
||||
}
|
||||
|
||||
public boolean inherits(PermissionGroup group)
|
||||
{
|
||||
return _parentGroups.contains(group);
|
||||
}
|
||||
|
||||
public static Optional<PermissionGroup> getGroup(String name)
|
||||
{
|
||||
return Stream.of(values()).filter(group -> group.name().equalsIgnoreCase(name)).findFirst();
|
||||
|
@ -0,0 +1,54 @@
|
||||
package mineplex.core.account.permissions;
|
||||
|
||||
public class PermissionGroupHelper
|
||||
{
|
||||
public static PermissionGroup getGroupFromLegacy(String legacyValue)
|
||||
{
|
||||
if (legacyValue == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String legacy = legacyValue.toLowerCase();
|
||||
final PermissionGroup current;
|
||||
|
||||
switch (legacy)
|
||||
{
|
||||
case "developer":
|
||||
current = PermissionGroup.DEV;
|
||||
break;
|
||||
case "jnr_dev":
|
||||
current = PermissionGroup.PLAYER;
|
||||
break;
|
||||
case "event_moderator":
|
||||
current = PermissionGroup.EVENTMOD;
|
||||
break;
|
||||
case "snr_moderator":
|
||||
current = PermissionGroup.SRMOD;
|
||||
break;
|
||||
case "moderator":
|
||||
current = PermissionGroup.MOD;
|
||||
break;
|
||||
case "helper":
|
||||
current = PermissionGroup.TRAINEE;
|
||||
break;
|
||||
case "mapdev":
|
||||
current = PermissionGroup.BUILDER;
|
||||
break;
|
||||
case "media":
|
||||
current = PermissionGroup.PLAYER;
|
||||
break;
|
||||
case "youtube_small":
|
||||
current = PermissionGroup.YT;
|
||||
break;
|
||||
case "all":
|
||||
current = PermissionGroup.PLAYER;
|
||||
break;
|
||||
default:
|
||||
current = PermissionGroup.getGroup(legacy).get();
|
||||
break;
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
package mineplex.core.account.permissions;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Pair;
|
||||
|
||||
public class PermissionManager extends MiniPlugin
|
||||
{
|
||||
private final CoreClientManager _clientManager;
|
||||
private final Map<String, PermissionGroup> _groups = new HashMap<>();
|
||||
private final Map<PermissionGroup, Map<GroupPermission, Boolean>> _specific = new HashMap<>();
|
||||
private final Map<PermissionGroup, Map<GroupPermission, Boolean>> _inheritable = new HashMap<>();
|
||||
|
||||
public PermissionManager(JavaPlugin plugin, CoreClientManager client)
|
||||
{
|
||||
super("Permission Manager");
|
||||
|
||||
_clientManager = client;
|
||||
}
|
||||
|
||||
private Set<GroupPermission> getPermissions(PermissionGroup group, boolean allowSpecific)
|
||||
{
|
||||
// TODO: replace
|
||||
return null;
|
||||
}
|
||||
|
||||
public PermissionGroup getGroupFromLegacy(String legacyValue)
|
||||
{
|
||||
if (legacyValue == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String legacy = legacyValue.toLowerCase();
|
||||
final PermissionGroup current;
|
||||
|
||||
if (legacy.equals("developer"))
|
||||
{
|
||||
current = PermissionGroup.DEV;
|
||||
}
|
||||
else if (legacy.equals("jnr_dev"))
|
||||
{
|
||||
current = PermissionGroup.PLAYER;
|
||||
}
|
||||
else if (legacy.equals("event_moderator"))
|
||||
{
|
||||
current = PermissionGroup.EVENTMOD;
|
||||
}
|
||||
else if (legacy.equals("snr_moderator"))
|
||||
{
|
||||
current = PermissionGroup.SRMOD;
|
||||
}
|
||||
else if (legacy.equals("moderator"))
|
||||
{
|
||||
current = PermissionGroup.MOD;
|
||||
}
|
||||
else if (legacy.equals("helper"))
|
||||
{
|
||||
current = PermissionGroup.TRAINEE;
|
||||
}
|
||||
else if (legacy.equals("mapdev"))
|
||||
{
|
||||
current = PermissionGroup.BUILDER;
|
||||
}
|
||||
else if (legacy.equals("media"))
|
||||
{
|
||||
current = PermissionGroup.PLAYER;
|
||||
}
|
||||
else if (legacy.equals("youtube_small"))
|
||||
{
|
||||
current = PermissionGroup.YT;
|
||||
}
|
||||
else if (legacy.equals("all"))
|
||||
{
|
||||
current = PermissionGroup.PLAYER;
|
||||
}
|
||||
else
|
||||
{
|
||||
current = PermissionGroup.getGroup(legacy).get();
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a group is an ancestor of a base group rather than just a direct parent
|
||||
*/
|
||||
public boolean inheritsFully(PermissionGroup base, PermissionGroup check)
|
||||
{
|
||||
// TODO: replace
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPermission(PermissionGroup group, GroupPermission permission)
|
||||
{
|
||||
// TODO: replace
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CoreClient client, GroupPermission permission)
|
||||
{
|
||||
// TODO: replace
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPermission(Pair<PermissionGroup, Set<PermissionGroup>> groups, GroupPermission permission)
|
||||
{
|
||||
// TODO: replace
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPermission(Player player, GroupPermission permission)
|
||||
{
|
||||
// TODO: replace
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setPermission(PermissionGroup group, GroupPermission permission, boolean inheritable, boolean value)
|
||||
{
|
||||
// TODO: replace
|
||||
}
|
||||
|
||||
public void revokePermission(PermissionGroup group, GroupPermission permission, boolean inheritable)
|
||||
{
|
||||
// TODO: replace
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
@ -310,7 +309,7 @@ public enum AchievementCategory
|
||||
String displayName = _statDisplays[i].getDisplayName();
|
||||
|
||||
// Skip showing Losses, Kills, Deaths for other players
|
||||
if (!clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(AchievementManager.SEE_FULL_STATS_PERMISSION)) && !player.getName().equals(targetName) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played")))
|
||||
if (!clientManager.Get(player).hasPermission(AchievementManager.Perm.SEE_FULL_STATS) && !player.getName().equals(targetName) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played")))
|
||||
continue;
|
||||
|
||||
double statNumber = 0;
|
||||
|
@ -9,9 +9,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.achievement.command.StatsCommand;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -24,10 +23,16 @@ import mineplex.core.stats.event.StatChangeEvent;
|
||||
|
||||
public class AchievementManager extends MiniPlugin
|
||||
{
|
||||
public static final String FAKE_LEVEL_TIER_PERMISSION = "mineplex.core.achievement.fakelevel.";
|
||||
public static final String SEE_FULL_STATS_PERMISSION = "mineplex.core.achievement.seefullstats";
|
||||
public static final String STATS_COMMAND_PERMISSION = "mineplex.core.achievement.guicommand";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
FAKE_LEVEL_50,
|
||||
FAKE_LEVEL_30,
|
||||
FAKE_LEVEL_15,
|
||||
FAKE_LEVEL_5,
|
||||
SEE_FULL_STATS,
|
||||
STATS_COMMAND,
|
||||
}
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private IncognitoManager _incognitoManager;
|
||||
private StatsManager _statsManager;
|
||||
@ -56,14 +61,12 @@ public class AchievementManager extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.MOD, GroupPermission.of(SEE_FULL_STATS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.MOD, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 1), true, true);
|
||||
pm.setPermission(PermissionGroup.SRMOD, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 2), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 3), true, true);
|
||||
pm.setPermission(PermissionGroup.LT, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 4), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(STATS_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.MOD.setPermission(Perm.SEE_FULL_STATS, true, true);
|
||||
PermissionGroup.MOD.setPermission(Perm.FAKE_LEVEL_5, true, true);
|
||||
PermissionGroup.SRMOD.setPermission(Perm.FAKE_LEVEL_15, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.FAKE_LEVEL_30, true, true);
|
||||
PermissionGroup.LT.setPermission(Perm.FAKE_LEVEL_50, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.STATS_COMMAND, true, true);
|
||||
}
|
||||
|
||||
public AchievementData get(Player player, Achievement type)
|
||||
@ -217,20 +220,17 @@ public class AchievementManager extends MiniPlugin
|
||||
public int getMineplexLevelNumber(Player sender)
|
||||
{
|
||||
int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel();
|
||||
|
||||
if (_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 4)))
|
||||
|
||||
if (_clientManager.Get(sender).hasPermission(Perm.FAKE_LEVEL_50))
|
||||
{
|
||||
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 3)))
|
||||
} else if (_clientManager.Get(sender).hasPermission(Perm.FAKE_LEVEL_30))
|
||||
{
|
||||
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 2)))
|
||||
} else if (_clientManager.Get(sender).hasPermission(Perm.FAKE_LEVEL_15))
|
||||
{
|
||||
level = Math.max(level, 15);
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(FAKE_LEVEL_TIER_PERMISSION + 1)))
|
||||
} else if (_clientManager.Get(sender).hasPermission(Perm.FAKE_LEVEL_5))
|
||||
{
|
||||
level = Math.max(level, 5);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package mineplex.core.achievement.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -13,7 +12,7 @@ public class StatsCommand extends CommandBase<AchievementManager>
|
||||
{
|
||||
public StatsCommand(AchievementManager plugin)
|
||||
{
|
||||
super(plugin, AchievementManager.STATS_COMMAND_PERMISSION, "stats");
|
||||
super(plugin, AchievementManager.Perm.STATS_COMMAND, "stats");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -29,7 +28,8 @@ public class StatsCommand extends CommandBase<AchievementManager>
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
if (Plugin.getClientManager().getPermissionManager().hasPermission(caller, GroupPermission.of(AchievementManager.SEE_FULL_STATS_PERMISSION))) attemptOffline(caller, args);
|
||||
if (Plugin.getClientManager().Get(caller).hasPermission(AchievementManager.Perm.SEE_FULL_STATS))
|
||||
attemptOffline(caller, args);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,9 +56,8 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.antihack.actions.AntiHackAction;
|
||||
import mineplex.core.antihack.actions.BanwaveAction;
|
||||
import mineplex.core.antihack.actions.GEPBanAction;
|
||||
@ -89,8 +88,6 @@ import mineplex.core.punish.Punishment;
|
||||
import mineplex.core.punish.PunishmentResponse;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
import static mineplex.core.account.permissions.GroupPermission.of;
|
||||
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class AntiHack extends MiniPlugin
|
||||
{
|
||||
@ -131,14 +128,17 @@ public class AntiHack extends MiniPlugin
|
||||
private static final String USER_HAS_BEEN_BANNED_BANWAVE = USER_HAS_BEEN_BANNED;
|
||||
|
||||
public static final int ID_LENGTH = 5;
|
||||
|
||||
public static final String SEE_GUARDIANS_PERMISSION = "mineplex.core.antihack.seeguardians";
|
||||
public static final String SEE_ALERTS_PERMISSION = "mineplex.core.antihack.seealerts";
|
||||
public static final String SILENTLY_BANNED_PERMISSION = "mineplex.core.antihack.silentlybanned";
|
||||
public static final String ANTICHEAT_TOGGLE_COMMAND_PERMISSION = "mineplex.core.antihack.togglecommand";
|
||||
public static final String DETAILED_MESSAGES_COMMAND_PERMISSION = "mineplex.core.antihack.detailedmessages";
|
||||
public static final String GET_VLS_COMMAND_PERMISSION = "mineplex.core.antihack.getvls";
|
||||
public static final String TEST_BAN_COMMAND_PERMISSION = "mineplex.core.antihack.testban";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
SEE_GUARDIANS,
|
||||
SEE_ALERTS,
|
||||
SILENTLY_BANNED,
|
||||
ANTICHEAT_TOGGLE_COMMAND,
|
||||
DETAILED_MESSAGES_COMMAND,
|
||||
GET_VLS_COMMAND,
|
||||
TEST_BAN_COMMAND,
|
||||
}
|
||||
|
||||
private final Cache<String, Integer> _cooldown = CacheBuilder.newBuilder()
|
||||
.concurrencyLevel(1)
|
||||
@ -186,7 +186,7 @@ public class AntiHack extends MiniPlugin
|
||||
{
|
||||
player.spigot().sendMessage(detailed);
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(SEE_ALERTS_PERMISSION)) && (violation.getOriginatingServer().equals(_thisServer) || _preferences.get(player).isActive(Preference.GLOBAL_GWEN_REPORTS)))
|
||||
else if (_clientManager.Get(player).hasPermission(Perm.SEE_ALERTS) && (violation.getOriginatingServer().equals(_thisServer) || _preferences.get(player).isActive(Preference.GLOBAL_GWEN_REPORTS)))
|
||||
{
|
||||
player.spigot().sendMessage(minimal);
|
||||
}
|
||||
@ -200,25 +200,24 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(SEE_GUARDIANS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.BUILDER, GroupPermission.of(SEE_GUARDIANS_PERMISSION), true, false);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(SEE_GUARDIANS_PERMISSION), true, true);
|
||||
|
||||
pm.setPermission(PermissionGroup.CONTENT, GroupPermission.of(SILENTLY_BANNED_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TRAINEE, of(SILENTLY_BANNED_PERMISSION), true, true);
|
||||
|
||||
pm.setPermission(PermissionGroup.TRAINEE, GroupPermission.of(SEE_ALERTS_PERMISSION), true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.SEE_GUARDIANS, true, true);
|
||||
PermissionGroup.BUILDER.setPermission(Perm.SEE_GUARDIANS, true, false);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.SEE_GUARDIANS, true, true);
|
||||
|
||||
PermissionGroup.CONTENT.setPermission(Perm.SILENTLY_BANNED, true, true);
|
||||
PermissionGroup.TRAINEE.setPermission(Perm.SILENTLY_BANNED, true, true);
|
||||
|
||||
PermissionGroup.TRAINEE.setPermission(Perm.SEE_ALERTS, true, true);
|
||||
|
||||
if (UtilServer.isTestServer())
|
||||
{
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(ANTICHEAT_TOGGLE_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(TEST_BAN_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.ANTICHEAT_TOGGLE_COMMAND, true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.TEST_BAN_COMMAND, true, true);
|
||||
}
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(DETAILED_MESSAGES_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(GET_VLS_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.QA, GroupPermission.of(DETAILED_MESSAGES_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.QA, GroupPermission.of(GET_VLS_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.DETAILED_MESSAGES_COMMAND, true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.GET_VLS_COMMAND, true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.DETAILED_MESSAGES_COMMAND, true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.GET_VLS_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -280,15 +279,14 @@ public class AntiHack extends MiniPlugin
|
||||
}
|
||||
};
|
||||
|
||||
if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(SILENTLY_BANNED_PERMISSION)))
|
||||
if (_clientManager.Get(player).hasPermission(Perm.SILENTLY_BANNED))
|
||||
{
|
||||
doPunish.accept(result ->
|
||||
{
|
||||
_pendingBan.remove(player);
|
||||
_banned.add(player.getUniqueId());
|
||||
});
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
runBanAnimation(player, () ->
|
||||
{
|
||||
@ -329,11 +327,11 @@ public class AntiHack extends MiniPlugin
|
||||
}
|
||||
};
|
||||
|
||||
if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(SILENTLY_BANNED_PERMISSION)))
|
||||
if (_clientManager.Get(player).hasPermission(Perm.SILENTLY_BANNED))
|
||||
{
|
||||
doPunish.accept(response -> {});
|
||||
}
|
||||
else
|
||||
doPunish.accept(response -> {
|
||||
});
|
||||
} else
|
||||
{
|
||||
runBanAnimation(player, () ->
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ public class AnticheatOffCommand extends CommandBase<AntiHack>
|
||||
{
|
||||
public AnticheatOffCommand(AntiHack plugin)
|
||||
{
|
||||
super(plugin, AntiHack.ANTICHEAT_TOGGLE_COMMAND_PERMISSION, "acoff");
|
||||
super(plugin, AntiHack.Perm.ANTICHEAT_TOGGLE_COMMAND, "acoff");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@ public class AnticheatOnCommand extends CommandBase<AntiHack>
|
||||
{
|
||||
public AnticheatOnCommand(AntiHack plugin)
|
||||
{
|
||||
super(plugin, AntiHack.ANTICHEAT_TOGGLE_COMMAND_PERMISSION, "acon");
|
||||
super(plugin, AntiHack.Perm.ANTICHEAT_TOGGLE_COMMAND, "acon");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@ public class DetailedMessagesCommand extends CommandBase<AntiHack>
|
||||
{
|
||||
public DetailedMessagesCommand(AntiHack plugin)
|
||||
{
|
||||
super(plugin, AntiHack.DETAILED_MESSAGES_COMMAND_PERMISSION, "detailedmessages");
|
||||
super(plugin, AntiHack.Perm.DETAILED_MESSAGES_COMMAND, "detailedmessages");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class GetVlsCommand extends CommandBase<AntiHack>
|
||||
{
|
||||
public GetVlsCommand(AntiHack plugin)
|
||||
{
|
||||
super(plugin, AntiHack.GET_VLS_COMMAND_PERMISSION, "getvls");
|
||||
super(plugin, AntiHack.Perm.GET_VLS_COMMAND, "getvls");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +16,7 @@ public class TestBanCommand extends CommandBase<AntiHack>
|
||||
{
|
||||
public TestBanCommand(AntiHack plugin)
|
||||
{
|
||||
super(plugin, AntiHack.TEST_BAN_COMMAND_PERMISSION, "testban");
|
||||
super(plugin, AntiHack.Perm.TEST_BAN_COMMAND, "testban");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,6 +4,9 @@ import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArmorStand;
|
||||
@ -20,15 +23,12 @@ import com.mineplex.spigot.ChunkAddEntityEvent;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
|
||||
public class AntiHackGuardian implements Listener
|
||||
{
|
||||
@ -118,7 +118,7 @@ public class AntiHackGuardian implements Listener
|
||||
if (!hideForStaff) return true;
|
||||
|
||||
// Don't let Builder -> Admin see it
|
||||
if (!clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(AntiHack.SEE_GUARDIANS_PERMISSION)))
|
||||
if (!clientManager.Get(player).hasPermission(AntiHack.Perm.SEE_GUARDIANS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ import com.google.gson.JsonObject;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.antihack.logging.builtin.PartyInfoMetadata;
|
||||
import mineplex.core.antihack.logging.builtin.PlayerInfoMetadata;
|
||||
@ -39,8 +38,11 @@ import mineplex.core.common.util.UtilServer;
|
||||
public class AntihackLogger extends MiniPlugin
|
||||
{
|
||||
public static final Gson GSON = new Gson();
|
||||
|
||||
private static final String SAVE_METADATA_COMMAND_PERMISSION = "mineplex.core.antihack.savemetadatacommand";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
SAVE_METADATA_COMMAND,
|
||||
}
|
||||
|
||||
private final CoreClientManager _clientManager = require(CoreClientManager.class);
|
||||
|
||||
@ -67,15 +69,14 @@ public class AntihackLogger extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
pm.setPermission(PermissionGroup.QA, GroupPermission.of(SAVE_METADATA_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.SAVE_METADATA_COMMAND, true, true);
|
||||
}
|
||||
|
||||
public void addCommands()
|
||||
{
|
||||
if (UtilServer.isTestServer())
|
||||
{
|
||||
addCommand(new CommandBase<AntihackLogger>(this, SAVE_METADATA_COMMAND_PERMISSION, "savemetadata")
|
||||
addCommand(new CommandBase<AntihackLogger>(this, Perm.SAVE_METADATA_COMMAND, "savemetadata")
|
||||
{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
|
@ -8,12 +8,9 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.aprilfools.command.PirateSongCommand;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
@ -81,8 +78,11 @@ public class AprilFoolsManager extends MiniPlugin
|
||||
.put("developer", "firstmate")
|
||||
.put("admin", "firstmate")
|
||||
.build();
|
||||
|
||||
public static final String PIRATE_SONG_COMMAND_PERMISSION = "mineplex.core.aprilfools.piratesong";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
PIRATE_SONG_COMMAND,
|
||||
}
|
||||
|
||||
private static AprilFoolsManager _instance;
|
||||
private final AprilFoolsRepository _repository;
|
||||
@ -106,8 +106,7 @@ public class AprilFoolsManager extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = Managers.get(CoreClientManager.class).getPermissionManager();
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(PIRATE_SONG_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.PIRATE_SONG_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ public class PirateSongCommand extends CommandBase<AprilFoolsManager>
|
||||
|
||||
public PirateSongCommand(AprilFoolsManager plugin)
|
||||
{
|
||||
super(plugin, AprilFoolsManager.PIRATE_SONG_COMMAND_PERMISSION, "piratesong");
|
||||
super(plugin, AprilFoolsManager.Perm.PIRATE_SONG_COMMAND, "piratesong");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,9 +12,8 @@ import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.powerplayclub.PowerPlayClubRepository;
|
||||
|
||||
public class BetaWhitelist extends MiniPlugin
|
||||
@ -42,9 +41,12 @@ public class BetaWhitelist extends MiniPlugin
|
||||
.add(UUID.fromString("6795643a-2b61-41bf-9429-c7549fd128a8")) // umGim
|
||||
.add(UUID.fromString("47ba454a-4999-42f4-a269-2f4114ceb3c7")) // falconviii
|
||||
.build();
|
||||
|
||||
private static final String BYPASS_WHITELIST_PERMISSION = "mineplex.core.beta.bypasswhitelist";
|
||||
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
BYPASS_WHITELIST,
|
||||
}
|
||||
|
||||
private final CoreClientManager _clientManager;
|
||||
private final PowerPlayClubRepository _powerPlayClubRepository;
|
||||
|
||||
@ -59,18 +61,17 @@ public class BetaWhitelist extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.ULTRA, GroupPermission.of(BYPASS_WHITELIST_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.ULTRA.setPermission(Perm.BYPASS_WHITELIST, true, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(BYPASS_WHITELIST_PERMISSION)) // If this player is Ultra+
|
||||
|| _powerPlayClubRepository.getCachedData(player).isSubscribed() // a PPC subscriber,
|
||||
|| EXTRA_PLAYERS.contains(player.getUniqueId())) // or explicitly whitelisted,
|
||||
if (_clientManager.Get(player).hasPermission(Perm.BYPASS_WHITELIST) // If this player is Ultra+
|
||||
|| _powerPlayClubRepository.getCachedData(player).isSubscribed() // a PPC subscriber,
|
||||
|| EXTRA_PLAYERS.contains(player.getUniqueId())) // or explicitly whitelisted,
|
||||
{
|
||||
return; // allow them in
|
||||
}
|
||||
|
@ -39,9 +39,8 @@ import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.ILoginProcessor;
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.bonuses.animations.AnimationCarl;
|
||||
import mineplex.core.bonuses.commands.AnimationCommand;
|
||||
import mineplex.core.bonuses.commands.GuiCommand;
|
||||
@ -94,18 +93,21 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
public static final TimeZone TIMEZONE = TimeZone.getTimeZone("UTC");
|
||||
|
||||
private static long timeOffSet = 0;
|
||||
|
||||
public static final String ETERNAL_BONUS_PERMISSION = "mineplex.core.bonus.eternal";
|
||||
public static final String TITAN_BONUS_PERMISSION = "mineplex.core.bonus.titan";
|
||||
public static final String LEGEND_BONUS_PERMISSION = "mineplex.core.bonus.legend";
|
||||
public static final String HERO_BONUS_PERMISSION = "mineplex.core.bonus.hero";
|
||||
public static final String ULTRA_BONUS_PERMISSION = "mineplex.core.bonus.ultra";
|
||||
public static final String MONTHLY_BONUS_PERMISSION = "mineplex.core.bonus.monthly";
|
||||
public static final String ALLOW_COMMAND_PERMISSION = "mineplex.core.bonus.allowcommand";
|
||||
public static final String ANIMATION_COMMAND_PERMISSION = "mineplex.core.bonus.animation";
|
||||
public static final String GUI_COMMAND_PERMISSION = "mineplex.core.bonus.gui";
|
||||
public static final String POWER_PLAY_COMMAND_PERMISSION = "mineplex.core.bonus.powerplay";
|
||||
public static final String TICKET_COMMAND_PERMISSION = "mineplex.core.bonus.ticket";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
ETERNAL_BONUS,
|
||||
TITAN_BONUS,
|
||||
LEGEND_BONUS,
|
||||
HERO_BONUS,
|
||||
ULTRA_BONUS,
|
||||
MONTHLY_BONUS,
|
||||
ALLOW_COMMAND,
|
||||
ANIMATION_COMMAND,
|
||||
GUI_COMMAND,
|
||||
POWER_PLAY_COMMAND,
|
||||
TICKET_COMMAND,
|
||||
}
|
||||
|
||||
private ArrayList<Object> _pendingExplosions = new ArrayList<>();
|
||||
private ArrayList<Player> _pendingExplosionsPlayers = new ArrayList<>();
|
||||
@ -310,19 +312,18 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
pm.setPermission(PermissionGroup.ULTRA, GroupPermission.of(MONTHLY_BONUS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ULTRA, GroupPermission.of(ULTRA_BONUS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.HERO, GroupPermission.of(HERO_BONUS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.LEGEND, GroupPermission.of(LEGEND_BONUS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TITAN, GroupPermission.of(TITAN_BONUS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ETERNAL, GroupPermission.of(ETERNAL_BONUS_PERMISSION), true, true);
|
||||
|
||||
//pm.setPermission(pm.getGroup("mod"), GroupPermission.of(ALLOW_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(ANIMATION_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(GUI_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(POWER_PLAY_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(TICKET_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.ULTRA.setPermission(Perm.MONTHLY_BONUS, true, true);
|
||||
PermissionGroup.ULTRA.setPermission(Perm.ULTRA_BONUS, true, true);
|
||||
PermissionGroup.HERO.setPermission(Perm.HERO_BONUS, true, true);
|
||||
PermissionGroup.LEGEND.setPermission(Perm.LEGEND_BONUS, true, true);
|
||||
PermissionGroup.TITAN.setPermission(Perm.TITAN_BONUS, true, true);
|
||||
PermissionGroup.ETERNAL.setPermission(Perm.ETERNAL_BONUS, true, true);
|
||||
|
||||
//pm.setPermission(pm.getGroup("mod"), Perm.ALLOW_COMMAND, true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.ANIMATION_COMMAND, true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.GUI_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.POWER_PLAY_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.TICKET_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -782,25 +783,21 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
BonusAmount data = new BonusAmount();
|
||||
|
||||
if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(ETERNAL_BONUS_PERMISSION)))
|
||||
if (_clientManager.Get(player).hasPermission(Perm.ETERNAL_BONUS))
|
||||
{
|
||||
data.setIlluminatedChests(2);
|
||||
data.setMythicalChests(2);
|
||||
data.setOmegaChests(1);
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(TITAN_BONUS_PERMISSION)))
|
||||
} else if (_clientManager.Get(player).hasPermission(Perm.TITAN_BONUS))
|
||||
{
|
||||
data.setMythicalChests(5);
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(LEGEND_BONUS_PERMISSION)))
|
||||
} else if (_clientManager.Get(player).hasPermission(Perm.LEGEND_BONUS))
|
||||
{
|
||||
data.setMythicalChests(3);
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(HERO_BONUS_PERMISSION)))
|
||||
} else if (_clientManager.Get(player).hasPermission(Perm.HERO_BONUS))
|
||||
{
|
||||
data.setMythicalChests(2);
|
||||
}
|
||||
else if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(ULTRA_BONUS_PERMISSION)))
|
||||
} else if (_clientManager.Get(player).hasPermission(Perm.ULTRA_BONUS))
|
||||
{
|
||||
data.setMythicalChests(1);
|
||||
}
|
||||
@ -1016,7 +1013,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (canVote(player)) availableRewards++;
|
||||
if (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) availableRewards++;
|
||||
if (_youtubeManager.canYoutube(player)) availableRewards++;
|
||||
if (canRank(player) && _clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(MONTHLY_BONUS_PERMISSION)) && isPastAugust()) availableRewards++;
|
||||
if (canRank(player) && _clientManager.Get(player).hasPermission(Perm.MONTHLY_BONUS) && isPastAugust()) availableRewards++;
|
||||
if (canDaily(player)) availableRewards++;
|
||||
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).getPrimaryGroup()) != null) availableRewards++;
|
||||
if (!_facebookManager.hasRedeemed(player)) availableRewards++;
|
||||
@ -1176,7 +1173,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false))
|
||||
{
|
||||
if (_pollManager.hasPoll(player) || canVote(player) || _youtubeManager.canYoutube(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(MONTHLY_BONUS_PERMISSION)) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
|
||||
if (_pollManager.hasPoll(player) || canVote(player) || _youtubeManager.canYoutube(player) || (_playWireManager.Get(player) != null && _playWireManager.Get(player).getAccountId() != -1 && _playWireManager.canRedeemTickets(_playWireManager.Get(player))) || (canRank(player) && _clientManager.Get(player).hasPermission(Perm.MONTHLY_BONUS) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
|
||||
{
|
||||
if (_showCarl.containsKey(player.getName()))
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ public class AllowCommand extends CommandBase<BonusManager>
|
||||
|
||||
public AllowCommand(BonusManager plugin)
|
||||
{
|
||||
super(plugin, BonusManager.ALLOW_COMMAND_PERMISSION, "allowCommand", "allowCmd");
|
||||
super(plugin, BonusManager.Perm.ALLOW_COMMAND, "allowCommand", "allowCmd");
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public class AllowCommand extends CommandBase<BonusManager>
|
||||
return;
|
||||
}
|
||||
ICommand iCommand = commands.get(args[1]);
|
||||
if (!_plugin.getClientManager().getPermissionManager().hasPermission(caller, iCommand.getPermission()))
|
||||
if (!_plugin.getClientManager().Get(caller).hasPermission(iCommand.getPermission()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Allow Command", "You're not allowed to use that command!"));
|
||||
return;
|
||||
|
@ -13,7 +13,7 @@ public class AnimationCommand extends CommandBase<BonusManager>{
|
||||
|
||||
public AnimationCommand(BonusManager plugin)
|
||||
{
|
||||
super(plugin, BonusManager.ANIMATION_COMMAND_PERMISSION, "animation");
|
||||
super(plugin, BonusManager.Perm.ANIMATION_COMMAND, "animation");
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ public class GuiCommand extends CommandBase<BonusManager>
|
||||
{
|
||||
public GuiCommand(BonusManager plugin)
|
||||
{
|
||||
super(plugin, BonusManager.GUI_COMMAND_PERMISSION, "bonus");
|
||||
super(plugin, BonusManager.Perm.GUI_COMMAND, "bonus");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,7 @@ public class PowerPlayCommand extends CommandBase<BonusManager>
|
||||
|
||||
public PowerPlayCommand(BonusManager manager)
|
||||
{
|
||||
super(manager, BonusManager.POWER_PLAY_COMMAND_PERMISSION, "powerplay");
|
||||
super(manager, BonusManager.Perm.POWER_PLAY_COMMAND, "powerplay");
|
||||
_bonusManager = manager;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class TicketCommand extends CommandBase<BonusManager>
|
||||
{
|
||||
public TicketCommand(BonusManager plugin)
|
||||
{
|
||||
super(plugin, BonusManager.TICKET_COMMAND_PERMISSION, "ticket");
|
||||
super(plugin, BonusManager.Perm.TICKET_COMMAND, "ticket");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,9 +22,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.boosters.command.BoosterCommand;
|
||||
import mineplex.core.boosters.event.BoosterActivateEvent;
|
||||
import mineplex.core.boosters.event.BoosterExpireEvent;
|
||||
@ -69,12 +68,15 @@ public class BoosterManager extends MiniPlugin
|
||||
public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Game Amplifiers");
|
||||
// Slot for the booster gui item
|
||||
public static final int INTERFACE_SLOT = 7;
|
||||
|
||||
public static final String ADD_BOOSTER_COMMAND_PERMISSION = "mineplex.core.booster.add";
|
||||
public static final String BOOSTER_COMMAND_PERMISSION = "mineplex.core.booster.command";
|
||||
public static final String BOOSTER_GUI_COMMAND_PERMISSION = "mineplex.core.booster.gui";
|
||||
public static final String RELOAD_BOOSTERS_COMMAND_PERMISSION = "mineplex.core.booster.reload";
|
||||
public static final String THANK_COMMAND_PERMISSION = "mineplex.core.booster.thank";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
ADD_BOOSTER_COMMAND,
|
||||
BOOSTER_COMMAND,
|
||||
BOOSTER_GUI_COMMAND,
|
||||
RELOAD_BOOSTERS_COMMAND,
|
||||
THANK_COMMAND,
|
||||
}
|
||||
|
||||
private BoosterRepository _repository;
|
||||
private CoreClientManager _clientManager;
|
||||
@ -123,13 +125,11 @@ public class BoosterManager extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(BOOSTER_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(THANK_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(ADD_BOOSTER_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(RELOAD_BOOSTERS_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.DEV, GroupPermission.of(BOOSTER_GUI_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.BOOSTER_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.THANK_COMMAND, true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.ADD_BOOSTER_COMMAND, true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.RELOAD_BOOSTERS_COMMAND, true, true);
|
||||
PermissionGroup.DEV.setPermission(Perm.BOOSTER_GUI_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,7 @@ public class AddCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public AddCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, BoosterManager.ADD_BOOSTER_COMMAND_PERMISSION, "add");
|
||||
super(plugin, BoosterManager.Perm.ADD_BOOSTER_COMMAND, "add");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ public class BoosterCommand extends MultiCommandBase<BoosterManager>
|
||||
{
|
||||
public BoosterCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, BoosterManager.BOOSTER_COMMAND_PERMISSION, "amplifier");
|
||||
super(plugin, BoosterManager.Perm.BOOSTER_COMMAND, "amplifier");
|
||||
|
||||
AddCommand(new AddCommand(plugin));
|
||||
AddCommand(new GuiCommand(plugin));
|
||||
|
@ -12,7 +12,7 @@ public class GuiCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public GuiCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, BoosterManager.BOOSTER_GUI_COMMAND_PERMISSION, "gui");
|
||||
super(plugin, BoosterManager.Perm.BOOSTER_GUI_COMMAND, "gui");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,7 @@ public class ReloadCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public ReloadCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, BoosterManager.RELOAD_BOOSTERS_COMMAND_PERMISSION, "reload");
|
||||
super(plugin, BoosterManager.Perm.RELOAD_BOOSTERS_COMMAND, "reload");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ public class ThankCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public ThankCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, BoosterManager.THANK_COMMAND_PERMISSION, "thank");
|
||||
super(plugin, BoosterManager.Perm.THANK_COMMAND, "thank");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,9 +11,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.botspam.command.BotSpamCommand;
|
||||
import mineplex.core.botspam.repository.BotSpamRepository;
|
||||
import mineplex.core.message.PrivateMessageEvent;
|
||||
@ -25,13 +24,16 @@ import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
public class BotSpamManager extends MiniPlugin
|
||||
{
|
||||
public static final String BYPASS_BOTSPAM_PERMISSION = "mineplex.core.botspam.bypass";
|
||||
public static final String BOTSPAM_COMMAND_PERMISSION = "mineplex.core.botspam.command";
|
||||
public static final String ADD_BOTSPAM_COMMAND_PERMISSION = "mineplex.core.botspam.add";
|
||||
public static final String TOGGLE_BOTSPAM_COMMAND_PERMISSION = "mineplex.core.botspam.toggle";
|
||||
public static final String UPDATE_BOTSPAM_COMMAND_PERMISSION = "mineplex.core.botspam.update";
|
||||
public static final String LIST_BOTSPAM_COMMAND_PERMISSION = "mineplex.core.botspam.list";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
BYPASS_BOTSPAM,
|
||||
BOTSPAM_COMMAND,
|
||||
ADD_BOTSPAM_COMMAND,
|
||||
TOGGLE_BOTSPAM_COMMAND,
|
||||
UPDATE_BOTSPAM_COMMAND,
|
||||
LIST_BOTSPAM_COMMAND,
|
||||
}
|
||||
|
||||
private Punish _punish;
|
||||
private CoreClientManager _clientManager;
|
||||
private BotSpamRepository _repository;
|
||||
@ -48,20 +50,19 @@ public class BotSpamManager extends MiniPlugin
|
||||
_spam = _repository.getSpamText();
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType(ForceUpdateCommand.class, command -> runAsync(() -> _spam = _repository.getSpamText()));
|
||||
|
||||
|
||||
generatePermissions();
|
||||
}
|
||||
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.TRAINEE, GroupPermission.of(BYPASS_BOTSPAM_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(BOTSPAM_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(ADD_BOTSPAM_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(TOGGLE_BOTSPAM_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(UPDATE_BOTSPAM_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(LIST_BOTSPAM_COMMAND_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.TRAINEE.setPermission(Perm.BYPASS_BOTSPAM, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.BOTSPAM_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.ADD_BOTSPAM_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.TOGGLE_BOTSPAM_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.UPDATE_BOTSPAM_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.LIST_BOTSPAM_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -69,11 +70,11 @@ public class BotSpamManager extends MiniPlugin
|
||||
{
|
||||
Player recipient = event.getRecipient();
|
||||
// Ignore messages sent to staff members
|
||||
if (_clientManager.getPermissionManager().hasPermission(recipient, GroupPermission.of(BYPASS_BOTSPAM_PERMISSION)))
|
||||
if (_clientManager.Get(recipient).hasPermission(Perm.BYPASS_BOTSPAM))
|
||||
return;
|
||||
|
||||
// Ignore messages sent by staff members
|
||||
if (_clientManager.getPermissionManager().hasPermission(event.getSender(), GroupPermission.of(BYPASS_BOTSPAM_PERMISSION)))
|
||||
if (_clientManager.Get(event.getSender()).hasPermission(Perm.BYPASS_BOTSPAM))
|
||||
return;
|
||||
|
||||
for (SpamText spamText : _spam)
|
||||
@ -91,7 +92,7 @@ public class BotSpamManager extends MiniPlugin
|
||||
public void onChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
// Ignore messages sent by staff members
|
||||
if (_clientManager.getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(BYPASS_BOTSPAM_PERMISSION)))
|
||||
if (_clientManager.Get(event.getPlayer()).hasPermission(Perm.BYPASS_BOTSPAM))
|
||||
return;
|
||||
|
||||
for (final SpamText spamText : _spam)
|
||||
|
@ -13,7 +13,7 @@ public class BotSpamAddCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamAddCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, BotSpamManager.ADD_BOTSPAM_COMMAND_PERMISSION, "add");
|
||||
super(plugin, BotSpamManager.Perm.ADD_BOTSPAM_COMMAND, "add");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@ public class BotSpamCommand extends MultiCommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, BotSpamManager.BOTSPAM_COMMAND_PERMISSION, "botban", "botspam");
|
||||
super(plugin, BotSpamManager.Perm.BOTSPAM_COMMAND, "botban", "botspam");
|
||||
|
||||
AddCommand(new BotSpamAddCommand(Plugin));
|
||||
AddCommand(new BotSpamEnableCommand(Plugin));
|
||||
|
@ -12,7 +12,7 @@ public class BotSpamDisableCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamDisableCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, BotSpamManager.TOGGLE_BOTSPAM_COMMAND_PERMISSION, "disable");
|
||||
super(plugin, BotSpamManager.Perm.TOGGLE_BOTSPAM_COMMAND, "disable");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ public class BotSpamEnableCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamEnableCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, BotSpamManager.TOGGLE_BOTSPAM_COMMAND_PERMISSION, "enable");
|
||||
super(plugin, BotSpamManager.Perm.TOGGLE_BOTSPAM_COMMAND, "enable");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,7 @@ public class BotSpamGlobalUpdateCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamGlobalUpdateCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, BotSpamManager.UPDATE_BOTSPAM_COMMAND_PERMISSION, "globalupdate");
|
||||
super(plugin, BotSpamManager.Perm.UPDATE_BOTSPAM_COMMAND, "globalupdate");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,12 @@ package mineplex.core.botspam.command;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -12,17 +18,12 @@ import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
|
||||
public class BotSpamListCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamListCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, BotSpamManager.LIST_BOTSPAM_COMMAND_PERMISSION, "list");
|
||||
super(plugin, BotSpamManager.Perm.LIST_BOTSPAM_COMMAND, "list");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,9 +36,8 @@ import org.json.simple.JSONValue;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.chat.command.BroadcastCommand;
|
||||
import mineplex.core.chat.command.ChatSlowCommand;
|
||||
@ -58,16 +57,19 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class Chat extends MiniPlugin
|
||||
{
|
||||
public static final String ALLOW_CAPS_PERMISSION = "mineplex.core.chat.allowcaps";
|
||||
public static final String BYPASS_COOLDOWN_PERMISSION = "mineplex.core.chat.bypasscooldown";
|
||||
public static final String BYPASS_SLOW_PERMISSION = "mineplex.core.chat.bypasschatslow";
|
||||
public static final String BYPASS_SILENCE_PERMISSION = "mineplex.core.chat.bypasssilence";
|
||||
public static final String BYPASS_SIGNS_PERMISSION = "mineplex.core.chat.bypasssigns";
|
||||
public static final String ALLOW_HACKUSATE_PERMISSION = "mineplex.core.chat.allowhackusate";
|
||||
public static final String ALLOW_SIMILAR_PERMISSION = "mineplex.core.chat.allowsimilar";
|
||||
public static final String SILENCE_COMMAND_PERMISSION = "mineplex.core.chat.silence";
|
||||
public static final String SLOW_CHAT_COMMAND_PERMISSION = "mineplex.core.chat.chatslow";
|
||||
public static final String BROADCAST_COMMAND_PERMISSION = "mineplex.core.chat.broadcast";
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
ALLOW_CAPS,
|
||||
BYPASS_COOLDOWN,
|
||||
BYPASS_SLOW,
|
||||
BYPASS_SILENCE,
|
||||
BYPASS_SIGNS,
|
||||
ALLOW_HACKUSATE,
|
||||
ALLOW_SIMILAR,
|
||||
SILENCE_COMMAND,
|
||||
SLOW_CHAT_COMMAND,
|
||||
BROADCAST_COMMAND,
|
||||
}
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private PreferencesManager _preferences;
|
||||
@ -112,17 +114,16 @@ public class Chat extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(ALLOW_CAPS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.MOD, GroupPermission.of(BYPASS_COOLDOWN_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TRAINEE, GroupPermission.of(BYPASS_SLOW_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.MOD, GroupPermission.of(BYPASS_SILENCE_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(BYPASS_SIGNS_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TRAINEE, GroupPermission.of(ALLOW_HACKUSATE_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.MOD, GroupPermission.of(ALLOW_SIMILAR_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(SILENCE_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.SRMOD, GroupPermission.of(SLOW_CHAT_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.MOD, GroupPermission.of(BROADCAST_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.ALLOW_CAPS, true, true);
|
||||
PermissionGroup.MOD.setPermission(Perm.BYPASS_COOLDOWN, true, true);
|
||||
PermissionGroup.TRAINEE.setPermission(Perm.BYPASS_SLOW, true, true);
|
||||
PermissionGroup.MOD.setPermission(Perm.BYPASS_SILENCE, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.BYPASS_SIGNS, true, true);
|
||||
PermissionGroup.TRAINEE.setPermission(Perm.ALLOW_HACKUSATE, true, true);
|
||||
PermissionGroup.MOD.setPermission(Perm.ALLOW_SIMILAR, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.SILENCE_COMMAND, true, true);
|
||||
PermissionGroup.SRMOD.setPermission(Perm.SLOW_CHAT_COMMAND, true, true);
|
||||
PermissionGroup.MOD.setPermission(Perm.BROADCAST_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -220,7 +221,7 @@ public class Chat extends MiniPlugin
|
||||
if (_silenced == 0)
|
||||
return false;
|
||||
|
||||
if (_clientManager.getPermissionManager().hasPermission(player, GroupPermission.of(BYPASS_SILENCE_PERMISSION)))
|
||||
if (_clientManager.Get(player).hasPermission(Perm.BYPASS_SILENCE))
|
||||
return false;
|
||||
|
||||
if (_silenced == -1)
|
||||
@ -238,7 +239,7 @@ public class Chat extends MiniPlugin
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onSignChange(SignChangeEvent event)
|
||||
{
|
||||
if (_clientManager.getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(BYPASS_SIGNS_PERMISSION)))
|
||||
if (_clientManager.Get(event.getPlayer()).hasPermission(Perm.BYPASS_SIGNS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -376,13 +377,13 @@ public class Chat extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
else if (!_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(BYPASS_COOLDOWN_PERMISSION)) &&
|
||||
else if (!_clientManager.Get(sender).hasPermission(Perm.BYPASS_COOLDOWN) &&
|
||||
!Recharge.Instance.use(sender, "Chat Message", 400, false, false))
|
||||
{
|
||||
UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (!_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(ALLOW_HACKUSATE_PERMISSION)) &&
|
||||
else if (!_clientManager.Get(sender).hasPermission(Perm.ALLOW_HACKUSATE) &&
|
||||
msgContainsHack(event.getMessage()))
|
||||
{
|
||||
UtilPlayer.message(sender, F.main("Chat",
|
||||
@ -396,12 +397,12 @@ public class Chat extends MiniPlugin
|
||||
MessageData lastMessage = _playerLastMessage.get(sender.getUniqueId());
|
||||
long chatSlowTime = 1000L * _chatSlow;
|
||||
long timeDiff = System.currentTimeMillis() - lastMessage.getTimeSent();
|
||||
if (timeDiff < chatSlowTime && !_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(BYPASS_SLOW_PERMISSION)))
|
||||
if (timeDiff < chatSlowTime && !_clientManager.Get(sender).hasPermission(Perm.BYPASS_SLOW))
|
||||
{
|
||||
UtilPlayer.message(sender, F.main("Chat", "Chat slow enabled. Please wait " + F.time(UtilTime.convertString(chatSlowTime - timeDiff, 1, UtilTime.TimeUnit.FIT))));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (!_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(ALLOW_SIMILAR_PERMISSION)) &&
|
||||
else if (!_clientManager.Get(sender).hasPermission(Perm.ALLOW_SIMILAR) &&
|
||||
UtilText.isStringSimilar(event.getMessage(), lastMessage.getMessage(), 0.8f))
|
||||
{
|
||||
UtilPlayer.message(sender, F.main("Chat", "This message is too similar to your previous message."));
|
||||
@ -412,7 +413,7 @@ public class Chat extends MiniPlugin
|
||||
if (!event.isCancelled())
|
||||
{
|
||||
String oldMessage = event.getMessage();
|
||||
if (!_clientManager.getPermissionManager().hasPermission(sender, GroupPermission.of(ALLOW_CAPS_PERMISSION)))
|
||||
if (!_clientManager.Get(sender).hasPermission(Perm.ALLOW_CAPS))
|
||||
{
|
||||
int capsCount = 0;
|
||||
for (char c : oldMessage.toCharArray())
|
||||
|
@ -12,7 +12,7 @@ public class BroadcastCommand extends CommandBase<Chat>
|
||||
{
|
||||
public BroadcastCommand(Chat plugin)
|
||||
{
|
||||
super(plugin, Chat.BROADCAST_COMMAND_PERMISSION, "s");
|
||||
super(plugin, Chat.Perm.BROADCAST_COMMAND, "s");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@ public class ChatSlowCommand extends CommandBase<Chat>
|
||||
{
|
||||
public ChatSlowCommand(Chat plugin)
|
||||
{
|
||||
super(plugin, Chat.SLOW_CHAT_COMMAND_PERMISSION, "chatslow");
|
||||
super(plugin, Chat.Perm.SLOW_CHAT_COMMAND, "chatslow");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@ public class SilenceCommand extends CommandBase<Chat>
|
||||
{
|
||||
public SilenceCommand(Chat plugin)
|
||||
{
|
||||
super(plugin, Chat.SILENCE_COMMAND_PERMISSION, "silence");
|
||||
super(plugin, Chat.Perm.SILENCE_COMMAND, "silence");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,9 +11,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.chatsnap.command.ChatSnapCommand;
|
||||
import mineplex.core.message.PrivateMessageEvent;
|
||||
|
||||
@ -22,8 +21,11 @@ import mineplex.core.message.PrivateMessageEvent;
|
||||
*/
|
||||
public class SnapshotPlugin extends MiniPlugin
|
||||
{
|
||||
public static final String CHAT_SNAP_COMMAND_PERMISSION = "mineplex.core.chatsnap.command";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
CHAT_SNAP_COMMAND,
|
||||
}
|
||||
|
||||
private final SnapshotManager _snapshotManager;
|
||||
private final CoreClientManager _clientManager;
|
||||
|
||||
@ -38,9 +40,8 @@ public class SnapshotPlugin extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.TITAN, GroupPermission.of(CHAT_SNAP_COMMAND_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.TITAN.setPermission(Perm.CHAT_SNAP_COMMAND, true, true);
|
||||
}
|
||||
|
||||
public SnapshotManager getSnapshotManager()
|
||||
|
@ -22,7 +22,7 @@ public class ChatSnapCommand extends CommandBase<SnapshotPlugin>
|
||||
{
|
||||
public ChatSnapCommand(SnapshotPlugin plugin)
|
||||
{
|
||||
super(plugin, SnapshotPlugin.CHAT_SNAP_COMMAND_PERMISSION, "chatsnap");
|
||||
super(plugin, SnapshotPlugin.Perm.CHAT_SNAP_COMMAND, "chatsnap");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,23 +15,23 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.PlayerSelector;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.common.util.UtilLambda;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand
|
||||
{
|
||||
private final GroupPermission _permission;
|
||||
private final Permission _permission;
|
||||
private List<String> _aliases;
|
||||
|
||||
protected PluginType Plugin;
|
||||
protected String _aliasUsed;
|
||||
protected CommandCenter _commandCenter;
|
||||
|
||||
public CommandBase(PluginType plugin, String permission, String... aliases)
|
||||
public CommandBase(PluginType plugin, Permission permission, String... aliases)
|
||||
{
|
||||
Plugin = plugin;
|
||||
_permission = GroupPermission.of(permission);
|
||||
_permission = permission;
|
||||
_aliases = Arrays.asList(aliases);
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
||||
_aliasUsed = alias;
|
||||
}
|
||||
|
||||
public GroupPermission getPermission()
|
||||
public Permission getPermission()
|
||||
{
|
||||
return _permission;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -46,8 +46,11 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
private final PacketHandler _packetHandler = Managers.require(PacketHandler.class);
|
||||
|
||||
private static AtomicIntegerFieldUpdater<PlayerConnection> chatSpamField = null;
|
||||
|
||||
public static final String BLOCKED_COMMAND_PERMISSION = "mineplex.core.command.blockedexecute";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
BLOCKED_COMMAND,
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
@ -81,17 +84,17 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
Plugin.getServer().getPluginManager().registerEvents(this, Plugin);
|
||||
|
||||
_packetHandler.addPacketHandler(this, true, PacketPlayInTabComplete.class);
|
||||
|
||||
PermissionGroup.DEV.setPermission(Perm.BLOCKED_COMMAND, true, true);
|
||||
if (UtilServer.isTestServer())
|
||||
{
|
||||
PermissionGroup.QAM.setPermission(Perm.BLOCKED_COMMAND, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setClientManager(CoreClientManager clientManager)
|
||||
{
|
||||
ClientManager = clientManager;
|
||||
|
||||
clientManager.getPermissionManager().setPermission(PermissionGroup.DEV, GroupPermission.of(BLOCKED_COMMAND_PERMISSION), true, true);
|
||||
if (UtilServer.isTestServer())
|
||||
{
|
||||
clientManager.getPermissionManager().setPermission(PermissionGroup.QAM, GroupPermission.of(BLOCKED_COMMAND_PERMISSION), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -113,7 +116,7 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
if (ClientManager.getPermissionManager().hasPermission(event.getPlayer(), command.getPermission())
|
||||
if (ClientManager.Get(event.getPlayer()).hasPermission(command.getPermission())
|
||||
|| UtilPlayer.isCommandAllowed(event.getPlayer(), commandName.toLowerCase()))
|
||||
{
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
|
||||
@ -138,7 +141,7 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
return;
|
||||
}
|
||||
|
||||
if (BLOCKED_COMMANDS.contains(commandName.toLowerCase()) && !(event.getPlayer().isOp() || ClientManager.getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(BLOCKED_COMMAND_PERMISSION))))
|
||||
if (BLOCKED_COMMANDS.contains(commandName.toLowerCase()) && !(event.getPlayer().isOp() || ClientManager.Get(event.getPlayer()).hasPermission(Perm.BLOCKED_COMMAND)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(MESSAGE);
|
||||
@ -212,7 +215,7 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
if (ClientManager.getPermissionManager().hasPermission(packetInfo.getPlayer(), command.getPermission())
|
||||
if (ClientManager.Get(packetInfo.getPlayer()).hasPermission(command.getPermission())
|
||||
|| UtilPlayer.isCommandAllowed(packetInfo.getPlayer(), commandName.toLowerCase()))
|
||||
{
|
||||
List<String> tmpres = command.onTabComplete(packetInfo.getPlayer(), commandName.toLowerCase(), args);
|
||||
@ -229,7 +232,7 @@ public class CommandCenter implements Listener, IPacketHandler
|
||||
// System.out.println("Path 2");
|
||||
for (ICommand command : Commands.values())
|
||||
{
|
||||
if (ClientManager.getPermissionManager().hasPermission(packetInfo.getPlayer(), command.getPermission())
|
||||
if (ClientManager.Get(packetInfo.getPlayer()).hasPermission(command.getPermission())
|
||||
|| UtilPlayer.isCommandAllowed(packetInfo.getPlayer(), commandName.toLowerCase()))
|
||||
{
|
||||
for (String alias : command.Aliases())
|
||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.lifetimes.Component;
|
||||
|
||||
public interface ICommand extends Component
|
||||
@ -18,7 +18,7 @@ public interface ICommand extends Component
|
||||
|
||||
void SetAliasUsed(String name);
|
||||
|
||||
GroupPermission getPermission();
|
||||
Permission getPermission();
|
||||
|
||||
@Override
|
||||
default void activate()
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
@ -17,7 +18,7 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
|
||||
{
|
||||
private NautHashMap<String, ICommand> Commands;
|
||||
|
||||
public MultiCommandBase(PluginType plugin, String permission, String... aliases)
|
||||
public MultiCommandBase(PluginType plugin, Permission permission, String... aliases)
|
||||
{
|
||||
super(plugin, permission, aliases);
|
||||
|
||||
@ -68,13 +69,12 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
if (_commandCenter.ClientManager.getPermissionManager().hasPermission(caller, command.getPermission()))
|
||||
if (_commandCenter.ClientManager.Get(caller).hasPermission(command.getPermission()))
|
||||
{
|
||||
command.SetAliasUsed(commandName);
|
||||
|
||||
|
||||
command.Execute(caller, newArgs);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
UtilPlayerBase.message(caller, C.mHead + "Permissions> " + C.mBody + "You do not have permission to do that.");
|
||||
}
|
||||
@ -106,7 +106,7 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
|
||||
Stream<ICommand> stream = Commands.values().stream();
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
stream = stream.filter(command -> _commandCenter.GetClientManager().getPermissionManager().hasPermission((Player)sender, command.getPermission()));
|
||||
stream = stream.filter(command -> _commandCenter.GetClientManager().Get((Player) sender).hasPermission(command.getPermission()));
|
||||
}
|
||||
return getMatches(args[0], stream.map(ICommand::Aliases).flatMap(Collection::stream));
|
||||
}
|
||||
|
@ -25,9 +25,8 @@ import mineplex.core.Managers;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.ILoginProcessor;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -74,23 +73,26 @@ import mineplex.serverdata.servers.ServerRepository;
|
||||
|
||||
public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
{
|
||||
public static final String OWN_COMMUNITY_PERMISSION = "mineplex.core.communities.own";
|
||||
public static final String COMMUNITY_CHAT_COMMAND_PERMISSION = "mineplex.core.communities.chat";
|
||||
public static final String COMMUNITY_COMMAND_PERMISSION = "mineplex.core.communities.command";
|
||||
public static final String COMMUNITY_DESCRIPTION_COMMAND_PERMISSION = "mineplex.core.communities.description";
|
||||
public static final String COMMUNITY_DESCRIPTION_STAFF_COMMAND_PERMISSION = "mineplex.core.communities.description.staff";
|
||||
public static final String COMMUNITY_DISBAND_COMMAND_PERMISSION = "mineplex.core.communities.disband";
|
||||
public static final String COMMUNITY_DISBAND_STAFF_COMMAND_PERMISSION = "mineplex.core.communities.disband.staff";
|
||||
public static final String COMMUNITY_INVITE_COMMAND_PERMISSION = "mineplex.core.communities.invite";
|
||||
public static final String COMMUNITY_INVITE_STAFF_COMMAND_PERMISSION = "mineplex.core.communities.invite.staff";
|
||||
public static final String COMMUNITY_JOIN_COMMAND_PERMISSION = "mineplex.core.communities.join";
|
||||
public static final String COMMUNITY_MCS_COMMAND_PERMISSION = "mineplex.core.communities.mcs";
|
||||
public static final String COMMUNITY_MCS_STAFF_COMMAND_PERMISSION = "mineplex.core.communities.mcs.staff";
|
||||
public static final String COMMUNITY_MENU_COMMAND_PERMISSION = "mineplex.core.communities.menu";
|
||||
public static final String COMMUNITY_RENAME_COMMAND_PERMISSION = "mineplex.core.communities.rename";
|
||||
public static final String COMMUNITY_RENAME_STAFF_COMMAND_PERMISSION = "mineplex.core.communities.rename.staff";
|
||||
public static final String COMMUNITY_UNINVITE_COMMAND_PERMISSION = "mineplex.core.communities.uninvite";
|
||||
public static final String COMMUNITY_UNINVITE_STAFF_COMMAND_PERMISSION = "mineplex.core.communities.uninvite.staff";
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
OWN_COMMUNITY,
|
||||
COMMUNITY_CHAT_COMMAND,
|
||||
COMMUNITY_COMMAND,
|
||||
COMMUNITY_DESCRIPTION_COMMAND,
|
||||
COMMUNITY_DESCRIPTION_STAFF_COMMAND,
|
||||
COMMUNITY_DISBAND_COMMAND,
|
||||
COMMUNITY_DISBAND_STAFF_COMMAND,
|
||||
COMMUNITY_INVITE_COMMAND,
|
||||
COMMUNITY_INVITE_STAFF_COMMAND,
|
||||
COMMUNITY_JOIN_COMMAND,
|
||||
COMMUNITY_MCS_COMMAND,
|
||||
COMMUNITY_MCS_STAFF_COMMAND,
|
||||
COMMUNITY_MENU_COMMAND,
|
||||
COMMUNITY_RENAME_COMMAND,
|
||||
COMMUNITY_RENAME_STAFF_COMMAND,
|
||||
COMMUNITY_UNINVITE_COMMAND,
|
||||
COMMUNITY_UNINVITE_STAFF_COMMAND,
|
||||
}
|
||||
|
||||
private final int UPDATE_CYCLE_SECONDS = 10; // The number of seconds between dirty communities refreshes
|
||||
private final int CACHE_INVALIDATION_SECONDS = 300; // The number of seconds between full communities refreshes
|
||||
@ -210,25 +212,24 @@ public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = getClientManager().getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.ETERNAL, GroupPermission.of(OWN_COMMUNITY_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_CHAT_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_DESCRIPTION_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(COMMUNITY_DESCRIPTION_STAFF_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ETERNAL, GroupPermission.of(COMMUNITY_DISBAND_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(COMMUNITY_DISBAND_STAFF_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_INVITE_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(COMMUNITY_INVITE_STAFF_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_JOIN_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_MCS_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(COMMUNITY_MCS_STAFF_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_MENU_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ETERNAL, GroupPermission.of(COMMUNITY_RENAME_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(COMMUNITY_RENAME_STAFF_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(COMMUNITY_UNINVITE_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(COMMUNITY_UNINVITE_STAFF_COMMAND_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.ETERNAL.setPermission(Perm.OWN_COMMUNITY, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_CHAT_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_DESCRIPTION_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.COMMUNITY_DESCRIPTION_STAFF_COMMAND, true, true);
|
||||
PermissionGroup.ETERNAL.setPermission(Perm.COMMUNITY_DISBAND_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.COMMUNITY_DISBAND_STAFF_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_INVITE_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.COMMUNITY_INVITE_STAFF_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_JOIN_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_MCS_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.COMMUNITY_MCS_STAFF_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_MENU_COMMAND, true, true);
|
||||
PermissionGroup.ETERNAL.setPermission(Perm.COMMUNITY_RENAME_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.COMMUNITY_RENAME_STAFF_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_UNINVITE_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.COMMUNITY_UNINVITE_STAFF_COMMAND, true, true);
|
||||
}
|
||||
|
||||
public boolean ownsCommunity(UUID uuid)
|
||||
|
@ -13,7 +13,7 @@ public class CommunityChatCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityChatCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_CHAT_COMMAND_PERMISSION, "chat");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_CHAT_COMMAND, "chat");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ public class CommunityCommand extends MultiCommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_COMMAND_PERMISSION, "community", "communities", "com");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_COMMAND, "community", "communities", "com");
|
||||
|
||||
AddCommand(new CommunityChatCommand(plugin));
|
||||
AddCommand(new CommunityCreateCommand(plugin));
|
||||
|
@ -18,7 +18,7 @@ public class CommunityCreateCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityCreateCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.OWN_COMMUNITY_PERMISSION, "create");
|
||||
super(plugin, CommunityManager.Perm.OWN_COMMUNITY, "create");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -20,7 +19,7 @@ public class CommunityDescriptionCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityDescriptionCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_DESCRIPTION_COMMAND_PERMISSION, "description");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_DESCRIPTION_COMMAND, "description");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,7 +43,7 @@ public class CommunityDescriptionCommand extends CommandBase<CommunityManager>
|
||||
}
|
||||
if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal())
|
||||
{
|
||||
if (!Managers.get(CoreClientManager.class).getPermissionManager().hasPermission(caller, GroupPermission.of(CommunityManager.COMMUNITY_DESCRIPTION_STAFF_COMMAND_PERMISSION)))
|
||||
if (!Managers.get(CoreClientManager.class).Get(caller).hasPermission(CommunityManager.Perm.COMMUNITY_DESCRIPTION_STAFF_COMMAND))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!"));
|
||||
return;
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -18,7 +17,7 @@ public class CommunityDisbandCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityDisbandCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_DISBAND_COMMAND_PERMISSION, "disband");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_DISBAND_COMMAND, "disband");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,7 +36,7 @@ public class CommunityDisbandCommand extends CommandBase<CommunityManager>
|
||||
}
|
||||
if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role != CommunityRole.LEADER)
|
||||
{
|
||||
if (!Managers.get(CoreClientManager.class).getPermissionManager().hasPermission(caller, GroupPermission.of(CommunityManager.COMMUNITY_DISBAND_STAFF_COMMAND_PERMISSION)))
|
||||
if (!Managers.get(CoreClientManager.class).Get(caller).hasPermission(CommunityManager.Perm.COMMUNITY_DISBAND_STAFF_COMMAND))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not the leader of " + F.name(c.getName()) + "!"));
|
||||
return;
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -18,7 +17,7 @@ public class CommunityInviteCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityInviteCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_INVITE_COMMAND_PERMISSION, "invite");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_INVITE_COMMAND, "invite");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,7 +37,7 @@ public class CommunityInviteCommand extends CommandBase<CommunityManager>
|
||||
}
|
||||
if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal())
|
||||
{
|
||||
if (!Managers.get(CoreClientManager.class).getPermissionManager().hasPermission(caller, GroupPermission.of(CommunityManager.COMMUNITY_INVITE_STAFF_COMMAND_PERMISSION)))
|
||||
if (!Managers.get(CoreClientManager.class).Get(caller).hasPermission(CommunityManager.Perm.COMMUNITY_INVITE_STAFF_COMMAND))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!"));
|
||||
return;
|
||||
|
@ -14,7 +14,7 @@ public class CommunityJoinCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityJoinCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_JOIN_COMMAND_PERMISSION, "join");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_JOIN_COMMAND, "join");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -19,7 +18,7 @@ public class CommunityMCSCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityMCSCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_MCS_COMMAND_PERMISSION, "mcs");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_MCS_COMMAND, "mcs");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,7 +37,7 @@ public class CommunityMCSCommand extends CommandBase<CommunityManager>
|
||||
}
|
||||
if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal())
|
||||
{
|
||||
if (!Managers.get(CoreClientManager.class).getPermissionManager().hasPermission(caller, GroupPermission.of(CommunityManager.COMMUNITY_MCS_STAFF_COMMAND_PERMISSION)))
|
||||
if (!Managers.get(CoreClientManager.class).Get(caller).hasPermission(CommunityManager.Perm.COMMUNITY_MCS_STAFF_COMMAND))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!"));
|
||||
return;
|
||||
|
@ -10,7 +10,7 @@ public class CommunityMenuCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityMenuCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_MENU_COMMAND_PERMISSION, "menu");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_MENU_COMMAND, "menu");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -21,7 +20,7 @@ public class CommunityRenameCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityRenameCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_RENAME_COMMAND_PERMISSION, "rename");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_RENAME_COMMAND, "rename");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,7 +40,7 @@ public class CommunityRenameCommand extends CommandBase<CommunityManager>
|
||||
}
|
||||
if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role != CommunityRole.LEADER)
|
||||
{
|
||||
if (!Managers.get(CoreClientManager.class).getPermissionManager().hasPermission(caller, GroupPermission.of(CommunityManager.COMMUNITY_RENAME_STAFF_COMMAND_PERMISSION)))
|
||||
if (!Managers.get(CoreClientManager.class).Get(caller).hasPermission(CommunityManager.Perm.COMMUNITY_RENAME_STAFF_COMMAND))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not the leader of " + F.name(c.getName()) + "!"));
|
||||
return;
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -18,7 +17,7 @@ public class CommunityUnInviteCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityUnInviteCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.COMMUNITY_UNINVITE_COMMAND_PERMISSION, "uninvite");
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_UNINVITE_COMMAND, "uninvite");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,7 +37,7 @@ public class CommunityUnInviteCommand extends CommandBase<CommunityManager>
|
||||
}
|
||||
if (c.getMembers().getOrDefault(caller.getUniqueId(), new CommunityMemberInfo(caller.getName(), caller.getUniqueId(), -1, CommunityRole.MEMBER, -1L)).Role.ordinal() > CommunityRole.COLEADER.ordinal())
|
||||
{
|
||||
if (!Managers.get(CoreClientManager.class).getPermissionManager().hasPermission(caller, GroupPermission.of(CommunityManager.COMMUNITY_UNINVITE_STAFF_COMMAND_PERMISSION)))
|
||||
if (!Managers.get(CoreClientManager.class).Get(caller).hasPermission(CommunityManager.Perm.COMMUNITY_UNINVITE_STAFF_COMMAND))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not a co-leader of " + F.name(c.getName()) + "!"));
|
||||
return;
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.communities.Community;
|
||||
@ -69,7 +68,7 @@ public class CommunityMemberButton extends CommunitiesGUIButton
|
||||
_fetching = true;
|
||||
clientManager.fetchGroups(_info.AccountId, (primaryGroup, additionalGroups) ->
|
||||
{
|
||||
if (clientManager.getPermissionManager().hasPermission(primaryGroup, GroupPermission.of(CommunityManager.OWN_COMMUNITY_PERMISSION)))
|
||||
if (primaryGroup.hasPermission(CommunityManager.Perm.OWN_COMMUNITY))
|
||||
{
|
||||
getCommunityManager().handleRoleUpdate(_viewer, _community, _info, CommunityRole.LEADER);
|
||||
getCommunityManager().handleRoleUpdate(_viewer, _community, _community.getMembers().get(_viewer.getUniqueId()), CommunityRole.COLEADER);
|
||||
|
@ -31,11 +31,10 @@ public class WinEffectPage extends GadgetPage
|
||||
if (gadget instanceof WinEffectRankBased)
|
||||
{
|
||||
WinEffectRankBased rankBased = (WinEffectRankBased) gadget;
|
||||
if (getClientManager().getPermissionManager().hasPermission(getPlayer(), rankBased.getUnlockPermission()))
|
||||
if (getClientManager().Get(getPlayer()).inheritsFrom(rankBased.getUnlockRank()))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
addGadget(gadget, slot, true);
|
||||
}
|
||||
|
@ -23,12 +23,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
@ -42,9 +39,12 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class Creature extends MiniPlugin
|
||||
{
|
||||
public static final String MOB_COMMAND_PERMISSION = "mineplex.core.mob.command";
|
||||
public static final String KILL_MOB_COMMAND_PERMISSION = "mineplex.core.mob.kill";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
MOB_COMMAND,
|
||||
KILL_MOB_COMMAND,
|
||||
}
|
||||
|
||||
private boolean _spawnForce = false;
|
||||
private boolean _disableCustom = false;
|
||||
|
||||
@ -57,10 +57,9 @@ public class Creature extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = Managers.get(CoreClientManager.class).getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(MOB_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(KILL_MOB_COMMAND_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.ADMIN.setPermission(Perm.MOB_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.KILL_MOB_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ public class KillCommand extends CommandBase<Creature>
|
||||
{
|
||||
public KillCommand(Creature plugin)
|
||||
{
|
||||
super(plugin, Creature.KILL_MOB_COMMAND_PERMISSION, "kill", "k");
|
||||
super(plugin, Creature.Perm.KILL_MOB_COMMAND, "kill", "k");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,7 @@ public class MobCommand extends MultiCommandBase<Creature>
|
||||
{
|
||||
public MobCommand(Creature plugin)
|
||||
{
|
||||
super(plugin, Creature.MOB_COMMAND_PERMISSION, "mob");
|
||||
super(plugin, Creature.Perm.MOB_COMMAND, "mob");
|
||||
|
||||
AddCommand(new KillCommand(Plugin));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class DisguiseCommand extends CommandBase<PlayerDisguiseManager> implemen
|
||||
{
|
||||
DisguiseCommand(PlayerDisguiseManager plugin)
|
||||
{
|
||||
super(plugin, PlayerDisguiseManager.USE_DISGUISE_PERMISSION, "disguise");
|
||||
super(plugin, PlayerDisguiseManager.Perm.USE_DISGUISE, "disguise");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,9 +36,8 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -68,10 +67,13 @@ import mineplex.serverdata.servers.ServerManager;
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
public static final String USE_DISGUISE_PERMISSION = "mineplex.core.disguise.playerdisguise.use";
|
||||
public static final String BLOCKED_DISGUISE_PERMISSION = "mineplex.core.disguise.playerdisguise.blocked";
|
||||
public static final String SHORT_DISGUISE_PERMISSION = "mineplex.core.disguise.playerdisguise.short";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
USE_DISGUISE,
|
||||
BLOCKED_DISGUISE,
|
||||
SHORT_DISGUISE,
|
||||
}
|
||||
|
||||
private static final Set<String> MOJANG;
|
||||
private static final Set<String> ILLEGAL_USERNAMES;
|
||||
private static final Set<String> ILLEGAL_CAPES;
|
||||
@ -154,14 +156,13 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clients.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.TM, GroupPermission.of(USE_DISGUISE_PERMISSION), false, true);
|
||||
pm.setPermission(PermissionGroup.MC, GroupPermission.of(USE_DISGUISE_PERMISSION), false, true);
|
||||
pm.setPermission(PermissionGroup.CONTENT, GroupPermission.of(USE_DISGUISE_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.CONTENT, GroupPermission.of(BLOCKED_DISGUISE_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.BUILDER, GroupPermission.of(BLOCKED_DISGUISE_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(SHORT_DISGUISE_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.TM.setPermission(Perm.USE_DISGUISE, false, true);
|
||||
PermissionGroup.MC.setPermission(Perm.USE_DISGUISE, false, true);
|
||||
PermissionGroup.CONTENT.setPermission(Perm.USE_DISGUISE, true, true);
|
||||
PermissionGroup.CONTENT.setPermission(Perm.BLOCKED_DISGUISE, true, true);
|
||||
PermissionGroup.BUILDER.setPermission(Perm.BLOCKED_DISGUISE, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.SHORT_DISGUISE, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -238,7 +239,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
CoreClient client = _clients.Get(event.getPlayer());
|
||||
|
||||
if (!getClientManager().getPermissionManager().hasPermission(client, GroupPermission.of(USE_DISGUISE_PERMISSION)))
|
||||
if (!client.hasPermission(Perm.USE_DISGUISE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -556,7 +557,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
if (other != null)
|
||||
{
|
||||
if (getClientManager().getPermissionManager().hasPermission(other, GroupPermission.of(BLOCKED_DISGUISE_PERMISSION)))
|
||||
if (other.hasPermission(Perm.BLOCKED_DISGUISE))
|
||||
{
|
||||
UtilPlayer.message(caller,
|
||||
F.main("Disguise", "You can't disguise as that person!"));
|
||||
@ -760,7 +761,7 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
}
|
||||
if (username.length() < 3)
|
||||
{
|
||||
if (!_clients.getPermissionManager().hasPermission(caller, GroupPermission.of(SHORT_DISGUISE_PERMISSION)))
|
||||
if (!_clients.Get(caller).hasPermission(Perm.SHORT_DISGUISE))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Disguise", "The chosen username of " + F.elem(username) + " must be longer than " + F.count("2") + " letters"));
|
||||
return false;
|
||||
|
@ -21,9 +21,8 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.ILoginProcessor;
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.donation.command.CrownCommand;
|
||||
import mineplex.core.donation.command.GemCommand;
|
||||
@ -42,10 +41,13 @@ import mineplex.core.utils.UtilScheduler;
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class DonationManager extends MiniClientPlugin<Donor>
|
||||
{
|
||||
public static final String CROWN_COMMAND_PERMISSION = "mineplex.core.donation.crowncommand";
|
||||
public static final String GEM_COMMAND_PERMISSION = "mineplex.core.donation.gemcommand";
|
||||
public static final String SHARD_COMMAND_PERMISSION = "mineplex.core.donation.shardcommand";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
CROWN_COMMAND,
|
||||
GEM_COMMAND,
|
||||
SHARD_COMMAND,
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum number of attempts that will be made to perform a transaction created by {@link DonationManager#rewardCurrencyUntilSuccess}
|
||||
*/
|
||||
@ -107,11 +109,10 @@ public class DonationManager extends MiniClientPlugin<Donor>
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = getClientManager().getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(CROWN_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(GEM_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(SHARD_COMMAND_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.ADMIN.setPermission(Perm.CROWN_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.GEM_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.SHARD_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ public class CrownCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
public CrownCommand(DonationManager plugin)
|
||||
{
|
||||
super(plugin, DonationManager.CROWN_COMMAND_PERMISSION, "crown");
|
||||
super(plugin, DonationManager.Perm.CROWN_COMMAND, "crown");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ public class GemCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
public GemCommand(DonationManager plugin)
|
||||
{
|
||||
super(plugin, DonationManager.GEM_COMMAND_PERMISSION, "gem");
|
||||
super(plugin, DonationManager.Perm.GEM_COMMAND, "gem");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ public class ShardCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
public ShardCommand(DonationManager plugin)
|
||||
{
|
||||
super(plugin, DonationManager.SHARD_COMMAND_PERMISSION, "coin", "shard", "shards");
|
||||
super(plugin, DonationManager.Perm.SHARD_COMMAND, "coin", "shard", "shards");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,9 +11,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -21,8 +20,11 @@ import mineplex.core.itemstack.ItemBuilder;
|
||||
|
||||
public class EloManager extends MiniDbClientPlugin<EloClientData>
|
||||
{
|
||||
public static final String TOP_ELO_COMMAND_PERMISSION = "mineplex.core.elo.topcommand";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
TOP_ELO_COMMAND,
|
||||
}
|
||||
|
||||
private EloRepository _repository;
|
||||
private EloRatingSystem _ratingSystem;
|
||||
private NautHashMap<String, EloTeam> _eloTeams = new NautHashMap<>();
|
||||
@ -46,11 +48,10 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
|
||||
}
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = getClientManager().getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(TOP_ELO_COMMAND_PERMISSION), true, true);
|
||||
}
|
||||
{
|
||||
|
||||
PermissionGroup.ADMIN.setPermission(Perm.TOP_ELO_COMMAND, true, true);
|
||||
}
|
||||
|
||||
public EloRepository getRepo()
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public class TopEloCommand extends CommandBase<EloManager>
|
||||
{
|
||||
public TopEloCommand(EloManager plugin)
|
||||
{
|
||||
super(plugin, EloManager.TOP_ELO_COMMAND_PERMISSION, "gettopelo", "topelo", "getelo");
|
||||
super(plugin, EloManager.Perm.TOP_ELO_COMMAND, "gettopelo", "topelo", "getelo");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,9 +11,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -23,8 +22,11 @@ import mineplex.core.treasure.TreasureType;
|
||||
|
||||
public class FacebookManager extends MiniDbClientPlugin<FacebookClient>
|
||||
{
|
||||
public static final String FACEBOOK_COMMAND_PERMISSION = "mineplex.core.facebook.command";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
FACEBOOK_COMMAND,
|
||||
}
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
@ -46,9 +48,8 @@ public class FacebookManager extends MiniDbClientPlugin<FacebookClient>
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(FACEBOOK_COMMAND_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.PLAYER.setPermission(Perm.FACEBOOK_COMMAND, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ public class FacebookCommand extends CommandBase<FacebookManager>
|
||||
{
|
||||
public FacebookCommand(FacebookManager plugin)
|
||||
{
|
||||
super(plugin, FacebookManager.FACEBOOK_COMMAND_PERMISSION, "facebook", "redeem");
|
||||
super(plugin, FacebookManager.Perm.FACEBOOK_COMMAND, "facebook", "redeem");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,9 +16,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.common.jsonchat.ChildJsonMessage;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -41,9 +40,12 @@ import mineplex.serverdata.data.PlayerStatus;
|
||||
|
||||
public class FriendManager extends MiniDbClientPlugin<FriendData>
|
||||
{
|
||||
public static final String FRIEND_COMMAND_PERMISSION = "mineplex.core.friend.command";
|
||||
public static final String JOIN_STAFF_PERMISSION = "mineplex.core.friend.joinstaff";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
FRIEND_COMMAND,
|
||||
JOIN_STAFF,
|
||||
}
|
||||
|
||||
private static FriendSorter _friendSorter = new FriendSorter();
|
||||
|
||||
private PreferencesManager _preferenceManager;
|
||||
@ -63,10 +65,9 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = getClientManager().getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.PLAYER, GroupPermission.of(FRIEND_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TRAINEE, GroupPermission.of(JOIN_STAFF_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.PLAYER.setPermission(Perm.FRIEND_COMMAND, true, true);
|
||||
PermissionGroup.TRAINEE.setPermission(Perm.JOIN_STAFF, true, true);
|
||||
}
|
||||
|
||||
public PreferencesManager getPreferenceManager()
|
||||
@ -269,7 +270,7 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
|
||||
|
||||
public void showFriends(Player caller)
|
||||
{
|
||||
boolean isStaff = ClientManager.getPermissionManager().hasPermission(caller, GroupPermission.of(JOIN_STAFF_PERMISSION));
|
||||
boolean isStaff = ClientManager.Get(caller).hasPermission(Perm.JOIN_STAFF);
|
||||
boolean gotAFriend = false;
|
||||
List<FriendStatus> friendStatuses = Get(caller).getFriends();
|
||||
Collections.sort(friendStatuses, _friendSorter);
|
||||
|
@ -14,7 +14,7 @@ public class AddFriend extends CommandBase<FriendManager>
|
||||
{
|
||||
public AddFriend(FriendManager plugin)
|
||||
{
|
||||
super(plugin, FriendManager.FRIEND_COMMAND_PERMISSION, "friends", "friend", "f");
|
||||
super(plugin, FriendManager.Perm.FRIEND_COMMAND, "friends", "friend", "f");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@ public class DeleteFriend extends CommandBase<FriendManager>
|
||||
{
|
||||
public DeleteFriend(FriendManager plugin)
|
||||
{
|
||||
super(plugin, FriendManager.FRIEND_COMMAND_PERMISSION, "unfriend");
|
||||
super(plugin, FriendManager.Perm.FRIEND_COMMAND, "unfriend");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,7 @@ public class FriendsDisplay extends CommandBase<FriendManager>
|
||||
{
|
||||
public FriendsDisplay(FriendManager plugin)
|
||||
{
|
||||
super(plugin, FriendManager.FRIEND_COMMAND_PERMISSION, "friendsdisplay");
|
||||
super(plugin, FriendManager.Perm.FRIEND_COMMAND, "friendsdisplay");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,9 +27,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.account.permissions.PermissionManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -281,22 +280,25 @@ import mineplex.core.treasure.TreasureManager;
|
||||
|
||||
public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
public static final String TITAN_ARROW_TRAIL_PERMISSION = "mineplex.core.gadget.arrowtrail.titan";
|
||||
public static final String TITAN_DEATH_EFFECT_PERMISSION = "mineplex.core.gadget.deatheffect.titan";
|
||||
public static final String TITAN_DOUBLE_JUMP_PERMISSION = "mineplex.core.gadget.doublejump.titan";
|
||||
public static final String ETERNAL_TAUNT_PERMISSION = "mineplex.core.gadget.taunt.eternal";
|
||||
public static final String LEGEND_PARTICLE_EFFECT_PERMISSION = "mineplex.core.gadget.particleeffect.legend";
|
||||
public static final String TITAN_PARTICLE_EFFECT_PERMISSION = "mineplex.core.gadget.particleeffect.titan";
|
||||
public static final String HERO_MORPH_BLAZE_PERMISSION = "mineplex.core.gadget.morph.hero.blaze";
|
||||
public static final String HERO_MORPH_CREEPER_PERMISSION = "mineplex.core.gadget.morph.hero.creeper";
|
||||
public static final String ULTRA_MORPH_PERMISSION = "mineplex.core.gadget.morph.ultra";
|
||||
public static final String TITAN_MORPH_PERMISSION = "mineplex.core.gadget.morph.titan";
|
||||
public static final String LEGEND_MORPH_PERMISSION = "mineplex.core.gadget.morph.legend";
|
||||
public static final String AMMO_COMMAND_PERMISSION = "mineplex.core.gadget.ammocommand";
|
||||
public static final String LOCK_INFUSED_COMMAND_PERMISSION = "mineplex.core.gadget.lockinfused";
|
||||
public static final String LOCK_COSMETICS_COMMAND_PERMISSION = "mineplex.core.gadget.lockcosmetics";
|
||||
public static final String UNLOCK_COSMETICS_COMMAND_PERMISSION = "mineplex.core.gadget.unlockcosmetics";
|
||||
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
TITAN_ARROW_TRAIL,
|
||||
TITAN_DEATH_EFFECT,
|
||||
TITAN_DOUBLE_JUMP,
|
||||
ETERNAL_TAUNT,
|
||||
LEGEND_PARTICLE_EFFECT,
|
||||
TITAN_PARTICLE_EFFECT,
|
||||
HERO_MORPH_BLAZE,
|
||||
HERO_MORPH_CREEPER,
|
||||
ULTRA_MORPH,
|
||||
TITAN_MORPH,
|
||||
LEGEND_MORPH,
|
||||
AMMO_COMMAND,
|
||||
LOCK_INFUSED_COMMAND,
|
||||
LOCK_COSMETICS_COMMAND,
|
||||
UNLOCK_COSMETICS_COMMAND,
|
||||
}
|
||||
|
||||
private final CoreClientManager _clientManager;
|
||||
private final DonationManager _donationManager;
|
||||
private final InventoryManager _inventoryManager;
|
||||
@ -363,30 +365,28 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
private void generatePermissions()
|
||||
{
|
||||
PermissionManager pm = _clientManager.getPermissionManager();
|
||||
|
||||
pm.setPermission(PermissionGroup.TITAN, GroupPermission.of(TITAN_ARROW_TRAIL_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TITAN, GroupPermission.of(TITAN_DEATH_EFFECT_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TITAN, GroupPermission.of(TITAN_DOUBLE_JUMP_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ETERNAL, GroupPermission.of(ETERNAL_TAUNT_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.LEGEND, GroupPermission.of(LEGEND_PARTICLE_EFFECT_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TITAN, GroupPermission.of(TITAN_PARTICLE_EFFECT_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.HERO, GroupPermission.of(HERO_MORPH_BLAZE_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.HERO, GroupPermission.of(HERO_MORPH_CREEPER_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ULTRA, GroupPermission.of(ULTRA_MORPH_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.TITAN, GroupPermission.of(TITAN_MORPH_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.LEGEND, GroupPermission.of(LEGEND_MORPH_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(AMMO_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(LOCK_INFUSED_COMMAND_PERMISSION), true, true);
|
||||
|
||||
PermissionGroup.TITAN.setPermission(Perm.TITAN_ARROW_TRAIL, true, true);
|
||||
PermissionGroup.TITAN.setPermission(Perm.TITAN_DEATH_EFFECT, true, true);
|
||||
PermissionGroup.TITAN.setPermission(Perm.TITAN_DOUBLE_JUMP, true, true);
|
||||
PermissionGroup.ETERNAL.setPermission(Perm.ETERNAL_TAUNT, true, true);
|
||||
PermissionGroup.LEGEND.setPermission(Perm.LEGEND_PARTICLE_EFFECT, true, true);
|
||||
PermissionGroup.TITAN.setPermission(Perm.TITAN_PARTICLE_EFFECT, true, true);
|
||||
PermissionGroup.HERO.setPermission(Perm.HERO_MORPH_BLAZE, true, true);
|
||||
PermissionGroup.HERO.setPermission(Perm.HERO_MORPH_CREEPER, true, true);
|
||||
PermissionGroup.ULTRA.setPermission(Perm.ULTRA_MORPH, true, true);
|
||||
PermissionGroup.TITAN.setPermission(Perm.TITAN_MORPH, true, true);
|
||||
PermissionGroup.LEGEND.setPermission(Perm.LEGEND_MORPH, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.AMMO_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.LOCK_INFUSED_COMMAND, true, true);
|
||||
if (UtilServer.isTestServer())
|
||||
{
|
||||
pm.setPermission(PermissionGroup.QA, GroupPermission.of(LOCK_COSMETICS_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.QA, GroupPermission.of(UNLOCK_COSMETICS_COMMAND_PERMISSION), true, true);
|
||||
}
|
||||
else
|
||||
PermissionGroup.QA.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
|
||||
PermissionGroup.QA.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
|
||||
} else
|
||||
{
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(LOCK_COSMETICS_COMMAND_PERMISSION), true, true);
|
||||
pm.setPermission(PermissionGroup.ADMIN, GroupPermission.of(UNLOCK_COSMETICS_COMMAND_PERMISSION), true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ public class AmmoCommand extends CommandBase<GadgetManager>
|
||||
|
||||
public AmmoCommand(GadgetManager plugin)
|
||||
{
|
||||
super(plugin, GadgetManager.AMMO_COMMAND_PERMISSION, "ammo");
|
||||
super(plugin, GadgetManager.Perm.AMMO_COMMAND, "ammo");
|
||||
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.donation.Donor;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
@ -21,7 +20,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
|
||||
public LockCosmeticsCommand(GadgetManager plugin)
|
||||
{
|
||||
super(plugin, GadgetManager.LOCK_COSMETICS_COMMAND_PERMISSION, "lockCosmetics");
|
||||
super(plugin, GadgetManager.Perm.LOCK_COSMETICS_COMMAND, "lockCosmetics");
|
||||
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class LockInfusedCommand extends CommandBase<GadgetManager>
|
||||
|
||||
public LockInfusedCommand(GadgetManager manager)
|
||||
{
|
||||
super(manager, GadgetManager.LOCK_INFUSED_COMMAND_PERMISSION, "lockinfused");
|
||||
super(manager, GadgetManager.Perm.LOCK_INFUSED_COMMAND, "lockinfused");
|
||||
|
||||
_manager = manager;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
|
||||
public UnlockCosmeticsCommand(GadgetManager plugin)
|
||||
{
|
||||
super(plugin, GadgetManager.UNLOCK_COSMETICS_COMMAND_PERMISSION, "unlockCosmetics");
|
||||
super(plugin, GadgetManager.Perm.UNLOCK_COSMETICS_COMMAND, "unlockCosmetics");
|
||||
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
@ -43,7 +42,7 @@ public class ArrowTrailTitan extends ArrowEffectGadget
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(GadgetManager.TITAN_ARROW_TRAIL_PERMISSION)))
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).hasPermission(GadgetManager.Perm.TITAN_ARROW_TRAIL))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.blood.BloodEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
@ -32,7 +31,7 @@ public class DeathTitan extends DeathEffectGadget
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(GadgetManager.TITAN_DEATH_EFFECT_PERMISSION)))
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).hasPermission(GadgetManager.Perm.TITAN_DEATH_EFFECT))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
@ -37,7 +36,7 @@ public class DoubleJumpTitan extends DoubleJumpEffectGadget
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(GadgetManager.TITAN_DOUBLE_JUMP_PERMISSION)))
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).hasPermission(GadgetManager.Perm.TITAN_DOUBLE_JUMP))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -81,7 +80,7 @@ public class MorphBlaze extends MorphGadget
|
||||
@EventHandler
|
||||
public void HeroOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(GadgetManager.HERO_MORPH_BLAZE_PERMISSION)))
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).hasPermission(GadgetManager.Perm.HERO_MORPH_BLAZE))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -168,7 +167,7 @@ public class MorphCreeper extends MorphGadget
|
||||
@EventHandler
|
||||
public void HeroOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(GadgetManager.HERO_MORPH_CREEPER_PERMISSION)))
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).hasPermission(GadgetManager.Perm.HERO_MORPH_CREEPER))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -84,7 +83,7 @@ public class MorphPig extends MorphGadget
|
||||
@EventHandler
|
||||
public void UltraOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(GadgetManager.ULTRA_MORPH_PERMISSION)))
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).hasPermission(GadgetManager.Perm.ULTRA_MORPH))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.account.permissions.GroupPermission;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
@ -225,7 +224,7 @@ public class MorphTitan extends MorphGadget
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().getPermissionManager().hasPermission(event.getPlayer(), GroupPermission.of(GadgetManager.TITAN_MORPH_PERMISSION)))
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).hasPermission(GadgetManager.Perm.TITAN_MORPH))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user