Skip to content

Commit

Permalink
Release 4.0.3 - SpongeAPI 4.0.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mbax committed Mar 8, 2016
1 parent 68dbf24 commit 814cb6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<artifactId>vanish</artifactId>

<name>Vanish</name>
<version>4.0.2</version>
<version>4.0.3</version>

<url>http://kitteh.org/</url>
<properties>
Expand Down Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>4.0.0</version>
<type>jar</type>
<optional>true</optional>
<scope>provided</scope>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kitteh/vanish/Vanish.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**
* Spiritual successor to VanishNoPacket, for Sponge.
*/
@Plugin(id = "Vanish", name = "Vanish", version = "4.0.2")
@Plugin(id = "org.kitteh.vanish", name = "Vanish", version = "4.0.3")
public class Vanish {
public static final String PERMISSION_VANISH = "vanish.vanish";

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/kitteh/vanish/VanishCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public CommandResult execute(@Nonnull CommandSource commandSource, @Nonnull Comm
for (int i = 0; i < 10; i++) {
location.getExtent().createEntity(EntityTypes.BAT, location.getPosition()).ifPresent(bat -> {
bats.add(bat);
location.getExtent().spawnEntity(bat, Cause.of(bat)); // TODO actual causes once SpongeDocs match SpongeReality
bat.offer(Keys.INVULNERABILITY, LIFE_TICKS);
location.getExtent().spawnEntity(bat, Cause.builder().owner(this.plugin).build()); // TODO Am I doing this right?

This comment has been minimized.

Copy link
@gabizou

gabizou Mar 9, 2016

You'll need a 'SpawnCause' as the root of the cause, but yes otherwise you are doing it right.

This comment has been minimized.

Copy link
@mbax

mbax Mar 9, 2016

Author Member

How might I do that?

This comment has been minimized.

Copy link
@TheMolkaPL

TheMolkaPL Mar 9, 2016

Cause.Builder builder = Cause.builder().from(SpawnCause.builder().type(spawn type here));

https://jd.spongepowered.org/4.0.3/org/spongepowered/api/event/cause/entity/spawn/SpawnType.html

I'm not sure about this.

This comment has been minimized.

Copy link
@gabizou

gabizou Mar 9, 2016

Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).named(NamedCause.OWNER, this.plugin).build()

This comment has been minimized.

Copy link
@mbax

mbax Mar 9, 2016

Author Member

Is there a difference between calling builder.named(NamedCause.OWNER, this.plugin) and builder.owner(this.plugin)?

This comment has been minimized.

Copy link
@gabizou

gabizou Mar 9, 2016

Nope.

This comment has been minimized.

Copy link
@mbax

mbax Mar 9, 2016

Author Member

Thanks for all the helpings :)

Are Causes or SpawnCauses mutable? I don't see anything in the API suggesting mutability and all the methods returning Causes create a new one. I just figure it's environmentally friendly to create this cause just once if possible.

This comment has been minimized.

Copy link
@gabizou

gabizou Mar 9, 2016

Cause and SpawnCause are immutable in all senses. You can however create a singular Cause and recycle the use of that cause for every bat spawn to spawn.

bat.offer(Keys.INVULNERABILITY_TICKS, LIFE_TICKS);
});
}
// TODO remove on shutdown too!
Expand Down

0 comments on commit 814cb6d

Please sign in to comment.