SteamWar/BauSystem2.0
Archiviert
12
0

Update Permission and Region and PermissionSystem and RegionSystem
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2024-05-20 14:51:11 +02:00
Ursprung c1f6b4bd91
Commit 3d07e83d02
4 geänderte Dateien mit 86 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,43 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem;
import de.steamwar.bausystem.permission.PermissionSystem;
import de.steamwar.providers.BauServerInfo;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.entity.Player;
public interface Permission {
Permission OWNER = PermissionSystem.impl::isOwner;
Permission SUPERVISOR = PermissionSystem.impl::isSupervisor;
Permission BUILD = PermissionSystem.impl::isBuilder;
Permission SPECTATOR = PermissionSystem.impl::isSpectator;
Permission MEMBER = PermissionSystem.impl::isMember;
boolean hasPermission(SteamwarUser steamwarUser, BauweltMember bauweltMember);
default boolean hasPermission(Player player) {
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
BauweltMember bauweltMember = BauweltMember.getBauMember(BauServerInfo.getOwnerId(), steamwarUser.getId());
return hasPermission(steamwarUser, bauweltMember);
}
}

Datei anzeigen

@ -0,0 +1,39 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.permission;
import de.steamwar.ImplementationProvider;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
public interface PermissionSystem {
PermissionSystem impl = ImplementationProvider.getImpl("de.steamwar.bausystem.permission.PermissionSystemImpl");
boolean isOwner(SteamwarUser steamwarUser, BauweltMember bauweltMember);
boolean isSupervisor(SteamwarUser steamwarUser, BauweltMember bauweltMember);
boolean isBuilder(SteamwarUser steamwarUser, BauweltMember bauweltMember);
boolean isSpectator(SteamwarUser steamwarUser, BauweltMember bauweltMember);
boolean isMember(SteamwarUser steamwarUser, BauweltMember bauweltMember);
}

Datei anzeigen

@ -30,10 +30,8 @@ import java.util.Optional;
public interface Region {
RegionSystem REGION_SYSTEM = null; // TODO: Add Loading of Implementation
static Region get(Location location) {
return REGION_SYSTEM.get(location);
return RegionSystem.impl.get(location);
}
enum HasFlagResult {

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.region;
import de.steamwar.ImplementationProvider;
import org.bukkit.Location;
import java.util.Optional;
@ -26,6 +27,8 @@ import java.util.stream.Stream;
public interface RegionSystem {
RegionSystem impl = ImplementationProvider.getImpl("de.steamwar.bausystem.region.RegionSystemImpl");
void load();
void save();