2 * Copyright (c) 2017, orillion <orillion@rizon.net>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
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.
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.
26 package net
.rizon
.acid
.plugins
.vizon
.conf
;
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
;
38 * @author orillion <orillion@rizon.net>
40 public class VizonConfig
extends Configuration
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
;
50 public int firstPrize
;
51 public int secondPrize
;
52 public int thirdPrize
;
53 public int consolationPrize
;
55 private ExpiryArgument drawingOpenArgument
;
56 private ExpiryArgument drawingCloseArgument
;
59 public void validate() throws ConfigException
61 drawingOpenArgument
= ExpiryArgument
.parse(drawingOpen
);
62 drawingCloseArgument
= ExpiryArgument
.parse(drawingClose
);
64 Validator
.validateNotNull("drawingOpenArgument", drawingOpenArgument
);
65 Validator
.validateNotNull("drawingCloseArgument", drawingCloseArgument
);
66 Validator
.validateNotNull("days", days
);
69 public Duration
getOpenTimeInterval()
71 return drawingOpenArgument
.getDuration();
74 public Duration
getCloseTimeInterval()
76 return drawingCloseArgument
.getDuration();