Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 02:50:05 +01:00
Add support for delegating permissions to Sponge.
When Sponge is not installed, behaviour is as before. Closes #331
Dieser Commit ist enthalten in:
Ursprung
0d5c115e4d
Commit
aa3a2d4764
@ -55,6 +55,7 @@
|
||||
<allow pkg="org.apache.logging.log4j"/>
|
||||
<allow pkg="org.lwjgl"/>
|
||||
<allow pkg="io.netty.buffer"/>
|
||||
<allow pkg="org.spongepowered.api" />
|
||||
</subpackage>
|
||||
</subpackage>
|
||||
</import-control>
|
||||
|
@ -15,9 +15,14 @@ apply plugin: 'forge'
|
||||
|
||||
dependencies {
|
||||
compile project(':worldedit-core')
|
||||
compile 'org.spongepowered:spongeapi:2.1-SNAPSHOT'
|
||||
testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url ="https://repo.spongepowered.org/maven" }
|
||||
}
|
||||
|
||||
minecraft {
|
||||
ext.forgeVersion = "11.14.0.1281"
|
||||
version = "1.8-$forgeVersion-1.8"
|
||||
@ -31,7 +36,7 @@ project.archivesBaseName = "${project.archivesBaseName}-mc${minecraft.version}"
|
||||
processResources {
|
||||
from (sourceSets.main.resources.srcDirs) {
|
||||
expand 'version': project.version,
|
||||
'mcVersion': project.minecraft.version,
|
||||
'mcVersion': project.minecraft.version,
|
||||
'forgeVersion': project.minecraft.forgeVersion,
|
||||
'internalVersion': project.internalVersion
|
||||
include 'mcmod.info'
|
||||
|
@ -23,6 +23,7 @@ import net.minecraft.command.ICommand;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
|
||||
public interface ForgePermissionsProvider {
|
||||
|
||||
@ -49,4 +50,17 @@ public interface ForgePermissionsProvider {
|
||||
@Override
|
||||
public void registerPermission(ICommand command, String permission) {}
|
||||
}
|
||||
|
||||
public static class SpongePermissionsProvider implements ForgePermissionsProvider {
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayerMP player, String permission) {
|
||||
return ((Player) player).hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPermission(ICommand command, String permission) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.CommandEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
@ -60,7 +61,7 @@ import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
/**
|
||||
* The Forge implementation of WorldEdit.
|
||||
*/
|
||||
@Mod(modid = ForgeWorldEdit.MOD_ID, name = "WorldEdit", version = "%VERSION%", acceptableRemoteVersions = "*")
|
||||
@Mod(modid = ForgeWorldEdit.MOD_ID, name = "WorldEdit", version = "%VERSION%", acceptableRemoteVersions = "*", dependencies = "after:Sponge")
|
||||
public class ForgeWorldEdit {
|
||||
|
||||
public static Logger logger;
|
||||
@ -116,7 +117,12 @@ public class ForgeWorldEdit {
|
||||
this.platform = new ForgePlatform(this);
|
||||
|
||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||
this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform);
|
||||
|
||||
if (Loader.isModLoaded("Sponge")) {
|
||||
this.provider = new ForgePermissionsProvider.SpongePermissionsProvider();
|
||||
} else {
|
||||
this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren