Add validator for player and commandsender for checking build Permission
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Dieser Commit ist enthalten in:
Ursprung
0b70bdfe97
Commit
0cec90c55c
@ -27,6 +27,9 @@ PAGE_LIST=§e Page ({0}/{1}) »»
|
|||||||
LIST_PREVIOUS_PAGE=§ePrevious page
|
LIST_PREVIOUS_PAGE=§ePrevious page
|
||||||
LIST_NEXT_PAGE=§eNext page
|
LIST_NEXT_PAGE=§eNext page
|
||||||
|
|
||||||
|
# Permissions
|
||||||
|
NO_PERMISSION = You are not allowed to use that here
|
||||||
|
|
||||||
# Scoreboard
|
# Scoreboard
|
||||||
SCOREBOARD_TIME = Time
|
SCOREBOARD_TIME = Time
|
||||||
SCOREBOARD_REGION = Region
|
SCOREBOARD_REGION = Region
|
||||||
|
@ -27,6 +27,9 @@ PAGE_LIST=§e Seite ({0}/{1}) »»
|
|||||||
LIST_PREVIOUS_PAGE=§eVorherige Seite
|
LIST_PREVIOUS_PAGE=§eVorherige Seite
|
||||||
LIST_NEXT_PAGE=§eNächste Seite
|
LIST_NEXT_PAGE=§eNächste Seite
|
||||||
|
|
||||||
|
# Permission
|
||||||
|
NO_PERMISSION = Du darfst dies hier nicht nutzen
|
||||||
|
|
||||||
# Scoreboard
|
# Scoreboard
|
||||||
SCOREBOARD_TIME = Uhrzeit
|
SCOREBOARD_TIME = Uhrzeit
|
||||||
SCOREBOARD_REGION = Region
|
SCOREBOARD_REGION = Region
|
||||||
|
@ -29,9 +29,12 @@ import de.steamwar.bausystem.region.loader.RegionLoader;
|
|||||||
import de.steamwar.bausystem.region.loader.Updater;
|
import de.steamwar.bausystem.region.loader.Updater;
|
||||||
import de.steamwar.bausystem.utils.TickListener;
|
import de.steamwar.bausystem.utils.TickListener;
|
||||||
import de.steamwar.bausystem.worlddata.WorldData;
|
import de.steamwar.bausystem.worlddata.WorldData;
|
||||||
|
import de.steamwar.command.SWCommandUtils;
|
||||||
import de.steamwar.message.Message;
|
import de.steamwar.message.Message;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -75,6 +78,24 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
new Updater(PrototypeLoader.file, PrototypeLoader::load);
|
new Updater(PrototypeLoader.file, PrototypeLoader::load);
|
||||||
new Updater(RegionLoader.file, RegionLoader::load);
|
new Updater(RegionLoader.file, RegionLoader::load);
|
||||||
|
|
||||||
|
SWCommandUtils.addValidator(Player.class, (player, object, messageSender) -> {
|
||||||
|
if (Permission.BUILD.hasPermission(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
messageSender.send("NO_PERMISSION");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
SWCommandUtils.addValidator(CommandSender.class, (commandSender, object, messageSender) -> {
|
||||||
|
if (commandSender instanceof Player) {
|
||||||
|
if (Permission.BUILD.hasPermission((Player) commandSender)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
messageSender.send("NO_PERMISSION");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
LinkageUtils.link();
|
LinkageUtils.link();
|
||||||
RamUsage.init();
|
RamUsage.init();
|
||||||
TickListener.impl.init();
|
TickListener.impl.init();
|
||||||
|
@ -20,17 +20,10 @@
|
|||||||
package de.steamwar.bausystem;
|
package de.steamwar.bausystem;
|
||||||
|
|
||||||
import de.steamwar.bausystem.config.BauServer;
|
import de.steamwar.bausystem.config.BauServer;
|
||||||
import de.steamwar.command.CommandMetaData;
|
|
||||||
import de.steamwar.command.TypeValidator;
|
|
||||||
import de.steamwar.sql.BauweltMember;
|
import de.steamwar.sql.BauweltMember;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren