Updated ItemParser to use the new banner materials

This commit is contained in:
Florian CUNY 2018-08-07 16:02:29 +02:00
parent e232452f65
commit 90a868bc40
9 changed files with 11 additions and 18 deletions

View File

@ -112,16 +112,11 @@ public class ItemParser {
private static ItemStack banner(String[] part) {
try {
if (part.length == 2) {
return new ItemStack(Material.WHITE_BANNER, Integer.parseInt(part[1]));
}
if (part.length >= 3) {
int reqAmount = Integer.parseInt(part[1]);
ItemStack result = new ItemStack(Material.getMaterial(part[2] + "_BANNER"), reqAmount);
if (part.length >= 2) {
ItemStack result = new ItemStack(Material.getMaterial(part[0]), Integer.parseInt(part[1]));
BannerMeta meta = (BannerMeta) result.getItemMeta();
for (int i = 3; i < part.length; i += 2) {
for (int i = 2; i < part.length; i += 2) {
meta.addPattern(new Pattern(DyeColor.valueOf(part[i + 1]), PatternType.valueOf(part[i])));
}

View File

@ -10,7 +10,7 @@
#
# This translation is adapted to version : [alpha-1]
banner: "BANNER:1:RED:STRIPE_RIGHT:BLACK:STRIPE_LEFT:YELLOW"
banner: "RED_BANNER:1:STRIPE_RIGHT:BLACK:STRIPE_LEFT:YELLOW"
not-setup:
header: |-

View File

@ -9,7 +9,7 @@
#
# This translation is adapted to version : [alpha-1]
banner: "BANNER:1:BLUE:STRIPE_DOWNLEFT:WHITE:STRIPE_DOWNRIGHT:WHITE:STRIPE_CENTER:WHITE:STRIPE_MIDDLE:WHITE:STRAIGHT_CROSS:RED:CROSS:RED"
banner: "BLUE_BANNER:1:STRIPE_DOWNLEFT:WHITE:STRIPE_DOWNRIGHT:WHITE:STRIPE_CENTER:WHITE:STRIPE_MIDDLE:WHITE:STRAIGHT_CROSS:RED:CROSS:RED"
protection:
flags:

View File

@ -9,7 +9,7 @@
#
# This translation is adapted to version : [alpha-2]
banner: "BANNER:1:WHITE:STRIPE_SMALL:RED:SQUARE_TOP_RIGHT:CYAN:SQUARE_TOP_RIGHT:BLUE"
banner: "WHITE_BANNER:1:STRIPE_SMALL:RED:SQUARE_TOP_RIGHT:CYAN:SQUARE_TOP_RIGHT:BLUE"
general:
success: "&aSuccess!"

View File

@ -9,7 +9,7 @@
#
# Cette traduction est adaptée pour la version : [alpha-2]
banner: "BANNER:1:WHITE:STRIPE_BOTTOM:RED:STRIPE_TOP:BLUE"
banner: "WHITE_BANNER:1:STRIPE_BOTTOM:RED:STRIPE_TOP:BLUE"
general:
deaths: "morts"

View File

@ -8,7 +8,7 @@
#
# This translation is adapted to version : [alpha-2]
banner: "BANNER:1:WHITE:HALF_VERTICAL:RED"
banner: "WHITE_BANNER:1:HALF_VERTICAL:RED"
general:
success: "&aSukces!"

View File

@ -10,7 +10,7 @@
# Banbeucmas: Người dịch bản YML gốc
# This translation is adapted to version : [alpha-2]
banner: "BANNER:1:RED:CREEPER:YELLOW:RHOMBUS_MIDDLE:YELLOW:TRIANGLES_BOTTOM:RED:SQUARE_BOTTOM_LEFT:RED:SQUARE_BOTTOM_RIGHT:RED"
banner: "RED_BANNER:1:CREEPER:YELLOW:RHOMBUS_MIDDLE:YELLOW:TRIANGLES_BOTTOM:RED:SQUARE_BOTTOM_LEFT:RED:SQUARE_BOTTOM_RIGHT:RED"
general:
deaths: "Chết"

View File

@ -9,7 +9,7 @@
# DuckSoft: translator
# This translation is adapted to version : [alpha-1]
banner: "BANNER:1:RED:SQUARE_TOP_RIGHT:YELLOW:CROSS:RED:CURLY_BORDER:RED:MOJANG:YELLOW:HALF_HORIZONTAL_MIRROR:RED:HALF_VERTICAL:RED"
banner: "RED_BANNER:1:SQUARE_TOP_RIGHT:YELLOW:CROSS:RED:CURLY_BORDER:RED:MOJANG:YELLOW:HALF_HORIZONTAL_MIRROR:RED:HALF_VERTICAL:RED"
not-setup:
header: |-

View File

@ -214,8 +214,6 @@ public class ItemParserTest {
assertEquals(2, result.getAmount());
}
/*
* Commenting out to get build to work
@Test
public void testParseBannerThreeArgs() {
// Germany
@ -230,7 +228,7 @@ public class ItemParserTest {
ItemParser.parse("RED_BANNER:1:STRIPE_RIGHT:BLACK:STRIPE_LEFT:YELLOW");
Mockito.verify(bannerMeta, Mockito.times(2)).addPattern(Mockito.any());
}
*/
@Test
public void testParseBannerTooManyColons() {
ItemStack result = ItemParser.parse("WHITE_BANNER:1:::::::::::::");