Remove guard statements
Dieser Commit ist enthalten in:
Ursprung
42c8336783
Commit
46d5a6aa5f
26
build.gradle
26
build.gradle
@ -27,6 +27,18 @@ plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '5.0.0'
|
||||
}
|
||||
|
||||
ext.swdep = { s ->
|
||||
if (file("${rootDir}/lib/${s}.jar").exists()) {
|
||||
return files("${rootDir}/lib/${s}.jar")
|
||||
} else {
|
||||
if (s.contains("-")) {
|
||||
return "de.steamwar:${s.toLowerCase().replace('-', ':')}"
|
||||
} else {
|
||||
return "de.steamwar:${s.toLowerCase()}:RELEASE"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group 'de.steamwar'
|
||||
version ''
|
||||
|
||||
@ -71,12 +83,20 @@ sourceSets {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = uri('https://steamwar.de/maven/')
|
||||
credentials {
|
||||
username = steamwarProperties.getProperty("maven.username")
|
||||
password = steamwarProperties.getProperty("maven.password")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly files("${projectDir}/lib/Spigot-1.15.jar")
|
||||
compileOnly files("${projectDir}/lib/WorldEdit-1.15.jar")
|
||||
compileOnly files("${projectDir}/lib/SpigotCore.jar")
|
||||
compileOnly swdep("Spigot-1.15")
|
||||
compileOnly swdep("WorldEdit-1.15")
|
||||
compileOnly swdep("SpigotCore")
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.22'
|
||||
testCompileOnly 'org.projectlombok:lombok:1.18.22'
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
package de.steamwar.lobby.map;
|
||||
|
||||
import de.steamwar.command.GuardChecker;
|
||||
import de.steamwar.command.GuardResult;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import lombok.SneakyThrows;
|
||||
@ -41,7 +40,7 @@ public class CustomMapCommand extends SWCommand {
|
||||
|
||||
@Register
|
||||
@SneakyThrows
|
||||
public void render(@Guard Player p, File file) {
|
||||
public void render(@Validator Player p, File file) {
|
||||
if (SteamwarUser.get(p).getUserGroup() != UserGroup.Developer) {
|
||||
return;
|
||||
}
|
||||
@ -52,14 +51,10 @@ public class CustomMapCommand extends SWCommand {
|
||||
new CustomMap(p, ImageIO.read(file));
|
||||
}
|
||||
|
||||
@ClassGuard(value = Player.class, local = true)
|
||||
public GuardChecker getGuardChecker() {
|
||||
return (commandSender, guardCheckType, strings, s) -> {
|
||||
Player player = (Player) commandSender;
|
||||
if (SteamwarUser.get(player).getUserGroup() == UserGroup.Developer) {
|
||||
return GuardResult.ALLOWED;
|
||||
}
|
||||
return GuardResult.DENIED;
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> getGuardChecker() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return SteamwarUser.get(player).getUserGroup() == UserGroup.Developer;
|
||||
};
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren