ChestShop-3/src/main/java/com/Acrobot/ChestShop/Listeners/PreShopCreation/QuantityChecker.java
Acrobot a5bfa86bca Mavenized the project
Switched the project to Maven - you're now able to easily build
ChestShop.
2013-03-08 20:31:15 +01:00

26 lines
817 B
Java

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);
}
}
}