2014-12-13 01:19:51 +01:00
|
|
|
/*
|
|
|
|
* The MIT License (MIT)
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* Copyright (c) 2013 AlgorithmX2
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
|
* this software and associated documentation files (the "Software"), to deal in
|
|
|
|
* the Software without restriction, including without limitation the rights to
|
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
|
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
|
|
* subject to the following conditions:
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2014-12-04 13:00:54 +01:00
|
|
|
package appeng.api.implementations.items;
|
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-12-04 13:00:54 +01:00
|
|
|
import appeng.api.config.SecurityPermissions;
|
|
|
|
import appeng.api.features.IPlayerRegistry;
|
|
|
|
import appeng.api.networking.security.ISecurityRegistry;
|
|
|
|
|
2015-06-16 02:44:59 +02:00
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
public interface IBiometricCard
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the {@link GameProfile} to null, to clear it.
|
|
|
|
*/
|
2015-01-03 02:53:14 +01:00
|
|
|
void setProfile( ItemStack itemStack, GameProfile username );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return {@link GameProfile} of the player encoded on this card, or a blank string.
|
|
|
|
*/
|
2015-01-03 02:53:14 +01:00
|
|
|
GameProfile getProfile( ItemStack is );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param itemStack card
|
2015-01-03 02:53:14 +01:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @return the full list of permissions encoded on the card.
|
|
|
|
*/
|
2015-01-03 02:53:14 +01:00
|
|
|
EnumSet<SecurityPermissions> getPermissions( ItemStack itemStack );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a permission is encoded on the card.
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @param permission card
|
2015-01-03 02:53:14 +01:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @return true if this permission is set on the card.
|
|
|
|
*/
|
2015-01-03 02:53:14 +01:00
|
|
|
boolean hasPermission( ItemStack is, SecurityPermissions permission );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* remove a permission from the item stack.
|
2015-04-03 08:54:31 +02:00
|
|
|
*
|
|
|
|
* @param itemStack card
|
2014-12-04 13:00:54 +01:00
|
|
|
* @param permission to be removed permission
|
|
|
|
*/
|
2015-01-03 02:53:14 +01:00
|
|
|
void removePermission( ItemStack itemStack, SecurityPermissions permission );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* add a permission to the item stack.
|
2015-04-03 08:54:31 +02:00
|
|
|
*
|
|
|
|
* @param itemStack card
|
2014-12-04 13:00:54 +01:00
|
|
|
* @param permission to be added permission
|
|
|
|
*/
|
2015-01-03 02:53:14 +01:00
|
|
|
void addPermission( ItemStack itemStack, SecurityPermissions permission );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* lets you handle submission of security values on the card for custom behavior.
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @param registry security registry
|
2015-01-03 02:53:14 +01:00
|
|
|
* @param pr player registry
|
|
|
|
* @param is card
|
2014-12-04 13:00:54 +01:00
|
|
|
*/
|
2015-01-03 02:53:14 +01:00
|
|
|
void registerPermissions( ISecurityRegistry registry, IPlayerRegistry pr, ItemStack is );
|
2014-12-04 13:00:54 +01:00
|
|
|
}
|