• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SimplyVanilla / SimplyPerms / #18

11 Mar 2024 09:36PM UTC coverage: 26.178% (-2.1%) from 28.261%
#18

push

github

web-flow
Fix velocity crash #3 (#10)

* Fixed [Velocity crash](https://gist.github.com/Netherwhal/5e37bd8a1656dbb9ac8cc88530144a65) happening when users in list are null

* Added forced stack trace to individuate error on Velocity restart

* Removed internal static list and reworked constructor

* Created UsersManager to keep track of loaded users

* Added usersManager field

* Added addUser method

* Updated some methods to use users manager

* Updated to use users manager to retrieve users

* Updated SimplePermProvider

1 of 24 new or added lines in 4 files covered. (4.17%)

1 existing line in 1 file now uncovered.

50 of 191 relevant lines covered (26.18%)

0.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/net/simplyvanilla/simplyperms/SimplePermProvider.java
1
package net.simplyvanilla.simplyperms;
2

3
import com.velocitypowered.api.permission.PermissionFunction;
4
import com.velocitypowered.api.permission.PermissionProvider;
5
import com.velocitypowered.api.permission.PermissionSubject;
6
import com.velocitypowered.api.permission.Tristate;
7
import com.velocitypowered.api.proxy.Player;
8
import net.simplyvanilla.simplyperms.users.User;
9

10
import java.util.UUID;
11

12
public class SimplePermProvider implements PermissionProvider {
13
    protected final SimplyPerms plugin;
14

NEW
15
    public SimplePermProvider(SimplyPerms plugin) {
×
NEW
16
        this.plugin = plugin;
×
NEW
17
    }
×
18

19
    @Override
20
    public PermissionFunction createFunction(final PermissionSubject subject) {
NEW
21
        return new SimplePermFunction(this.plugin, subject);
×
22
    }
23

NEW
24
    private record SimplePermFunction(SimplyPerms plugin, PermissionSubject subject) implements PermissionFunction {
×
25

26
        @Override
27
        public Tristate getPermissionValue(final String permission) {
28
            if (this.subject instanceof Player) {
×
29
                UUID uuid = ((Player) this.subject).getUniqueId();
×
NEW
30
                User user = this.plugin.getUsersManager().getUser(uuid);
×
31
                return user.getPermissionState(permission);
×
32
            }
33
            return Tristate.TRUE;
×
34
        }
35
    }
36
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc