mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Restore inventories looted by fast inventory and flush magic values when reloaded
This commit is contained in:
1 parent
873a1b9d60
commit
96f3906eff
6 files changed
+61
-8
No files matched your search
@@ -24,6 +24,11 @@ import net.h31ix.anticheat.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class User {
|
||||
private final String name;
|
||||
@@ -32,6 +37,7 @@ public class User {
|
||||
private int med;
|
||||
private Location goodLocation;
|
||||
private boolean silentMode;
|
||||
private List<ItemStack> inventorySnapshot = null;
|
||||
|
||||
public User(String name) {
|
||||
this.name = name;
|
||||
@@ -114,5 +120,26 @@ public class User {
|
||||
|
||||
goodLocation = e;
|
||||
}
|
||||
|
||||
|
||||
public void setSnapshot(ItemStack[] is) {
|
||||
inventorySnapshot = new ArrayList<ItemStack>();
|
||||
for(int i=0;i<is.length;i++) {
|
||||
if(is[i] != null) {
|
||||
inventorySnapshot.add(is[i].clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSnapshot() {
|
||||
inventorySnapshot = null;
|
||||
}
|
||||
|
||||
public void restore(Inventory inventory) {
|
||||
inventory.clear();
|
||||
for(ItemStack is : inventorySnapshot) {
|
||||
if(is != null) {
|
||||
inventory.addItem(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user