Skip to content

Commit 55f270a

Browse files
committed
initial work on api migration 7 => 8
1 parent 17aea0b commit 55f270a

26 files changed

Lines changed: 195 additions & 107 deletions

File tree

api-jvm-impl/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
dependencies {
33
api project(':api-jvm')
4-
implementation 'ch.vorburger.minecraft.osgi:api:1.0.0'
54
implementation('com.spotify:futures-extra:4.0.0') {
65
exclude group: 'com.google.guava'
76
}

api-jvm-impl/src/main/java/ch/vorburger/minecraft/storeys/japi/impl/Scripts.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package ch.vorburger.minecraft.storeys.japi.impl;
2020

21-
import ch.vorburger.minecraft.osgi.api.PluginInstance;
2221
import ch.vorburger.minecraft.storeys.japi.Script;
2322
import ch.vorburger.minecraft.storeys.japi.impl.events.EventService;
2423
import java.util.Collection;

api-jvm-impl/src/main/java/ch/vorburger/minecraft/storeys/japi/impl/actions/ActionContextImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020

2121
import ch.vorburger.minecraft.storeys.japi.ActionContext;
2222
import ch.vorburger.minecraft.storeys.japi.ReadingSpeed;
23-
import org.spongepowered.api.command.CommandSource;
23+
import org.spongepowered.api.command.CommandCause;
2424

2525
public final class ActionContextImpl implements ActionContext {
2626

27-
private final CommandSource commandSource;
27+
private final CommandCause commandSource;
2828
private final ReadingSpeed readingSpeed;
2929

30-
public ActionContextImpl(CommandSource commandSource, ReadingSpeed readingSpeed) {
30+
public ActionContextImpl(CommandCause commandSource, ReadingSpeed readingSpeed) {
3131
super();
3232
this.commandSource = commandSource;
3333
this.readingSpeed = readingSpeed;
3434
}
3535

36-
public CommandSource getCommandSource() {
36+
public CommandCause getCommandCause() {
3737
return commandSource;
3838
}
3939

api-jvm-impl/src/main/java/ch/vorburger/minecraft/storeys/japi/impl/actions/CommandAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public CommandAction setCommand(String commandLine) {
5656
}
5757

5858
@Override protected CommandResult executeInMainThread(ActionContext context) throws ActionException {
59-
CommandResult result = Sponge.getCommandManager().process(context.getCommandSource(),
59+
CommandResult result = Sponge.getCommandManager().process(context.getCommandCause(),
6060
requireNonNull(commandLineWithoutSlash, "commandLineWithoutSlash"));
61-
LOG.info("processed command \"/{}\" from source {} with result {}", commandLineWithoutSlash, context.getCommandSource(),
61+
LOG.info("processed command \"/{}\" from source {} with result {}", commandLineWithoutSlash, context.getCommandCause(),
6262
toString(result));
6363
return result;
6464
}

api-jvm-impl/src/main/java/ch/vorburger/minecraft/storeys/japi/impl/actions/NarrateAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public NarrateAction setEntity(String entityName) {
5555
}
5656

5757
@Override public CompletionStage<Void> execute(ActionContext context) {
58-
Locatable locatable = (Locatable) context.getCommandSource();
58+
Locatable locatable = (Locatable) context.getCommandCause();
5959
World world = locatable.getWorld();
6060

6161
return narrator.narrate(world, requireNonNull(entityName, "entityName"), getText().toPlain(), context.getReadingSpeed());

api-jvm-impl/src/main/java/ch/vorburger/minecraft/storeys/japi/impl/actions/TitleAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class TitleAction extends TextAction<Void> {
6161
int msToRead = context.getReadingSpeed().msToRead(bothTexts) + FADE_IN_MS + FADE_OUT_MS;
6262

6363
return actionWaitHelper.executeAndWait(msToRead, () -> {
64-
CommandSource commandSource = context.getCommandSource();
64+
CommandSource commandSource = context.getCommandCause();
6565
if (commandSource instanceof Viewer) {
6666
Viewer srcAsViewer = (Viewer) commandSource;
6767

api-jvm-impl/src/main/java/ch/vorburger/minecraft/storeys/japi/impl/events/EventService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package ch.vorburger.minecraft.storeys.japi.impl.events;
2020

21-
import ch.vorburger.minecraft.osgi.api.PluginInstance;
2221
import ch.vorburger.minecraft.storeys.japi.PlayerInsideEvent;
2322
import ch.vorburger.minecraft.storeys.japi.impl.Unregisterable;
2423
import java.util.Collection;
@@ -39,6 +38,7 @@
3938
import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent;
4039
import org.spongepowered.api.event.network.ClientConnectionEvent.Join;
4140
import org.spongepowered.api.text.Text;
41+
import org.spongepowered.plugin.PluginContainer;
4242

4343
@Singleton public class EventService implements AutoCloseable {
4444

@@ -56,8 +56,8 @@
5656
}
5757

5858
// @Inject PluginInstance cannot work, so we use explicit "setter injection"
59-
public void setPluginInstance(PluginInstance plugin) {
60-
eventManager.registerListeners(plugin, this);
59+
public void setPluginContainer(PluginContainer pluginContainer) {
60+
eventManager.registerListeners(pluginContainer, this);
6161
// TODO InteractItemEvent ?
6262
}
6363

api-jvm/src/main/java/ch/vorburger/minecraft/storeys/japi/ActionContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
*/
1919
package ch.vorburger.minecraft.storeys.japi;
2020

21-
import org.spongepowered.api.command.CommandSource;
21+
import org.spongepowered.api.command.CommandCause;
2222

2323
public interface ActionContext {
2424

25-
CommandSource getCommandSource();
25+
CommandCause getCommandCause();
2626

2727
ReadingSpeed getReadingSpeed();
2828
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ subprojects {
5959
// errorprone 'com.google.errorprone:error_prone_core:2.3.1'
6060
// implementation 'com.google.errorprone:error_prone_annotations:2.3.1'
6161

62-
implementation('org.spongepowered:spongeapi:7.3.0') {
62+
implementation('org.spongepowered:spongeapi:8.1.0') {
6363
exclude group: 'com.google.guava'
6464
exclude group: 'com.google.inject'
6565
exclude group: 'com.google.code.gson'

storeys/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ repositories {
66

77
dependencies {
88
api project(':api-jvm-impl')
9-
api 'ch.vorburger.minecraft.osgi:api:1.0.0'
109
implementation 'ch.vorburger:fswatch:1.3.0'
1110

1211
implementation project(':example')

0 commit comments

Comments
 (0)