@@ -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