Allow flags to handle article formatting

This commit is contained in:
Graphica 2017-07-29 22:24:00 -04:00 committed by cnr
parent d24b8a229c
commit c2ab6f9dd4
1 changed files with 59 additions and 12 deletions

View File

@ -222,7 +222,7 @@ public enum CountryFlag
new Pattern(WHITE, CURLY_BORDER),
new Pattern(WHITE, CURLY_BORDER)),
CZECH_REPUBLIC("The Czech Republic", "Czech Republic", WHITE,
CZECH_REPUBLIC("Czech Republic", "Czech Republic", true, WHITE,
new Pattern(RED, HALF_VERTICAL),
new Pattern(BLUE, TRIANGLE_TOP)),
@ -231,7 +231,7 @@ public enum CountryFlag
new Pattern(RED, HALF_HORIZONTAL_MIRROR),
new Pattern(WHITE, STRIPE_CENTER)),
DOMINICAN_REPUBLIC("Dominican Republic", "Dominican", WHITE,
DOMINICAN_REPUBLIC("Dominican Republic", "Dominican", true, WHITE,
new Pattern(BLUE, SQUARE_TOP_RIGHT),
new Pattern(BLUE, SQUARE_BOTTOM_LEFT),
new Pattern(RED, SQUARE_TOP_LEFT),
@ -279,7 +279,7 @@ public enum CountryFlag
new Pattern(BLUE, CIRCLE_MIDDLE),
new Pattern(BLUE, CIRCLE_MIDDLE)),
EU("The European Union", "European Union", BLUE,
EU("European Union", "European Union", true, BLUE,
new Pattern(YELLOW, CROSS),
new Pattern(YELLOW, STRIPE_MIDDLE),
new Pattern(BLUE, BORDER),
@ -287,7 +287,7 @@ public enum CountryFlag
new Pattern(BLUE, STRIPE_BOTTOM),
new Pattern(BLUE, CIRCLE_MIDDLE)),
FAROE_ISLANDS("The Faroe Islands", "Faroese", RED,
FAROE_ISLANDS("Faroe Islands", "Faroese", true, RED,
new Pattern(BLUE, STRIPE_TOP),
new Pattern(BLUE, STRIPE_TOP),
new Pattern(BLUE, STRIPE_TOP),
@ -421,7 +421,7 @@ public enum CountryFlag
new Pattern(GREEN, STRIPE_TOP),
new Pattern(ORANGE, STRIPE_BOTTOM)),
ISLE_OF_MAN("Isle of Man", "Isle of Man", RED,
ISLE_OF_MAN("Isle of Man", "Isle of Man", true, RED,
new Pattern(WHITE, SKULL),
new Pattern(WHITE, FLOWER),
new Pattern(RED, STRIPE_TOP),
@ -438,7 +438,7 @@ public enum CountryFlag
new Pattern(GREEN, STRIPE_TOP),
new Pattern(RED, STRIPE_BOTTOM)),
IVORY_COAST("Ivory Coast", "Ivory Coast", WHITE,
IVORY_COAST("Ivory Coast", "Ivory Coast", true, WHITE,
new Pattern(ORANGE, STRIPE_TOP),
new Pattern(ORANGE, STRIPE_TOP),
new Pattern(ORANGE, STRIPE_TOP),
@ -600,7 +600,7 @@ public enum CountryFlag
new Pattern(WHITE, CIRCLE_MIDDLE),
new Pattern(RED, FLOWER)),
NETHERLANDS("The Netherlands", "Dutch", WHITE,
NETHERLANDS("Netherlands", "Dutch", true, WHITE,
new Pattern(RED, PatternType.STRIPE_RIGHT),
new Pattern(RED, PatternType.STRIPE_RIGHT),
new Pattern(BLUE, PatternType.STRIPE_LEFT),
@ -689,7 +689,7 @@ public enum CountryFlag
new Pattern(YELLOW, CIRCLE_MIDDLE),
new Pattern(GREEN, CIRCLE_MIDDLE)),
PHILIPPINES("The Philippines", "Philippine", BLUE,
PHILIPPINES("Philippines", "Philippine", true, BLUE,
new Pattern(RED, HALF_VERTICAL),
new Pattern(WHITE, TRIANGLE_TOP)),
@ -789,7 +789,7 @@ public enum CountryFlag
new Pattern(BLUE, STRIPE_CENTER),
new Pattern(BLUE, STRIPE_CENTER)),
SOLOMON_ISLANDS("Solomon Islands", "Solomon Islands", BLUE,
SOLOMON_ISLANDS("Solomon Islands", "Solomon Islands", true, BLUE,
new Pattern(WHITE, BRICKS),
new Pattern(BLUE, HALF_HORIZONTAL_MIRROR),
new Pattern(BLUE, BORDER),
@ -936,7 +936,7 @@ public enum CountryFlag
new Pattern(RED, FLOWER),
new Pattern(RED, TRIANGLE_BOTTOM)),
UAE("United Arab Emirates", "United Arab Emirates", GREEN,
UAE("United Arab Emirates", "United Arab Emirates", true, GREEN,
new Pattern(BLACK, HALF_VERTICAL),
new Pattern(WHITE, STRIPE_CENTER),
new Pattern(WHITE, STRIPE_CENTER),
@ -951,7 +951,7 @@ public enum CountryFlag
new Pattern(YELLOW, STRIPE_SMALL),
new Pattern(RED, BORDER)),
UK("The United Kingdom", "British", BLUE,
UK("United Kingdom", "British", true, BLUE,
new Pattern(WHITE, STRIPE_DOWNLEFT),
new Pattern(WHITE, STRIPE_DOWNLEFT),
new Pattern(WHITE, STRIPE_DOWNRIGHT),
@ -973,7 +973,7 @@ public enum CountryFlag
new Pattern(BLUE, STRIPE_SMALL),
new Pattern(YELLOW, SQUARE_TOP_RIGHT)),
USA("The United States of America", "American", RED,
USA("United States of America", "American", true, RED,
new Pattern(WHITE, STRIPE_SMALL),
new Pattern(BLUE, SQUARE_TOP_RIGHT),
new Pattern(BLUE, SQUARE_TOP_RIGHT),
@ -1026,19 +1026,46 @@ public enum CountryFlag
;
private final boolean _article;
private final String _country;
private final String _adjective;
private final DyeColor _baseColor;
private final Pattern[] _patterns;
/**
* Create a country flag banner.
*
* @param country Country name.
* @param adjective Country name as an adjective.
* @param baseColor base color of the banner.
* @param patterns List of patterns to apply to the banner.
*/
CountryFlag(String country, String adjective, DyeColor baseColor, Pattern... patterns)
{
this(country, adjective, false, baseColor, patterns);
}
/**
* Create a country flag banner for a country with a name often preceded with "The".
*
* @param country Country name.
* @param adjective Country name as an adjective.
* @param article Whether the country name should be preceded with "The".
* @param baseColor base color of the banner.
* @param patterns List of patterns to apply to the banner.
*/
CountryFlag(String country, String adjective, boolean article, DyeColor baseColor, Pattern... patterns)
{
_country = country;
_adjective = adjective;
_article = article;
_baseColor = baseColor;
_patterns = patterns;
}
/**
* @return a flag banner item.
*/
public ItemStack getBanner()
{
ItemStack banner = new ItemStack(Material.BANNER);
@ -1054,21 +1081,41 @@ public enum CountryFlag
return banner;
}
/**
* @return the name of the country.
*/
public String getCountryName()
{
return (_article ? "The " : "") + _country;
}
/**
* @return the name of the country without a possible article before the country name.
*/
public String getCountryNameRaw()
{
return _country;
}
/**
* @return the name of the country written in an adjectival manner.
*/
public String getCountryAdjective()
{
return _adjective;
}
/**
* @return the banner color.
*/
public DyeColor getBaseColor()
{
return _baseColor;
}
/**
* @return the patterns applied to the banner.
*/
public List<Pattern> getPatterns()
{
return Arrays.asList(_patterns);