mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Serialization methods
This commit is contained in:
parent
5a8f58d9dd
commit
d2df5fdc60
@ -1,10 +1,14 @@
|
||||
package net.minestom.server.permission;
|
||||
|
||||
import net.minestom.server.command.CommandSender;
|
||||
import net.minestom.server.data.Data;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Representation of a permission granted to a CommandSender
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Permission {
|
||||
|
||||
/**
|
||||
@ -14,5 +18,18 @@ public interface Permission {
|
||||
*/
|
||||
boolean isValidFor(CommandSender commandSender);
|
||||
|
||||
// TODO: Serialization?
|
||||
/**
|
||||
* Writes any required data for this permission inside the given destination
|
||||
* @param destination Data to write to
|
||||
*/
|
||||
default void write(@NotNull Data destination) {}
|
||||
|
||||
/**
|
||||
* Reads any required data for this permission from the given destination
|
||||
* @param source Data to read from
|
||||
* @return this for chaining
|
||||
*/
|
||||
default Permission read(@Nullable Data source) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package permissions;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.command.CommandSender;
|
||||
import net.minestom.server.data.Data;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.permission.Permission;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
Loading…
Reference in New Issue
Block a user