Initial release
This commit is contained in:
1 parent
2d7b67bbd9
commit
20e2081abd
14 files changed
+64
-374
No files matched your search
@@ -1,29 +1,22 @@
|
|||||||

|

|
||||||
|
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[](https://github.com/PlayPro/CoreProtect/actions)
|
|
||||||
[](https://app.netlify.com/sites/coreprotect/deploys)
|
|
||||||
[](https://www.codefactor.io/repository/github/playpro/coreprotect)
|
|
||||||
[](https://discord.gg/b4DZ4jy)
|
|
||||||
|
|
||||||
CoreProtect
|
CoreProtect-OG
|
||||||
===========
|
===========
|
||||||
|
|
||||||
CoreProtect is a blazing fast data logging and anti-griefing tool for Minecraft servers.
|
CoreProtect-OG is a soft fork of [CoreProtect](https://github.com/PlayPro/CoreProtect/) maintained for 1.19.4 by [TrueOG Network](https://true-og.net). CoreProtect is a blazing fast data logging and anti-griefing tool for Minecraft servers.
|
||||||
|
|
||||||
For a detailed description of the plugin, please visit [coreprotect.net](https://coreprotect.net).
|
For a detailed description of the plugin, please visit [coreprotect.net](https://coreprotect.net).
|
||||||
|
|
||||||
| Quick Links | |
|
|
||||||
| --- | --- |
|
|
||||||
| CoreProtect Discord: | [discord.gg/b4DZ4jy](https://discord.gg/b4DZ4jy) |
|
|
||||||
| CoreProtect Patreon: | [patreon.com/coreprotect](https://www.patreon.com/coreprotect) |
|
|
||||||
| CoreProtect Documentation: | [docs.coreprotect.net](https://docs.coreprotect.net) |
|
|
||||||
| Downloads for MC 1.14 - 1.20: | [coreprotect.net/latest](https://coreprotect.net/latest/) |
|
|
||||||
| Downloads for MC 1.8 - 1.12: | [coreprotect.net/legacy](https://coreprotect.net/legacy/) |
|
|
||||||
|
|
||||||
bStats
|
# Changes from CoreProtect:
|
||||||
------
|
- Updated gradle to 8.8.
|
||||||
[](https://bstats.org/plugin/bukkit/CoreProtect)
|
- Fixed build
|
||||||
|
- Replaced FAWE with standard WorldEdit
|
||||||
|
- Removed 1.21 code.
|
||||||
|
- Replaced deprecated function calls.
|
||||||
|
|
||||||
|
|
||||||
API
|
API
|
||||||
------
|
------
|
||||||
@@ -45,11 +38,3 @@ Maven
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
Contributing
|
|
||||||
------
|
|
||||||
CoreProtect is an open source project, and gladly accepts community contributions.
|
|
||||||
|
|
||||||
If you'd like to contribute, please read our contributing guidelines here: [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
||||||
|
|
||||||
[](CONTRIBUTING.md#code-of-conduct)
|
|
||||||
+8
-17
@@ -11,30 +11,22 @@ String projectVersion = '22.4'
|
|||||||
String projectBranch = ''
|
String projectBranch = ''
|
||||||
version = projectVersion // `version` might be modified, we don't always want that (e.g. plugin.yml)
|
version = projectVersion // `version` might be modified, we don't always want that (e.g. plugin.yml)
|
||||||
description = 'Provides block protection for your server.'
|
description = 'Provides block protection for your server.'
|
||||||
sourceCompatibility = '21'
|
sourceCompatibility = '17'
|
||||||
|
|
||||||
if (System.getenv("BUILD_NUMBER") != null) {
|
|
||||||
// Being built in Jenkins, append Build ID
|
|
||||||
version += "-${System.getenv("BUILD_NUMBER")}"
|
|
||||||
} else if (!(version ==~ '^[^.]*\\.[^.]*\\.[^.]*$')) { // Thanks https://stackoverflow.com/a/9949200/1709894
|
|
||||||
// Append the Git hash if 'version' has less than two periods
|
|
||||||
version += "-${gitVersion()}"
|
|
||||||
}
|
|
||||||
logger.info("Building version $version")
|
logger.info("Building version $version")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url = 'https://hub.spigotmc.org/nexus/content/groups/public/' }
|
maven { url = 'https://hub.spigotmc.org/nexus/content/groups/public' }
|
||||||
maven { url = 'https://repo.papermc.io/repository/maven-public/' }
|
maven { url = 'https://repo.papermc.io/repository/maven-public' }
|
||||||
maven { url = 'https://repo.codemc.org/repository/maven-public/' }
|
maven { url = 'https://repo.codemc.org/repository/maven-public' }
|
||||||
|
maven { url = 'https://maven.enginehub.org/repo' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(platform("com.intellectualsites.bom:bom-newest:1.45")) // Ref: https://github.com/IntellectualSites/bom
|
implementation(platform("com.intellectualsites.bom:bom-newest:1.45")) // Ref: https://github.com/IntellectualSites/bom
|
||||||
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Core")
|
compileOnly 'io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT'
|
||||||
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit")
|
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT'
|
||||||
compileOnly 'io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT'
|
|
||||||
implementation 'org.bstats:bstats-bukkit-lite:1.8'
|
|
||||||
implementation 'com.zaxxer:HikariCP:5.0.1'
|
implementation 'com.zaxxer:HikariCP:5.0.1'
|
||||||
|
implementation("com.github.oshi:oshi-core:6.6.5")
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
@@ -48,7 +40,6 @@ artifacts {
|
|||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
// #toString because #getGroup technically returns an Object
|
// #toString because #getGroup technically returns an Object
|
||||||
relocate('org.bstats', project.group.toString())
|
|
||||||
relocate('com.zaxxer', project.group.toString())
|
relocate('com.zaxxer', project.group.toString())
|
||||||
exclude(dependency('com.google.code.gson:.*'))
|
exclude(dependency('com.google.code.gson:.*'))
|
||||||
exclude(dependency('org.intellij:.*'))
|
exclude(dependency('org.intellij:.*'))
|
||||||
|
|||||||
@@ -1,168 +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>net.coreprotect</groupId>
|
|
||||||
<artifactId>CoreProtect</artifactId>
|
|
||||||
<version>22.4</version>
|
|
||||||
<properties>
|
|
||||||
<project.branch></project.branch>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
<build>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/java</directory>
|
|
||||||
<excludes>
|
|
||||||
<exclude>**/*.java</exclude>
|
|
||||||
</excludes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>11</source>
|
|
||||||
<target>11</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<version>3.3.0</version>
|
|
||||||
<configuration>
|
|
||||||
<archive>
|
|
||||||
<manifestEntries>
|
|
||||||
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
|
|
||||||
</manifestEntries>
|
|
||||||
</archive>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.2.4</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<filters>
|
|
||||||
<filter>
|
|
||||||
<artifact>*:*:*:*</artifact>
|
|
||||||
<excludes>
|
|
||||||
<exclude>**/*.java</exclude>
|
|
||||||
<exclude>**/*.c</exclude>
|
|
||||||
<exclude>META-INF/maven/**</exclude>
|
|
||||||
<exclude>META-INF/services/**</exclude>
|
|
||||||
</excludes>
|
|
||||||
</filter>
|
|
||||||
</filters>
|
|
||||||
<artifactSet>
|
|
||||||
<excludes>
|
|
||||||
<exclude>com.google.code.gson:*</exclude>
|
|
||||||
<exclude>org.intellij:*</exclude>
|
|
||||||
<exclude>org.jetbrains:*</exclude>
|
|
||||||
<exclude>org.slf4j:*</exclude>
|
|
||||||
<exclude>org.apache.logging.log4j:*</exclude>
|
|
||||||
<exclude>net.java.dev.jna:*</exclude>
|
|
||||||
</excludes>
|
|
||||||
</artifactSet>
|
|
||||||
<relocations>
|
|
||||||
<relocation>
|
|
||||||
<pattern>org.bstats</pattern>
|
|
||||||
<shadedPattern>net.coreprotect</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
<relocation>
|
|
||||||
<pattern>com.zaxxer</pattern>
|
|
||||||
<shadedPattern>net.coreprotect</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
</relocations>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>spigot-repo</id>
|
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>paper-repo</id>
|
|
||||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>codemc-repo</id>
|
|
||||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.intellectualsites.bom</groupId>
|
|
||||||
<artifactId>bom-newest</artifactId> <!-- Ref: https://github.com/IntellectualSites/bom -->
|
|
||||||
<version>1.45</version>
|
|
||||||
<scope>import</scope>
|
|
||||||
<type>pom</type>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<!--
|
|
||||||
paper-api: io.papermc.paper
|
|
||||||
paper-api (<= 1.16): com.destroystokyo.paper
|
|
||||||
spigot-api: org.spigotmc
|
|
||||||
bukkit: org.bukkit
|
|
||||||
-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.papermc.paper</groupId>
|
|
||||||
<artifactId>paper-api</artifactId>
|
|
||||||
<version>1.21.1-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bstats</groupId>
|
|
||||||
<artifactId>bstats-bukkit-lite</artifactId>
|
|
||||||
<version>1.8</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fastasyncworldedit</groupId>
|
|
||||||
<artifactId>FastAsyncWorldEdit-Core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fastasyncworldedit</groupId>
|
|
||||||
<artifactId>FastAsyncWorldEdit-Bukkit</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>FastAsyncWorldEdit-Core</artifactId>
|
|
||||||
<groupId>*</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zaxxer</groupId>
|
|
||||||
<artifactId>HikariCP</artifactId>
|
|
||||||
<version>5.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.oshi</groupId>
|
|
||||||
<artifactId>oshi-core</artifactId>
|
|
||||||
<version>6.6.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-core</artifactId>
|
|
||||||
<version>2.23.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "CoreProtect-OG"
|
||||||
@@ -4,7 +4,6 @@ import java.io.File;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bstats.bukkit.MetricsLite;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@@ -115,13 +114,6 @@ public final class CoreProtect extends JavaPlugin {
|
|||||||
|
|
||||||
Consumer.startConsumer();
|
Consumer.startConsumer();
|
||||||
|
|
||||||
// Enabling bStats
|
|
||||||
try {
|
|
||||||
new MetricsLite(this, 2876);
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
// Failed to connect to bStats server or something else went wrong.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Chat.console(Phrase.build(Phrase.ENABLE_FAILED, ConfigHandler.EDITION_NAME));
|
Chat.console(Phrase.build(Phrase.ENABLE_FAILED, ConfigHandler.EDITION_NAME));
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public class BukkitAdapter implements BukkitInterface {
|
|||||||
public static final int BUKKIT_V1_18 = 18;
|
public static final int BUKKIT_V1_18 = 18;
|
||||||
public static final int BUKKIT_V1_19 = 19;
|
public static final int BUKKIT_V1_19 = 19;
|
||||||
public static final int BUKKIT_V1_20 = 20;
|
public static final int BUKKIT_V1_20 = 20;
|
||||||
public static final int BUKKIT_V1_21 = 21;
|
|
||||||
|
|
||||||
public static void loadAdapter() {
|
public static void loadAdapter() {
|
||||||
switch (ConfigHandler.SERVER_VERSION) {
|
switch (ConfigHandler.SERVER_VERSION) {
|
||||||
@@ -65,9 +64,8 @@ public class BukkitAdapter implements BukkitInterface {
|
|||||||
case BUKKIT_V1_20:
|
case BUKKIT_V1_20:
|
||||||
BukkitAdapter.ADAPTER = new Bukkit_v1_20();
|
BukkitAdapter.ADAPTER = new Bukkit_v1_20();
|
||||||
break;
|
break;
|
||||||
case BUKKIT_V1_21:
|
|
||||||
default:
|
default:
|
||||||
BukkitAdapter.ADAPTER = new Bukkit_v1_21();
|
BukkitAdapter.ADAPTER = new Bukkit_v1_19();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
package net.coreprotect.bukkit;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Keyed;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.NamespacedKey;
|
|
||||||
import org.bukkit.Tag;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
|
|
||||||
import net.coreprotect.model.BlockGroup;
|
|
||||||
|
|
||||||
public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface {
|
|
||||||
|
|
||||||
public Bukkit_v1_21() {
|
|
||||||
BlockGroup.CONTAINERS = new HashSet<>(Arrays.asList(Material.JUKEBOX, Material.DISPENSER, Material.CHEST, Material.FURNACE, Material.BREWING_STAND, Material.TRAPPED_CHEST, Material.HOPPER, Material.DROPPER, Material.ARMOR_STAND, Material.ITEM_FRAME, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.SMOKER, Material.LECTERN, Material.CHISELED_BOOKSHELF, Material.DECORATED_POT, Material.CRAFTER));
|
|
||||||
BlockGroup.INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.SPRUCE_FENCE_GATE, Material.BIRCH_FENCE_GATE, Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE, Material.MANGROVE_FENCE_GATE, Material.ACACIA_FENCE_GATE, Material.DISPENSER, Material.NOTE_BLOCK, Material.CHEST, Material.FURNACE, Material.LEVER, Material.REPEATER, Material.MANGROVE_TRAPDOOR, Material.ACACIA_TRAPDOOR, Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR, Material.SPRUCE_TRAPDOOR, Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.BREWING_STAND, Material.ANVIL, Material.CHIPPED_ANVIL, Material.DAMAGED_ANVIL, Material.ENDER_CHEST, Material.TRAPPED_CHEST, Material.COMPARATOR, Material.HOPPER, Material.DROPPER, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.GRINDSTONE, Material.LOOM, Material.SMOKER, Material.CRAFTING_TABLE, Material.CARTOGRAPHY_TABLE, Material.ENCHANTING_TABLE, Material.SMITHING_TABLE, Material.STONECUTTER, Material.CRIMSON_FENCE_GATE, Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR, Material.CRAFTER));
|
|
||||||
BlockGroup.UPDATE_STATE = new HashSet<>(Arrays.asList(Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FURNACE, Material.BLAST_FURNACE, Material.SMOKER, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.GLOWSTONE, Material.JACK_O_LANTERN, Material.REPEATER, Material.REDSTONE_LAMP, Material.BEACON, Material.COMPARATOR, Material.DAYLIGHT_DETECTOR, Material.REDSTONE_BLOCK, Material.HOPPER, Material.CHEST, Material.TRAPPED_CHEST, Material.ACTIVATOR_RAIL, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.SHROOMLIGHT, Material.RESPAWN_ANCHOR, Material.CRYING_OBSIDIAN, Material.TARGET, Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER, Material.CAVE_VINES, Material.CAVE_VINES_PLANT, Material.GLOW_LICHEN, Material.LIGHT, Material.LAVA_CAULDRON, Material.CHISELED_BOOKSHELF, Material.CRAFTER));
|
|
||||||
|
|
||||||
for (Material value : Tag.TRAPDOORS.getValues()) {
|
|
||||||
if (value == Material.IRON_TRAPDOOR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!BlockGroup.INTERACT_BLOCKS.contains(value)) {
|
|
||||||
BlockGroup.INTERACT_BLOCKS.add(value);
|
|
||||||
}
|
|
||||||
if (!BlockGroup.SAFE_INTERACT_BLOCKS.contains(value)) {
|
|
||||||
BlockGroup.SAFE_INTERACT_BLOCKS.add(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityType getEntityType(Material material) {
|
|
||||||
switch (material) {
|
|
||||||
case END_CRYSTAL:
|
|
||||||
return EntityType.valueOf("END_CRYSTAL");
|
|
||||||
default:
|
|
||||||
return EntityType.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getRegistryKey(Object value) {
|
|
||||||
return ((Keyed) value).getKey().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getRegistryValue(String key, Object tClass) {
|
|
||||||
NamespacedKey namespacedKey = NamespacedKey.fromString(key);
|
|
||||||
// return RegistryAccess.registryAccess().getRegistry(RegistryKey.CAT_VARIANT).get((NamespacedKey)value);
|
|
||||||
return Bukkit.getRegistry((Class) tClass).get(namespacedKey);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -24,9 +24,9 @@ public class WorldEditHandler {
|
|||||||
Region region = session.getSelection(world);
|
Region region = session.getSelection(world);
|
||||||
if (region != null && world.getName().equals(((Player) user).getWorld().getName())) {
|
if (region != null && world.getName().equals(((Player) user).getWorld().getName())) {
|
||||||
BlockVector3 block = region.getMinimumPoint();
|
BlockVector3 block = region.getMinimumPoint();
|
||||||
int x = block.getBlockX();
|
int x = block.x();
|
||||||
int y = block.getBlockY();
|
int y = block.y();
|
||||||
int z = block.getBlockZ();
|
int z = block.z();
|
||||||
int width = region.getWidth();
|
int width = region.getWidth();
|
||||||
int height = region.getHeight();
|
int height = region.getHeight();
|
||||||
int length = region.getLength();
|
int length = region.getLength();
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class PaperAdapter implements PaperInterface {
|
|||||||
public static final int PAPER_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
public static final int PAPER_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
||||||
public static final int PAPER_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
public static final int PAPER_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
||||||
public static final int PAPER_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
public static final int PAPER_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
||||||
public static final int PAPER_V1_21 = BukkitAdapter.BUKKIT_V1_21;
|
|
||||||
|
|
||||||
public static void loadAdapter() {
|
public static void loadAdapter() {
|
||||||
int paperVersion = ConfigHandler.SERVER_VERSION;
|
int paperVersion = ConfigHandler.SERVER_VERSION;
|
||||||
@@ -50,9 +49,8 @@ public class PaperAdapter implements PaperInterface {
|
|||||||
PaperAdapter.ADAPTER = new Paper_v1_17();
|
PaperAdapter.ADAPTER = new Paper_v1_17();
|
||||||
break;
|
break;
|
||||||
case PAPER_V1_20:
|
case PAPER_V1_20:
|
||||||
case PAPER_V1_21:
|
|
||||||
default:
|
default:
|
||||||
PaperAdapter.ADAPTER = new Paper_v1_20();
|
PaperAdapter.ADAPTER = new Paper_v1_17();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public class SpigotAdapter implements SpigotInterface {
|
|||||||
public static final int SPIGOT_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
public static final int SPIGOT_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
||||||
public static final int SPIGOT_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
public static final int SPIGOT_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
||||||
public static final int SPIGOT_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
public static final int SPIGOT_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
||||||
public static final int SPIGOT_V1_21 = BukkitAdapter.BUKKIT_V1_21;
|
|
||||||
|
|
||||||
public static void loadAdapter() {
|
public static void loadAdapter() {
|
||||||
int spigotVersion = ConfigHandler.SERVER_VERSION;
|
int spigotVersion = ConfigHandler.SERVER_VERSION;
|
||||||
@@ -41,7 +40,6 @@ public class SpigotAdapter implements SpigotInterface {
|
|||||||
case SPIGOT_V1_18:
|
case SPIGOT_V1_18:
|
||||||
case SPIGOT_V1_19:
|
case SPIGOT_V1_19:
|
||||||
case SPIGOT_V1_20:
|
case SPIGOT_V1_20:
|
||||||
case SPIGOT_V1_21:
|
|
||||||
default:
|
default:
|
||||||
SpigotAdapter.ADAPTER = new SpigotHandler();
|
SpigotAdapter.ADAPTER = new SpigotHandler();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
import org.apache.logging.log4j.core.config.Configurator;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -120,26 +120,32 @@ public class Util extends Queue {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CentralProcessor getProcessorInfo() {
|
public static CentralProcessor getProcessorInfo() {
|
||||||
CentralProcessor result = null;
|
CentralProcessor result = null;
|
||||||
try {
|
try {
|
||||||
Class.forName("com.sun.jna.Platform");
|
Class.forName("com.sun.jna.Platform");
|
||||||
if (System.getProperty("os.name").startsWith("Windows") && !System.getProperty("sun.arch.data.model").equals("64")) {
|
if (System.getProperty("os.name").startsWith("Windows")
|
||||||
Class.forName("com.sun.jna.platform.win32.Win32Exception");
|
&& !System.getProperty("sun.arch.data.model").equals("64")) {
|
||||||
}
|
Class.forName("com.sun.jna.platform.win32.Win32Exception");
|
||||||
else if (System.getProperty("os.name").toLowerCase().contains("android") || System.getProperty("java.runtime.name").toLowerCase().contains("android")) {
|
} else if (System.getProperty("os.name").toLowerCase().contains("android")
|
||||||
return null;
|
|| System.getProperty("java.runtime.name").toLowerCase().contains("android")) {
|
||||||
}
|
return null;
|
||||||
Configurator.setLevel("oshi.hardware.common.AbstractCentralProcessor", Level.OFF);
|
}
|
||||||
SystemInfo systemInfo = new SystemInfo();
|
|
||||||
result = systemInfo.getHardware().getProcessor();
|
// Disable logging for the OSHI class
|
||||||
}
|
Logger logger = Logger.getLogger("oshi.hardware.common.AbstractCentralProcessor");
|
||||||
catch (Exception e) {
|
logger.setLevel(Level.OFF);
|
||||||
// unable to read processor information
|
|
||||||
}
|
// Retrieve processor information
|
||||||
|
SystemInfo systemInfo = new SystemInfo();
|
||||||
|
result = systemInfo.getHardware().getProcessor();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Unable to read processor information
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getBlockId(Material material) {
|
public static int getBlockId(Material material) {
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
|
|||||||
Executable → Regular
+12
-63
@@ -4,16 +4,13 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@@ -23,6 +20,7 @@ import net.coreprotect.config.Config;
|
|||||||
import net.coreprotect.utility.Util;
|
import net.coreprotect.utility.Util;
|
||||||
|
|
||||||
public class CoreProtectLogger extends AbstractDelegateExtent {
|
public class CoreProtectLogger extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private final Actor eventActor;
|
private final Actor eventActor;
|
||||||
private final World eventWorld;
|
private final World eventWorld;
|
||||||
private final Extent eventExtent;
|
private final Extent eventExtent;
|
||||||
@@ -36,79 +34,30 @@ public class CoreProtectLogger extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
||||||
org.bukkit.World world = BukkitAdapter.adapt(eventWorld);
|
if (!(eventWorld instanceof BukkitWorld)) {
|
||||||
|
return eventExtent.setBlock(position, block);
|
||||||
|
}
|
||||||
|
org.bukkit.World world = ((BukkitWorld) eventWorld).getWorld();
|
||||||
if (!Config.getConfig(world).WORLDEDIT) {
|
if (!Config.getConfig(world).WORLDEDIT) {
|
||||||
if (CoreProtectEditSessionEvent.isFAWE()) {
|
return eventExtent.setBlock(position, block);
|
||||||
return eventExtent.setBlock(position.getX(), position.getY(), position.getZ(), block);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return eventExtent.setBlock(position, block);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockState oldBlock = eventExtent.getBlock(position);
|
BlockState oldBlock = eventExtent.getBlock(position);
|
||||||
Material oldType = BukkitAdapter.adapt(oldBlock.getBlockType());
|
Material oldType = BukkitAdapter.adapt(oldBlock.getBlockType());
|
||||||
Location location = new Location(world, position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
Location location = new Location(world, position.x(), position.y(), position.z());
|
||||||
BaseBlock baseBlock = WorldEditLogger.getBaseBlock(eventExtent, position, location, oldType, oldBlock);
|
BaseBlock baseBlock = WorldEditLogger.getBaseBlock(eventExtent, position, location, oldType, oldBlock);
|
||||||
|
|
||||||
// No clear way to get container content data from within the WorldEdit API
|
// No clear way to get container content data from within the WorldEdit API
|
||||||
// Data may be available by converting oldBlock.toBaseBlock().getNbtData()
|
// Data may be available by converting oldBlock.toBaseBlock().getNbtData()
|
||||||
// e.g. BaseBlock block = eventWorld.getBlock(position);
|
// e.g. BaseBlock block = eventWorld.getBlock(position);
|
||||||
ItemStack[] containerData = CoreProtectEditSessionEvent.isFAWE() ? null : Util.getContainerContents(oldType, null, location);
|
ItemStack[] containerData = Util.getContainerContents(oldType, null, location);
|
||||||
|
|
||||||
if (CoreProtectEditSessionEvent.isFAWE()) {
|
if (eventExtent.setBlock(position, block)) {
|
||||||
if (eventExtent.setBlock(position.getX(), position.getY(), position.getZ(), block)) {
|
WorldEditLogger.postProcess(eventExtent, eventActor, position, location, block, baseBlock, oldType, oldBlock, containerData);
|
||||||
WorldEditLogger.postProcess(eventExtent, eventActor, position, location, block, baseBlock, oldType, oldBlock, containerData);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (eventExtent.setBlock(position, block)) {
|
|
||||||
WorldEditLogger.postProcess(eventExtent, eventActor, position, location, block, baseBlock, oldType, oldBlock, containerData);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
|
||||||
return this.setBlock(BlockVector3.at(x, y, z), block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int replaceBlocks(final Region region, final Mask mask, final Pattern pattern) throws MaxChangedBlocksException {
|
|
||||||
org.bukkit.World world = BukkitAdapter.adapt(eventWorld);
|
|
||||||
if (!Config.getConfig(world).WORLDEDIT) {
|
|
||||||
return eventExtent.replaceBlocks(region, mask, pattern);
|
|
||||||
}
|
|
||||||
processPatternToBlocks(world, region, pattern);
|
|
||||||
return eventExtent.replaceBlocks(region, mask, pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
|
||||||
org.bukkit.World world = BukkitAdapter.adapt(eventWorld);
|
|
||||||
if (!Config.getConfig(world).WORLDEDIT) {
|
|
||||||
return eventExtent.setBlocks(region, pattern);
|
|
||||||
}
|
|
||||||
processPatternToBlocks(world, region, pattern);
|
|
||||||
return eventExtent.setBlocks(region, pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processPatternToBlocks(org.bukkit.World world, Region region, Pattern pattern) {
|
|
||||||
for (BlockVector3 position : region.clone()) {
|
|
||||||
BlockState oldBlock = eventExtent.getBlock(position);
|
|
||||||
Material oldType = BukkitAdapter.adapt(oldBlock.getBlockType());
|
|
||||||
Location location = new Location(world, position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
|
||||||
BaseBlock baseBlock = WorldEditLogger.getBaseBlock(eventExtent, position, location, oldType, oldBlock);
|
|
||||||
|
|
||||||
// No clear way to get container content data from within the WorldEdit API
|
|
||||||
// Data may be available by converting oldBlock.toBaseBlock().getNbtData()
|
|
||||||
// e.g. BaseBlock block = eventWorld.getBlock(position);
|
|
||||||
ItemStack[] containerData = CoreProtectEditSessionEvent.isFAWE() ? null : Util.getContainerContents(oldType, null, location);
|
|
||||||
WorldEditLogger.postProcess(eventExtent, eventActor, position, location, pattern.applyBlock(position), baseBlock, oldType, oldBlock, containerData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,6 @@ public final class WorldEditBlockState implements BlockState {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockState copy(Location location) {
|
public BlockState copy(Location location) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: CoreProtect
|
name: CoreProtect-OG
|
||||||
main: net.coreprotect.CoreProtect
|
main: net.coreprotect.CoreProtect
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
branch: ${project.branch}
|
branch: ${project.branch}
|
||||||
@@ -143,4 +143,4 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
coreprotect.networking:
|
coreprotect.networking:
|
||||||
description: Has permission to use the networking API
|
description: Has permission to use the networking API
|
||||||
default: op
|
default: op
|
||||||
Reference in new issue
Block a user