update for CommandDetonator
Dieser Commit ist enthalten in:
Ursprung
1b2da12ee9
Commit
d0ea73c56c
@ -92,8 +92,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
|||||||
getCommand("lockschem").setExecutor(new CommandLockschem());
|
getCommand("lockschem").setExecutor(new CommandLockschem());
|
||||||
new CommandDebugStick();
|
new CommandDebugStick();
|
||||||
getCommand("watervision").setExecutor(new CommandGills());
|
getCommand("watervision").setExecutor(new CommandGills());
|
||||||
getCommand("detonator").setExecutor(new CommandDetonator());
|
new CommandDetonator();
|
||||||
getCommand("detonator").setTabCompleter(new CommandDetonatorTabCompleter());
|
|
||||||
getCommand("script").setExecutor(new CommandScript());
|
getCommand("script").setExecutor(new CommandScript());
|
||||||
getCommand("scriptvars").setExecutor(new CommandScriptVars());
|
getCommand("scriptvars").setExecutor(new CommandScriptVars());
|
||||||
getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter());
|
getCommand("scriptvars").setTabCompleter(new CommandScriptVarsTabCompleter());
|
||||||
|
@ -1,22 +1,3 @@
|
|||||||
/*
|
|
||||||
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;
|
||||||
@ -24,12 +5,98 @@ import de.steamwar.bausystem.Permission;
|
|||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.world.Detonator;
|
import de.steamwar.bausystem.world.Detonator;
|
||||||
import de.steamwar.bausystem.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
import org.bukkit.command.Command;
|
import de.steamwar.command.SWCommand;
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CommandDetonator implements CommandExecutor {
|
|
||||||
|
public class CommandDetonator extends SWCommand {
|
||||||
|
|
||||||
|
public CommandDetonator() {
|
||||||
|
super ("detonator", "dt");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Register(help = true)
|
||||||
|
public void genericHelp(Player p, String... args) {
|
||||||
|
help(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("wand")
|
||||||
|
public void wandCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
SWUtils.giveItemToPlayer(p, Detonator.WAND);
|
||||||
|
p.updateInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("detonator")
|
||||||
|
public void detonatorCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
SWUtils.giveItemToPlayer(p, Detonator.WAND);
|
||||||
|
p.updateInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("item")
|
||||||
|
public void itemCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
SWUtils.giveItemToPlayer(p, Detonator.WAND);
|
||||||
|
p.updateInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Register("remove")
|
||||||
|
public void removeCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
p.getInventory().removeItem(Detonator.WAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Register("detonate")
|
||||||
|
public void detonateCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
Detonator.execute(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("click")
|
||||||
|
public void clickCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
Detonator.execute(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("use")
|
||||||
|
public void useCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
Detonator.execute(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Register("clear")
|
||||||
|
public void clearCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
p.getInventory().setItemInMainHand(Detonator.clearDetonator(p.getInventory().getItemInMainHand()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("delete")
|
||||||
|
public void deleteCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
p.getInventory().setItemInMainHand(Detonator.clearDetonator(p.getInventory().getItemInMainHand()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register("reset")
|
||||||
|
public void resetCommand(Player p) {
|
||||||
|
if (permissionCheck(p)) {
|
||||||
|
p.getInventory().setItemInMainHand(Detonator.clearDetonator(p.getInventory().getItemInMainHand()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void help(Player player) {
|
private void help(Player player) {
|
||||||
player.sendMessage("§8/§edetonator wand §8- §7Legt den Fernzünder ins Inventar");
|
player.sendMessage("§8/§edetonator wand §8- §7Legt den Fernzünder ins Inventar");
|
||||||
@ -45,44 +112,4 @@ public class CommandDetonator implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
|
||||||
if (!(sender instanceof Player))
|
|
||||||
return false;
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
help(player);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!permissionCheck(player)) return false;
|
|
||||||
|
|
||||||
switch (args[0].toLowerCase()) {
|
|
||||||
case "wand":
|
|
||||||
case "detonator":
|
|
||||||
case "item":
|
|
||||||
SWUtils.giveItemToPlayer(player, Detonator.WAND);
|
|
||||||
player.updateInventory();
|
|
||||||
break;
|
|
||||||
case "remove":
|
|
||||||
player.getInventory().removeItem(Detonator.WAND);
|
|
||||||
break;
|
|
||||||
case "detonate":
|
|
||||||
case "click":
|
|
||||||
case "use":
|
|
||||||
Detonator.execute(player);
|
|
||||||
break;
|
|
||||||
case "clear":
|
|
||||||
case "delete":
|
|
||||||
case "reset":
|
|
||||||
player.getInventory().setItemInMainHand(Detonator.clearDetonator(player.getInventory().getItemInMainHand()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
help(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,8 +23,6 @@ commands:
|
|||||||
watervision:
|
watervision:
|
||||||
aliases: wv
|
aliases: wv
|
||||||
lockschem:
|
lockschem:
|
||||||
detonator:
|
|
||||||
aliases: dt
|
|
||||||
script:
|
script:
|
||||||
scriptvars:
|
scriptvars:
|
||||||
simulator:
|
simulator:
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren