Skip to content

Commit

Permalink
chore: added pack_icon, and resources, and removed commands for meant…
Browse files Browse the repository at this point in the history
…ime and is in release
  • Loading branch information
Adr-hyng committed Aug 13, 2024
1 parent 03f4524 commit 243ffee
Show file tree
Hide file tree
Showing 53 changed files with 802 additions and 2,574 deletions.
4 changes: 2 additions & 2 deletions BP/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"format_version": 2,
"header": {
"name": "Anvil Repairing BP 1.0.0 [DEBUG]",
"description": "Repair your anvils with as simple as iron ingots to extend its lifespan, and use hammer to damage it without breaking the block.\n @Made By: https://twitter.com/h_YanG_0A",
"name": "Anvil Repairing BP 1.0.0",
"description": "Repair your anvils with as simple as iron ingots to extend its lifespan. \n @Made By: https://twitter.com/h_YanG_0A",
"uuid": "8699f58d-1fa2-4af6-85cb-1cbe713d2511",
"version": [
1,
Expand Down
6 changes: 0 additions & 6 deletions BP/scripts/anvil_states.js

This file was deleted.

35 changes: 35 additions & 0 deletions BP/scripts/chroma/formatCodes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import TextColor from "./textColor";
const formatCodes = {
[TextColor.Black]: "§0",
[TextColor.DarkBlue]: "§1",
[TextColor.DarkGreen]: "§2",
[TextColor.DarkAqua]: "§3",
[TextColor.DarkRed]: "§4",
[TextColor.DarkPurple]: "§5",
[TextColor.Gold]: "§6",
[TextColor.Gray]: "§7",
[TextColor.DarkGray]: "§8",
[TextColor.Blue]: "§9",
[TextColor.Green]: "§a",
[TextColor.Aqua]: "§b",
[TextColor.Red]: "§c",
[TextColor.LightPurple]: "§d",
[TextColor.Yellow]: "§e",
[TextColor.White]: "§f",
[TextColor.MinecoinGold]: "§g",
[TextColor.MaterialQuartz]: "§h",
[TextColor.MaterialIron]: "§i",
[TextColor.MaterialNetherite]: "§j",
obfuscated: "§k",
bold: "§l",
[TextColor.MaterialRedstone]: "§m",
[TextColor.MaterialCopper]: "§n",
italic: "§o",
[TextColor.MaterialGold]: "§p",
[TextColor.MaterialEmerald]: "§q",
reset: "§r",
[TextColor.MaterialDiamond]: "§s",
[TextColor.MaterialLapis]: "§t",
[TextColor.MaterialAmethyst]: "§u",
};
export default formatCodes;
12 changes: 12 additions & 0 deletions BP/scripts/chroma/formatText.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import getFormatCodes from "./getFormatCodes";
import formatCodes from "./formatCodes";
const formattingEnd = `${formatCodes.reset}§¬`;
const nestedFormattingEnd = new RegExp(`(?<=${formattingEnd}(?!${formatCodes.reset}|$))`, "g");
export default function formatText(text, formatting) {
const prefix = getFormatCodes(formatting);
text = prefix + text;
text = text.replace(nestedFormattingEnd, prefix);
if (!text.endsWith(formattingEnd))
text += formattingEnd;
return text;
}
16 changes: 16 additions & 0 deletions BP/scripts/chroma/getFormatCodes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import formatCodes from "./formatCodes";
export default function getFormatCodes(formatting) {
let codes = "";
const { color, bold, italic, obfuscated, reset } = formatting;
if (reset)
codes += formatCodes.reset;
if (bold)
codes += formatCodes.bold;
if (italic)
codes += formatCodes.italic;
if (obfuscated)
codes += formatCodes.obfuscated;
if (color)
codes += formatCodes[color];
return codes;
}
118 changes: 118 additions & 0 deletions BP/scripts/chroma/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import formatText from "./formatText";
import getFormatCodes from "./getFormatCodes";
import makeCallable from "./makeCallable";
import TextColor from "./textColor";
class Chroma {
constructor(formatting = {}) {
this.formatting = formatting;
function format(...text) {
return formatText(text.join(" "), this.formatting);
}
return makeCallable(this, format);
}
toString() {
return getFormatCodes(this.formatting);
}
with(option, value) {
return new Chroma({ ...this.formatting, [option]: value });
}
get bold() {
return this.with("bold", true);
}
get italic() {
return this.with("italic", true);
}
get obfuscated() {
return this.with("obfuscated", true);
}
get reset() {
return new Chroma({ reset: true });
}
color(textColor) {
return this.with("color", textColor);
}
get aqua() {
return this.color(TextColor.Aqua);
}
get black() {
return this.color(TextColor.Black);
}
get blue() {
return this.color(TextColor.Blue);
}
get darkAqua() {
return this.color(TextColor.DarkAqua);
}
get darkBlue() {
return this.color(TextColor.DarkBlue);
}
get darkGray() {
return this.color(TextColor.DarkGray);
}
get darkGreen() {
return this.color(TextColor.DarkGreen);
}
get darkPurple() {
return this.color(TextColor.DarkPurple);
}
get darkRed() {
return this.color(TextColor.DarkRed);
}
get gold() {
return this.color(TextColor.Gold);
}
get gray() {
return this.color(TextColor.Gray);
}
get green() {
return this.color(TextColor.Green);
}
get lightPurple() {
return this.color(TextColor.LightPurple);
}
get materialAmethyst() {
return this.color(TextColor.MaterialAmethyst);
}
get materialCopper() {
return this.color(TextColor.MaterialCopper);
}
get materialDiamond() {
return this.color(TextColor.MaterialDiamond);
}
get materialEmerald() {
return this.color(TextColor.MaterialEmerald);
}
get materialGold() {
return this.color(TextColor.MaterialGold);
}
get materialIron() {
return this.color(TextColor.MaterialIron);
}
get materialLapis() {
return this.color(TextColor.MaterialLapis);
}
get materialNetherite() {
return this.color(TextColor.MaterialNetherite);
}
get materialQuartz() {
return this.color(TextColor.MaterialQuartz);
}
get materialRedstone() {
return this.color(TextColor.MaterialRedstone);
}
get minecoinGold() {
return this.color(TextColor.MinecoinGold);
}
get red() {
return this.color(TextColor.Red);
}
get yellow() {
return this.color(TextColor.Yellow);
}
get white() {
return this.color(TextColor.White);
}
}
const chroma = new Chroma();
export default chroma;
export { chroma, TextColor };
7 changes: 7 additions & 0 deletions BP/scripts/chroma/makeCallable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function makeCallable(object, callback) {
const callableObject = callback.bind(object);
Object.setPrototypeOf(callableObject, Object.getPrototypeOf(object));
const properties = Object.getOwnPropertyDescriptors(object);
Object.defineProperties(callableObject, properties);
return callableObject;
}
31 changes: 31 additions & 0 deletions BP/scripts/chroma/textColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var TextColor;
(function (TextColor) {
TextColor["Aqua"] = "aqua";
TextColor["Black"] = "black";
TextColor["Blue"] = "blue";
TextColor["DarkAqua"] = "dark_aqua";
TextColor["DarkBlue"] = "dark_blue";
TextColor["DarkGray"] = "dark_gray";
TextColor["DarkGreen"] = "dark_green";
TextColor["DarkPurple"] = "dark_purple";
TextColor["DarkRed"] = "dark_red";
TextColor["Gold"] = "gold";
TextColor["Gray"] = "gray";
TextColor["Green"] = "green";
TextColor["LightPurple"] = "light_purple";
TextColor["MaterialAmethyst"] = "material_amethyst";
TextColor["MaterialCopper"] = "material_copper";
TextColor["MaterialDiamond"] = "material_diamond";
TextColor["MaterialEmerald"] = "material_emerald";
TextColor["MaterialGold"] = "material_gold";
TextColor["MaterialIron"] = "material_iron";
TextColor["MaterialLapis"] = "material_lapis";
TextColor["MaterialNetherite"] = "material_netherite";
TextColor["MaterialQuartz"] = "material_quartz";
TextColor["MaterialRedstone"] = "material_redstone";
TextColor["MinecoinGold"] = "minecoin_gold";
TextColor["Red"] = "red";
TextColor["Yellow"] = "yellow";
TextColor["White"] = "white";
})(TextColor || (TextColor = {}));
export default TextColor;
1 change: 0 additions & 1 deletion BP/scripts/commands/ICommandBase.js

This file was deleted.

8 changes: 0 additions & 8 deletions BP/scripts/commands/command_handler.js

This file was deleted.

Empty file removed BP/scripts/commands/config.js
Empty file.
39 changes: 0 additions & 39 deletions BP/scripts/commands/dev_helper.js

This file was deleted.

54 changes: 0 additions & 54 deletions BP/scripts/commands/help.js

This file was deleted.

8 changes: 0 additions & 8 deletions BP/scripts/configuration/config_handler.js

This file was deleted.

Empty file.
13 changes: 11 additions & 2 deletions BP/scripts/configuration/server_configuration.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
export default {
debug: true,
/**
* Enables debug messages to content logs.
*/
debug: false,
/**
* The amount of iron ingots required in order to repair an anvil.
*/
IronIngotsRequired: 1,
};
export const VERSION = "1.0.0";

// version (do not change)
export const VERSION = "1.0.0";
5 changes: 0 additions & 5 deletions BP/scripts/constant.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { JsonDatabase } from "./utils/Database/con-database";
export const ADDON_NAMESPACE = "yn";
export const ADDON_NAME = "ANVIL_REPAIR";
export const ADDON_IDENTIFIER = `${ADDON_NAMESPACE}:anvrep`;
export const db = new JsonDatabase(ADDON_NAME);
export var AnvilDamageStates;
(function (AnvilDamageStates) {
AnvilDamageStates["UNDAMAGED"] = "undamaged";
Expand Down
Loading

0 comments on commit 243ffee

Please sign in to comment.