fake player permission
This commit is contained in:
parent
df3f4eb088
commit
2d4bfdeb18
@ -86,6 +86,7 @@ public class PermissionRegistry {
|
|||||||
public static ClaimPermission ANIMALSPAWN = global(new ClaimPermission("ANIMALSPAWN", () -> new ItemStack(Items.PIG_SPAWN_EGG), "Prevent other spawn in claim"));
|
public static ClaimPermission ANIMALSPAWN = global(new ClaimPermission("ANIMALSPAWN", () -> new ItemStack(Items.PIG_SPAWN_EGG), "Prevent other spawn in claim"));
|
||||||
public static ClaimPermission LIGHTNING = global(new ClaimPermission("LIGHTNING", () -> new ItemStack(Items.TRIDENT), "Allow lightning to affect claims", "e.g. set blocks on fire", "or affect animals (mobs are excluded)"));
|
public static ClaimPermission LIGHTNING = global(new ClaimPermission("LIGHTNING", () -> new ItemStack(Items.TRIDENT), "Allow lightning to affect claims", "e.g. set blocks on fire", "or affect animals (mobs are excluded)"));
|
||||||
public static ClaimPermission LOCKITEMS = global(new ClaimPermission("LOCKITEMS", () -> new ItemStack(Items.FIREWORK_STAR), true, "If items should be locked on death"));
|
public static ClaimPermission LOCKITEMS = global(new ClaimPermission("LOCKITEMS", () -> new ItemStack(Items.FIREWORK_STAR), true, "If items should be locked on death"));
|
||||||
|
public static ClaimPermission FAKEPLAYER = global(new ClaimPermission("FAKEPLAYER", () -> new ItemStack(Items.CARROT_ON_A_STICK), false, "Allow fakeplayers to interact in this claim", "Some mods fakeplayer has the users uuid", "For those mods this permission is not needed"));
|
||||||
|
|
||||||
private static ClaimPermission register(ClaimPermission perm) {
|
private static ClaimPermission register(ClaimPermission perm) {
|
||||||
if (locked) {
|
if (locked) {
|
||||||
|
@ -238,7 +238,16 @@ public class Claim implements IPermissionContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteract(ServerPlayer player, ClaimPermission perm, BlockPos pos, boolean message) {
|
public boolean canInteract(ServerPlayer player, ClaimPermission perm, BlockPos pos, boolean message) {
|
||||||
message = message && player.getClass().equals(ServerPlayer.class); //dont send messages to fake players
|
boolean realPlayer = player != null && player.getClass().equals(ServerPlayer.class);
|
||||||
|
message = message && realPlayer; //dont send messages to fake players
|
||||||
|
//Delegate interaction to FAKEPLAYER perm if a fake player
|
||||||
|
if (player != null && !realPlayer) {
|
||||||
|
//Some mods use the actual user/placer/owner whatever of the fakeplayer. E.g. ComputerCraft
|
||||||
|
//For those mods we dont pass them as fake players
|
||||||
|
if (!player.getUUID().equals(this.owner) && !this.playersGroups.containsKey(player.getUUID())) {
|
||||||
|
perm = PermissionRegistry.FAKEPLAYER;
|
||||||
|
}
|
||||||
|
}
|
||||||
InteractionResult res = ClaimPermissionCheck.check(player, perm, pos);
|
InteractionResult res = ClaimPermissionCheck.check(player, perm, pos);
|
||||||
if (res != InteractionResult.PASS)
|
if (res != InteractionResult.PASS)
|
||||||
return res != InteractionResult.FAIL;
|
return res != InteractionResult.FAIL;
|
||||||
|
@ -309,7 +309,8 @@ public class LangManager {
|
|||||||
});
|
});
|
||||||
//en_us is basically used as a default modifiable file
|
//en_us is basically used as a default modifiable file
|
||||||
if (lang.equals("en_us")) {
|
if (lang.equals("en_us")) {
|
||||||
this.defaultTranslation.forEach((key, t) -> this.translation.putIfAbsent(key, t));
|
this.defaultTranslation.forEach(this.translation::putIfAbsent);
|
||||||
|
this.defaultTranslationArray.forEach(this.translationArr::putIfAbsent);
|
||||||
saveTo(this.confDir.resolve("en_us.json").toFile(), this.translation, this.translationArr);
|
saveTo(this.confDir.resolve("en_us.json").toFile(), this.translation, this.translationArr);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user