Skip to content

Commit 3326f00

Browse files
Initial commit
0 parents  commit 3326f00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6125
-0
lines changed

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# deps
2+
/node_modules
3+
4+
# generated content
5+
.contentlayer
6+
.content-collections
7+
.source
8+
9+
# test & build
10+
/coverage
11+
/.next/
12+
/out/
13+
/build
14+
*.tsbuildinfo
15+
16+
# misc
17+
.DS_Store
18+
*.pem
19+
/.pnp
20+
.pnp.js
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# others
26+
.env*.local
27+
.vercel
28+
next-env.d.ts

app/(home)/layout.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { ReactNode } from 'react';
2+
import { HomeLayout } from 'fumadocs-ui/layouts/home';
3+
import { baseOptions } from '@/app/layout.config';
4+
5+
export default function Layout({ children }: { children: ReactNode }) {
6+
return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
7+
}

app/(home)/page.tsx

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
"use client"; // Dodaj ten dyrektywę na początku pliku
2+
3+
import Link from 'next/link';
4+
import Image from 'next/image';
5+
import { useEffect, useState } from 'react';
6+
7+
export default function HomePage() {
8+
const [isDarkTheme, setIsDarkTheme] = useState(false);
9+
10+
useEffect(() => {
11+
const htmlElement = document.documentElement;
12+
13+
// Funkcja sprawdzająca aktualny motyw
14+
const checkTheme = () => {
15+
setIsDarkTheme(htmlElement.classList.contains('dark'));
16+
};
17+
18+
// Inicjalne sprawdzenie motywu
19+
checkTheme();
20+
21+
// Konfiguracja obserwatora zmian
22+
const observer = new MutationObserver((mutations) => {
23+
mutations.forEach((mutation) => {
24+
if (mutation.attributeName === 'class') {
25+
checkTheme();
26+
}
27+
});
28+
});
29+
30+
// Rozpocznij obserwację
31+
observer.observe(htmlElement, {
32+
attributes: true,
33+
attributeFilter: ['class']
34+
});
35+
36+
// Sprzątanie przy unmount
37+
return () => observer.disconnect();
38+
}, []);
39+
40+
return (
41+
<main
42+
style={{
43+
flex: 1,
44+
display: 'flex',
45+
flexDirection: 'column',
46+
alignItems: 'center',
47+
justifyContent: 'center',
48+
textAlign: 'center',
49+
padding: '2rem',
50+
}}
51+
>
52+
<Image
53+
src={isDarkTheme ? "/header_dark.png" : "/header.png"}
54+
alt="LogicGates Header"
55+
width={600}
56+
height={600}
57+
style={{
58+
marginBottom: '2rem',
59+
}}
60+
/>
61+
62+
{/* Reszta kodu pozostaje bez zmian */}
63+
<h1 style={{ fontSize: '2.5rem', fontWeight: 'bold', marginBottom: '1.5rem' }}>
64+
Welcome to LogicGates
65+
</h1>
66+
67+
<p style={{ fontSize: '1.2rem', maxWidth: '600px', marginBottom: '2rem', lineHeight: '1.6' }}>
68+
Say goodbye to massive Redstone circuits! This plugin introduces compact and efficient logic gates directly into your Spigot server.
69+
</p>
70+
71+
<p>
72+
Explore the{' '}
73+
<Link
74+
href="/docs"
75+
style={{
76+
fontWeight: '600',
77+
textDecoration: 'underline',
78+
}}
79+
>
80+
documentation
81+
</Link>{' '}
82+
to get started.
83+
</p>
84+
</main>
85+
);
86+
}

app/api/search/route.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { source } from '@/lib/source';
2+
import { createFromSource } from 'fumadocs-core/search/server';
3+
4+
export const { GET } = createFromSource(source);

app/docs/[[...slug]]/page.tsx

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { source } from '@/lib/source';
2+
import {
3+
DocsPage,
4+
DocsBody,
5+
DocsDescription,
6+
DocsTitle,
7+
} from 'fumadocs-ui/page';
8+
import { notFound } from 'next/navigation';
9+
import defaultMdxComponents from 'fumadocs-ui/mdx';
10+
import { Popup, PopupContent, PopupTrigger } from 'fumadocs-twoslash/ui';
11+
12+
export default async function Page(props: {
13+
params: Promise<{ slug?: string[] }>;
14+
}) {
15+
const params = await props.params;
16+
const page = source.getPage(params.slug);
17+
if (!page) notFound();
18+
19+
const MDX = page.data.body;
20+
21+
return (
22+
<DocsPage toc={page.data.toc} full={page.data.full}>
23+
<DocsTitle>{page.data.title}</DocsTitle>
24+
<DocsDescription>{page.data.description}</DocsDescription>
25+
<DocsBody>
26+
<MDX
27+
components={{
28+
...defaultMdxComponents,
29+
Popup,
30+
PopupContent,
31+
PopupTrigger,
32+
}}
33+
/>
34+
</DocsBody>
35+
</DocsPage>
36+
);
37+
}
38+
39+
export async function generateStaticParams() {
40+
return source.generateParams();
41+
}
42+
43+
export async function generateMetadata(props: {
44+
params: Promise<{ slug?: string[] }>;
45+
}) {
46+
const params = await props.params;
47+
const page = source.getPage(params.slug);
48+
if (!page) notFound();
49+
50+
return {
51+
title: page.data.title,
52+
description: page.data.description,
53+
};
54+
}

app/docs/layout.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
2+
import type { ReactNode } from 'react';
3+
import { baseOptions } from '@/app/layout.config';
4+
import { source } from '@/lib/source';
5+
6+
export default function Layout({ children }: { children: ReactNode }) {
7+
return (
8+
<DocsLayout tree={source.pageTree} {...baseOptions}>
9+
{children}
10+
</DocsLayout>
11+
);
12+
}

app/layout.config.tsx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
2+
3+
/**
4+
* Shared layout configurations
5+
*
6+
* you can configure layouts individually from:
7+
* Home Layout: app/(home)/layout.tsx
8+
* Docs Layout: app/docs/layout.tsx
9+
*/
10+
export const baseOptions: BaseLayoutProps = {
11+
nav: {
12+
title: 'LogicGates for Spigot',
13+
},
14+
links: [
15+
{
16+
text: 'Documentation',
17+
url: '/docs',
18+
active: 'nested-url',
19+
},
20+
{
21+
text: 'Latest version',
22+
url: 'https://github.com/piotrmaciejbednarski/LogicGates/releases/latest',
23+
secondary: true,
24+
}
25+
],
26+
githubUrl: 'https://github.com/piotrmaciejbednarski/LogicGates/',
27+
};

app/layout.tsx

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { RootProvider } from 'fumadocs-ui/provider';
2+
import 'fumadocs-ui/style.css';
3+
import 'fumadocs-ui/css/dusk.css';
4+
import 'fumadocs-twoslash/twoslash.css';
5+
import { Inter } from 'next/font/google';
6+
import type { ReactNode } from 'react';
7+
8+
const inter = Inter({
9+
subsets: ['latin'],
10+
});
11+
12+
export default function Layout({ children }: { children: ReactNode }) {
13+
return (
14+
<html lang="en" className={inter.className} suppressHydrationWarning>
15+
<body
16+
style={{
17+
display: 'flex',
18+
flexDirection: 'column',
19+
minHeight: '100vh',
20+
}}
21+
>
22+
<RootProvider>{children}</RootProvider>
23+
</body>
24+
</html>
25+
);
26+
}

content/docs/commands/list.mdx

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Command list
3+
---
4+
5+
1. /logicgates debug
6+
- **Description**: Toggles debug mode for the plugin. This is useful for developers or administrators to troubleshoot issues.
7+
- **Permission**: `logicgates.admin`
8+
- **Usage:** Only players with admin permissions can use this command. When activated, it provides detailed logs when gate output was changed.
9+
10+
2. /logicgates menu
11+
- **Description**: Opens a graphical user interface (GUI) that allows players to select logic gates.
12+
- **Permission**: `logicgates.give`
13+
- **Usage**: Players can use this command to access a menu where they can choose from various logic gates configured in the plugin. The GUI displays all available gates, and players can select one to use.
14+
15+
3. /logicgates update
16+
- **Description**: Checks for updates to the plugin. If an update is available, it notifies the user.
17+
- **Permission**: `logicgates.admin`
18+
- **Usage**: This command is intended for administrators to ensure the plugin is up-to-date with the latest version.
19+
20+
4. /logicgates inspect
21+
- **Description**: Activates inspection mode, allowing players to inspect logic gates in the world.
22+
- **Permission**: `logicgates.inspect`
23+
- **Usage**: Players can use this command to enter a mode where they can examine logic gates, view their properties, and troubleshoot issues.
24+
25+
5. /logicgates rotate
26+
- **Description**: Gives the player a "Rotation Wand" that can be used to rotate logic gates in the world.
27+
- **Permission**: `logicgates.rotate`
28+
- **Usage**: Players receive a special wand (a stick with a unique identifier) that allows them to right-click on logic gates to change their orientation.
29+
30+
6. /logicgates toggleinput
31+
- **Description**: Change number of inputs of selected logic gate.
32+
- **Permission**: `logicgates.toggleinput`
33+
- **Usage**: Players can use this command to enter a mode where they can toggle the inputs number of logic gates.
34+
35+
7. /logicgates howto
36+
- **Description**: Provides instructions and a link to the plugin's documentation for creating and using logic gates.
37+
- **Permission**: None (available to all players)
38+
- **Usage**: This command sends a clickable message with a link to the plugin's documentation, helping players learn how to use the plugin effectively.
39+
40+
8. /logicgates help
41+
- **Description**: Displays a list of available commands and their usage.
42+
- **Permission**: None (available to all players)
43+
- **Usage**: Players can use this command to get a summary of all commands and their purposes.
44+
45+
9. /logicgates author
46+
- **Description**: Displays information about the plugin's author, including contact details.
47+
- **Permission**: None (available to all players)
48+
- **Usage**: This command provides credits to the plugin's creator and may include links to contact the author for support or feedback.
49+
50+
10. /logicgates save
51+
- **Description**: Saves the current state of all logic gates to the plugin's configuration.
52+
- **Permission**: `logicgates.admin`
53+
- **Usage**: Administrators can use this command to manually save the state of all gates, ensuring that changes are persisted.
54+
55+
11. /logicgates redstonecompatibility [on/off]
56+
- **Description**: Toggles redstone compatibility for logic gates.
57+
- **Permission**: `logicgates.admin`
58+
- **Usage**: Administrators can enable or disable compatibility with redstone circuits.
59+
60+
12. /logicgates fixparticles
61+
- **Description**: Fixes issues with particle effects in the plugin.
62+
- **Permission**: `logicgates.admin`
63+
- **Usage**: Administrators can use this command to reload or reset particle effects, resolving any visual glitches.
64+
65+
13. /logicgates particles [on/off]
66+
- **Description**: Toggles particle effects for logic gates.
67+
- **Permission**: `logicgates.admin`
68+
- **Usage**: Administrators can enable or disable particle effects, which are used to visualize gate operations.
69+
70+
14. /logicgates language [language_code]
71+
- **Description**: Changes the plugin's language to the specified language code.
72+
- **Permission**: `logicgates.admin`
73+
- **Usage**: Administrators can use this command to switch the plugin's language to one of the supported options.
74+
75+
15. /logicgates timer [seconds]
76+
- **Description**: Sets a cooldown of TIMER gate.
77+
- **Permission**: `logicgates.timer`
78+
- **Usage**: Players can specify a cooldown time (in seconds) for TIMER gate.
79+
80+
16. /logicgates reload
81+
- **Description**: Reloads the plugin's configuration file.
82+
- **Permission**: `logicgates.admin`
83+
- **Usage**: Administrators can use this command to reload the plugin's configuration without restarting the server.

content/docs/commands/permissions.mdx

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Player Permissions
3+
---
4+
5+
To properly manage permissions in the **Logic Gates** plugin, players must be granted the appropriate permissions.
6+
7+
- **logicgates.place**: Allows the player to create logic gates.
8+
9+
- **logicgates.break**: Allows the player to destroy existing logic gates.
10+
11+
- **logicgates.admin**: Permissions for administrators. Allows the use of commands such as `debug`, `update`, `save`, `redstonecompatibility`, `fixparticles`, `particles`, `language`, `reload`. These commands enable debugging, plugin updates, saving the state of logic gates, managing redstone compatibility, fixing particle effects, and other administrative functions.
12+
13+
- **logicgates.give**: Permission for players who can use the GUI to select logic gates with the `/logicgates menu` command. This provides easy access to various gates in the plugin.
14+
15+
- **logicgates.inspect**: Permission that allows players to activate the logic gate inspection mode. The `/logicgates inspect` command allows viewing the properties of gates in-game.
16+
17+
- **logicgates.rotate**: Permission granting players a special wand to rotate logic gates with the `/logicgates rotate` command.
18+
19+
- **logicgates.toggleinput**: Permission allowing players to change the number of inputs on a selected logic gate. Players can modify the number of inputs using the `/logicgates toggleinput` command.
20+
21+
- **logicgates.timer**: Permission enabling players to set the wait time for the TIMER gate using the `/logicgates timer` command.
22+

content/docs/getting-started/faq.mdx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Frequently Asked Questions
3+
---
4+
5+
## Why do I need to connect "expanders" to the output instead of connecting redstone directly?
6+
7+
The Bukkit/Spigot/PaperMC engines update redstone, comparators, and repeaters every tick. This means that if the plugin tries to override the state of an object, it will be reset in the next update. Using a repeater on a gate’s output can create a "clock" effect. However, redstone alone only works for one block, and extending the circuit causes the signal to be lost.
8+
9+
The solution is to use **safe output expanders**, such as **buttons, levers, or observers** — these retain their state and are not updated by the server every tick. This ensures stability and prevents bugs in your mechanisms.
10+
11+
## Does the plugin impact performance?
12+
13+
No, the plugin generally has no impact on performance. However, a very high number of logic gates may lead to performance issues.
14+
15+
To maintain performance, consider adjusting settings like **particle effects** in **config.yml**.
16+
17+
## I’m experiencing issues with the plugin, and it’s not my fault
18+
19+
Bugs can happen — the plugin is not completely stable. I actively work on improving the plugin and fixing bugs. You can also **report issues on GitHub** or suggest changes via the [Issues page](https://github.com/piotrmaciejbednarski/LogicGates/issues).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Installing LogicGates
3+
---
4+
5+
Download the latest version of the **LogicGates plugin** from the [official GitHub repository](https://github.com/piotrmaciejbednarski/LogicGates).
6+
7+
Place the downloaded .jar file (e.g., LogicGates-1.1.5.jar) in the **plugins** folder of your Bukkit/Spigot server. Start or restart the server. The LogicGates plugin will be loaded automatically.
8+
9+
## Requirements
10+
11+
- The LogicGates plugin is compatible with **versions 1.16** and later.
12+
- It is recommended to use the latest stable version of **Spigot or Paper**.
13+
- The plugin requires **Java version 17** or later.
14+
15+
The LogicGates plugin works with Multiverse-Core and WorldEdit plugins (optional). Their presence may extend the functionality of the plugin, but they are **not required** for it to function.

0 commit comments

Comments
 (0)