Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
79 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
main/src/main/java/net/citizensnpcs/trait/PaintingTrait.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package net.citizensnpcs.trait; | ||
|
||
import org.bukkit.Art; | ||
import org.bukkit.entity.Painting; | ||
|
||
import net.citizensnpcs.api.persistence.Persist; | ||
import net.citizensnpcs.api.trait.Trait; | ||
import net.citizensnpcs.api.trait.TraitName; | ||
|
||
/** | ||
* Persists {@link Painting} metadata. | ||
*/ | ||
@TraitName("paintingtrait") | ||
public class PaintingTrait extends Trait { | ||
@Persist("art") | ||
private Art art; | ||
|
||
public PaintingTrait() { | ||
super("paintingtrait"); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
if (!(npc.getEntity() instanceof Painting)) | ||
return; | ||
Painting painting = (Painting) npc.getEntity(); | ||
if (art != null) { | ||
painting.setArt(art); | ||
} | ||
} | ||
|
||
/** | ||
* @see Painting#setArt(Art) | ||
*/ | ||
public void setArt(Art art) { | ||
this.art = art; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters