Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 143 additions & 13 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,50 +1,180 @@
<!DOCTYPE html>
<html lang="en">
<script>

redirects = {
"detectitem" : ["item","itemdetect","itemdetection","itemdetection","itemcheck","inventorydetect","detectitems","items"],
"customitemtag" : ["customitemtags","custom_data","customdata","itemtag","itemtagcustom","itemtags","customdataitem"],
"amountitems" : ["numitems","numberofitems","itemamount","itemcount","itemcounter","amountitem","amountofitems","itemscount","quantityofitems","countofitems","numitem"],
"itemclick" : ["clickitem","rightclick","click","clickonitem","interactionclick","interaction","leftclick","carrotonastick","coas"],
"giveitembedrock" : ["giveitembc","givebedrock","bedrockitemgive","bedrockgiveitem"],
"modifyinventory" : ["inventorymodify","changeinventory","modifyinv","changeinv","itemmodifier","invmod","inventoryedit","editinventory","inventoryedit"],
"randomnumber" : ["rnd","randomnum","random","randomvalue","randomresult","scoreboardrandom","randomscoreboard","randomscore","rndnum","randint","rndint"],
"nbttransfer" : ["copynbt","nbtcopy","executestore","transfernbt"],
"scorecompare" : ["comparescore","scorecheck","comparisonofscores"],
"findsamescoreentity": ["findlinkedentity","findsamescoreplayer","findlinkedplayer"],
"movetoscore" : ["summonatscore","tptoscore","movitoscore","tpatscore","tpscore","scoretp","scoremove"],
"changeofscore" : ["scorechange","changeofscorebaord","scoreboardchange","changescore"],
"linkentity" : ["entitylink","scoreboardid","id","linktoentity"],
"highestscore": ["topscore","maxscore","minscore","lowscore","leaderboard","lowestscore","leaderboard","maxscore","minscore","topscore","bestscore"],
"runonce" : ["executeonce","run1time","run1","runonetime","onceexecution","executeonce","execute1"],
"areas" : ["regions","zones","area","location","locationcheck"],
"heighttest" : ["ytest","heightcheck","ycheck","testheight"],
"playerdeaths" : ["deaths","deathcount","dead","deathscount"],
"playerkills" : ["kills","killcount","killed","killedplayers","killamount"],
"playerjoins" : ["joins","joined","joinplayer","join","joinedplayer","newplayer","playerjoin","playerjoined"],
"storeinventory" : ["saveinventory","backupinventory","storeinv","saveinv","backupinv","storageinventory","inventorystorage","inventorysave","inventorybackup","invstore","invsave","invbackpup"],
"lookat" : ["facing","lineofsight","facingdirection"],
"moving": ["move","movement","ismoving","detectmovement","movementdetection","locationchange"],
"functionconditions" : ["conditionalfunction","conditionalfunctions","functioncondition","functionsconditions","functionscondition","functionif","functiontestfor"],
"blockinvert" : ["not","invertresult","notgate","invertblock","resultinvert","unless"],
"numplayers" : ["playercount","amountplayers","playercounter","playernumbers","numberplayer","playerscount","countplayer"],
"tagentity" : ["entitytag"],
"angermob" : ["mobanger","angerentity","aggromob","aggro"],
"shootfacing" : ["shootdirection","shootlookat","shootlook","facingshoot","directionshoot","lookatshot"],
"mobdeaths" : ["mobkills","deathmob","deathsmobs","mobsdeath","killsmob","killmob"],
"hostilefriendly" : ["friendlymob","pvp","nopvp","disablepvp","disablehostile"],
"npc" : ["bedrocknpc","npcbedrock"],
"blockdelay" : ["timer","scoreboardtimer","delay","delaytimer"],
"compasstoplayer" : ["playercompass","compassplayer"],
"raycast" : ["raycasting","ray"],
"makecircle" : ["createcircle","drawcircle"],
"customcommands" : ["customcommand","triggercommand","commandcustom"],
"fakeplayer" : [],
"range" : ["2dots","twodots","ranges"],
"commandcontext" : ["cmdcontext","atvsas"],
"escaping" : ["escape"],
"multipletags" : [],
}

const path = window.location.pathname;
const url = window.location.href;

