1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-09 16:17:37 +02:00

Update for latest SpongeAPI & ModularFramework.

This commit is contained in:
Matthew Miller (Me4502)
2016-02-27 23:27:19 +10:00
parent 80a7f49379
commit 89f69b8a04
4 changed files with 18 additions and 19 deletions

View File

@@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
}
@@ -30,10 +30,10 @@ repositories {
}
dependencies {
compile 'org.spongepowered:spongeapi:2.1-SNAPSHOT'
compile 'org.spongepowered:spongeapi:3.1.0-SNAPSHOT'
compile 'com.google.guava:guava:18.0'
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.me4502:ModularFramework:1.2.1'
compile 'com.me4502:ModularFramework:1.3.0'
testCompile 'org.mockito:mockito-core:2.+'
testCompile 'junit:junit:4.+'
}

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip

View File

@@ -3,10 +3,11 @@ package org.mcess.essentials;
import com.google.inject.Inject;
import com.me4502.modularframework.ModuleController;
import com.me4502.modularframework.ShadedModularFramework;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.config.DefaultConfig;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.service.config.DefaultConfig;
import java.io.File;
@@ -19,14 +20,12 @@ public class Essentials {
@DefaultConfig(sharedRoot = false)
private File mainConfig;
private File configurationDirectory;
@Listener
public void onInitialize(GameStartedServerEvent event) {
moduleController = ShadedModularFramework.registerModuleController(this, event.getGame());
moduleController = ShadedModularFramework.registerModuleController(this, Sponge.getGame());
configurationDirectory = new File(mainConfig.getParent(), "modules");
File configurationDirectory = new File(mainConfig.getParent(), "modules");
configurationDirectory.mkdir();
moduleController.setConfigurationDirectory(configurationDirectory);

View File

@@ -1,30 +1,30 @@
package org.mcess.essentials.modules;
import com.me4502.modularframework.module.Module;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.util.command.CommandException;
import org.spongepowered.api.util.command.CommandResult;
import org.spongepowered.api.util.command.CommandSource;
import org.spongepowered.api.util.command.args.CommandContext;
import org.spongepowered.api.util.command.spec.CommandExecutor;
import org.spongepowered.api.util.command.spec.CommandSpec;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandExecutor;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.text.Text;
@Module(moduleName = "Teleport", onEnable = "onInitialize")
public class Teleport {
public void onInitialize() {
CommandSpec myCommandSpec = CommandSpec.builder()
.description(Texts.of("Teleport to a player"))
.description(Text.of("Teleport to a player"))
.permission("essentials.teleport")
.executor(new TeleportCommand())
.build();
}
private class TeleportCommand implements CommandExecutor {
private static class TeleportCommand implements CommandExecutor {
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
return null;
return CommandResult.success();
}
}
}