use of org.cubeengine.butler.parametric.Command in project modules-extra by CubeEngine.
the class EditModeCommand method sell.
@Command(desc = "Changes the sign to a sell-sign")
public void sell(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.SELL);
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 owner.
@Command(desc = "Changes the signs owner")
public void owner(Player context, User owner) {
if (!context.equals(owner)) {
if (!context.hasPermission(module.perms().EDIT_PLAYER_OTHER.getId())) {
throw new PermissionDeniedException(module.perms().EDIT_PLAYER_OTHER);
}
} else {
if (!context.hasPermission(module.perms().EDIT_PLAYER_SELF.getId())) {
throw new PermissionDeniedException(module.perms().EDIT_PLAYER_SELF);
}
}
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
data.setOwner(owner.getUniqueId());
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 admin.
@Command(desc = "Changes the sign to an admin-sign")
public void admin(Player context) {
if (!context.hasPermission(module.perms().EDIT_ADMIN.getId())) {
throw new PermissionDeniedException(module.perms().EDIT_ADMIN);
}
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
data.setOwner(IMarketSignData.ADMIN_SIGN);
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 size.
@Command(desc = "Sets the signs inventory size")
public void size(Player context, @org.cubeengine.butler.parametric.Optional Integer size, @ParameterPermission @Flag boolean infinite) {
if (size == null || size < 0) {
size = infinite ? -1 : 0;
}
if (size == 0 || size > 6) {
i18n.send(context, NEGATIVE, "Invalid size! Use -i for infinite OR 1-6 inventory-lines!");
return;
}
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
data.setSize(size);
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 nodemand.
@Command(desc = "Changes the demand of a sign")
public void nodemand(Player context) {
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
data.setDemand(null);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
Aggregations