Skip to content

Commit

Permalink
rename 'yaml data' scripts to just 'data' scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 14, 2020
1 parent 932b457 commit f444039
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 52 deletions.
Expand Up @@ -384,7 +384,7 @@ public static void registerTags() {
// @returns ElementTag
// @description
// Converts the Script Container to a JSON array.
// Best used with 'yaml data' type scripts.
// Best used with 'data' type scripts.
// -->
registerTag("to_json", (attribute, object) -> {
JSONObject jsobj = new JSONObject(YamlConfiguration.reverse(object.container.getContents().getMap(), true));
Expand All @@ -397,7 +397,7 @@ public static void registerTags() {
// @returns ElementTag
// @description
// Converts the Script Container to raw YAML text.
// Best used with 'yaml data' type scripts.
// Best used with 'data' type scripts.
// -->
registerTag("to_yaml", (attribute, object) -> {
YamlConfiguration config = new YamlConfiguration();
Expand Down
Expand Up @@ -30,7 +30,7 @@ public static void reloadScripts() {
hadError = true;
DenizenCore.getImplementation().debugError("Could not load scripts!");
DenizenCore.getImplementation().debugException(e);
_yamlScripts = YamlConfiguration.load("scripts_failed_to_load:\n type: yaml data\n");
_yamlScripts = YamlConfiguration.load("scripts_failed_to_load:\n type: data\n");
}

ScriptRegistry.buildCoreYamlScriptContainers(_yamlScripts);
Expand Down
Expand Up @@ -25,7 +25,8 @@ public static void _registerCoreTypes() {
_registerType("task", TaskScriptContainer.class);
_registerType("procedure", ProcedureScriptContainer.class);
_registerType("world", WorldScriptContainer.class);
_registerType("yaml data", YamlDataScriptContainer.class);
_registerType("data", DataScriptContainer.class);
_registerType("yaml data", DataScriptContainer.class);
}

public static boolean containsScript(String id) {
Expand Down
Expand Up @@ -86,18 +86,6 @@ public YamlConfiguration getContents() {
return contents;
}

/**
* Casts this container to a specify type of script container. Must be a valid
* container type of the type casting to.
*
* @param type the class of the ScriptContainer casting to
* @param <T> the ScriptContainer object
* @return a ScriptContainer of the type specified
*/
public <T extends ScriptContainer> T getAsContainerType(Class<T> type) {
return type.cast(this);
}

// <--[language]
// @name Script Name
// @group Script Container System
Expand Down
@@ -0,0 +1,44 @@
package com.denizenscript.denizencore.scripts.containers.core;

import com.denizenscript.denizencore.scripts.containers.ScriptContainer;
import com.denizenscript.denizencore.utilities.Deprecations;
import com.denizenscript.denizencore.utilities.YamlConfiguration;

public class DataScriptContainer extends ScriptContainer {

// <--[language]
// @name Data Script Containers
// @group Script Container System
// @description
// Data script containers are generic script containers for information that will be referenced by other scripts.
//
// No part of a 'data' script container is ever run as commands.
//
// There are no required keys.
//
// Generally, data is read using the <@link tag ScriptTag.data_key> tag.
//
// <code>
// Data_Script_Name:
//
// type: data
//
// # Your data here
// some key: some value
// some list key:
// - some list value
// some map key:
// some subkey: some value
//
// </code>
//
// -->

public DataScriptContainer(YamlConfiguration configurationSection, String scriptContainerName) {
super(configurationSection, scriptContainerName);
canRunScripts = false;
if (configurationSection.get("type").toString().equalsIgnoreCase("yaml data")) {
Deprecations.yamlDataContainer.warn(this);
}
}
}

This file was deleted.

Expand Up @@ -218,6 +218,9 @@ public class Deprecations {
// In Bukkit impl, Added 2020/04/19, Relevant for many years now, deprecate officially by 2023.
public static Warning interactScriptPriority = new FutureWarning("Assignment script 'interact scripts' section should not have numbered priority values, these were removed years ago. Check https://guide.denizenscript.com/guides/troubleshooting/updates-since-videos.html#assignment-script-updates for more info.");

// Added 2020/06/13.
public static Warning yamlDataContainer = new FutureWarning("'yaml data' containers are now just called 'data' containers.");

// ==================== PAST deprecations of things that are already gone but still have a warning left behind ====================

// In Bukkit impl, Added on 2019/10/13
Expand Down

0 comments on commit f444039

Please sign in to comment.