use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class EditModeCommand method price.
@Command(desc = "Sets the price")
public void price(Player context, Double price) {
if (price < 0) {
i18n.send(context, NEGATIVE, "A negative price!? Are you serious?");
return;
}
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
data.setPrice(price);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class EditModeCommand method demand.
@Command(desc = "Changes the demand of a sign")
public void demand(Player context, Integer demand) {
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
if (data.getSignType() == null) {
data.setSignType(SignType.SELL);
} else if (data.getSignType() == SignType.BUY) {
i18n.send(context, NEGATIVE, "Buy signs cannot have a demand!");
return;
}
data.setDemand(demand);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class EditModeCommand method amount.
@Command(desc = "Sets the amount")
public void amount(Player context, Integer amount) {
if (amount < 0) {
i18n.send(context, NEGATIVE, "Negative amounts could be unfair! Just sayin'");
return;
}
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
data.setAmount(amount);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class EditModeCommand method buy.
@Command(desc = "Changes the sign to a buy-sign")
public void buy(Player context) {
// TODO perms for sell/Buy maybe?
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
data.setSignType(SignType.BUY);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class EditModeCommand method item.
@Command(desc = "Sets the item")
public void item(Player context, ItemStack item) {
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
if (!data.isAdminOwner() && data.getStock() != 0) {
i18n.send(context, NEGATIVE, "You have to take all items out of the market-sign to be able to change the item in it!");
return;
}
data.setItem(item, false);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
Aggregations