Permalink
Browse files

Updated Sponge worldedit to 1.12.1

  • Loading branch information...
me4502 committed Sep 17, 2017
1 parent 5c64cf2 commit 354045acb9d55f8b96fa0d204f05952db53eacff
@@ -13,7 +13,7 @@ plugins {
dependencies {
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'
}
@@ -25,6 +25,7 @@
import org.spongepowered.api.service.context.Contextual;
import org.spongepowered.api.service.permission.PermissionDescription;
import org.spongepowered.api.service.permission.PermissionService;
import org.spongepowered.api.service.permission.SubjectReference;
import java.util.stream.Collectors;
@@ -36,15 +37,14 @@ public boolean hasPermission(Player player, String permission) {
public void registerPermission(CommandCallable command, String permission) {
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();
}));
}
public String[] getGroups(Player player) {
PermissionService permissionService = Sponge.getGame().getServiceManager().getRegistration(PermissionService.class).get().getProvider();
return player.getParents().stream()
.filter(subject -> subject.getContainingCollection().equals(permissionService.getGroupSubjects()))
.map(Contextual::getIdentifier).collect(Collectors.toList()).toArray(new String[0]);
.map(SubjectReference::getSubjectIdentifier)
.collect(Collectors.toList()).toArray(new String[0]);
}
}
@@ -43,10 +43,6 @@
import org.spongepowered.api.data.property.block.SkyLuminanceProperty;
import org.spongepowered.api.entity.EntityType;
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.World;
@@ -197,7 +193,7 @@ public void dropItem(Vector position, BaseItemStack item) {
);
entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot());
getWorld().spawnEntity(entity, ENTITY_SPAWN_CAUSE);
getWorld().spawnEntity(entity);
}
@Override
@@ -253,11 +249,6 @@ public boolean equals(Object o) {
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
@Override
public Entity createEntity(Location location, BaseEntity entity) {
@@ -279,7 +270,7 @@ public Entity createEntity(Location location, BaseEntity entity) {
new Vector3d(dir.getX(), dir.getY(), dir.getZ())
);
if (world.spawnEntity(newEnt, ENTITY_SPAWN_CAUSE)) {
if (world.spawnEntity(newEnt)) {
return new SpongeEntity(newEnt);
}

0 comments on commit 354045a

Please sign in to comment.