[Scarpet] Added ability to cancel events (#1497)
* Added ability to cancel events * Made more events cancellable * Added event_priority to __config * Check for string values for performance * Made player_finishes_using_item cancellable * Made player_chooses_recipe cancellable * Made player_swaps_hands cancellable * Made player_message cancellable * Added __on_player_placing_block (#1498) * Added event to docs, keywords, event_test * Added docs for event cancellation
This commit is contained in:
1 parent
4bb4b557e5
commit
24b9c386ec
14 files changed
+243
-99
No files matched your search
@@ -75,6 +75,7 @@ public class CarpetScriptHost extends ScriptHost
|
||||
private Tag globalState;
|
||||
private int saveTimeout;
|
||||
public boolean persistenceRequired;
|
||||
public double eventPriority;
|
||||
|
||||
public Map<Value, Value> appConfig;
|
||||
public Map<String, CommandArgument> appArgTypes;
|
||||
@@ -298,6 +299,7 @@ public class CarpetScriptHost extends ScriptHost
|
||||
setPerPlayer(config.getOrDefault(new StringValue("scope"), new StringValue("player")).getString().equalsIgnoreCase("player"));
|
||||
persistenceRequired = config.getOrDefault(new StringValue("stay_loaded"), Value.TRUE).getBoolean();
|
||||
strict = config.getOrDefault(StringValue.of("strict"), Value.FALSE).getBoolean();
|
||||
eventPriority = config.getOrDefault(new StringValue("event_priority"), Value.ZERO).readDoubleNumber();
|
||||
// check requires
|
||||
Value loadRequirements = config.get(new StringValue("requires"));
|
||||
if (loadRequirements instanceof FunctionValue)
|
||||
|
||||
Reference in new issue
Block a user