ChestShop-3/src/main/java/com/Acrobot/ChestShop/Listeners/PreShopCreation/QuantityChecker.java

26 lines
817 B
Java
Raw Normal View History

2013-01-15 21:33:00 +01:00
package com.Acrobot.ChestShop.Listeners.PreShopCreation;
import com.Acrobot.Breeze.Utils.NumberUtil;
import com.Acrobot.ChestShop.Events.PreShopCreationEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import static com.Acrobot.ChestShop.Events.PreShopCreationEvent.CreationOutcome.INVALID_QUANTITY;
import static com.Acrobot.ChestShop.Signs.ChestShopSign.QUANTITY_LINE;
/**
* @author Acrobot
*/
public class QuantityChecker implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public static void onPreShopCreation(PreShopCreationEvent event) {
String quantity = event.getSignLine(QUANTITY_LINE);
if (!NumberUtil.isInteger(quantity)) {
event.setOutcome(INVALID_QUANTITY);
}
}
}