My question involves criminal law for the state of: Rhode Island
I was 30 minutes from my home when I stumbled upon an abandoned building. It was fenced off, except for an opening for cars, there were two cars near the building. Apparently there were warning signs, however I did not see any. I went inside only to be approached by a police officer who immediately told me to unfold my pockets and take off my backpack. I asked him if I was being arrested or being detained, to which he replied "take off the bag". I had about a gram in the bag, (thought he was asking for consent) and kept asking him if I was being arrested. This went on till he said that unless I took off the bag and showed him my pockets that I would face a year in prison for trespassing on state property, to which I responded by showing him the contents of my pockets and bag. He told me to sit, put handcuffs on, and searched the bag. After finding the marijuana, I was taken in by a different officer to the station. After I was released and asked for a copy of the police report, it said on there that I had tried to trick the officer multiple times and that he told me I was under arrest before telling me to take off the bag. Anyway my main question is I'm currently 17 turning 18 in the fall going to a juvenile drug court sometime soon, should I consult an attorney, what should I be looking towards?

