Files
lakebane/src/engine/devcmd/cmds/RemoveBaneCmd.java
T

70 lines
2.2 KiB
Java
Raw Normal View History

2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.SiegeResult;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.objects.*;
/**
* @author Eighty
*/
public class RemoveBaneCmd extends AbstractDevCmd {
2023-07-15 09:23:48 -04:00
public RemoveBaneCmd() {
2022-04-30 09:41:17 -04:00
super("removebane");
}
2023-07-15 09:23:48 -04:00
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
Bane bane = city.getBane();
if (bane == null) {
throwbackError(pc, "Could not find bane to remove.");
return;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
bane.endBane(SiegeResult.DEFEND);
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
throwbackInfo(pc, "The bane has been removed.");
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected String _getHelpString() {
2022-04-30 09:41:17 -04:00
return "Removes a bane from the city grid you're standing on.";
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected String _getUsageString() {
2022-04-30 09:41:17 -04:00
return "'./removebane'";
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
}