Fix to fire Island events after an island is created.

Events were firing too early before the island had been fully pasted
async.
This commit is contained in:
tastybento 2019-01-03 10:24:50 -08:00
parent 8452a080f7
commit 2713f58ac5

View File

@ -172,6 +172,25 @@ public class NewIsland {
// Delete the old island
plugin.getIslands().deleteIsland(oldIsland, true);
}
// Fire exit event
Reason reasonDone = Reason.CREATED;
switch (reason) {
case CREATE:
reasonDone = Reason.CREATED;
break;
case RESET:
reasonDone = Reason.RESETTED;
break;
default:
break;
}
IslandEvent.builder()
.involvedPlayer(user.getUniqueId())
.reason(reasonDone)
.island(island)
.location(island.getCenter())
.build();
});
// Make nether island
if (plugin.getIWM().isNetherGenerate(world) && plugin.getIWM().isNetherIslands(world) && plugin.getIWM().getNetherWorld(world) != null) {
@ -186,25 +205,6 @@ public class NewIsland {
// Set default settings
island.setFlagsDefaults();
// Fire exit event
Reason reasonDone = Reason.CREATED;
switch (reason) {
case CREATE:
reasonDone = Reason.CREATED;
break;
case RESET:
reasonDone = Reason.RESETTED;
break;
default:
break;
}
IslandEvent.builder()
.involvedPlayer(user.getUniqueId())
.reason(reasonDone)
.island(island)
.location(island.getCenter())
.build();
}
/**