mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-06-23 21:04:46 +02:00
26 lines
817 B
Java
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);
|
|
}
|
|
}
|
|
}
|