Security Update.
This commit is contained in:
Vendored
+43
-2
@@ -1,12 +1,16 @@
|
||||
package appeng.me.cache;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.api.networking.events.MENetworkStorageEvent;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.MEMonitorHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.storage.ItemWatcher;
|
||||
|
||||
public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
{
|
||||
@@ -16,6 +20,11 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
|
||||
boolean sendEvent = false;
|
||||
|
||||
public void forceUpdate()
|
||||
{
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
public NetworkMonitor(GridStorageCache cache, StorageChannel chan) {
|
||||
super( null );
|
||||
myGridCache = cache;
|
||||
@@ -24,8 +33,21 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
|
||||
final static public LinkedList depth = new LinkedList();
|
||||
|
||||
private BaseActionSource src;
|
||||
|
||||
public void setSource(BaseActionSource src)
|
||||
{
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postChange(T diff)
|
||||
protected BaseActionSource getSource()
|
||||
{
|
||||
return src;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postChange(T diff, BaseActionSource src)
|
||||
{
|
||||
if ( depth.contains( this ) )
|
||||
return;
|
||||
@@ -33,7 +55,26 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
depth.push( this );
|
||||
|
||||
sendEvent = true;
|
||||
super.postChange( diff );
|
||||
super.postChange( diff, src );
|
||||
|
||||
if ( myGridCache.interests.containsKey( diff ) )
|
||||
{
|
||||
Set<ItemWatcher> list = myGridCache.interests.get( diff );
|
||||
if ( !list.isEmpty() )
|
||||
{
|
||||
IItemList<T> myStorageList = getStorageList();
|
||||
|
||||
IAEStack fullStack = myStorageList.findPrecise( diff );
|
||||
if ( fullStack == null )
|
||||
{
|
||||
fullStack = diff.copy();
|
||||
fullStack.setStackSize( 0 );
|
||||
}
|
||||
|
||||
for (ItemWatcher iw : list)
|
||||
iw.getHost().onStackChange( myStorageList, fullStack, diff, src, getChannel() );
|
||||
}
|
||||
}
|
||||
|
||||
Object last = depth.pop();
|
||||
if ( last != this )
|
||||
|
||||
Reference in New Issue
Block a user