SteamWar/BauSystem2.0
Archiviert
12
0

Add UnsignCommand

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-07-10 15:04:59 +02:00
Ursprung d77deffcc9
Commit 10af2079d4
2 geänderte Dateien mit 59 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -471,6 +471,10 @@ REGION_TNT_ON=§aTNT-Schaden aktiviert
REGION_TNT_OFF=§cTNT-Schaden deaktiviert
REGION_TNT_TB=§aTNT-Schaden außerhalb Baurahmen aktiviert
REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört
# Unsign Book
UNSIGN_HELP_1=§8/§eunsign §8- §7Mache ein Buch beschreibbar
# Team
LOCK_SCHEM_NO_USER=§7Dieser Spieler existiert nicht!
LOCK_SCHEM_NO_SCHEM=§7Dieser Spieler besitzt keine Schematic mit diesem Namen!

Datei anzeigen

@ -0,0 +1,55 @@
/*
* 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.script;
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.core.VersionedCallable;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.COMMAND)
public class UnsignCommand extends SWCommand {
public UnsignCommand() {
super("unsign");
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Unsign");
BauSystem.MESSAGE.sendPrefixless("UNSIGN_HELP_1", p);
}
@Register
public void unsignCommand(Player p) {
ItemStack itemStack = p.getInventory().getItemInMainHand();
if (isNoBook(itemStack)) return;
itemStack.setType(Material.WRITABLE_BOOK);
p.getInventory().setItemInMainHand(itemStack);
}
private boolean isNoBook(ItemStack item) {
return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
}
}