Package etithespirit.orimod.util
Class SidedValue<T>
java.lang.Object
etithespirit.orimod.util.SidedValue<T>
- Type Parameters:
T
- The type of value to store.
A value that exists independently for both sides of the game. This is intended for static use, as instances of objects will
(or should) exist for either side no matter what.
-
Field Details
-
clientValue
The value on the clientside. -
serverValue
The value on the serverside.
-
-
Constructor Details
-
SidedValue
Construct a newSidedValue
. The specific side is determined by whether or not this game is an instance of the dedicated server.- Parameters:
def
- The default value to store.
-
-
Method Details
-
set
Sets the value for the given side.- Parameters:
onClient
- Whether or not to set the client value.newValue
- The new value to use.- Throws:
IllegalArgumentException
- IfisClient
is true, but this is running in a dedicated server (making that impossible).
-
get
Gets the value for the given side.- Parameters:
onClient
- Whether or not to get the client value.- Returns:
- The value appropriate for the given side.
- Throws:
IllegalArgumentException
- IfisClient
is true, but this is running in a dedicated server (making that impossible).
-