<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package worldofzuul.item;

import worldofzuul.environment.Room;

/**
 *
 * @author mikkellarsen
 */
public class Key extends Item {
    /**
     * Creating a variable room of the type Room
     */
    private Room room;

    /**
     * Creating a constructor of the class Key
     * @param room
     */
    public Key(Room room){
        super("Key");
        this.room = room;
    }
    /**
     * Creating a method to get room
     * @return room
     */
    public Room getRoom() {
        return room;
    }
    /**
     * Creating a method to set the room
     * @param room
     */
    public void setRoom(Room room) {
        this.room = room;
    }
    
    /**
     * Creates a "use" method for the "Key" item. The method check for a locked
     * door in the current room, and unlocks the door if there is one.
     * @param player 
     */
    @Override
    public void use(Player player) {
        Room currentRoom = player.getCurrentRoom();
        System.out.println("You used the key on the door " + currentRoom.getShortDescription());
        if(currentRoom.getName().equals("Lobby1")) {
            currentRoom.getExit("south").unlock(this);
            System.out.println("The Oval office has been unlocked");
        } else {
            System.out.println("There is no locked door here.");
        }
    }


}
<commit_msg>Added player import to key class (#63)<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package worldofzuul.item;

import worldofzuul.character.Player;
import worldofzuul.environment.Room;

/**
 *
 * @author mikkellarsen
 */
public class Key extends Item {
    /**
     * Creating a variable room of the type Room
     */
    private Room room;

    /**
     * Creating a constructor of the class Key
     * @param room
     */
    public Key(Room room){
        super("Key");
        this.room = room;
    }
    /**
     * Creating a method to get room
     * @return room
     */
    public Room getRoom() {
        return room;
    }
    /**
     * Creating a method to set the room
     * @param room
     */
    public void setRoom(Room room) {
        this.room = room;
    }
    
    /**
     * Creates a "use" method for the "Key" item. The method check for a locked
     * door in the current room, and unlocks the door if there is one.
     * @param player 
     */
    @Override
    public void use(Player player) {
        Room currentRoom = player.getCurrentRoom();
        System.out.println("You used the key on the door " + currentRoom.getShortDescription());
        if(currentRoom.getName().equals("Lobby1")) {
            currentRoom.getExit("south").unlock(this);
            System.out.println("The Oval office has been unlocked");
        } else {
            System.out.println("There is no locked door here.");
        }
    }


}

{'fraction_non_alphanumeric': 0.10362364907819453, 'fraction_numerical': 0.0012714558169103624, 'mean_word_length': 2.1375872382851444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1337373', 'n_tokens_mistral': 890, 'n_tokens_neox': 868, 'n_words': 312}