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