Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
DarioMavilia committed Dec 9, 2024
1 parent c411114 commit ca8c1ef
Show file tree
Hide file tree
Showing 16 changed files with 237 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/CrafterBlocker.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions CrafterBlocker.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>PAPER</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
</module>
72 changes: 72 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.unitedlands</groupId>
<artifactId>CrafterBlocker</artifactId>
<version>1.1</version>
<packaging>jar</packaging>

<name>CrafterBlocker</name>

<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
41 changes: 41 additions & 0 deletions src/main/java/org/unitedlands/crafterBlocker/CrafterBlocker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.unitedlands.crafterBlocker;

import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.CrafterCraftEvent;
import org.bukkit.event.block.BlockPlaceEvent;

public final class CrafterBlocker extends JavaPlugin implements Listener {

private static final String CRAFTER_DISABLED_MESSAGE = "§c§lU§f§lL §7§lCore §8§l» §cCrafters have been temporarily disabled.";

@Override
public void onEnable() {
// Plugin startup logic.
// Registering event listeners.
getServer().getPluginManager().registerEvents(this, this);
getLogger().info("CrafterBlocker has been enabled.");
}

@Override
public void onDisable() {
// Plugin shutdown logic.
getLogger().info("CrafterBlocker has been disabled.");
}

@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
// Check if the block placed is a crafter.
if (event.getBlockPlaced().getType() == Material.CRAFTER) {
event.getPlayer().sendMessage(CRAFTER_DISABLED_MESSAGE);
}
}

@EventHandler
public void onCrafterCraft(CrafterCraftEvent event) {
// Cancel the crafting event.
event.setCancelled(true);
}
}
6 changes: 6 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: CrafterBlocker
version: '1.1'
main: org.unitedlands.crafterBlocker.CrafterBlocker
api-version: '1.21'
authors: [Litning11]
description: A plugin that disables Crafter blocks.
6 changes: 6 additions & 0 deletions target/classes/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: CrafterBlocker
version: '1.1'
main: org.unitedlands.crafterBlocker.CrafterBlocker
api-version: '1.21'
authors: [Litning11]
description: A plugin that disables Crafter blocks.
3 changes: 3 additions & 0 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
artifactId=CrafterBlocker
groupId=org.unitedlands
version=1.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org\unitedlands\crafterBlocker\CrafterBlocker.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:\Users\dario\IdeaProjects\CrafterBlocker\src\main\java\org\unitedlands\crafterBlocker\CrafterBlocker.java

0 comments on commit ca8c1ef

Please sign in to comment.