1.8-ONLY local cache issue with filled_map render

Discussion in 'Plugin Development' started by Fuizziy, Jul 9, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    Fuizziy

    Dear community,

    I am asking for quite a technical bit of help here. I am working with MapRenderers, and doing a basic 1.8 plugin for my 1.8 ONLY server (consider no protocol hack plugin being used, since the issue is happening even after uninstalling it), that shows to a player the location where he can run away from the danger.

    Here is the renderer class: https://pastebin.com/6ihGG7sL

    And here is the way I give the map to the player :


    Code:
    Code (Java):
    
       public ItemStack getMap(Player player) {
           MapView view = Bukkit.createMap(player.getWorld());
    
           for(MapRenderer r : view.getRenderers()) {
               view.removeRenderer(r);
           }
           view.addRenderer(new AreaRenderer(endPoint));
    
           ItemStack map = new ItemStack(Material.MAP);
           map.setDurability(view.getId());
    
           ItemMeta im = map.getItemMeta();
           im.setDisplayName(ChatColor.GREEN + "Carte de survie");
           im.setLore(Arrays.asList(ChatColor.GRAY + "T'indique l'emplacement de la",
                   ChatColor.GRAY + "safezone, là où la corruption",
                   ChatColor.GRAY + "ne t'atteindra pas"));
           map.setItemMeta(im);
           return map;
       }
    
    
    As you can see, the code itself works well :
    Image (open)

    upload_2020-7-9_10-0-33.png




    The only issue, though, is that when the server restarts and reinitialize the world (hence the players data remotely) with a rough rm -rf <map-folder> && cp -r <clean-map> <map-folder>, players getting a fresh new generated map with the same damagedAmount that they had before have it frozen. The cursor isn't moving, like the renderer isn't rendering anymore. There is no server-side error, nor client-side error.

    Disconnecting from the Minecraft client solve the issue (but I won't ask my players to do it at the beginning of each game haha..), and getting a map with another damaged value than the previous one solve it too (but the only mean to give a defined "N" damaged value to the map is to create "N" MapView before, which is not a solution).

    ----------------

    The main reason that comes to my mind is:
    Minecraft is somehow caching locally player's serverside data, which is useful for resource packs and, probably... custom maps, since they can include very large 128*128p buffered image *optimization intensifies*. And the fact that the world's cache is cleared before the start of every game would cause synchronization issues. -> The problem doesn't appear in LOCAL 1.9+, but does appear in LOCAL 1.8, which leads me to think that the issue is indeed located in the local player files of legacy versions, cleared after a launcher session restard. Any way, for instance, to clear user's current server cache locally?

    Does anyone have a strong understanding of that particular topic? Any help would be highly appreciated!

    Thank you very much for your time, wishing you all a great day :)

    @timtower this might be a weird bug from my side, but could you please release that publically? I don't see the "waiting for approval" anymore, but I still have 0 view on the thread. As you can see: this new thread is now protocolhack-free compliant

    Best regards
     
    Last edited by a moderator: Jul 9, 2020
  2. Offline

    timtower Administrator Administrator Moderator

    It is public. Was that 10 minutes after you posted it.
    0 views can also mean that nobody has seen it yet.
     
Thread Status:
Not open for further replies.

Share This Page