Don't use getPlayerOrException in CarpetScriptHost
This commit is contained in:
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user