Update Permission #220
@ -27,6 +27,9 @@ PAGE_LIST=§e Page ({0}/{1}) »»
|
||||
LIST_PREVIOUS_PAGE=§ePrevious page
|
||||
LIST_NEXT_PAGE=§eNext page
|
||||
|
||||
# Permissions
|
||||
NO_PERMISSION = You are not allowed to use that here
|
||||
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME = Time
|
||||
SCOREBOARD_REGION = Region
|
||||
|
@ -27,6 +27,9 @@ PAGE_LIST=§e Seite ({0}/{1}) »»
|
||||
LIST_PREVIOUS_PAGE=§eVorherige Seite
|
||||
LIST_NEXT_PAGE=§eNächste Seite
|
||||
|
||||
# Permission
|
||||
NO_PERMISSION = Du darfst dies hier nicht nutzen
|
||||
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME = Uhrzeit
|
||||
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.utils.TickListener;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.message.Message;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
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(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;
|
||||
});
|
||||
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
|
||||
LinkageUtils.link();
|
||||
RamUsage.init();
|
||||
TickListener.impl.init();
|
||||
|
@ -20,17 +20,10 @@
|
||||
package de.steamwar.bausystem;
|
||||
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.command.CommandMetaData;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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;
|
||||
|
||||
@AllArgsConstructor
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Die 3 Validator sind sehr gleich von der Codestruktur, evtl. Eine Extra-Methode daraus machen, mit Input CommandSender und Parameter, welche Permission.