Prepare for 1.6 release

This commit is contained in:
Luck 2016-08-28 15:29:02 +01:00
parent a3ebf86f6b
commit b2cf6dce2d
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
12 changed files with 25 additions and 54 deletions

View File

@ -8,9 +8,6 @@
# The name of the server, used for server specific permissions. Set to 'global' to disable.
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.
include-global: true

View File

@ -8,9 +8,6 @@
# The name of the server, used for server specific permissions. Set to 'global' to disable.
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.
include-global: false

View File

@ -46,7 +46,6 @@ public class InfoCommand extends SingleMainCommand {
plugin.getVersion(),
plugin.getDatastore().getName(),
c.getServer(),
c.getDefaultGroupName(),
c.getSyncTime(),
formatBoolean(c.getIncludeGlobalPerms()),
formatBoolean(c.getOnlineMode()),

View File

@ -125,7 +125,6 @@ public enum Message {
PREFIX + "&6Running &bLuckPerms v%s&6 by &bLuck&6." + "\n" +
PREFIX + "&f-> &eStorage Method: &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-> &eInclude Global Perms: &6%s" + "\n" +
PREFIX + "&f-> &eOnline Mode: &6%s" + "\n" +

View File

@ -50,13 +50,6 @@ public abstract class LPConfiguration<T extends LuckPermsPlugin> {
defaultServerName + "' (the default)");
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();
@ -73,12 +66,20 @@ public abstract class LPConfiguration<T extends LuckPermsPlugin> {
return getInt("data.sync-minutes", 3);
}
/**
* As of 1.6, this value is a constant
* @return the default group node
*/
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() {
return getString("default-group", "default");
return "default";
}
public boolean getIncludeGlobalPerms() {

View File

@ -85,7 +85,7 @@ public abstract class PermissionHolder {
permissions.addAll(nodes);
permissions.addAll(transientNodes);
Iterator<Node> iterator = permissions.descendingIterator(); // TODO check this
Iterator<Node> iterator = permissions.descendingIterator();
while (iterator.hasNext()) {
Node entry = iterator.next();

View File

@ -26,6 +26,7 @@ import com.google.inject.Inject;
import lombok.Getter;
import me.lucko.luckperms.api.LuckPermsApi;
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.Sender;
import me.lucko.luckperms.constants.Message;
@ -119,6 +120,9 @@ public class LPSpongePlugin implements LuckPermsPlugin {
importer = new Importer(commandManager);
consecutiveExecutor = new ConsecutiveExecutor(commandManager);
getLog().info("Registering PermissionService...");
Sponge.getServiceManager().setProvider(this, PermissionService.class, new LuckPermsService(this));
getLog().info("Registering API...");
apiProvider = new ApiProvider(this);
LuckPerms.registerProvider(apiProvider);

View File

@ -72,19 +72,6 @@ public class SpongeListener extends AbstractListener {
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
public void onClientLeave(ClientConnectionEvent.Disconnect e) {
onLeave(e.getTargetEntity().getUniqueId());

View File

@ -22,6 +22,7 @@
package me.lucko.luckperms.api.sponge;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import lombok.*;
import me.lucko.luckperms.LPSpongePlugin;
@ -54,7 +55,7 @@ public class LuckPermsService implements PermissionService {
private final Set<PermissionDescription> descriptionSet;
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) {
this.plugin = plugin;
@ -71,12 +72,12 @@ public class LuckPermsService implements PermissionService {
}
public SubjectData getDefaultData() {
return null; // TODO
return getDefaults().getSubjectData();
}
@Override
public Subject getDefaults() {
return null; // TODO
return getSubjects("defaults").get("default");
}
@Override
@ -90,7 +91,7 @@ public class LuckPermsService implements PermissionService {
@Override
public Map<String, SubjectCollection> getKnownSubjects() {
return subjects;
return ImmutableMap.copyOf(subjects);
}
@Override
@ -124,10 +125,6 @@ public class LuckPermsService implements PermissionService {
contextCalculators.add(contextCalculator);
}
public List<String> getPossiblePermissions() {
return getDescriptions().stream().map(PermissionDescription::getId).collect(Collectors.toList());
}
@RequiredArgsConstructor
@EqualsAndHashCode
@ToString

View File

@ -25,12 +25,7 @@ package me.lucko.luckperms.users;
import me.lucko.luckperms.LPSpongePlugin;
import me.lucko.luckperms.api.event.events.UserPermissionRefreshEvent;
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;
class SpongeUser extends User {
@ -48,6 +43,10 @@ class SpongeUser extends User {
@Override
public void refreshPermissions() {
plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
// Do nothing. Should be grabbed from PermissionService.
/*
plugin.doSync(() -> {
Optional<Player> p = plugin.getGame().getServer().getPlayer(plugin.getUuidCache().getExternalUUID(getUuid()));
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())));
plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
});
*/
}
}

View File

@ -23,9 +23,7 @@
package me.lucko.luckperms.users;
import me.lucko.luckperms.LPSpongePlugin;
import org.spongepowered.api.entity.living.player.Player;
import java.util.Optional;
import java.util.UUID;
public class SpongeUserManager extends UserManager {
@ -39,11 +37,6 @@ public class SpongeUserManager extends UserManager {
@Override
public void unload(User user) {
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());
}
}

View File

@ -8,9 +8,6 @@
# The name of the server, used for server specific permissions. Set to 'global' to disable.
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.
include-global=true