<commit_before>package com.planet_ink.coffee_mud.Abilities.Properties;

import com.planet_ink.coffee_mud.core.CMClass;
import com.planet_ink.coffee_mud.core.CMLib;
import com.planet_ink.coffee_mud.core.CMParms;
import com.planet_ink.coffee_mud.core.collections.SLinkedList;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.CharClass;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.XMLLibrary.XMLTag;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.MOB;
import com.planet_ink.coffee_mud.Races.interfaces.Race;

import java.util.*;

/*
   Copyright 2017-2018 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
public class Prop_OutfitContainer extends Property
{
	@Override
	public String ID()
	{
		return "Prop_OutfitContainer";
	}

	@Override
	public String name()
	{
		return "Remembers whats put in, and wear the contents when worn";
	}

	@Override
	protected int canAffectCode()
	{
		return Ability.CAN_ITEMS;
	}

	@Override
	public boolean bubbleAffect()
	{
		return true;
	}

	protected List<Item> outfitContents = new SLinkedList<Item>();
	protected boolean fixedYet = false;

	@Override
	public void setMiscText(final String text)
	{
		super.setMiscText(text);
		fixedYet = false;
		this.outfitContents.clear();
	}

	protected void fixContentsFromText()
	{
		final Item affected = (this.affected instanceof Item)? (Item)this.affected : null;
		if((!fixedYet)
		&&(affected != null))
		{
			this.outfitContents.clear();
			final ItemPossessor possessor=affected.owner();
			if(possessor.numItems() > 0)
			{
				fixedYet = true;
				if(super.miscText.length()>1)
				{
					final int xmlStart = super.miscText.indexOf(';');
					if(xmlStart >=0)
					{
						final List<XMLTag> tags=CMLib.xml().parseAllXML(miscText.substring(xmlStart+1));
						final List<String> itemNames = new ArrayList<String>(tags.size());
						for(final XMLTag tag : tags)
							itemNames.add(tag.value());
						Collections.sort(itemNames);<commit_msg>npe in outfit container.<commit_after>package com.planet_ink.coffee_mud.Abilities.Properties;

import com.planet_ink.coffee_mud.core.CMClass;
import com.planet_ink.coffee_mud.core.CMLib;
import com.planet_ink.coffee_mud.core.CMParms;
import com.planet_ink.coffee_mud.core.collections.SLinkedList;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.CharClass;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.XMLLibrary.XMLTag;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.MOB;
import com.planet_ink.coffee_mud.Races.interfaces.Race;

import java.util.*;

/*
   Copyright 2017-2018 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
public class Prop_OutfitContainer extends Property
{
	@Override
	public String ID()
	{
		return "Prop_OutfitContainer";
	}

	@Override
	public String name()
	{
		return "Remembers whats put in, and wear the contents when worn";
	}

	@Override
	protected int canAffectCode()
	{
		return Ability.CAN_ITEMS;
	}

	@Override
	public boolean bubbleAffect()
	{
		return true;
	}

	protected List<Item> outfitContents = new SLinkedList<Item>();
	protected boolean fixedYet = false;

	@Override
	public void setMiscText(final String text)
	{
		super.setMiscText(text);
		fixedYet = false;
		this.outfitContents.clear();
	}

	protected void fixContentsFromText()
	{
		final Item affected = (this.affected instanceof Item)? (Item)this.affected : null;
		if((!fixedYet)
		&&(affected != null))
		{
			this.outfitContents.clear();
			final ItemPossessor possessor=affected.owner();
			if(possessor == null)
				return;
			if(possessor.numItems() > 0)
			{
				fixedYet = true;
				if(super.miscText.length()>1)
				{
					final int xmlStart = super.miscText.indexOf(';');
					if(xmlStart >=0)
					{
						final List<XMLTag> tags=CMLib.xml().parseAllXML(miscText.substring(xmlStart+1));
						final List<String> itemNames = new ArrayList<String>(tags.size());
						for(final XMLTag tag : tags)
							itemNames.add(tag.value());
						Collections.sort(itemNames);
{'fraction_non_alphanumeric': 0.10533807829181495, 'fraction_numerical': 0.0056939501779359435, 'mean_word_length': 4.425675675675675, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5045632', 'n_tokens_mistral': 2076, 'n_tokens_neox': 1816, 'n_words': 431}