Hmm, this is certainly a niche situation, but can definitely be done. Might be a little trickier though. Typically, when the players inventory is full of junk so a script cannot run, the script should either terminate and let the player know this, or do something loss-less, such as going to a bank and depositing the junk. Arbitrarily dropping items isn't a great idea in general: what is the inventory was full of godswords?
Anyway, to achieve what you're looking for, the default API entries won't seem to provide this functionality. We'll have to create our own filter:
(Note that I haven't tested this code and wrote it here in the reply box so there could be errors, let me know if it doesn't work!)
if (getInventory().isFull()) {
getInventory().dropForFilter(new Filter<Item>(){
@Override
public boolean match(Item x) {
return !x.getName().equals("Cup of Tea");
}
});
}