Initial commit: Minecraft plugin that detects 'oye' in chat and prints it in green
This commit is contained in:
66
pom.xml
Normal file
66
pom.xml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<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>party.cybsec</groupId>
|
||||||
|
<artifactId>oye</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>OyePlugin</name>
|
||||||
|
<description>A Minecraft plugin that detects "oye" in chat and prints it in green</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>17</source>
|
||||||
|
<target>17</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
</project>
|
||||||
36
src/main/java/com/example/oye/OyePlugin.java
Normal file
36
src/main/java/com/example/oye/OyePlugin.java
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package party.cybsec.oye;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
public class OyePlugin extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
// register the event listener
|
||||||
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
|
getLogger().info("Oye plugin enabled!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
getLogger().info("Oye plugin disabled!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
|
String message = event.getMessage().toLowerCase();
|
||||||
|
|
||||||
|
// check if the message contains "oye"
|
||||||
|
if (message.contains("oye")) {
|
||||||
|
// cancel the original message
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
// send a green "oye" message
|
||||||
|
getServer().broadcastMessage(ChatColor.GREEN + "oye");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/main/resources/plugin.yml
Normal file
4
src/main/resources/plugin.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
name: OyePlugin
|
||||||
|
version: 1.0
|
||||||
|
main: party.cybsec.oye.OyePlugin
|
||||||
|
api-version: 1.21
|
||||||
BIN
target/classes/party/cybsec/oye/OyePlugin.class
Normal file
BIN
target/classes/party/cybsec/oye/OyePlugin.class
Normal file
Binary file not shown.
4
target/classes/plugin.yml
Normal file
4
target/classes/plugin.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
name: OyePlugin
|
||||||
|
version: 1.0
|
||||||
|
main: party.cybsec.oye.OyePlugin
|
||||||
|
api-version: 1.21
|
||||||
3
target/maven-archiver/pom.properties
Normal file
3
target/maven-archiver/pom.properties
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
artifactId=oye
|
||||||
|
groupId=party.cybsec
|
||||||
|
version=1.0
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
party/cybsec/oye/OyePlugin.class
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/Users/jacktotonchi/Documents/oye/oye/src/main/java/com/example/oye/OyePlugin.java
|
||||||
BIN
target/original-oye-1.0.jar
Normal file
BIN
target/original-oye-1.0.jar
Normal file
Binary file not shown.
BIN
target/oye-1.0.jar
Normal file
BIN
target/oye-1.0.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user