mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
Updated ItemParser to use the new banner materials
This commit is contained in:
parent
e232452f65
commit
90a868bc40
@ -112,16 +112,11 @@ public class ItemParser {
|
|||||||
|
|
||||||
private static ItemStack banner(String[] part) {
|
private static ItemStack banner(String[] part) {
|
||||||
try {
|
try {
|
||||||
if (part.length == 2) {
|
if (part.length >= 2) {
|
||||||
return new ItemStack(Material.WHITE_BANNER, Integer.parseInt(part[1]));
|
ItemStack result = new ItemStack(Material.getMaterial(part[0]), Integer.parseInt(part[1]));
|
||||||
}
|
|
||||||
if (part.length >= 3) {
|
|
||||||
int reqAmount = Integer.parseInt(part[1]);
|
|
||||||
|
|
||||||
ItemStack result = new ItemStack(Material.getMaterial(part[2] + "_BANNER"), reqAmount);
|
|
||||||
|
|
||||||
BannerMeta meta = (BannerMeta) result.getItemMeta();
|
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])));
|
meta.addPattern(new Pattern(DyeColor.valueOf(part[i + 1]), PatternType.valueOf(part[i])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# This translation is adapted to version : [alpha-1]
|
# 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:
|
not-setup:
|
||||||
header: |-
|
header: |-
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# This translation is adapted to version : [alpha-1]
|
# 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:
|
protection:
|
||||||
flags:
|
flags:
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# This translation is adapted to version : [alpha-2]
|
# 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:
|
general:
|
||||||
success: "&aSuccess!"
|
success: "&aSuccess!"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# Cette traduction est adaptée pour la version : [alpha-2]
|
# 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:
|
general:
|
||||||
deaths: "morts"
|
deaths: "morts"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#
|
#
|
||||||
# This translation is adapted to version : [alpha-2]
|
# This translation is adapted to version : [alpha-2]
|
||||||
|
|
||||||
banner: "BANNER:1:WHITE:HALF_VERTICAL:RED"
|
banner: "WHITE_BANNER:1:HALF_VERTICAL:RED"
|
||||||
|
|
||||||
general:
|
general:
|
||||||
success: "&aSukces!"
|
success: "&aSukces!"
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# Banbeucmas: Người dịch bản YML gốc
|
# Banbeucmas: Người dịch bản YML gốc
|
||||||
# This translation is adapted to version : [alpha-2]
|
# 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:
|
general:
|
||||||
deaths: "Chết"
|
deaths: "Chết"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# DuckSoft: translator
|
# DuckSoft: translator
|
||||||
# This translation is adapted to version : [alpha-1]
|
# 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:
|
not-setup:
|
||||||
header: |-
|
header: |-
|
||||||
|
@ -214,8 +214,6 @@ public class ItemParserTest {
|
|||||||
assertEquals(2, result.getAmount());
|
assertEquals(2, result.getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Commenting out to get build to work
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseBannerThreeArgs() {
|
public void testParseBannerThreeArgs() {
|
||||||
// Germany
|
// Germany
|
||||||
@ -230,7 +228,7 @@ public class ItemParserTest {
|
|||||||
ItemParser.parse("RED_BANNER:1:STRIPE_RIGHT:BLACK:STRIPE_LEFT:YELLOW");
|
ItemParser.parse("RED_BANNER:1:STRIPE_RIGHT:BLACK:STRIPE_LEFT:YELLOW");
|
||||||
Mockito.verify(bannerMeta, Mockito.times(2)).addPattern(Mockito.any());
|
Mockito.verify(bannerMeta, Mockito.times(2)).addPattern(Mockito.any());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseBannerTooManyColons() {
|
public void testParseBannerTooManyColons() {
|
||||||
ItemStack result = ItemParser.parse("WHITE_BANNER:1:::::::::::::");
|
ItemStack result = ItemParser.parse("WHITE_BANNER:1:::::::::::::");
|
||||||
|
Loading…
Reference in New Issue
Block a user