use of org.cubeengine.module.signmarket.data.MarketSignData in project modules-extra by CubeEngine.
the class EditModeCommand method copy.
@Restricted(Player.class)
@Command(desc = "Copies the settings from the previous sign")
public void copy(Player context) {
ImmutableMarketSignData data = manager.getPreviousData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No previous market sign");
return;
}
if (data.getOwner().equals(IMarketSignData.ADMIN_SIGN)) {
if (!context.hasPermission(module.perms().EDIT_ADMIN.getId())) {
throw new PermissionDeniedException(module.perms().EDIT_ADMIN);
}
} else {
if (!context.hasPermission(module.perms().EDIT_USE.getId())) {
throw new PermissionDeniedException(module.perms().EDIT_USE);
}
}
MarketSignData copy = data.asMutable();
if (!copy.isAdminOwner()) {
copy.setStock(0);
}
Location<World> loc = manager.updateData(copy, context);
manager.executeShowInfo(copy, context, loc);
}
use of org.cubeengine.module.signmarket.data.MarketSignData in project modules-extra by CubeEngine.
the class EditModeCommand method setstock.
@Command(desc = "Sets the signs stock")
public void setstock(Player context, Integer amount) {
MarketSignData data = manager.getCurrentData(context);
if (data == null) {
i18n.send(context, NEGATIVE, "No active sign!");
return;
}
if (data.getStock() == null) {
i18n.send(context, NEGATIVE, "This sign has no stock! Use \"stock\" first to enable it!");
return;
}
data.setStock(amount);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
use of org.cubeengine.module.signmarket.data.MarketSignData in project modules-extra by CubeEngine.
the class EditModeCommand method player.
@Command(desc = "Changes the sign to an player-sign")
public void player(Player context) {
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;
}
if (data.isAdminOwner()) {
data.setSize(6);
}
data.setOwner(context.getUniqueId());
data.setStock(0);
Location<World> loc = manager.updateData(data, context);
manager.executeShowInfo(data, context, loc);
}
use of org.cubeengine.module.signmarket.data.MarketSignData 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.module.signmarket.data.MarketSignData 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);
}
Aggregations