Other functions
Ouranos API has bunch of functions you can use to interact with Ouranos worlds.
Interract with bank
All of these functions uses integrated Database to work, that's why they are throwing an exception
Adding money in the bank
try {
OuranosAPI.getInstance().addBankMoney(player, 20);
} catch (SQLException e) {
throw new RuntimeException(e);
}
Removing money in the bank
try {
OuranosAPI.getInstance().removeBankMoney(player, 20);
} catch (SQLException e) {
throw new RuntimeException(e);
}
Getting player balance
try {
double balance = OuranosAPI.getInstance().getBankBalance(player, 20);
} catch (SQLException e) {
throw new RuntimeException(e);
}
Interacting with settlements
Getting discovered settlements
This method returns all settlements (cities and villages) loaded in the world
try {
List<Settlement> settlements = OuranosAPI.getInstance().getDiscoveredSettlements(worldName);
} catch (SQLException e) {
throw new RuntimeException(e);
}
Getting discovered cities
This method returns all cities loaded in the world
try {
List<City> settlements = OuranosAPI.getInstance().getDiscoveredCities(worldName);
} catch (SQLException e) {
throw new RuntimeException(e);
}
Getting discovered villages
This method returns all villages loaded in the world
try {
List<Village> settlements = OuranosAPI.getInstance().getDiscoveredVillages(worldName);
} catch (SQLException e) {
throw new RuntimeException(e);
}
Getting settlement at specific location
This method will return the settlement at the specific location, or null if there's no settlement at this location
Settlement settlement = OuranosAPI.getInstance().getSettlementAt(location);
Convert Settlement into Village or City
Settlement is the superclass of Village and City, you can then use the instanceof keyword to get the city or village from a settlement.
Settlement settlement = ... ;
if(settlement instanceof Village) {
Village village = (Village) settlement;
...
} else if(settlement instanceof City) {
City city = (City) settlement;
...
}
Interacting with world
Getting the climate
Climate climate = OuranosAPI.getInstance().getClimateAt(location);
Getting the biome
OuranosBiome biome = OuranosAPI.getInstance().getBiomeAt(location);
Last updated