update for CommandBau
Dieser Commit ist enthalten in:
Ursprung
64b7814dd5
Commit
a09784287b
@ -85,7 +85,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
getCommand("fire").setExecutor(new CommandFire());
|
||||
getCommand("freeze").setExecutor(new CommandFreeze());
|
||||
getCommand("testblock").setExecutor(new CommandTestblock());
|
||||
getCommand("bau").setExecutor(new CommandBau());
|
||||
getCommand("bauinfo").setExecutor(new CommandInfo());
|
||||
getCommand("protect").setExecutor(new CommandProtect());
|
||||
getCommand("skull").setExecutor(new CommandSkull());
|
||||
|
@ -1,34 +1,46 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 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.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandBau implements CommandExecutor {
|
||||
|
||||
public class CommandBau extends SWCommand {
|
||||
|
||||
public CommandBau() {
|
||||
super("bau", "b", "gs");
|
||||
}
|
||||
|
||||
|
||||
@Register()
|
||||
public void genericCommand(Player p) {
|
||||
permissionCheck(p);
|
||||
}
|
||||
|
||||
@Register("togglebuild")
|
||||
public void toggleBuildCommand(Player p, String arg) {
|
||||
if (permissionCheck(p)) {
|
||||
onToggleBD(p, arg);
|
||||
}
|
||||
}
|
||||
|
||||
@Register("togglewe")
|
||||
public void toggleWECommand(Player p, String arg) {
|
||||
if (permissionCheck(p)) {
|
||||
onToggleWE(p, arg);
|
||||
}
|
||||
}
|
||||
|
||||
@Register("toggleworld")
|
||||
public void toggleWorldCommand(Player p, String arg) {
|
||||
if (permissionCheck(p)) {
|
||||
onToggleWorld(p, arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onToggleBD(Player p, String arg) {
|
||||
SteamwarUser id = SteamwarUser.get(arg);
|
||||
@ -74,23 +86,13 @@ public class CommandBau implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player))
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
if (!BauSystem.getOwner().equals(player.getUniqueId())) {
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDies ist nicht deine Welt!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("togglebuild")) {
|
||||
onToggleBD(player, args[1]);
|
||||
} else if (args[0].equalsIgnoreCase("togglewe")) {
|
||||
onToggleWE(player, args[1]);
|
||||
} else if (args[0].equalsIgnoreCase("toggleworld")) {
|
||||
onToggleWorld(player, args[1]);
|
||||
private boolean permissionCheck(Player p) {
|
||||
if (!BauSystem.getOwner().equals(p.getUniqueId())) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDies ist nicht deine Welt!");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -15,10 +15,6 @@ commands:
|
||||
testblock:
|
||||
aliases: tb
|
||||
reset:
|
||||
bau:
|
||||
aliases:
|
||||
- gs
|
||||
- b
|
||||
protect:
|
||||
bauinfo:
|
||||
speed:
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren