Skip to content

Commit 112c2c7

Browse files
committed
First commit v1.0
0 parents  commit 112c2c7

File tree

12 files changed

+248
-0
lines changed

12 files changed

+248
-0
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/discord.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) [2023] [Jiří Apjár]
4+
Copyright (c) [2023] [Filip Zeman]
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# TheCraftBlock
2+
![badge](https://img.shields.io/github/v/release/Fly_Ultra/TheCraftBlock)
3+
![badge](https://img.shields.io/github/downloads/Fly_Ultra/TheCraftBlock/total)
4+
![badge](https://img.shields.io/github/last-commit/ForestTechMC/ForestChannelAPI)
5+
![badge](https://img.shields.io/badge/platform-spigot-lightgrey)
6+
[![badge](https://img.shields.io/discord/896466173166747650?label=discord)](https://discord.gg/2PpdrfxhD4)
7+
[![badge](https://img.shields.io/github/license/Fly_Ultra/TheCraftBlock)](https://github.com/Fly_Ultra/TheCraftBlock/blob/master/LICENSE.txt)
8+
9+
10+
Example how to block, all prepare of craft -> listener
11+
You can use this on Creative servers, or on some realistic based server
12+
13+
## Table of contents
14+
15+
* [Getting started](#getting-started)
16+
* [License](#license)
17+
18+
## Getting started
19+
20+
1. Stop server
21+
2. Add this plugin into /plugins
22+
3. Start server
23+
4. And have fun!
24+
25+
## License
26+
ForestChannelAPI is licensed under the permissive MIT license. Please see [`LICENSE.txt`](https://github.com/Fly_Ultra/TheCraftBlock/blob/master/LICENSE.txt) for more information.

pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
8+
<groupId>cz.flyultra</groupId>
9+
<artifactId>TheCraftBlock</artifactId>
10+
<version>1.0</version>
11+
12+
<properties>
13+
<maven.compiler.source>17</maven.compiler.source>
14+
<maven.compiler.target>17</maven.compiler.target>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
18+
<repositories>
19+
<repository>
20+
<id>spigot-repo</id>
21+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
22+
</repository>
23+
</repositories>
24+
25+
<dependencies>
26+
<dependency>
27+
<groupId>org.spigotmc</groupId>
28+
<artifactId>spigot-api</artifactId>
29+
<version>1.19-R0.1-SNAPSHOT</version>
30+
<scope>provided</scope>
31+
</dependency>
32+
</dependencies>
33+
</project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package cz.flyultra;
2+
3+
import org.bukkit.entity.Player;
4+
import org.bukkit.event.EventHandler;
5+
import org.bukkit.event.Listener;
6+
import org.bukkit.event.inventory.PrepareItemCraftEvent;
7+
import org.bukkit.inventory.ItemStack;
8+
9+
public class CraftListener implements Listener {
10+
private Main plugin;
11+
12+
public CraftListener() {
13+
this.plugin = Main.getInstance();
14+
}
15+
16+
/**
17+
*
18+
* This event block all prepare of craft
19+
* And response with message "§7Never say ever!"
20+
*
21+
* @param event PrepareItemCraftEvent
22+
*/
23+
@EventHandler
24+
public void onInventoryClick(PrepareItemCraftEvent event) {
25+
Player player = (Player) event.getView().getPlayer();
26+
27+
if (event.getInventory().getMatrix() == null) {
28+
return;
29+
}
30+
31+
if (event.getInventory().getContents() == null) {
32+
return;
33+
}
34+
35+
for (ItemStack itemStack : event.getInventory().getContents()) {
36+
37+
if (itemStack == null || itemStack.getItemMeta() == null) {
38+
continue;
39+
}
40+
41+
player.sendMessage("§7Never say ever!");
42+
player.closeInventory();
43+
}
44+
45+
}
46+
47+
}

0 commit comments

Comments
 (0)