if (path.endsWith("/")) {
console.log("Redirecting to " + url.slice(0, -1));
window.location.href = url.slice(0, -1);
}
if (path.startsWith("/wiki/faq") || path.startsWith("/wiki/faqs") || path.startsWith("/wiki/question") || path.startsWith("/wiki/w")) {
window.location.href = url.replace(/\/(faqs|faq|question|w)/, "/wiki");
}
if (path.startsWith("/wiki/questions/")) {
for (const key in redirects) {
for (const alias of redirects[key]) {
if (path.endsWith("/" + alias) || path.includes("/" + alias + "/") || path.includes("/" + alias + "?")) {
console.log("Redirecting to" + key);
window.location.href = url.replace(alias, key);
break;
}
}
}
}
</script>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>404: Page Not Found</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
background-color: #00aced;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-image: url(https://raw.githubusercontent.com/MinecraftCommands/discord-server-assets/refs/heads/main/invite_backgrounds/mcc_invite_banner.jpg);
}
.container {
text-align: center;
background-color: #ffffff;
padding: 40px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
h1 {
color: #e74c3c;
font-size: 36px;
}
.cmd-box {
font-family: monospace;
display: inline-block;
background: #000;
color: #e6e6e6;
padding: 6px 8px;
border: 2px solid #3a3a3a;
font-size: 14px;
}
.valid {
color: #9e9e9e;
font-family: monospace;
}
.invalid {color: #e04b4b;}
button {
background-color: #3498db;
color: white;
padding: 12px 24px;
font-size: 16px;
border: none;
border-radius: 5px;
font-family: monospace;
font-size: 14px;
color: #e0e0e0;
padding: 6px 16px;
background: #7b7b7b;
border: 2px solid #373737;
box-shadow:inset 1px 1px 0 #ffffff,inset -1px -1px 0 #4a4a4a;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #2980b9;
button:hover {background: #8b8b8b;}
button:active {
background: #6b6b6b;
box-shadow: inset 1px 1px 0 #4a4a4a, inset -1px -1px 0 #ffffff;
}
</style>
</head>
<body>
<div class="container">
<img class="logo" src="https://raw.githubusercontent.com/MinecraftCommands/discord-server-assets/refs/heads/main/logos/default.gif" alt="Minecraft Commands Logo" width="100" height="100", style="border-radius: 5%;"><br><br>
<h1>404: Page Not Found</h1>
<button onclick="window.location.href='https://minecraftcommands.github.io/wiki';">Go back to the Table of Contents</button><br>
<p>If you encounter any issues, you can <a href="https://github.com/MinecraftCommands/wiki/issues" target="_blank">create a GitHub issue</a>.</p>
<div id="cmd" class="cmd-box"></div><br><br>
<div class="valid">Unknown or incomplete url. See below for error at <span id="invalid-path"></span> &lt--[HERE]</div><br>
<button onclick="window.location.href='https://minecraftcommands.github.io/wiki';">Go back to the Table of Contents</button><br><br>
<button onclick="history.back();">Go to previous page</button><br>
<p>If you encounter any issues or think this is an error, you can <a href="https://github.com/MinecraftCommands/wiki/issues" target="_blank">create a GitHub issue</a>.</p>
</div>
</body>
<script>
const allowed = ["questions","resources","bcresources","debugging","optimising","CONTRIBUTING","404.html"];
const parts = path.split("/").filter(Boolean);

let html = "";
let invalidParts = [];

if (parts[0] === "wiki") {
html += `<span class="valid">/wiki</span>`;
if (parts[1]) {
if (allowed.includes(parts[1])) {
html += `<span class="valid">/${parts[1]}</span>`;
} else {
html += `<span class="invalid">/${parts[1]}</span>`;
invalidParts.push(parts[1]);
}
}
for (let i = 2; i < parts.length; i++) {
html += `<span class="invalid">/${parts[i]}</span>`;
invalidParts.push(parts[i]);
}
} else {
html = `<span class="invalid">/${parts.join("/")}</span>`;
invalidParts = parts;
}

document.getElementById("cmd").innerHTML = html;
document.getElementById("invalid-path").textContent = invalidParts.length ? "/" + invalidParts.join("/") : "none";

console.error("404 Page Not Found")

const date = new Date();
if (date.getMonth() === 11 && date.getDate() >= 20 && date.getDate() <= 31) {
const logo = document.querySelector('.logo');
logo.src = "https://raw.githubusercontent.com/MinecraftCommands/discord-server-assets/refs/heads/main/logos/christmas.gif"
}
if (date.getMonth() === 9 && date.getDate() >= 24 && date.getDate() <= 31) {
const logo = document.querySelector('.logo');
logo.src = "https://raw.githubusercontent.com/MinecraftCommands/discord-server-assets/refs/heads/main/logos/halloween.gif"
}
</script>
</html>
48 changes: 48 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Contributing

- [Codeblocks and Details](#codeblocks-and-details)
- [Table of contents](#table-of-contents)
- [Article names](#article-names)

## Codeblocks and Details

When typing code longer than several lines and in order to prevent cluttering the article with commands/json wrap your code into an HTML `details` tag, that will result into previewing it like this:

<details markdown="1">
<summary style="color: #e67e22; font-weight: bold;">See commands</summary>

```mcfunction
# Command blocks
say this is a command
```
</details>

This is acomplished by typing this

````html
<details markdown="1">
<summary style="color: #e67e22; font-weight: bold;">See commands</summary>

```mcfunction
# Command blocks
say this is a command
```
</details>
````

## Table of contents

Below the title of each new article add a table of contents, like how it's done in every article for better navigation. For example:

```markdown
- [Java](#java)
- [Target selector](#target-selector)
- [Predicate](#predicate)
- [Bedrock](#bedrock)
- [Commands](#commands)
- [Behavior Packs](#behavior-packs)
```

## Article names

Keep the article names all lowercase without any separator between worlds, like how it's done in all existing articles.
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ include:
- LICENSE.md
- COPYING.md
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- ISSUE_TEMPLATE.md
- PULL_REQUEST_TEMPLATE.md
126 changes: 126 additions & 0 deletions _includes/head-custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<link href="https://cdn.jsdelivr.net/npm/prismjs/themes/prism.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/prismjs/prism.js"></script>
<script>
Prism.languages.mcfunction = {
'comment': {
pattern: /^#.*/m,
greedy: true
},
'angle-word': {
pattern: /<[\w_]+>/,
greedy: true
},
'run-command': {
pattern: /\brun\s+\b[a-zA-Z_][\w]*\b/,
inside: {
'keyword': /\brun\b/,
'command': /\b[a-zA-Z_][\w]*\b/
},
greedy: true
},
'command': {
pattern: /^\s*\b[a-zA-Z_][\w]*\b/m,
greedy: true
},
'macro': {
pattern: /(^\$)|\$\([a-zA-Z_][\w]*\)/m,
greedy: true
},
'fakeplayer': {
pattern: /([#\$][a-zA-Z_][\w]*)/,
greedy: true
},
'resource': {
pattern: /#?\b[a-z0-9_.-]+:[a-z0-9_./-]+\b/i
},
'property': {
pattern: /\b[a-zA-Z_][\w]*=/,
greedy: true
},
'string': {
pattern: /"(?:\\.|[^"\\])*"/,
greedy: true
},
'boolean': /\b(?:true|false)\b/,
'number': /\b-?\d+(?:\.\d+)?\b/,
'punctuation': /[{}\[\](),.:]/,
'selector': {
pattern: /@(s|n|a|e|p|r|initiator)\b/,
greedy: true
},
'operator': {
pattern: /[=+\-*/%]=?|!=|<|>|<=|>=|\^/,
greedy: true
},
'coordinate': {
pattern: /[~\^]-?\d*(?:\.\d+)?/,
greedy: true
},
'nbt': {
pattern: /[\{\}][^{}]*[\{\}]?|[\[\]][^\[\]]*[\[\]]?/,
greedy: true
},
'nbtpath': {
pattern: /\b[a-zA-Z_][\w]*(?:\.[a-zA-Z_][\w]*)+\b/,
greedy: true
},
'uuid': {
pattern: /\b[0-9a-f]+(?:-[0-9a-f]+){4,4}\b/i,
greedy: true
},
};
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll("pre > code").forEach(function(codeBlock) {
const pre = codeBlock.parentNode;
if (pre.querySelector(".copy-button")) return;
const button = document.createElement("button");
button.className = "copy-button";
button.textContent = "Copy";
pre.appendChild(button);

button.addEventListener("click", function() {
navigator.clipboard.writeText(codeBlock.innerText).then(() => {
button.textContent = "Copied!";
setTimeout(() => { button.textContent = "Copy"; }, 1500);
});
});
});
});
</script>
<style>
.token.comment { color: #5b7f44; }
.token.macro { color: #ffd000; }
.token.command { color: #c678dd; }
.token.resource { color: #4b97d5; }
.token.property { color: #e06c75; }
.token.string { color: #7fbf6a; }
.token.boolean { color: #56b6c2; }
.token.number { color: #d19a66; }
.token.punctuation { color: #0093c4; }
.token.selector { color: #d19a66; }
.token.fakeplayer { color: #ff8800; }
.token.operator { color: #e06c75; background: none}
.token.coordinate { color: #56b6c2; }
.token.nbt { color: #61afef; }
.token.nbtpath { color: #be5046; }
.token.uuid { color: #d19a66; font-style: italic; }
.token.keyword { color: #0093c4;}
.token.angle-word { color: #ff0000; background-color:#56b6c2; border-radius: 5px; }
pre { position: relative; }
.copy-button {
position: absolute;
top: 4px;
right: 4px;
padding: 2px 6px;
font-size: 12px;
cursor: pointer;
border: none;
border-radius: 3px;
background: #61afef;
color: white;
opacity: 0.8;
transition: opacity 0.2s;
z-index: 10;
}
.copy-button:hover { opacity: 1; }
</style>
Loading