Shorten the length of url
This commit is contained in:
1 parent
b46760c46b
commit
5895f0f63b
3 files changed
+18
-7
No files matched your search
+2
-2
@@ -30,8 +30,8 @@ dependencies {
|
|||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
shadow('com.maxmind.geoip2:geoip2:4.2.0')
|
shadow('com.maxmind.geoip2:geoip2:4.2.0')
|
||||||
implementation "io.javalin:javalin:6.4.0"
|
shadow("io.javalin:javalin:6.4.0")
|
||||||
implementation 'com.github.houbb:pinyin:0.4.0'
|
shadow('com.github.houbb:pinyin:0.4.0')
|
||||||
shadow('com.google.inject:guice:7.0.0') {
|
shadow('com.google.inject:guice:7.0.0') {
|
||||||
exclude group: 'com.google.guava', module: 'guava'
|
exclude group: 'com.google.guava', module: 'guava'
|
||||||
exclude group: 'com.google.guava', module: 'listenablefuture'
|
exclude group: 'com.google.guava', module: 'listenablefuture'
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ public class SignatureService {
|
|||||||
public byte[] createSignature(Signature signature) {
|
public byte[] createSignature(Signature signature) {
|
||||||
var buf = Unpooled.buffer();
|
var buf = Unpooled.buffer();
|
||||||
writeSignature(buf, signature);
|
writeSignature(buf, signature);
|
||||||
buf = buf.slice(0, buf.readableBytes());
|
var arr = new byte[buf.readableBytes()];
|
||||||
return buf.array();
|
buf.readBytes(arr);
|
||||||
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.ib67.sfcraft.util;
|
|||||||
|
|
||||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -15,10 +16,19 @@ public record Permission<T extends Entity>(String key, boolean byDefault) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(T t) {
|
public boolean hasPermission(T t) {
|
||||||
if (Permissions.check(t, SFConsts.SPECIAL_SUDO)) return true;
|
if (check(t, SFConsts.SPECIAL_SUDO)) return true;
|
||||||
if (byDefault) {
|
if (byDefault) {
|
||||||
return !Permissions.check(t, "-"+key);
|
return !check(t, "-"+key);
|
||||||
}
|
}
|
||||||
return Permissions.check(t, key);
|
return check(t, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean check(T t, String permission){
|
||||||
|
if(t instanceof PlayerEntity player) {
|
||||||
|
if (player.getCommandTags().contains(permission)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Permissions.check(t, permission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user