-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb3c1fc
commit 95e4df4
Showing
5 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
export function formatAtlasToChat(atlas) { | ||
if (!atlas.loaded) return ChatLib.chat('&cHPM Atlas hasn\'t loaded yet! Please wait!') | ||
delete atlas.loaded // Fucks with iteration, gtfo | ||
|
||
let components = [] | ||
components.push('\n&7&lâ– Module Atlas\n') | ||
|
||
Object.values(atlas).forEach(moduleData => { | ||
components.push(`&7 | `) | ||
|
||
if (FileLib.exists(`./config/ChatTriggers/modules/${moduleData.name}`)) { | ||
components.push( | ||
new TextComponent('&c&lx ') | ||
.setHover('show_text','&cDelete Module') | ||
.setClick('run_command',`/hpm delete ${moduleData.name}`), | ||
new TextComponent('&a&l+ ') | ||
.setHover('show_text','&aCheck for Updates') | ||
.setClick('run_command',`/hpm import ${moduleData.name}`), | ||
) | ||
} else { | ||
components.push( | ||
new TextComponent('&8&lx ').setHover('show_text', '&7&mDelete Module'), | ||
new TextComponent('&a&l+ ') | ||
.setHover('show_text', '&aImport Module') | ||
.setClick('run_command', `/hpm import ${moduleData.name}`) | ||
) | ||
} | ||
components.push( | ||
new TextComponent(`&7| &b${moduleData.name}\n`) // kill me | ||
.setHover('show_text', `&a${moduleData.name}\n&7by &b${moduleData.creator}\n\n&eClick to view ${Object.keys(moduleData.releases).length} release${Object.keys(moduleData.releases).length == 1 ? '' : 's'}!`) | ||
.setClick('run_command',`/hpm atlas ${moduleData.name}`) | ||
) | ||
}) | ||
|
||
ChatLib.chat(new Message(components).setChatLineId(694201337)) | ||
atlas.loaded = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export function viewModReleases(atlas, moduleName) { | ||
if (!atlas.loaded) return ChatLib.chat('&cHPM Atlas hasn\'t loaded yet! Please wait!') | ||
if (!moduleName) return ChatLib.chat('&cPlease input a module name!') | ||
|
||
moduleName = moduleName.split(':')[0].toLowerCase() | ||
const moduleData = atlas[moduleName] | ||
|
||
if (!moduleData) return ChatLib.chat('&cThis module doesn\'t exist!') | ||
|
||
let components = [ | ||
new TextComponent('\n&7 ✖').setClick('run_command','/hpm atlas').setHover('show_text','&7Click to return to the atlas!'), | ||
` &7&l${moduleData.name}\n`, | ||
`&7 | Created by: ${moduleData.creator}\n`, | ||
] | ||
|
||
Object.keys(moduleData.releases).forEach(releaseName => { | ||
const releaseData = moduleData.releases[releaseName] | ||
|
||
components.push('&7 | ') | ||
components.push( | ||
new TextComponent('&a&l+') | ||
.setClick('run_command',`/hpm import ${moduleName}:${releaseName}`) | ||
.setHover('show_text', `&aImport ${moduleName}:${releaseName}`) | ||
) | ||
components.push(` &7| &b${releaseName} ${releaseData.unstable ? '&6(Unstable)' : ''}\n`) | ||
}) | ||
|
||
ChatLib.chat(new Message(components).setChatLineId(694201337)) | ||
} |