<commit_before>package be.nokorbis.spigot.commandsigns.controller;

import be.nokorbis.spigot.commandsigns.menus.CoreMenuCommandsAdd;
import be.nokorbis.spigot.commandsigns.api.DisplayMessages;
import be.nokorbis.spigot.commandsigns.api.menu.EditionMenu;
import be.nokorbis.spigot.commandsigns.api.menu.MenuNavigationContext;
import be.nokorbis.spigot.commandsigns.model.CommandBlock;
import org.bukkit.entity.Player;


public class NCommandSignsConfigurationManager {
	private static final DisplayMessages messages = DisplayMessages.getDisplayMessages("messages/menu");
	private final NCommandSignsManager 	manager;
	private final Player                editor;
	private       CommandBlock          commandBlock;
	private       boolean               isCreating;
	private       MenuNavigationContext navigationContext;

	public NCommandSignsConfigurationManager(final Player player, final NCommandSignsManager manager) {
		this.editor = player;
		this.manager = manager;
		this.navigationContext = new MenuNavigationContext();
	}

	public Player getEditor() {
		return this.editor;
	}

	public boolean isCreating() {
		return this.isCreating;
	}

	public boolean isEditing() {
		return !this.isCreating();
	}

	public void setCreating(boolean creating) {
		this.isCreating = creating;
	}

	public void setEditing(boolean editing) {
		this.setCreating(!editing);
	}

	public CommandBlock getCommandBlock() {
		return commandBlock;
	}

	public void setCommandBlock(CommandBlock commandBlock) {
		this.commandBlock = commandBlock;
	}

	public void setCurrentMenu(EditionMenu<CommandBlock> menu) {
		this.navigationContext.setCoreMenu(menu);
	}

	public void display() {
		EditionMenu<CommandBlock> coreMenu = this.navigationContext.getCoreMenu();
		if (coreMenu != null) {
			coreMenu.display(editor, commandBlock, this.navigationContext);
		}
		else {
			if (!this.navigationContext.isCancelled()) {
				this.manager.saveCommandBlock(commandBlock);
				if (this.isCreating) {
					this.editor.sendMessage(messages.get("menu.creation_completed"));
				}
				else {
					this.editor.sendMessage(messages.get("menu.edition_completed"));
				}
			}
			else {
				this.editor.sendMessage(messages.get("menu.configuration_cancelled"));
			}

			this.manager.removeConfigurationManager(this.editor);
		}
	}
<commit_msg>add a prevention comment<commit_after>package be.nokorbis.spigot.commandsigns.controller;

import be.nokorbis.spigot.commandsigns.menus.CoreMenuCommandsAdd;
import be.nokorbis.spigot.commandsigns.api.DisplayMessages;
import be.nokorbis.spigot.commandsigns.api.menu.EditionMenu;
import be.nokorbis.spigot.commandsigns.api.menu.MenuNavigationContext;
import be.nokorbis.spigot.commandsigns.model.CommandBlock;
import org.bukkit.entity.Player;


public class NCommandSignsConfigurationManager {
	private static final DisplayMessages messages = DisplayMessages.getDisplayMessages("messages/menu");
	private final NCommandSignsManager 	manager;
	private final Player                editor;
	private       CommandBlock          commandBlock;
	private       boolean               isCreating;
	private       MenuNavigationContext navigationContext;

	public NCommandSignsConfigurationManager(final Player player, final NCommandSignsManager manager) {
		this.editor = player;
		this.manager = manager;
		this.navigationContext = new MenuNavigationContext();
	}

	public Player getEditor() {
		return this.editor;
	}

	public boolean isCreating() {
		return this.isCreating;
	}

	public boolean isEditing() {
		return !this.isCreating();
	}

	public void setCreating(boolean creating) {
		this.isCreating = creating;
	}

	public void setEditing(boolean editing) {
		this.setCreating(!editing);
	}

	public CommandBlock getCommandBlock() {
		return commandBlock;
	}

	public void setCommandBlock(CommandBlock commandBlock) {
		this.commandBlock = commandBlock;
	}

	public void setCurrentMenu(EditionMenu<CommandBlock> menu) {
		this.navigationContext.setCoreMenu(menu);
	}

	public void display() {
		EditionMenu<CommandBlock> coreMenu = this.navigationContext.getCoreMenu();
		if (coreMenu != null) {
			coreMenu.display(editor, commandBlock, this.navigationContext);
		}
		else {
			if (!this.navigationContext.isCancelled()) {
				//might be a synchro problem here because the clone() happened earlier
				this.manager.saveCommandBlock(commandBlock);
				if (this.isCreating) {
					this.editor.sendMessage(messages.get("menu.creation_completed"));
				}
				else {
					this.editor.sendMessage(messages.get("menu.edition_completed"));
				}
			}
			else {
				this.editor.sendMessage(messages.get("menu.configuration_cancelled"));
			}

			this.manager.removeConfigurationManager(this.editor);
		}
	}

{'fraction_non_alphanumeric': 0.09566326530612244, 'fraction_numerical': 0.0, 'mean_word_length': 4.554899645808737, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '23338', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1379, 'n_words': 254}