use of logisticspipes.interfaces.routing.IChannelManager in project LogisticsPipes by RS485.
the class ChannelManagerProvider method getChannelManager.
@Override
public IChannelManager getChannelManager(@Nonnull World world) {
if (worldWeakReference == null || worldWeakReference.get() == null || channelManager == null) {
worldWeakReference = new WeakReference<>(world);
if (channelManager != null) {
channelManager.markDirty();
}
channelManager = new ChannelManager(world);
}
return channelManager;
}
use of logisticspipes.interfaces.routing.IChannelManager in project LogisticsPipes by RS485.
the class AddNewChannelPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
manager.createNewChannel(name, PlayerIdentifier.get(player), rights, securityStationID);
}
use of logisticspipes.interfaces.routing.IChannelManager in project LogisticsPipes by RS485.
the class DeleteChannelPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
manager.removeChannel(channelIdentifier);
}
use of logisticspipes.interfaces.routing.IChannelManager in project LogisticsPipes by RS485.
the class EditChannelPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
Optional<ChannelInformation> channelOpt = manager.getChannels().stream().filter(chan -> chan.getChannelIdentifier().equals(channelIdentifier)).findFirst();
if (channelOpt.isPresent()) {
ChannelInformation channel = channelOpt.get();
if (!channel.getName().equals(getName())) {
manager.updateChannelName(channelIdentifier, getName());
}
if (!channel.getRights().equals(getRights()) || (channel.getResponsibleSecurityID() != null && getSecurityStationID() != null && !channel.getResponsibleSecurityID().equals(getSecurityStationID())) || channel.getResponsibleSecurityID() != getSecurityStationID()) {
manager.updateChannelRights(channelIdentifier, getRights(), getSecurityStationID());
}
}
}
use of logisticspipes.interfaces.routing.IChannelManager in project LogisticsPipes by RS485.
the class OpenEditChannelGUIPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
TileEntity tile = player.getEntityWorld().getTileEntity(new BlockPos(getPosX(), getPosY(), getPosZ()));
UUID securityID = null;
if (tile instanceof LogisticsSecurityTileEntity) {
LogisticsSecurityTileEntity security = (LogisticsSecurityTileEntity) tile;
securityID = security.getSecId();
}
UUID finalSecurityID = securityID;
IChannelManager channelManager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
Optional<ChannelInformation> match = channelManager.getChannels().stream().filter(channel -> channel.getChannelIdentifier().toString().equals(getIdentifier())).findFirst();
match.ifPresent(channel -> NewGuiHandler.getGui(EditChannelGuiProvider.class).setResponsibleSecurityID(finalSecurityID).setChannel(channel).open(player));
}
Aggregations