Skip to content

Commit

Permalink
Do not call getViewer() on open in shared contexts (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
DevNatan authored Dec 1, 2023
1 parent abb7508 commit 12a80ca
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 26 deletions.
7 changes: 0 additions & 7 deletions inventory-framework-anvil-input/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ plugins {
apply from: '../library.gradle'
apply from: '../publish.gradle'

repositories {
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }

}

dependencies {
compileOnly libs.spigot
compileOnlyApi projects.inventoryFrameworkPlatformBukkit
Expand Down
6 changes: 0 additions & 6 deletions inventory-framework-platform-bukkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ plugins {
apply from: '../library.gradle'
apply from: '../publish.gradle'

repositories {
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
api projects.inventoryFrameworkPlatform
runtimeOnly projects.inventoryFrameworkAnvilInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,26 @@ IFRenderContext createRenderContext(IFOpenContext openContext) {
ViewContainer createdContainer = openContext.getContainer();
if (createdContainer == null) createdContainer = elementFactory.createContainer(openContext);

final IFRenderContext context = elementFactory.createRenderContext(
final IFRenderContext renderContext = elementFactory.createRenderContext(
openContext.getId(),
root,
openContext.getConfig(),
createdContainer,
new HashMap<>(),
openContext.getViewer(),
openContext.isShared() ? null : openContext.getViewer(),
openContext.getInitialData());

context.setEndless(openContext.isEndless());
openContext.getStateValues().forEach(context::initializeState);
renderContext.setEndless(openContext.isEndless());
openContext.getStateValues().forEach(renderContext::initializeState);

for (final Viewer viewer : openContext.getIndexedViewers().values()) {
if (!viewer.isTransitioning()) viewer.setActiveContext(context);
if (!viewer.isTransitioning()) viewer.setActiveContext(renderContext);
// TODO Pass viewer object as parameter instead
root.onViewerAdded(context, viewer.getPlatformInstance(), context.getInitialData());
context.addViewer(viewer);
root.onViewerAdded(renderContext, viewer.getPlatformInstance(), renderContext.getInitialData());
renderContext.addViewer(viewer);
}

context.setActive(true);
return context;
renderContext.setActive(true);
return renderContext;
}
}
4 changes: 0 additions & 4 deletions library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ apply plugin: 'com.diffplug.spotless'
group rootProject.group
version rootProject.version

repositories {
mavenCentral()
}

dependencies {
compileOnly libs.jetbrains.annotations
testCompileOnly libs.jetbrains.annotations
Expand Down
11 changes: 11 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
buildscript {
dependencyResolutionManagement {
repositories {
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://repo.papermc.io/repository/maven-public/' }
}
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
Expand Down

0 comments on commit 12a80ca

Please sign in to comment.