mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-13 14:48:34 +00:00
Scattercommand should use the same editsession for all commands, make it "silent" by default and allow players to see output if wanted.
This commit is contained in:
@ -795,7 +795,8 @@ public final class PlatformCommandManager {
|
||||
}
|
||||
Optional<EditSession> editSessionOpt = context.injectedValue(Key.of(EditSession.class));
|
||||
|
||||
if (editSessionOpt.isPresent()) {
|
||||
// Require null CommandEvent#getSession as it means the editsession is being handled somewhere else.
|
||||
if (editSessionOpt.isPresent() && event.getSession() == null) {
|
||||
EditSession editSession = editSessionOpt.get();
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
@ -866,6 +867,14 @@ public final class PlatformCommandManager {
|
||||
store.injectValue(Key.of(boolean.class), context -> Optional.of(isSuggestions));
|
||||
store.injectValue(Key.of(InjectedValueStore.class), ValueProvider.constant(store));
|
||||
store.injectValue(Key.of(Event.class), ValueProvider.constant(event));
|
||||
//FAWE start - allow giving editsessions
|
||||
if (event instanceof CommandEvent) {
|
||||
EditSession session = ((CommandEvent) event).getSession();
|
||||
if (session != null) {
|
||||
store.injectValue(Key.of(EditSession.class), context -> Optional.of(session));
|
||||
}
|
||||
}
|
||||
//FAWE end
|
||||
return MemoizingValueAccess.wrap(
|
||||
MergedValueAccess.of(store, globalInjectedValues)
|
||||
);
|
||||
|
Reference in New Issue
Block a user