SteamWar/BauSystem
Archiviert
13
0

Update BauSystem to new CommandFramework #217

Manuell gemergt
YoyoNow hat 63 Commits von CommandFramework nach master 2021-04-02 18:08:26 +02:00 zusammengeführt
3 geänderte Dateien mit 42 neuen und 45 gelöschten Zeilen
Nur Änderungen aus Commit a09784287b werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -85,7 +85,6 @@ public class BauSystem extends JavaPlugin implements Listener {
getCommand("fire").setExecutor(new CommandFire()); getCommand("fire").setExecutor(new CommandFire());
getCommand("freeze").setExecutor(new CommandFreeze()); getCommand("freeze").setExecutor(new CommandFreeze());
getCommand("testblock").setExecutor(new CommandTestblock()); getCommand("testblock").setExecutor(new CommandTestblock());
getCommand("bau").setExecutor(new CommandBau());
getCommand("bauinfo").setExecutor(new CommandInfo()); getCommand("bauinfo").setExecutor(new CommandInfo());
getCommand("protect").setExecutor(new CommandProtect()); getCommand("protect").setExecutor(new CommandProtect());
getCommand("skull").setExecutor(new CommandSkull()); getCommand("skull").setExecutor(new CommandSkull());

Datei anzeigen

@ -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; package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.world.Welt; import de.steamwar.bausystem.world.Welt;
import de.steamwar.command.SWCommand;
import de.steamwar.sql.BauweltMember; import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser; 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; 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) { private void onToggleBD(Player p, String arg) {
SteamwarUser id = SteamwarUser.get(arg); SteamwarUser id = SteamwarUser.get(arg);
@ -74,23 +86,13 @@ public class CommandBau implements CommandExecutor {
return false; 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")) { private boolean permissionCheck(Player p) {
onToggleBD(player, args[1]); if (!BauSystem.getOwner().equals(p.getUniqueId())) {
} else if (args[0].equalsIgnoreCase("togglewe")) { p.sendMessage(BauSystem.PREFIX + "§cDies ist nicht deine Welt!");
onToggleWE(player, args[1]);
} else if (args[0].equalsIgnoreCase("toggleworld")) {
onToggleWorld(player, args[1]);
}
return false; return false;
} else {
return true;
}
} }
} }

Datei anzeigen

@ -15,10 +15,6 @@ commands:
testblock: testblock:
aliases: tb aliases: tb
reset: reset:
bau:
aliases:
- gs
- b
protect: protect:
bauinfo: bauinfo:
speed: speed: