partially implement sponge 1.12
This commit is contained in:
1 parent
1987513a8b
commit
f50520e396
33 files changed
+634
-440
No files matched your search
@@ -23,6 +23,7 @@ dependency-reduced-pom.xml
|
|||||||
# various other potential build files
|
# various other potential build files
|
||||||
build/
|
build/
|
||||||
bin/
|
bin/
|
||||||
|
out/
|
||||||
dist/
|
dist/
|
||||||
manifest.mf
|
manifest.mf
|
||||||
|
|
||||||
|
|||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
<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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-api</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- netty-all 4.1.24.Final is provided with CraftBukkit (1.12+) -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.netty</groupId>
|
|
||||||
<artifactId>netty-all</artifactId>
|
|
||||||
<version>4.1.24.Final</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Panilla configuration
|
||||||
|
|
||||||
|
# Do not change
|
||||||
|
configuration-version: 1.0
|
||||||
|
|
||||||
|
locale-file: en_US.yml
|
||||||
|
|
||||||
|
# Logging options
|
||||||
|
logging:
|
||||||
|
console: false
|
||||||
|
chat: false
|
||||||
|
|
||||||
|
# Strictness of how much you wish to enforce
|
||||||
|
# lenient - Only prevent game-breaking things or crashes
|
||||||
|
# average - Prevent most abusive things
|
||||||
|
# strict - Prevent anything non-vanilla
|
||||||
|
strictness: average
|
||||||
|
|
||||||
|
# Whitelist NBT tags from being checked
|
||||||
|
nbt-whitelist:
|
||||||
|
# - Enchantments # 1.13+ format
|
||||||
|
# - ench # 1.12 format
|
||||||
|
|
||||||
|
# You shouldn't have to touch this.
|
||||||
|
#
|
||||||
|
# If you have plugins which use an excessive amount of
|
||||||
|
# custom NBT keys, then you can raise it as high as you like.
|
||||||
|
#
|
||||||
|
# This is to prevent crash items which have an excessive
|
||||||
|
# amount of NBT keys.
|
||||||
|
max-non-minecraft-nbt-keys: 16
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
prefix: "&c"
|
||||||
|
packet-from-dropped: Packet from %s (%s) was dropped
|
||||||
|
packet-to-dropped: Packet to %s (%s) was dropped
|
||||||
|
packet-dropped-reason-too-large: because it was too large (%d bytes out of protocol maximum of %d bytes)
|
||||||
|
packet-dropped-reason-invalid-nbt: because NBT tag %s failed checks
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
prefix: "&c"
|
||||||
|
packet-from-dropped: Packet de %s (%s) estaba ignorado
|
||||||
|
packet-to-dropped: Packet a %s (%s) estaba ignorado
|
||||||
|
packet-dropped-reason-too-large: Porque es demasiado grande (%d bytes de un máximo de of %d bytes)
|
||||||
|
packet-dropped-reason-invalid-nbt: Porque NBT etiqueta %s cheques fallidos
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: Panilla
|
||||||
|
version: ${version}
|
||||||
|
main: ${mainClass}
|
||||||
|
api-version: 1.13
|
||||||
|
description: Prevent abusive NBT and harmful packets
|
||||||
|
authors: [royalkingkb]
|
||||||
|
website: https://github.com/Ruinscraft/Panilla
|
||||||
|
permissions:
|
||||||
|
panilla.log.chat:
|
||||||
|
description: View warning logs in chat if enabled in the config
|
||||||
|
default: op
|
||||||
|
panilla.bypass:
|
||||||
|
description: Bypass packet checks
|
||||||
|
default: op
|
||||||
|
commands:
|
||||||
|
panilla:
|
||||||
|
description: Information about your Panilla instance
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
prefix: "&c"
|
||||||
|
packet-from-dropped: Пакет от %s (%s) был удален
|
||||||
|
packet-to-dropped: Пакет до %s (%s) был удален
|
||||||
|
packet-dropped-reason-too-large: потому что слишком большой (%d байтов из максимальных %d байтов)
|
||||||
|
packet-dropped-reason-invalid-nbt: потому что NBT тег %s не прошел проверку
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
<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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-bukkit</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<mainClass>com.ruinscraft.panilla.bukkit.PanillaPlugin</mainClass>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>bukkit</artifactId>
|
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-api</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-craftbukkit-v1_8_R3</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-craftbukkit-v1_12_R1</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-craftbukkit-v1_13_R2</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-craftbukkit-v1_14_R1</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.1.1</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>
|
|
||||||
<includes>
|
|
||||||
<include>plugin.yml</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<filtering>false</filtering>
|
|
||||||
<excludes>
|
|
||||||
<exclude>**/*.java</exclude>
|
|
||||||
<exclude>plugin.yml</exclude>
|
|
||||||
</excludes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<finalName>Panilla</finalName>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-craftbukkit-v1_12_R1</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-api</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-craftbukkit-v1_13_R2</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-api</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-craftbukkit-v1_14_R1</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-api</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.14-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-craftbukkit-v1_8_R3</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla-api</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// https://docs.spongepowered.org/stable/en/plugin/internals/mcp-setup.html
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'forge'
|
||||||
|
url = 'https://files.minecraftforge.net/maven'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'net.minecrell.vanillagradle.server' version '2.2-6'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly project(":panilla-api")
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version = '1.12.2'
|
||||||
|
mappings = 'stable_39'
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.ruinscraft.panilla.sponge72;
|
||||||
|
|
||||||
|
import com.ruinscraft.panilla.api.IContainerCleaner;
|
||||||
|
import com.ruinscraft.panilla.api.IPanilla;
|
||||||
|
import com.ruinscraft.panilla.api.IPanillaPlayer;
|
||||||
|
import com.ruinscraft.panilla.api.nbt.checks.NbtChecks;
|
||||||
|
import com.ruinscraft.panilla.sponge72.nbt.NbtTagCompound;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public class ContainerCleaner implements IContainerCleaner {
|
||||||
|
|
||||||
|
private final IPanilla panilla;
|
||||||
|
|
||||||
|
public ContainerCleaner(IPanilla panilla) {
|
||||||
|
this.panilla = panilla;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clean(IPanillaPlayer player) {
|
||||||
|
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player.getHandle();
|
||||||
|
Container container = entityPlayerMP.inventoryContainer;
|
||||||
|
|
||||||
|
for (int slot = 0; slot < container.inventorySlots.size(); slot++) {
|
||||||
|
ItemStack itemStack = container.getSlot(slot).getStack();
|
||||||
|
|
||||||
|
if (itemStack == null || !itemStack.hasTagCompound()) continue;
|
||||||
|
|
||||||
|
NBTTagCompound tag = itemStack.getTagCompound();
|
||||||
|
|
||||||
|
String failedNbt = NbtChecks.checkAll(
|
||||||
|
new NbtTagCompound(tag), itemStack.getItem().getClass().getSimpleName(), panilla);
|
||||||
|
|
||||||
|
if (failedNbt != null) {
|
||||||
|
tag.removeTag(failedNbt);
|
||||||
|
container.getSlot(slot).getStack().setTagCompound(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruinscraft.panilla.sponge72;
|
||||||
|
|
||||||
|
import com.ruinscraft.panilla.api.IProtocolConstants;
|
||||||
|
|
||||||
|
public class ProtocolConstants implements IProtocolConstants {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxPacketSizeBytes() {
|
||||||
|
return 2097152; // net.minecraft.server.PacketDecompressor L33
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package com.ruinscraft.panilla.sponge72.io;
|
||||||
|
|
||||||
|
import com.ruinscraft.panilla.api.IPanilla;
|
||||||
|
import com.ruinscraft.panilla.api.IPanillaPlayer;
|
||||||
|
import com.ruinscraft.panilla.api.exception.NbtNotPermittedException;
|
||||||
|
import com.ruinscraft.panilla.api.exception.OversizedPacketException;
|
||||||
|
import com.ruinscraft.panilla.api.io.IPacketInspector;
|
||||||
|
import com.ruinscraft.panilla.api.nbt.checks.NbtChecks;
|
||||||
|
import com.ruinscraft.panilla.sponge72.nbt.NbtTagCompound;
|
||||||
|
import io.netty.buffer.UnpooledByteBufAllocator;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraft.network.play.client.CPacketCreativeInventoryAction;
|
||||||
|
import net.minecraft.network.play.client.CPacketCustomPayload;
|
||||||
|
import net.minecraft.network.play.server.SPacketCustomPayload;
|
||||||
|
import net.minecraft.network.play.server.SPacketSetSlot;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class PacketInspector implements IPacketInspector {
|
||||||
|
|
||||||
|
private final IPanilla panilla;
|
||||||
|
|
||||||
|
public PacketInspector(IPanilla panilla) {
|
||||||
|
this.panilla = panilla;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkSize(Object _packet, boolean from) throws OversizedPacketException {
|
||||||
|
if (_packet instanceof Packet<?>) {
|
||||||
|
Packet<?> packet = (Packet<?>) _packet;
|
||||||
|
PacketBuffer dataSerializer = new PacketBuffer(UnpooledByteBufAllocator.DEFAULT.buffer());
|
||||||
|
|
||||||
|
int sizeBytes = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
packet.readPacketData(dataSerializer);
|
||||||
|
|
||||||
|
sizeBytes = dataSerializer.readableBytes();
|
||||||
|
|
||||||
|
// https://github.com/aadnk/ProtocolLib/commit/5ec87c9d7650ae21faca9b7b3cc7ac1629870d24
|
||||||
|
if (packet instanceof CPacketCustomPayload || packet instanceof SPacketCustomPayload) {
|
||||||
|
packet.writePacketData(dataSerializer);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
dataSerializer.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeBytes > panilla.getProtocolConstants().maxPacketSizeBytes()) {
|
||||||
|
throw new OversizedPacketException(packet.getClass().getSimpleName(), from, sizeBytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkPacketPlayInSetCreativeSlot(Object _packet) throws NbtNotPermittedException {
|
||||||
|
if (_packet instanceof CPacketCreativeInventoryAction) {
|
||||||
|
CPacketCreativeInventoryAction packet = (CPacketCreativeInventoryAction) _packet;
|
||||||
|
|
||||||
|
int slot = packet.getSlotId();
|
||||||
|
ItemStack itemStack = packet.getStack();
|
||||||
|
|
||||||
|
if (itemStack == null || !itemStack.hasTagCompound()) return;
|
||||||
|
|
||||||
|
NbtChecks.checkPacketPlayIn(slot, new NbtTagCompound(
|
||||||
|
itemStack.getTagCompound()), itemStack.getItem().getClass().getSimpleName(),
|
||||||
|
packet.getClass().getSimpleName(), panilla);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkPacketPlayOutSetSlot(Object _packet) throws NbtNotPermittedException {
|
||||||
|
if (_packet instanceof SPacketSetSlot) {
|
||||||
|
SPacketSetSlot packet = (SPacketSetSlot) _packet;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Field slotField = SPacketSetSlot.class.getDeclaredField("slot");
|
||||||
|
Field itemStackField = SPacketSetSlot.class.getDeclaredField("item");
|
||||||
|
|
||||||
|
slotField.setAccessible(true);
|
||||||
|
itemStackField.setAccessible(true);
|
||||||
|
|
||||||
|
int slot = (int) slotField.get(packet);
|
||||||
|
ItemStack itemStack = (ItemStack) itemStackField.get(packet);
|
||||||
|
|
||||||
|
if (itemStack == null || !itemStack.hasTagCompound()) return;
|
||||||
|
|
||||||
|
NbtChecks.checkPacketPlayOut(slot, new NbtTagCompound(
|
||||||
|
itemStack.getTagCompound()), itemStack.getItem().getClass().getSimpleName(),
|
||||||
|
packet.getClass().getSimpleName(), panilla);
|
||||||
|
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPacketPlayOutSetSlotAir(IPanillaPlayer player, int slot) {
|
||||||
|
// int windowId (0 for player)
|
||||||
|
// int slotId
|
||||||
|
// ItemStack item
|
||||||
|
SPacketSetSlot packet = new SPacketSetSlot(0, slot, new ItemStack(Block.getBlockById(0)));
|
||||||
|
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player.getHandle();
|
||||||
|
entityPlayerMP.connection.sendPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.ruinscraft.panilla.sponge72.io;
|
||||||
|
|
||||||
|
import com.ruinscraft.panilla.api.IPanilla;
|
||||||
|
import com.ruinscraft.panilla.api.IPanillaPlayer;
|
||||||
|
import com.ruinscraft.panilla.api.PanillaLogger;
|
||||||
|
import com.ruinscraft.panilla.api.io.IPlayerInjector;
|
||||||
|
import com.ruinscraft.panilla.api.io.PlayerInbound;
|
||||||
|
import com.ruinscraft.panilla.api.io.PlayerOutbound;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class PlayerInjector implements IPlayerInjector {
|
||||||
|
|
||||||
|
private final IPanilla panilla;
|
||||||
|
private final PanillaLogger panillaLogger;
|
||||||
|
|
||||||
|
public PlayerInjector(IPanilla panilla, PanillaLogger panillaLogger) {
|
||||||
|
this.panilla = panilla;
|
||||||
|
this.panillaLogger = panillaLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Channel getPlayerChannel(IPanillaPlayer player) throws IllegalArgumentException {
|
||||||
|
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player.getHandle();
|
||||||
|
try {
|
||||||
|
Field channelField = NetworkManager.class.getField("connection");
|
||||||
|
channelField.setAccessible(true);
|
||||||
|
Channel channel = (Channel) channelField.get(entityPlayerMP.connection.netManager);
|
||||||
|
return channel;
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(final IPanillaPlayer player) {
|
||||||
|
Channel channel = getPlayerChannel(player);
|
||||||
|
|
||||||
|
/* Register inbound */
|
||||||
|
if (channel.pipeline().get(PANILLA_CHANNEL_IN) == null) {
|
||||||
|
PlayerInbound inbound = new PlayerInbound(player, panilla, panillaLogger);
|
||||||
|
channel.pipeline().addBefore(MINECRAFT_CHANNEL_DPLX, PANILLA_CHANNEL_IN, inbound);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register outbound */
|
||||||
|
if (channel.pipeline().get(PANILLA_CHANNEL_OUT) == null) {
|
||||||
|
PlayerOutbound outbound = new PlayerOutbound(player, panilla, panillaLogger);
|
||||||
|
channel.pipeline().addBefore(MINECRAFT_CHANNEL_DPLX, PANILLA_CHANNEL_OUT, outbound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregister(final IPanillaPlayer player) {
|
||||||
|
Channel channel = getPlayerChannel(player);
|
||||||
|
|
||||||
|
/* Unregister inbound */
|
||||||
|
if (channel.pipeline().get(PANILLA_CHANNEL_IN) != null) {
|
||||||
|
channel.pipeline().remove(PANILLA_CHANNEL_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unregister outbound */
|
||||||
|
if (channel.pipeline().get(PANILLA_CHANNEL_OUT) != null) {
|
||||||
|
channel.pipeline().remove(PANILLA_CHANNEL_OUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.ruinscraft.panilla.sponge72.nbt;
|
||||||
|
|
||||||
|
import com.ruinscraft.panilla.api.nbt.INbtTagCompound;
|
||||||
|
import com.ruinscraft.panilla.api.nbt.INbtTagList;
|
||||||
|
import com.ruinscraft.panilla.api.nbt.NbtDataType;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class NbtTagCompound implements INbtTagCompound {
|
||||||
|
|
||||||
|
private final NBTTagCompound handle;
|
||||||
|
|
||||||
|
public NbtTagCompound(NBTTagCompound handle) {
|
||||||
|
this.handle = handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(String key) {
|
||||||
|
return handle.hasKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKeyOfType(String key, NbtDataType nbtDataType) {
|
||||||
|
return handle.hasKey(key, nbtDataType.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getKeys() {
|
||||||
|
return handle.getKeySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInt(String key) {
|
||||||
|
return handle.getInteger(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short getShort(String key) {
|
||||||
|
return handle.getShort(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getString(String key) {
|
||||||
|
return handle.getString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public INbtTagList getList(String key, NbtDataType nbtDataType) {
|
||||||
|
return new NbtTagList(handle.getTagList(key, nbtDataType.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public INbtTagCompound getCompound(String key) {
|
||||||
|
return new NbtTagCompound(handle.getCompoundTag(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.ruinscraft.panilla.sponge72.nbt;
|
||||||
|
|
||||||
|
import com.ruinscraft.panilla.api.nbt.INbtTagCompound;
|
||||||
|
import com.ruinscraft.panilla.api.nbt.INbtTagList;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
|
public class NbtTagList implements INbtTagList {
|
||||||
|
|
||||||
|
private final NBTTagList handle;
|
||||||
|
|
||||||
|
public NbtTagList(NBTTagList handle) {
|
||||||
|
this.handle = handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public INbtTagCompound getCompound(int index) {
|
||||||
|
return new NbtTagCompound(handle.getCompoundTagAt(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getString(int index) {
|
||||||
|
return handle.getStringTagAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return handle.tagCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,3 @@
|
|||||||
|
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||||
|
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||||
|
org.gradle.jvmargs=-Xmx3G
|
||||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
|
#Tue May 07 19:14:41 CDT 2019
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
|
||||||
@@ -1,20 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
@@ -22,6 +6,47 @@
|
|||||||
##
|
##
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
fi
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
PRG="$0"
|
||||||
@@ -36,49 +61,9 @@ while [ -h "$PRG" ] ; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
SAVED="`pwd`"
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
APP_HOME="`pwd -P`"
|
APP_HOME="`pwd -P`"
|
||||||
cd "$SAVED" >/dev/null
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
@@ -105,7 +90,7 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
@@ -129,7 +114,6 @@ fi
|
|||||||
if $cygwin ; then
|
if $cygwin ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
@@ -170,19 +154,11 @@ if $cygwin ; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
save () {
|
function splitJvmOpts() {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
JVM_OPTS=("$@")
|
||||||
echo " "
|
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
||||||
Vendored
+10
-20
@@ -1,19 +1,3 @@
|
|||||||
@rem
|
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
@rem you may not use this file except in compliance with the License.
|
|
||||||
@rem You may obtain a copy of the License at
|
|
||||||
@rem
|
|
||||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@@ -24,14 +8,14 @@
|
|||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
@@ -62,9 +46,10 @@ echo location of your Java installation.
|
|||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
:init
|
||||||
@rem Get command-line arguments, handling Windows variants
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
:win9xME_args
|
:win9xME_args
|
||||||
@rem Slurp the command line arguments.
|
@rem Slurp the command line arguments.
|
||||||
@@ -75,6 +60,11 @@ set _SKIP=2
|
|||||||
if "x%~1" == "x" goto execute
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
<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>com.ruinscraft</groupId>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>api</module>
|
|
||||||
<module>bukkit</module>
|
|
||||||
<module>craftbukkit-v1_12_R1</module>
|
|
||||||
<module>craftbukkit-v1_13_R2</module>
|
|
||||||
<module>craftbukkit-v1_14_R1</module>
|
|
||||||
<module>sponge</module>
|
|
||||||
<module>sponge72</module>
|
|
||||||
<module>sponge80</module>
|
|
||||||
<module>craftbukkit-v1_8_R3</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
+20
-12
@@ -1,23 +1,31 @@
|
|||||||
/*
|
|
||||||
* This file was generated by the Gradle 'init' task.
|
|
||||||
*/
|
|
||||||
|
|
||||||
rootProject.name = 'panilla'
|
rootProject.name = 'panilla'
|
||||||
|
|
||||||
|
// api
|
||||||
include(':panilla-api')
|
include(':panilla-api')
|
||||||
include(':panilla-bukkit')
|
|
||||||
|
// bukkit
|
||||||
|
include(':panilla-craftbukkit-v1_8_R3')
|
||||||
include(':panilla-craftbukkit-v1_12_R1')
|
include(':panilla-craftbukkit-v1_12_R1')
|
||||||
include(':panilla-craftbukkit-v1_13_R2')
|
include(':panilla-craftbukkit-v1_13_R2')
|
||||||
include(':panilla-craftbukkit-v1_14_R1')
|
include(':panilla-craftbukkit-v1_14_R1')
|
||||||
|
include(':panilla-bukkit')
|
||||||
|
|
||||||
|
// sponge
|
||||||
|
include(':panilla-forge112')
|
||||||
|
include(':panilla-forge113')
|
||||||
include(':panilla-sponge')
|
include(':panilla-sponge')
|
||||||
include(':panilla-sponge72')
|
|
||||||
include(':panilla-sponge80')
|
// api
|
||||||
include(':panilla-craftbukkit-v1_8_R3')
|
|
||||||
project(':panilla-api').projectDir = file('api')
|
project(':panilla-api').projectDir = file('api')
|
||||||
project(':panilla-bukkit').projectDir = file('bukkit')
|
|
||||||
|
// bukkit
|
||||||
|
project(':panilla-craftbukkit-v1_8_R3').projectDir = file('craftbukkit-v1_8_R3')
|
||||||
project(':panilla-craftbukkit-v1_12_R1').projectDir = file('craftbukkit-v1_12_R1')
|
project(':panilla-craftbukkit-v1_12_R1').projectDir = file('craftbukkit-v1_12_R1')
|
||||||
project(':panilla-craftbukkit-v1_13_R2').projectDir = file('craftbukkit-v1_13_R2')
|
project(':panilla-craftbukkit-v1_13_R2').projectDir = file('craftbukkit-v1_13_R2')
|
||||||
project(':panilla-craftbukkit-v1_14_R1').projectDir = file('craftbukkit-v1_14_R1')
|
project(':panilla-craftbukkit-v1_14_R1').projectDir = file('craftbukkit-v1_14_R1')
|
||||||
|
project(':panilla-bukkit').projectDir = file('bukkit')
|
||||||
|
|
||||||
|
// sponge
|
||||||
|
project(':panilla-forge112').projectDir = file('forge112')
|
||||||
|
project(':panilla-forge113').projectDir = file('forge113')
|
||||||
project(':panilla-sponge').projectDir = file('sponge')
|
project(':panilla-sponge').projectDir = file('sponge')
|
||||||
project(':panilla-sponge72').projectDir = file('sponge72')
|
|
||||||
project(':panilla-sponge80').projectDir = file('sponge80')
|
|
||||||
project(':panilla-craftbukkit-v1_8_R3').projectDir = file('craftbukkit-v1_8_R3')
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'sponge-repo'
|
||||||
|
url = 'https://repo.spongepowered.org/maven'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'org.spongepowered:spongeapi:7.1.0'
|
||||||
|
compile project(":panilla-api")
|
||||||
|
compile project(":panilla-forge112")
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-sponge</artifactId>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.ruinscraft.panilla.sponge;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.ruinscraft.panilla.api.*;
|
||||||
|
import com.ruinscraft.panilla.api.config.PConfig;
|
||||||
|
import com.ruinscraft.panilla.api.config.PLocale;
|
||||||
|
import com.ruinscraft.panilla.api.io.IPacketInspector;
|
||||||
|
import com.ruinscraft.panilla.api.io.IPlayerInjector;
|
||||||
|
import org.spongepowered.api.Game;
|
||||||
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
|
import org.spongepowered.api.event.Listener;
|
||||||
|
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
|
||||||
|
import org.spongepowered.api.plugin.Plugin;
|
||||||
|
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||||
|
import org.spongepowered.api.util.Color;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@Plugin(id = "panilla", name = "Panilla")
|
||||||
|
public class PanillaPlugin implements IPanilla, IPanillaPlatform {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Game game;
|
||||||
|
@Inject
|
||||||
|
private Logger logger;
|
||||||
|
|
||||||
|
private PConfig pConfig;
|
||||||
|
private PLocale pLocale;
|
||||||
|
private IProtocolConstants protocolConstants;
|
||||||
|
private IPlayerInjector playerInjector;
|
||||||
|
private IPacketInspector packetInspector;
|
||||||
|
private IContainerCleaner containerCleaner;
|
||||||
|
private IEnchantments enchantments;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PConfig getPanillaConfig() {
|
||||||
|
return pConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PLocale getPanillaLocale() {
|
||||||
|
return pLocale;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPanillaPlatform getPlatform() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IProtocolConstants getProtocolConstants() {
|
||||||
|
return protocolConstants;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPlayerInjector getPlayerInjector() {
|
||||||
|
return playerInjector;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPacketInspector getPacketInspector() {
|
||||||
|
return packetInspector;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IContainerCleaner getContainerCleaner() {
|
||||||
|
return containerCleaner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnchantments getEnchantments() {
|
||||||
|
return enchantments;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String translateColorCodes(String string) {
|
||||||
|
return TextSerializers.formattingCode('&').replaceCodes(string, TextSerializers.LEGACY_FORMATTING_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidPotionColor(int bgr) {
|
||||||
|
int r = (bgr >> 0) & 0xFF;
|
||||||
|
int g = (bgr >> 8) & 0xFF;
|
||||||
|
int b = (bgr >> 16) & 0xFF;
|
||||||
|
int rgb = (r << 16) | (g << 8) | (b << 0);
|
||||||
|
|
||||||
|
Color.ofRgb(rgb); // TODO:
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<IPanillaPlayer> getOnlinePlayers() {
|
||||||
|
Collection<IPanillaPlayer> panillaPlayers = Collections.EMPTY_SET;
|
||||||
|
|
||||||
|
for (Player player : game.getServer().getOnlinePlayers()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return panillaPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Logger getLogger() {
|
||||||
|
return logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Listener
|
||||||
|
public void onServerStart(GameStartedServerEvent event) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
compileOnly 'org.spongepowered:spongeapi:7.2.0-SNAPSHOT'
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-sponge72</artifactId>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>sponge-repo</id>
|
|
||||||
<url>http://repo.spongepowered.org/maven</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>forge-repo</id>
|
|
||||||
<url>http://files.minecraftforge.net/maven</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spongepowered</groupId>
|
|
||||||
<artifactId>spongeapi</artifactId>
|
|
||||||
<version>7.2.0-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>panilla</artifactId>
|
|
||||||
<groupId>com.ruinscraft</groupId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>panilla-sponge80</artifactId>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
Reference in new issue
Block a user