mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-30 22:53:27 +01:00
Prepare for 1.6 release
This commit is contained in:
parent
a3ebf86f6b
commit
b2cf6dce2d
@ -8,9 +8,6 @@
|
|||||||
# The name of the server, used for server specific permissions. Set to 'global' to disable.
|
# The name of the server, used for server specific permissions. Set to 'global' to disable.
|
||||||
server: global
|
server: global
|
||||||
|
|
||||||
# The default group assigned to all users on their first join.
|
|
||||||
default-group: default
|
|
||||||
|
|
||||||
# If users on this server should have their global permissions/groups applied.
|
# If users on this server should have their global permissions/groups applied.
|
||||||
include-global: true
|
include-global: true
|
||||||
|
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
# The name of the server, used for server specific permissions. Set to 'global' to disable.
|
# The name of the server, used for server specific permissions. Set to 'global' to disable.
|
||||||
server: bungee
|
server: bungee
|
||||||
|
|
||||||
# The default group assigned to all users on their first join.
|
|
||||||
default-group: default
|
|
||||||
|
|
||||||
# If users on this server should have their global permissions/groups applied.
|
# If users on this server should have their global permissions/groups applied.
|
||||||
include-global: false
|
include-global: false
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@ public class InfoCommand extends SingleMainCommand {
|
|||||||
plugin.getVersion(),
|
plugin.getVersion(),
|
||||||
plugin.getDatastore().getName(),
|
plugin.getDatastore().getName(),
|
||||||
c.getServer(),
|
c.getServer(),
|
||||||
c.getDefaultGroupName(),
|
|
||||||
c.getSyncTime(),
|
c.getSyncTime(),
|
||||||
formatBoolean(c.getIncludeGlobalPerms()),
|
formatBoolean(c.getIncludeGlobalPerms()),
|
||||||
formatBoolean(c.getOnlineMode()),
|
formatBoolean(c.getOnlineMode()),
|
||||||
|
@ -125,7 +125,6 @@ public enum Message {
|
|||||||
PREFIX + "&6Running &bLuckPerms v%s&6 by &bLuck&6." + "\n" +
|
PREFIX + "&6Running &bLuckPerms v%s&6 by &bLuck&6." + "\n" +
|
||||||
PREFIX + "&f-> &eStorage Method: &6%s" + "\n" +
|
PREFIX + "&f-> &eStorage Method: &6%s" + "\n" +
|
||||||
PREFIX + "&f-> &eServer Name: &6%s" + "\n" +
|
PREFIX + "&f-> &eServer Name: &6%s" + "\n" +
|
||||||
PREFIX + "&f-> &eDefault Group: &6%s" + "\n" +
|
|
||||||
PREFIX + "&f-> &eSync Interval: &6%s minutes" + "\n" +
|
PREFIX + "&f-> &eSync Interval: &6%s minutes" + "\n" +
|
||||||
PREFIX + "&f-> &eInclude Global Perms: &6%s" + "\n" +
|
PREFIX + "&f-> &eInclude Global Perms: &6%s" + "\n" +
|
||||||
PREFIX + "&f-> &eOnline Mode: &6%s" + "\n" +
|
PREFIX + "&f-> &eOnline Mode: &6%s" + "\n" +
|
||||||
|
@ -50,13 +50,6 @@ public abstract class LPConfiguration<T extends LuckPermsPlugin> {
|
|||||||
defaultServerName + "' (the default)");
|
defaultServerName + "' (the default)");
|
||||||
set("server", defaultServerName);
|
set("server", defaultServerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(getDefaultGroupName()).find()) {
|
|
||||||
plugin.getLog().severe("Default group defined in config.yml contains invalid characters. Group names can " +
|
|
||||||
"only contain alphanumeric characters.\nDefined default group name '" + getDefaultGroupName() +
|
|
||||||
"' will be replaced with 'default' (the default)");
|
|
||||||
set("default-group", "default");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void init();
|
protected abstract void init();
|
||||||
@ -73,12 +66,20 @@ public abstract class LPConfiguration<T extends LuckPermsPlugin> {
|
|||||||
return getInt("data.sync-minutes", 3);
|
return getInt("data.sync-minutes", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As of 1.6, this value is a constant
|
||||||
|
* @return the default group node
|
||||||
|
*/
|
||||||
public String getDefaultGroupNode() {
|
public String getDefaultGroupNode() {
|
||||||
return "group." + getDefaultGroupName();
|
return "group.default";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As of 1.6, this value is a constant
|
||||||
|
* @return the name of the default group
|
||||||
|
*/
|
||||||
public String getDefaultGroupName() {
|
public String getDefaultGroupName() {
|
||||||
return getString("default-group", "default");
|
return "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIncludeGlobalPerms() {
|
public boolean getIncludeGlobalPerms() {
|
||||||
|
@ -85,7 +85,7 @@ public abstract class PermissionHolder {
|
|||||||
permissions.addAll(nodes);
|
permissions.addAll(nodes);
|
||||||
permissions.addAll(transientNodes);
|
permissions.addAll(transientNodes);
|
||||||
|
|
||||||
Iterator<Node> iterator = permissions.descendingIterator(); // TODO check this
|
Iterator<Node> iterator = permissions.descendingIterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Node entry = iterator.next();
|
Node entry = iterator.next();
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import com.google.inject.Inject;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.lucko.luckperms.api.LuckPermsApi;
|
import me.lucko.luckperms.api.LuckPermsApi;
|
||||||
import me.lucko.luckperms.api.implementation.ApiProvider;
|
import me.lucko.luckperms.api.implementation.ApiProvider;
|
||||||
|
import me.lucko.luckperms.api.sponge.LuckPermsService;
|
||||||
import me.lucko.luckperms.commands.ConsecutiveExecutor;
|
import me.lucko.luckperms.commands.ConsecutiveExecutor;
|
||||||
import me.lucko.luckperms.commands.Sender;
|
import me.lucko.luckperms.commands.Sender;
|
||||||
import me.lucko.luckperms.constants.Message;
|
import me.lucko.luckperms.constants.Message;
|
||||||
@ -119,6 +120,9 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
|||||||
importer = new Importer(commandManager);
|
importer = new Importer(commandManager);
|
||||||
consecutiveExecutor = new ConsecutiveExecutor(commandManager);
|
consecutiveExecutor = new ConsecutiveExecutor(commandManager);
|
||||||
|
|
||||||
|
getLog().info("Registering PermissionService...");
|
||||||
|
Sponge.getServiceManager().setProvider(this, PermissionService.class, new LuckPermsService(this));
|
||||||
|
|
||||||
getLog().info("Registering API...");
|
getLog().info("Registering API...");
|
||||||
apiProvider = new ApiProvider(this);
|
apiProvider = new ApiProvider(this);
|
||||||
LuckPerms.registerProvider(apiProvider);
|
LuckPerms.registerProvider(apiProvider);
|
||||||
|
@ -72,19 +72,6 @@ public class SpongeListener extends AbstractListener {
|
|||||||
refreshPlayer(e.getTargetEntity().getUniqueId());
|
refreshPlayer(e.getTargetEntity().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Use reflection/any other method to refresh on world change
|
|
||||||
/*
|
|
||||||
@Listener
|
|
||||||
public void onPlayerTeleport(DisplaceEntityEvent e) {
|
|
||||||
final Entity entity = e.getTargetEntity();
|
|
||||||
if (!(entity instanceof Player)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshPlayer(entity.getUniqueId());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
public void onClientLeave(ClientConnectionEvent.Disconnect e) {
|
public void onClientLeave(ClientConnectionEvent.Disconnect e) {
|
||||||
onLeave(e.getTargetEntity().getUniqueId());
|
onLeave(e.getTargetEntity().getUniqueId());
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.api.sponge;
|
package me.lucko.luckperms.api.sponge;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import me.lucko.luckperms.LPSpongePlugin;
|
import me.lucko.luckperms.LPSpongePlugin;
|
||||||
@ -54,7 +55,7 @@ public class LuckPermsService implements PermissionService {
|
|||||||
private final Set<PermissionDescription> descriptionSet;
|
private final Set<PermissionDescription> descriptionSet;
|
||||||
|
|
||||||
private final Map<String, SubjectCollection> subjects;
|
private final Map<String, SubjectCollection> subjects;
|
||||||
private final Set<ContextCalculator<Subject>> contextCalculators;
|
private final Set<ContextCalculator<Subject>> contextCalculators; // TODO actually use context calculators, idk...
|
||||||
|
|
||||||
public LuckPermsService(LPSpongePlugin plugin) {
|
public LuckPermsService(LPSpongePlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -71,12 +72,12 @@ public class LuckPermsService implements PermissionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SubjectData getDefaultData() {
|
public SubjectData getDefaultData() {
|
||||||
return null; // TODO
|
return getDefaults().getSubjectData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Subject getDefaults() {
|
public Subject getDefaults() {
|
||||||
return null; // TODO
|
return getSubjects("defaults").get("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -90,7 +91,7 @@ public class LuckPermsService implements PermissionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, SubjectCollection> getKnownSubjects() {
|
public Map<String, SubjectCollection> getKnownSubjects() {
|
||||||
return subjects;
|
return ImmutableMap.copyOf(subjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -124,10 +125,6 @@ public class LuckPermsService implements PermissionService {
|
|||||||
contextCalculators.add(contextCalculator);
|
contextCalculators.add(contextCalculator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getPossiblePermissions() {
|
|
||||||
return getDescriptions().stream().map(PermissionDescription::getId).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
@ToString
|
@ToString
|
||||||
|
@ -25,12 +25,7 @@ package me.lucko.luckperms.users;
|
|||||||
import me.lucko.luckperms.LPSpongePlugin;
|
import me.lucko.luckperms.LPSpongePlugin;
|
||||||
import me.lucko.luckperms.api.event.events.UserPermissionRefreshEvent;
|
import me.lucko.luckperms.api.event.events.UserPermissionRefreshEvent;
|
||||||
import me.lucko.luckperms.api.implementation.internal.UserLink;
|
import me.lucko.luckperms.api.implementation.internal.UserLink;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
|
||||||
import org.spongepowered.api.util.Tristate;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
class SpongeUser extends User {
|
class SpongeUser extends User {
|
||||||
@ -48,6 +43,10 @@ class SpongeUser extends User {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshPermissions() {
|
public void refreshPermissions() {
|
||||||
|
plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
|
||||||
|
|
||||||
|
// Do nothing. Should be grabbed from PermissionService.
|
||||||
|
/*
|
||||||
plugin.doSync(() -> {
|
plugin.doSync(() -> {
|
||||||
Optional<Player> p = plugin.getGame().getServer().getPlayer(plugin.getUuidCache().getExternalUUID(getUuid()));
|
Optional<Player> p = plugin.getGame().getServer().getPlayer(plugin.getUuidCache().getExternalUUID(getUuid()));
|
||||||
if (!p.isPresent()) return;
|
if (!p.isPresent()) return;
|
||||||
@ -64,5 +63,6 @@ class SpongeUser extends User {
|
|||||||
local.entrySet().forEach(e -> player.getSubjectData().setPermission(Collections.emptySet(), e.getKey(), Tristate.fromBoolean(e.getValue())));
|
local.entrySet().forEach(e -> player.getSubjectData().setPermission(Collections.emptySet(), e.getKey(), Tristate.fromBoolean(e.getValue())));
|
||||||
plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
|
plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,7 @@
|
|||||||
package me.lucko.luckperms.users;
|
package me.lucko.luckperms.users;
|
||||||
|
|
||||||
import me.lucko.luckperms.LPSpongePlugin;
|
import me.lucko.luckperms.LPSpongePlugin;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SpongeUserManager extends UserManager {
|
public class SpongeUserManager extends UserManager {
|
||||||
@ -39,11 +37,6 @@ public class SpongeUserManager extends UserManager {
|
|||||||
@Override
|
@Override
|
||||||
public void unload(User user) {
|
public void unload(User user) {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
Optional<Player> p = plugin.getGame().getServer().getPlayer(plugin.getUuidCache().getExternalUUID(user.getUuid()));
|
|
||||||
if (p.isPresent()) {
|
|
||||||
p.get().getSubjectData().clearParents();
|
|
||||||
p.get().getSubjectData().clearPermissions();
|
|
||||||
}
|
|
||||||
getAll().remove(user.getUuid());
|
getAll().remove(user.getUuid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
# The name of the server, used for server specific permissions. Set to 'global' to disable.
|
# The name of the server, used for server specific permissions. Set to 'global' to disable.
|
||||||
server="global"
|
server="global"
|
||||||
|
|
||||||
# The default group assigned to all users on their first join.
|
|
||||||
default-group="default"
|
|
||||||
|
|
||||||
# If users on this server should have their global permissions/groups applied.
|
# If users on this server should have their global permissions/groups applied.
|
||||||
include-global=true
|
include-global=true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user