]> jfr.im git - irc/rizon/acid.git/blob - vizon/src/main/java/net/rizon/acid/plugins/vizon/conf/VizonConfig.java
Implement Vizon
[irc/rizon/acid.git] / vizon / src / main / java / net / rizon / acid / plugins / vizon / conf / VizonConfig.java
1 /*
2 * Copyright (c) 2017, orillion <orillion@rizon.net>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26 package net.rizon.acid.plugins.vizon.conf;
27
28 import java.time.Duration;
29 import java.util.List;
30 import net.rizon.acid.arguments.ExpiryArgument;
31 import net.rizon.acid.conf.Client;
32 import net.rizon.acid.conf.ConfigException;
33 import net.rizon.acid.conf.Configuration;
34 import net.rizon.acid.conf.Validator;
35
36 /**
37 *
38 * @author orillion <orillion@rizon.net>
39 */
40 public class VizonConfig extends Configuration
41 {
42 public List<Client> clients;
43 public String vizonChannel;
44 public String vizonBot;
45 public List<Integer> days;
46 public String drawingOpen;
47 public String drawingClose;
48 public String drawingTime;
49
50 public int firstPrize;
51 public int secondPrize;
52 public int thirdPrize;
53 public int consolationPrize;
54
55 private ExpiryArgument drawingOpenArgument;
56 private ExpiryArgument drawingCloseArgument;
57
58 @Override
59 public void validate() throws ConfigException
60 {
61 drawingOpenArgument = ExpiryArgument.parse(drawingOpen);
62 drawingCloseArgument = ExpiryArgument.parse(drawingClose);
63
64 Validator.validateNotNull("drawingOpenArgument", drawingOpenArgument);
65 Validator.validateNotNull("drawingCloseArgument", drawingCloseArgument);
66 Validator.validateNotNull("days", days);
67 }
68
69 public Duration getOpenTimeInterval()
70 {
71 return drawingOpenArgument.getDuration();
72 }
73
74 public Duration getCloseTimeInterval()
75 {
76 return drawingCloseArgument.getDuration();
77 }
78 }