Explorar el Código

Players moving to a blacklisted world will have scoreboards removed

Robert Chapton hace 5 años
padre
commit
665a31fc85
Se han modificado 2 ficheros con 13 adiciones y 1 borrados
  1. 3 0
      Changelog.txt
  2. 10 1
      src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

+ 3 - 0
Changelog.txt

@@ -1,3 +1,6 @@
+Version 2.1.102
+    Scoreboards will now be removed from players who teleport to a blacklisted world
+
 Version 2.1.101
     Fixed an exploit where chorus plants could be used to gain automatic XP
     Added blast furnace, cartography table, grindstone, lectern, loom, scaffolding, smoker, stonecutter, and sweet berry bush to the list of internal blocks that don't trigger tool readying

+ 10 - 1
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -27,6 +27,7 @@ import com.gmail.nossr50.skills.salvage.SalvageManager;
 import com.gmail.nossr50.skills.taming.TamingManager;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.player.UserManager;
+import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
 import com.gmail.nossr50.util.skills.RankUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.sounds.SoundManager;
@@ -69,8 +70,16 @@ public class PlayerListener implements Listener {
     @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
     public void onPlayerTeleport(PlayerTeleportEvent event) {
         /* WORLD BLACKLIST CHECK */
-        if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
+        if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
+            //Remove scoreboards
+            ScoreboardManager.teardownPlayer(event.getPlayer());
             return;
+        } else if(WorldBlacklist.isWorldBlacklisted(event.getFrom().getWorld())) {
+            //This only fires if they are traveling to a non-blacklisted world from a blacklisted world
+
+            //Setup scoreboards
+            ScoreboardManager.setupPlayer(event.getPlayer());
+        }
 
         Player player = event.getPlayer();