Updated Sponge worldedit to 1.12.1

Dieser Commit ist enthalten in:
Me4502 2017-09-17 16:41:39 +10:00
Ursprung 5c64cf2f56
Commit 354045acb9
7 geänderte Dateien mit 7 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -13,7 +13,7 @@ plugins {
dependencies { dependencies {
compile project(':worldedit-core') compile project(':worldedit-core')
compile 'org.spongepowered:spongeapi:6.0.0-SNAPSHOT' compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT'
testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1'
} }

Datei anzeigen

@ -25,6 +25,7 @@ import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.service.context.Contextual; import org.spongepowered.api.service.context.Contextual;
import org.spongepowered.api.service.permission.PermissionDescription; import org.spongepowered.api.service.permission.PermissionDescription;
import org.spongepowered.api.service.permission.PermissionService; import org.spongepowered.api.service.permission.PermissionService;
import org.spongepowered.api.service.permission.SubjectReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -36,15 +37,14 @@ public class SpongePermissionsProvider {
public void registerPermission(CommandCallable command, String permission) { public void registerPermission(CommandCallable command, String permission) {
Sponge.getGame().getServiceManager().getRegistration(PermissionService.class).ifPresent((permissionService -> { Sponge.getGame().getServiceManager().getRegistration(PermissionService.class).ifPresent((permissionService -> {
PermissionDescription.Builder permissionBuilder = permissionService.getProvider().newDescriptionBuilder(SpongeWorldEdit.inst()).get(); PermissionDescription.Builder permissionBuilder = permissionService.getProvider().newDescriptionBuilder(SpongeWorldEdit.inst());
permissionBuilder.id(permission).register(); permissionBuilder.id(permission).register();
})); }));
} }
public String[] getGroups(Player player) { public String[] getGroups(Player player) {
PermissionService permissionService = Sponge.getGame().getServiceManager().getRegistration(PermissionService.class).get().getProvider();
return player.getParents().stream() return player.getParents().stream()
.filter(subject -> subject.getContainingCollection().equals(permissionService.getGroupSubjects())) .map(SubjectReference::getSubjectIdentifier)
.map(Contextual::getIdentifier).collect(Collectors.toList()).toArray(new String[0]); .collect(Collectors.toList()).toArray(new String[0]);
} }
} }

Datei anzeigen

@ -43,10 +43,6 @@ import org.spongepowered.api.data.property.block.GroundLuminanceProperty;
import org.spongepowered.api.data.property.block.SkyLuminanceProperty; import org.spongepowered.api.data.property.block.SkyLuminanceProperty;
import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.entity.EntityType;
import org.spongepowered.api.entity.EntityTypes; import org.spongepowered.api.entity.EntityTypes;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.event.cause.NamedCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes;
import org.spongepowered.api.world.BlockChangeFlag; import org.spongepowered.api.world.BlockChangeFlag;
import org.spongepowered.api.world.World; import org.spongepowered.api.world.World;
@ -197,7 +193,7 @@ public abstract class SpongeWorld extends AbstractWorld {
); );
entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot()); entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot());
getWorld().spawnEntity(entity, ENTITY_SPAWN_CAUSE); getWorld().spawnEntity(entity);
} }
@Override @Override
@ -253,11 +249,6 @@ public abstract class SpongeWorld extends AbstractWorld {
protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data); protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data);
private static final Cause ENTITY_SPAWN_CAUSE = Cause
.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build())
.suggestNamed(NamedCause.SOURCE, SpongeWorldEdit.inst())
.build();
@Nullable @Nullable
@Override @Override
public Entity createEntity(Location location, BaseEntity entity) { public Entity createEntity(Location location, BaseEntity entity) {
@ -279,7 +270,7 @@ public abstract class SpongeWorld extends AbstractWorld {
new Vector3d(dir.getX(), dir.getY(), dir.getZ()) new Vector3d(dir.getX(), dir.getY(), dir.getZ())
); );
if (world.spawnEntity(newEnt, ENTITY_SPAWN_CAUSE)) { if (world.spawnEntity(newEnt)) {
return new SpongeEntity(newEnt); return new SpongeEntity(newEnt);
} }