Giter VIP home page Giter VIP logo

Comments (3)

Jikoo avatar Jikoo commented on August 26, 2024

Unfortunately OpenInv does not have a way to account for external inventory storage. If you're running a plugin that changes inventory storage, that plugin needs to be responsible for offline viewing and modification.

To help avoid accidents you should consider negating the node OpenInv.openoffline.

You can also use the config node settings.disable-saving to prevent OpenInv from saving changes to offline players. Note that this will not prevent OpenInv modifying inventory contents on login if the player has been recently modified and is in the cache. OpenInv runs on lowest priority to attempt better compatibility with other inventory modification plugins (anticheats that filter items, etc.) so ideally PlayerSQL should overwrite any changes made by OpenInv in the mirroring process.

Related to lishid#171, need a way to more completely disable offline access.

from openinv.

Combustible avatar Combustible commented on August 26, 2024

Not sure how technical you are @YTiceice but the solution we are using for exactly the same problem is to build our own version of OpenInv with this patch:

+++ b/plugin/src/main/java/com/lishid/openinv/OpenInv.java
@@ -447,12 +447,23 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
         // Replace stored player with our own version
         this.playerCache.put(key, this.accessor.getPlayerDataManager().inject(player));

+        /* Remove the cached entry if it exists */
+        this.playerCache.invalidate(key);
+
         if (this.inventories.containsKey(key)) {
-            this.inventories.get(key).setPlayerOffline();
+            Iterator<HumanEntity> iterator = this.inventories.remove(key).getBukkitInventory().getViewers().iterator();
+            while (iterator.hasNext()) {
+                HumanEntity human = iterator.next();
+                human.closeInventory();
+            }
         }

         if (this.enderChests.containsKey(key)) {
-            this.enderChests.get(key).setPlayerOffline();
+            Iterator<HumanEntity> iterator = this.enderChests.remove(key).getBukkitInventory().getViewers().iterator();
+            while (iterator.hasNext()) {
+                HumanEntity human = iterator.next();
+                human.closeInventory();
+            }
         }
     }

I would someday still like a config option to do something like this so I don't have to build my own OpenInv plugin every time there's a new MC version.

Similarly to YTiceice, we are using a separate database for player data storage.

from openinv.

YTiceice avatar YTiceice commented on August 26, 2024

Ok

from openinv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.