From 22bd43f725add677c96a22ccd286f0d47d0fb8b8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 12 Jan 2018 08:17:44 +1100 Subject: [PATCH] Use root locale for upper / lowercasing --- .../net/md_5/bungee/chat/BaseComponentSerializer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java b/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java index 9aed9c56..7f647512 100644 --- a/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java +++ b/chat/src/main/java/net/md_5/bungee/chat/BaseComponentSerializer.java @@ -11,6 +11,7 @@ import net.md_5.bungee.api.chat.HoverEvent; import java.util.Arrays; import java.util.HashSet; +import java.util.Locale; public class BaseComponentSerializer { @@ -19,7 +20,7 @@ public class BaseComponentSerializer { if ( object.has( "color" ) ) { - component.setColor( ChatColor.valueOf( object.get( "color" ).getAsString().toUpperCase() ) ); + component.setColor( ChatColor.valueOf( object.get( "color" ).getAsString().toUpperCase( Locale.ROOT ) ) ); } if ( object.has( "bold" ) ) { @@ -55,7 +56,7 @@ public class BaseComponentSerializer { JsonObject event = object.getAsJsonObject( "clickEvent" ); component.setClickEvent( new ClickEvent( - ClickEvent.Action.valueOf( event.get( "action" ).getAsString().toUpperCase() ), + ClickEvent.Action.valueOf( event.get( "action" ).getAsString().toUpperCase( Locale.ROOT ) ), event.get( "value" ).getAsString() ) ); } if ( object.has( "hoverEvent" ) ) @@ -72,7 +73,7 @@ public class BaseComponentSerializer context.deserialize( event.get( "value" ), BaseComponent.class ) }; } - component.setHoverEvent( new HoverEvent( HoverEvent.Action.valueOf( event.get( "action" ).getAsString().toUpperCase() ), res ) ); + component.setHoverEvent( new HoverEvent( HoverEvent.Action.valueOf( event.get( "action" ).getAsString().toUpperCase( Locale.ROOT ) ), res ) ); } } @@ -126,14 +127,14 @@ public class BaseComponentSerializer if ( component.getClickEvent() != null ) { JsonObject clickEvent = new JsonObject(); - clickEvent.addProperty( "action", component.getClickEvent().getAction().toString().toLowerCase() ); + clickEvent.addProperty( "action", component.getClickEvent().getAction().toString().toLowerCase( Locale.ROOT ) ); clickEvent.addProperty( "value", component.getClickEvent().getValue() ); object.add( "clickEvent", clickEvent ); } if ( component.getHoverEvent() != null ) { JsonObject hoverEvent = new JsonObject(); - hoverEvent.addProperty( "action", component.getHoverEvent().getAction().toString().toLowerCase() ); + hoverEvent.addProperty( "action", component.getHoverEvent().getAction().toString().toLowerCase( Locale.ROOT ) ); hoverEvent.add( "value", context.serialize( component.getHoverEvent().getValue() ) ); object.add( "hoverEvent", hoverEvent ); }