-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
75c656f
commit b9e6ff5
Showing
6 changed files
with
639 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 |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# Sanctioner | ||
[![](https://i.loli.net/2019/06/02/5cf3ac062cc3478578.png)](http://www.mcbbs.net/thread-870745-1-1.html "制裁者") | ||
|
||
Sanctioner plugin for Nukkit | ||
|
||
Allows banned players to join the game, but everything they do is in vain. Quietly punishes them, they may not know they are banned :/ | ||
|
||
Please see [mcbbs](http://www.mcbbs.net/thread-870745-1-1.html) for more information. | ||
## Commands | ||
| Command | Permission | Description | Default | | ||
| - | - | - | - | - | | ||
| /crash <player> | sanctioner.crash | Crashs the player's client | OP | |
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,51 @@ | ||
<?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>cn.wode490390.nukkit</groupId> | ||
<artifactId>sanctioner</artifactId> | ||
<version>1.0.0</version> | ||
<name>Sanctioner</name> | ||
<description>Sanctioner plugin for Nukkit</description> | ||
<inceptionYear>2019</inceptionYear> | ||
<url>http://wode490390.cn/</url> | ||
<packaging>jar</packaging> | ||
<licenses> | ||
<license> | ||
<name>GNU General Public License, Version 3.0</name> | ||
<url>http://www.gnu.org/licenses/gpl.html</url> | ||
</license> | ||
</licenses> | ||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<repositories> | ||
<repository> | ||
<id>nukkitx</id> | ||
<url>http://repo.nukkitx.com/main/</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>cn.nukkit</groupId> | ||
<artifactId>nukkit</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<finalName>wodeSanctioner-${project.version}</finalName> | ||
<defaultGoal>clean package</defaultGoal> | ||
<resources> | ||
<resource> | ||
<targetPath>.</targetPath> | ||
<filtering>true</filtering> | ||
<directory>${basedir}/src/main/resources</directory> | ||
<includes> | ||
<include>*.yml</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</build> | ||
</project> |
60 changes: 60 additions & 0 deletions
60
src/main/java/cn/wode490390/nukkit/sanctioner/CrashCommand.java
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,60 @@ | ||
package cn.wode490390.nukkit.sanctioner; | ||
|
||
import cn.nukkit.Player; | ||
import cn.nukkit.command.Command; | ||
import cn.nukkit.command.CommandSender; | ||
import cn.nukkit.command.PluginIdentifiableCommand; | ||
import cn.nukkit.command.data.CommandParamType; | ||
import cn.nukkit.command.data.CommandParameter; | ||
import cn.nukkit.item.Item; | ||
import cn.nukkit.lang.TranslationContainer; | ||
import cn.nukkit.network.protocol.InventoryContentPacket; | ||
import cn.nukkit.network.protocol.types.ContainerIds; | ||
import cn.nukkit.plugin.Plugin; | ||
import cn.nukkit.utils.TextFormat; | ||
|
||
public class CrashCommand extends Command implements PluginIdentifiableCommand { | ||
|
||
private static final InventoryContentPacket CRASH_PACKET = new InventoryContentPacket(); | ||
|
||
static { | ||
CRASH_PACKET.inventoryId = ContainerIds.CREATIVE; | ||
CRASH_PACKET.slots = new Item[]{Item.get(230)}; | ||
} | ||
|
||
private final Plugin plugin; | ||
|
||
public CrashCommand(Plugin plugin) { | ||
super("crash", "Crashs the player's client", "/crash <player>"); | ||
this.setPermission("sanctioner.crash"); | ||
this.getCommandParameters().clear(); | ||
this.addCommandParameters("default", new CommandParameter[]{ | ||
new CommandParameter("player", CommandParamType.TARGET, false) | ||
}); | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public boolean execute(CommandSender sender, String label, String[] args) { | ||
if (!this.plugin.isEnabled() || !this.testPermission(sender)) { | ||
return false; | ||
} | ||
if (args.length > 0) { | ||
Player player = plugin.getServer().getPlayer(args[0]); | ||
if (player != null) { | ||
player.dataPacket(CRASH_PACKET); | ||
Command.broadcastCommandMessage(sender, TextFormat.YELLOW + "Successfully crashed " + args[0] + "'s client"); | ||
} else { | ||
sender.sendMessage("No targets matched selector"); | ||
} | ||
} else { | ||
sender.sendMessage(new TranslationContainer("commands.generic.usage", this.getUsage())); | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public Plugin getPlugin() { | ||
return this.plugin; | ||
} | ||
} |
Oops, something went wrong.