Don't use getPlayerOrException in CarpetScriptHost

This commit is contained in:
altrisi committed 2023-06-26 18:33:20 +02:00
1 parent a8fedc37e4
commit 177179b70a
1 file changed
+3 -11
@@ -675,12 +675,8 @@ public class CarpetScriptHost extends ScriptHost
return this; return this;
} }
// user based // user based
ServerPlayer player; ServerPlayer player = source.getPlayer();
try if (player == null)
{
player = source.getPlayerOrException();
}
catch (CommandSyntaxException ignored)
{ {
throw new SimpleCommandExceptionType(Component.literal("Cannot run player based apps without the player context")).create(); throw new SimpleCommandExceptionType(Component.literal("Cannot run player based apps without the player context")).create();
} }
@@ -1057,11 +1053,7 @@ public class CarpetScriptHost extends ScriptHost
responsibleSource = source; responsibleSource = source;
errorSnooper = (expr, /*Nullable*/ token, ctx, message) -> errorSnooper = (expr, /*Nullable*/ token, ctx, message) ->
{ {
try if (!source.isPlayer())
{
source.getPlayerOrException();
}
catch (CommandSyntaxException e)
{ {
return null; return null;
} }