Ignore PlayerInventory owner as a viewer

If online, owner is always a viewer. If offline, they are never a viewer. There's no reason to count them - keeps inventory permanently cached while online if opened, even if not in use.
This commit is contained in:
Jikoo
2022-01-27 11:37:53 -05:00
parent 4ca222f031
commit f78a5b4fba
2 changed files with 6 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 lishid. All rights reserved.
* Copyright (C) 2011-2022 lishid. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -105,7 +105,8 @@ public class SpecialPlayerInventory extends Inventory implements ISpecialPlayerI
@Override
public boolean isInUse() {
return !this.getViewers().isEmpty();
List<HumanEntity> viewers = this.getViewers();
return viewers.size() > 1 || !viewers.isEmpty() && !viewers.get(0).getUniqueId().equals(this.player.getUUID());
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 lishid. All rights reserved.
* Copyright (C) 2011-2022 lishid. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -105,7 +105,8 @@ public class SpecialPlayerInventory extends Inventory implements ISpecialPlayerI
@Override
public boolean isInUse() {
return !this.getViewers().isEmpty();
List<HumanEntity> viewers = this.getViewers();
return viewers.size() > 1 || !viewers.isEmpty() && !viewers.get(0).getUniqueId().equals(this.player.getUUID());
}
@Override