@@ -113,7 +113,11 @@ public final MethodResult sendFormattedMessage(@NotNull IArguments arguments) th
113113 if (checkBrackets (arguments .optString (2 )))
114114 return MethodResult .of (null , "incorrect bracket string (e.g. [], {}, <>, ...)" );
115115
116- MutableComponent preparedMessage = appendPrefix (arguments .optString (1 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()), arguments .optString (2 , "[]" ), arguments .optString (3 , "" )).append (component );
116+ MutableComponent preparedMessage = appendPrefix (
117+ arguments .optString (1 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()),
118+ arguments .optString (2 , "[]" ),
119+ arguments .optString (3 , "" ).replaceAll ("&" , "\u00a7 " )
120+ ).append (component );
117121 for (ServerPlayer player : ServerLifecycleHooks .getCurrentServer ().getPlayerList ().getPlayers ()) {
118122 if (!APConfig .PERIPHERALS_CONFIG .chatBoxMultiDimensional .get () && player .getLevel ().dimension () != dimension )
119123 continue ;
@@ -135,7 +139,11 @@ public final MethodResult sendMessage(@NotNull IArguments arguments) throws LuaE
135139 if (checkBrackets (arguments .optString (2 )))
136140 return MethodResult .of (null , "incorrect bracket string (e.g. [], {}, <>, ...)" );
137141
138- MutableComponent preparedMessage = appendPrefix (arguments .optString (1 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()), arguments .optString (2 , "[]" ), arguments .optString (3 , "" )).append (message );
142+ MutableComponent preparedMessage = appendPrefix (
143+ arguments .optString (1 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()),
144+ arguments .optString (2 , "[]" ),
145+ arguments .optString (3 , "" ).replaceAll ("&" , "\u00a7 " )
146+ ).append (message );
139147 for (ServerPlayer player : ServerLifecycleHooks .getCurrentServer ().getPlayerList ().getPlayers ()) {
140148 if (!APConfig .PERIPHERALS_CONFIG .chatBoxMultiDimensional .get () && player .getLevel ().dimension () != dimension )
141149 continue ;
@@ -152,7 +160,7 @@ public final MethodResult sendFormattedMessageToPlayer(@NotNull IArguments argum
152160 String message = arguments .getString (0 );
153161 String playerName = arguments .getString (1 );
154162 int maxRange = APConfig .PERIPHERALS_CONFIG .chatBoxMaxRange .get ();
155- int range = arguments .optInt (4 , maxRange );
163+ int range = arguments .optInt (5 , maxRange );
156164 range = maxRange == -1 ? range : Math .min (range , APConfig .PERIPHERALS_CONFIG .chatBoxMaxRange .get ());
157165 ResourceKey <Level > dimension = getLevel ().dimension ();
158166 ServerPlayer player = getPlayer (playerName );
@@ -166,7 +174,11 @@ public final MethodResult sendFormattedMessageToPlayer(@NotNull IArguments argum
166174 if (checkBrackets (arguments .optString (3 )))
167175 return MethodResult .of (null , "incorrect bracket string (e.g. [], {}, <>, ...)" );
168176
169- MutableComponent preparedMessage = appendPrefix (arguments .optString (2 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()), arguments .optString (3 , "[]" ), arguments .optString (4 , "" )).append (component );
177+ MutableComponent preparedMessage = appendPrefix (
178+ arguments .optString (2 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()),
179+ arguments .optString (3 , "[]" ),
180+ arguments .optString (4 , "" ).replaceAll ("&" , "\u00a7 " )
181+ ).append (component );
170182 if (!APConfig .PERIPHERALS_CONFIG .chatBoxMultiDimensional .get () && player .getLevel ().dimension () != dimension )
171183 return MethodResult .of (false , "NOT_SAME_DIMENSION" );
172184
@@ -182,7 +194,7 @@ public final MethodResult sendMessageToPlayer(@NotNull IArguments arguments) thr
182194 String message = arguments .getString (0 );
183195 String playerName = arguments .getString (1 );
184196 int maxRange = APConfig .PERIPHERALS_CONFIG .chatBoxMaxRange .get ();
185- int range = arguments .optInt (4 , maxRange );
197+ int range = arguments .optInt (5 , maxRange );
186198 range = maxRange == -1 ? range : Math .min (range , APConfig .PERIPHERALS_CONFIG .chatBoxMaxRange .get ());
187199 ResourceKey <Level > dimension = getLevel ().dimension ();
188200 ServerPlayer player = getPlayer (playerName );
@@ -192,7 +204,11 @@ public final MethodResult sendMessageToPlayer(@NotNull IArguments arguments) thr
192204 if (checkBrackets (arguments .optString (3 )))
193205 return MethodResult .of (null , "incorrect bracket string (e.g. [], {}, <>, ...)" );
194206
195- MutableComponent preparedMessage = appendPrefix (arguments .optString (2 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()), arguments .optString (3 , "[]" ), arguments .optString (4 , "" )).append (message );
207+ MutableComponent preparedMessage = appendPrefix (
208+ arguments .optString (2 , APConfig .PERIPHERALS_CONFIG .defaultChatBoxPrefix .get ()),
209+ arguments .optString (3 , "[]" ),
210+ arguments .optString (4 , "" ).replaceAll ("&" , "\u00a7 " )
211+ ).append (message );
196212 if (!APConfig .PERIPHERALS_CONFIG .chatBoxMultiDimensional .get () && player .getLevel ().dimension () != dimension )
197213 return MethodResult .of (false , "NOT_SAME_DIMENSION" );
198214
0 commit comments