SteamWar/BauSystem2.0
Archiviert
12
0

Merge remote-tracking branch 'origin/master'

Dieser Commit ist enthalten in:
Zeanon 2021-04-17 15:53:16 +02:00
Commit f15c4346a6
2 geänderte Dateien mit 86 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -25,7 +25,6 @@ import net.md_5.bungee.api.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
public class GamemodeCommand extends SWCommand {
@ -52,4 +51,4 @@ public class GamemodeCommand extends SWCommand {
public void gamemodeCommand(final Player p, final GameMode gameMode) {
p.setGameMode(gameMode);
}
}
}

Datei anzeigen

@ -0,0 +1,85 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 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.features.team;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
public class LockSchemCommand extends SWCommand {
public LockSchemCommand() {
super("lockschem", "schemlock");
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
SteamwarUser steamwarUser = SteamwarUser.get(p.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if (userGroup != UserGroup.Admin &&
userGroup != UserGroup.Developer &&
userGroup != UserGroup.Moderator &&
userGroup != UserGroup.Supporter) {
return;
}
sendHelp(p);
}
@Register
public void genericCommand(Player p, String owner, String schematicName) {
SteamwarUser steamwarUser = SteamwarUser.get(p.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if (userGroup != UserGroup.Admin &&
userGroup != UserGroup.Developer &&
userGroup != UserGroup.Moderator &&
userGroup != UserGroup.Supporter) {
return;
}
SteamwarUser schemOwner = SteamwarUser.get(owner);
if (schemOwner == null) {
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
return;
}
Schematic schematic = Schematic.getSchemFromDB(schematicName, schemOwner.getUUID());
if (schematic == null) {
p.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
return;
}
p.sendMessage(BauSystem.PREFIX + "Schematic " + schematic.getSchemName() + " von " +
SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " von " + schematic.getSchemType().toString() +
" auf NORMAL zurückgesetzt!");
schematic.setSchemType(SchematicType.Normal);
}
private void sendHelp(Player player) {
player.sendMessage("§8/§eschemlock §8[§7Owner§8] §8[§7Schematic§8] §8- §7 Sperre eine Schematic");
}
}