Skip to content

Commit

Permalink
Avoid announcing advancements when going to nether or end and back.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Feb 19, 2021
1 parent 7548c42 commit f833978
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import com.wasteofplastic.invswitcher.InvSwitcher;

import world.bentobox.bentobox.util.Util;

/**
* Handles all teleportation events, e.g., player teleporting into world
*
Expand All @@ -32,7 +34,9 @@ public PlayerListener(InvSwitcher addon) {
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled=true)
public void onWorldEnter(final PlayerChangedWorldEvent event) {
addon.getStore().getInventory(event.getPlayer(), event.getPlayer().getWorld());
if (!Util.sameWorld(event.getPlayer().getWorld(), event.getFrom())) {
addon.getStore().getInventory(event.getPlayer(), event.getPlayer().getWorld());
}
}

/**
Expand All @@ -41,7 +45,9 @@ public void onWorldEnter(final PlayerChangedWorldEvent event) {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onWorldExit(final PlayerChangedWorldEvent event) {
addon.getStore().storeInventory(event.getPlayer(), event.getFrom());
if (!Util.sameWorld(event.getPlayer().getWorld(), event.getFrom())) {
addon.getStore().storeInventory(event.getPlayer(), event.getFrom());
}
}


Expand Down

0 comments on commit f833978

Please sign in to comment.