Skip to content

Commit 8c298c9

Browse files
Bump version number and clean up code. Also add saving on disable.
1 parent b8e0e5f commit 8c298c9

3 files changed

Lines changed: 74 additions & 48 deletions

File tree

.idea/workspace.xml

Lines changed: 72 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.bitlimit.NPCs</groupId>
99
<artifactId>NPCs</artifactId>
10-
<version>0.6.0</version>
10+
<version>0.6.1</version>
1111
<name>NPCs</name>
1212
<description>Non-playing characters.</description>
1313

src/main/java/com/bitlimit/NPCs/NPCs.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,12 @@ public class NPCs extends JavaPlugin implements Listener {
2222
@Override
2323
public void onEnable() {
2424
try {
25-
// this.manager = RemoteEntities.createManager(this);
26-
// this.manager.setEntitySerializer(new YMLSerializer(this));
27-
// this.manager.saveEntities();
28-
//
29-
// this.manager.setSaveOnDisable(true);
30-
// this.manager.loadEntities();
31-
3225
this.manager = RemoteEntities.createManager(this);
3326

34-
//First we register the serializer that should be used
35-
//In this case we use the YML serializer, but you can also use your own as well as the json serializer
3627
this.manager.setEntitySerializer(new YMLSerializer(this));
37-
//To load the entities we saved, you can just do this:
28+
this.manager.setSaveOnDisable(true);
3829
this.manager.loadEntities();
39-
40-
//If we want to save all current entities, it's pretty easy:
41-
// this.manager.saveEntities();
42-
//
43-
// //Some serializers allow single entities to be saved, i.e. the YML serializer
44-
// //But first, we need to create an entitiy.
45-
// RemoteEntity entity = this.manager.createNamedEntity(RemoteEntityType.Human, Bukkit.getWorld("world").getSpawnLocation(), "Smith");
46-
// //Now we can just call the save method. Keep in mind that it will not work when the serializer doesn't support single entity serialization
47-
// entity.save();
48-
49-
//Now all the entities should be back like you never removed them
5030
} catch (Exception e) {
51-
this.manager = null;
5231
e.printStackTrace();
5332
}
5433

@@ -78,7 +57,6 @@ public void saveData() {
7857

7958
@EventHandler
8059
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
81-
8260
if (!(event.getEntity() instanceof LivingEntity)) {
8361
return;
8462
}

0 commit comments

Comments
 (0)