-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a152ec7
Showing
3 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: MiniLuv | ||
main: to.joe.j2mc.miniluv.J2MC_MiniLuv | ||
version: 1.0 | ||
depend: [Core] | ||
website: http://forums.joe.to | ||
author: J2 Minecraft Plugin Team | ||
description: Ministry of love |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<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>to.joe</groupId> | ||
<artifactId>j2mc-miniluv</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>j2mc-miniluv</name> | ||
<url>http://www.github.com/joeto/j2mc-miniluv</url> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<scm> | ||
<connection>scm:git:git://github.com/joeto/j2mc-miniluv/j2mc-miniluv.git</connection> | ||
<developerConnection>scm:git:ssh://[email protected]/joeto/j2mc-miniluv/j2mc-miniluv.git</developerConnection> | ||
<url>s://www.github.com/joeto/j2mc-miniluv</url> | ||
</scm> | ||
<repositories> | ||
<repository> | ||
<id>bukkit-repo</id> | ||
<url>http://repo.bukkit.org/content/groups/public</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.bukkit</groupId> | ||
<artifactId>craftbukkit</artifactId> | ||
<version>1.1-R5-SNAPSHOT</version> | ||
<type>jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>to.joe</groupId> | ||
<artifactId>j2mc-core</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<!-- This builds a completely 'ready to start' jar with all dependencies inside --> | ||
<build> | ||
<directory>target</directory> | ||
<outputDirectory>target/classes</outputDirectory> | ||
<finalName>${project.artifactId}</finalName> | ||
<sourceDirectory>src</sourceDirectory> | ||
<defaultGoal>clean install</defaultGoal> | ||
|
||
<resources> | ||
<resource> | ||
<targetPath>.</targetPath> | ||
<filtering>true</filtering> | ||
<directory>${basedir}</directory> | ||
<includes> | ||
<include>plugin.yml</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.1</version> | ||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Main-Class>Main</Main-Class> | ||
<Implementation-Title>j2mc-miniluv</Implementation-Title> | ||
<Implementation-Version>${describe}</Implementation-Version> | ||
<Implementation-Vendor>j2</Implementation-Vendor> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<inherited>true</inherited> | ||
<configuration> | ||
<source>1.5</source> | ||
<target>1.5</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
|
||
s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package to.joe.j2mc.miniluv; | ||
|
||
import org.bukkit.ChatColor; | ||
import org.bukkit.Location; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.block.SignChangeEvent; | ||
import org.bukkit.event.player.PlayerChatEvent; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import to.joe.j2mc.core.J2MC_Manager; | ||
import to.joe.j2mc.core.event.MessageEvent; | ||
|
||
public class J2MC_MiniLuv extends JavaPlugin implements Listener { | ||
|
||
@Override | ||
public void onEnable() { | ||
this.getServer().getPluginManager().registerEvents(this, this); | ||
|
||
this.getLogger().info("Ministry of love loaded and surveying"); | ||
} | ||
|
||
public void sendAlert(String message) { | ||
this.getServer().getPluginManager().callEvent(new MessageEvent(MessageEvent.compile("ADMININFO"), message)); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.MONITOR) | ||
public void onChat(PlayerChatEvent event) { | ||
if (event.getMessage().toLowerCase().contains("fag") || event.getMessage().toLowerCase().contains("nigg")) { | ||
this.sendAlert("Watch " + event.getPlayer().getName() + " for language: " + event.getMessage()); | ||
} | ||
if (event.getMessage().contains("_____##___##") || event.getMessage().contains("_-_-_-_-_-_-_-'' ''") || event.getMessage().contains("-_-_-_-_-_-_-_,------,") || event.getMessage().contains("##___#######")) { | ||
if (this.getServer().getPluginManager().isPluginEnabled("Bans")) { | ||
final String toSend = "BobTheHAXXXXXXguy:" + event.getPlayer().getName() + ":spam hacks:ammar2"; | ||
this.getServer().getPluginManager().callEvent(new MessageEvent(MessageEvent.compile("NEWADDBAN"), toSend)); | ||
this.sendAlert("Banned " + event.getPlayer().getName() + " for using nyancraft"); | ||
} else { | ||
this.sendAlert("Check out " + event.getPlayer().getName() + ", he is probably using spam hacks (nyancraft)"); | ||
} | ||
} | ||
if(event.getMessage().matches("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")) { | ||
this.sendAlert(event.getPlayer().getName() + " just posted an ip in chat"); | ||
} | ||
} | ||
|
||
|
||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) | ||
public void onSignChange(SignChangeEvent event) { | ||
String bad = null; | ||
for (final String line : event.getLines()) { | ||
if (line.toLowerCase().contains("fag") || (line.toLowerCase().contains("nigg")) || line.matches("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")) { | ||
bad = line; | ||
break; | ||
} | ||
} | ||
if (bad!=null) { | ||
final Location loc = event.getBlock().getLocation(); | ||
final String msg = event.getPlayer().getName() + " created a bad sign @ X" + loc.getBlockX() + " Y" + loc.getBlockY() + " Z" + loc.getBlockZ() + "! Line: \"" + bad + "\""; | ||
this.sendAlert(msg); | ||
J2MC_Manager.getCore().adminAndLog(ChatColor.RED + msg); | ||
} | ||
} | ||
|
||
} |