Merge remote-tracking branch 'origin/master'
Dieser Commit ist enthalten in:
Commit
6b30bfc5aa
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.other;
|
||||
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@Linked(LinkageType.COMMAND)
|
||||
public class GamemodeCommand extends SWCommand {
|
||||
|
||||
public GamemodeCommand() {
|
||||
super("gamemode", "gm", "g");
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
public void help(final Player p, final String... args) {
|
||||
p.sendMessage(ChatColor.RED + "Unbekannter Spielmodus.");
|
||||
p.sendMessage(ChatColor.RED + "Mögliche Spielmodi: survival, adventure, creative, specator.");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(final Player p) {
|
||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||
p.setGameMode(GameMode.SPECTATOR);
|
||||
} else {
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@Register
|
||||
public void gamemodeCommand(final Player p, final GameMode gameMode) {
|
||||
p.setGameMode(gameMode);
|
||||
}
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren