Compare commits

..
19 Commits
Author SHA1 Message Date
NotAlexNoyle 7db997d5f6 Update canonical Gitea link 2026-10-31 11:46:37 -04:00
NotAlexNoyle 82900988eb Exclude CODEOWNERS from language statistics 2026-10-27 08:25:11 -04:00
NotAlexNoyle 26b31874ad Add CODEOWNERS (one staff approval) 2026-10-27 08:25:11 -04:00
NotAlexNoyle 9f5a4065d9 Fix PlayerBounties-OG head compatibility 2026-03-27 10:53:12 -04:00
NotAlexNoyle d150f0ddc2 Add PlayerHeads-OG Compatibility 2026-03-26 10:16:11 -04:00
NotAlexNoyle 1e6613dc32 Use TrueOG Network config file 2026-01-27 22:22:41 -05:00
NotAlexNoyle b45037511f Milestone towards tracking config files on git. Waiting on true-og/SubstAgent update 2026-01-01 07:56:08 -05:00
NotAlexNoyle bb1846d086 Update gradle to 8.14.3 2025-08-20 10:33:38 -04:00
NotAlexNoyle 731b2d9190 Remove accidental clone 2025-06-27 14:19:24 -04:00
NotAlexNoyle 90503ae619 Update gradle to 8.14.2, add auto formatting 2025-06-25 01:49:57 -04:00
NotAlexNoyle bec6ca0205 Update gradle to 8.14.1 and shadow to 8.3.6 2025-06-13 16:23:25 -04:00
NotAlexNoyle e80ab17dec Update gradle 2025-05-30 13:02:22 -04:00
NotAlexNoyle ec983c8e1a Stop suppressing fork builds 2025-01-03 07:39:29 -05:00
NotAlexNoyle 2a7bb93f78 Merge branch 'PlayPro:master' into master 2025-01-03 07:36:22 -05:00
NotAlexNoyle 0e341c9a96 Clean up 2024-12-09 10:12:29 -05:00
NotAlexNoyle 84e265d570 Add gradle wrapper 2024-12-09 10:11:27 -05:00
NotAlexNoyle 20e2081abd Initial release 2024-12-09 09:31:17 -05:00
NotAlexNoyle 2d7b67bbd9 Merge branch 'PlayPro:master' into master 2024-12-08 14:43:06 -05:00
NotAlexNoyle 830c4a0041 Purge log4j 2024-10-19 20:09:06 +00:00
328 changed files with 26422 additions and 28670 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
.gitea/CODEOWNERS linguist-detectable=false
+3
View File
@@ -0,0 +1,3 @@
# Pull requests request review from the eligible staff team(s).
# One approval from either an Admin or Developer satisfies branch protection.
* @trueog/Admins @trueog/Developers
+1 -3
View File
@@ -3,8 +3,6 @@ daysUntilClose: 7
exemptLabels:
- 'accepted'
- 'bug'
- 'confirmed bug (tested)'
- 'potential bug (needs testing)'
- 'suggestion'
- 'help wanted'
staleLabel: stale
@@ -12,4 +10,4 @@ markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: false
closeComment: false
+8 -3
View File
@@ -13,11 +13,16 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 25
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '25'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build
run: mvn -B verify
+4 -47
View File
@@ -16,7 +16,6 @@ local.properties
.settings/
.loadpath
.gradle/
.vscode/
# External tool builders
.externalToolBuilders/
@@ -53,23 +52,8 @@ nbproject
target
dependency-reduced-pom.xml
src/test
maven_output.txt
# Wrapper files
mvnw
mvnw.cmd
#################
## Gradle
#################
test/
build
gradle
# Wrapper files
gradlew
gradlew.bat
#################
## Visual Studio
@@ -173,23 +157,6 @@ Desktop.ini
## Misc.
#############
.claude
AGENTS.md
CLAUDE.md
.cursorrules
.windsurfrules
.clinerules
context.json
context.yml
run.sh
run_*.sh
no-log4j2.xml
database.db
*tests.txt
test*.db
nullnull
refactor.txt
# Compiled class file
*.class
@@ -216,17 +183,7 @@ hs_err_pid*
# Documentation dev folder
docs/dev/
# symlinks
CoreProtect-TestAPI
CoreProtect-Fabric
CoreProtect-Hytale
publish/
# Extensions
/src/main/java/net/coreprotect/utility/extensions
!/src/main/java/net/coreprotect/utility/extensions/Extensions.java
/.apt_generated/
/.apt_generated_tests/
# Server side files
server/*
/src/main/java/net/coreprotect/extensions/*.java
!/src/main/java/net/coreprotect/extensions/Extensions.java
!/src/main/java/net/coreprotect/extensions/PlayerBountiesHeadCompatibility.java
+15 -183
View File
@@ -1,206 +1,38 @@
![CoreProtect](https://userfolio.com/uploads/coreprotect-banner-v19.png)
[![Artistic License 2.0](https://img.shields.io/github/license/PlayPro/CoreProtect?&logo=github)](https://github.com/PlayPro/CoreProtect/blob/master/LICENSE)
[![GitHub Workflows](https://github.com/PlayPro/CoreProtect/actions/workflows/build.yml/badge.svg)](https://github.com/PlayPro/CoreProtect/actions)
[![Netlify Status](https://img.shields.io/netlify/c1d26a0f-65c5-4e4b-95d7-e08af671ab67)](https://app.netlify.com/sites/coreprotect/deploys)
[![CodeFactor](https://www.codefactor.io/repository/github/playpro/coreprotect/badge)](https://www.codefactor.io/repository/github/playpro/coreprotect)
[![Join us on Discord](https://img.shields.io/discord/348680641560313868.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/b4DZ4jy)
[![Artistic License 2.0](https://img.shields.io/github/license/PlayPro/CoreProtect?&logo=github)](LICENSE)
# CoreProtect
CoreProtect-OG
===========
CoreProtect is a fast, efficient data logging and anti-griefing tool. Inspect, lookup, rollback, and restore any amount of damage without impacting your server performance.
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.
CoreProtect is the [#1 anti-griefing plugin](https://bstats.org/plugin/bukkit/CoreProtect), and has been actively developed since early 2012.
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 - 26.2: | [coreprotect.net/latest](https://coreprotect.net/latest/) |
| Downloads for MC 1.8 - 1.12: | [coreprotect.net/legacy](https://coreprotect.net/legacy/) |
| Downloads for Fabric: | [coreprotect.net/fabric](https://coreprotect.net/fabric) |
| Downloads for Hytale: | [coreprotect.net/hytale](https://coreprotect.net/hytale) |
## API
# Changes from CoreProtect:
- Compatibility with [PlayerBounties-OG](https://git.trueog.net/trueog/PlayerBounties-OG) player heads in backups and restores.
- Replaced FAWE with standard WorldEdit.
- Removed 1.21 server code.
- Replaced deprecated function calls (<1.19.4).
- Builds with TrueOG Network live config files.
API
------
### [API Documentation](https://docs.coreprotect.net/api/)
### Dependency Information
Maven:
Maven
```xml
<repository>
<id>playpro-repo</id>
<url>https://maven.playpro.com</url>
</repository>
```
```xml
<dependency>
<groupId>net.coreprotect</groupId>
<artifactId>coreprotect</artifactId>
<version>24.1</version>
<version>22.4</version>
<scope>provided</scope>
</dependency>
```
## Donation Keys
To support the project and obtain a donation key, visit [coreprotect.net/donate](https://coreprotect.net/donate/).
## Other Plugins
* DarkerNights: [spigotmc.org/resources/darkernights.87814](https://www.spigotmc.org/resources/darkernights.87814/)
* TransitTubes: [patreon.com/posts/75731668](https://www.patreon.com/posts/75731668)
## Video Tutorial
[![CoreProtect video tutorial](https://www.userfolio.com/uploads/coreprotect-video-tutorial.png)](https://youtu.be/JwijCiueZ3Y)
## Core Features
* Fast, efficient data logging.
* Rollbacks and restores with lag-free processing.
* Multi-threaded to ensure server performance is never impacted.
* No configuration required. Install the plugin, and you're good to go.
* SQLite storage by default, with optional MySQL support.
* Supports Bukkit, Spigot, Paper, Folia, MultiPaper, and more.
* Permission system support and advanced lookup permissions.
* Easy-to-use commands and inspector.
* Advanced lookup filters and operation limits by radius, world, or WorldEdit selection.
* Paginated results with clickable pagination.
* Preview rollbacks and restores, and undo rollbacks by restoring the same data.
* Rollback or restore specific users, multiple users, or global activity.
* Inventory rollback support.
* Purge old data by time, world, and block type.
* Multi-world support.
* Configurable global and per-world logging settings.
* Safe default parameters.
* Include or exclude specific blocks, items, entities, or users, plus logging blacklists.
* WorldEdit and supported FAWE logging.
* Enhanced item lookup tooltips.
* Localization and translation support.
* Automatic update checking and error reporting.
* Developer and networking API support.
* *...and much more!*
## What does it log?
### Blocks and World Changes
* Blocks placed or broken by players.
* Natural block breakage, such as attached blocks breaking when their support is removed.
* Block movement, including falling sand, gravel, and piston movement.
* Water and lava placement, removal, and flow.
* Liquid tracking, associating flowing liquids with the player who placed the source.
* Fire ignition from flint and steel or fire charges, block burning, and fire fade.
* Optional natural fire extinguishing.
* TNT, Creeper, Ghast, and other explosions, plus primed TNT removal.
* Entities changing blocks, including Endermen, Ender Dragons, and zombies breaking doors.
* Leaf decay.
* Tree growth linked back to the player who planted the sapling.
* Mushroom, vine, amethyst, chorus, and bamboo growth.
* Sculk spread from sculk catalysts.
* Nether portal and other natural portal generation.
* Crops trampled by players and turtle eggs trampled by players or entities.
* Snow generated by snow golems.
* Liquid-formed blocks such as obsidian, cobblestone, and concrete.
* Flowers placed in flower pots.
* Dragon egg teleportation.
* Suspicious sand and gravel brushing or destruction.
* Custom blocks, such as CraftEngine blocks.
### Containers, Inventories, and Items
* Items taken from or placed into vanilla or supported third-party containers.
* Hopper, dropper, and dispenser transactions, including container transfers.
* Player inventory transactions, including items dropped, thrown, shot, or picked up.
* Items broken, created, destroyed, deposited, or withdrawn by players.
* Items placed on campfires and lectern book transactions.
* Chiseled bookshelf, decorated pot, and shelf inventory transactions.
* Copper Golem chest and jukebox transactions, plus crafter slot changes.
* Bundle actions through the `#bundle` tag.
* Items crafted or traded with villagers.
* Allay item exchanges.
* Paintings and item frames.
### Entities and Player Activity
* Entity deaths and detailed death reasons.
* Player-caused entity kills, including animals and monsters.
* Armor stands and End Crystals.
* Villagers killed by lightning, gossip data, and job-site memories.
* Thrown eggs, snowballs, potions, ender pearls, tridents, and wind charges.
* Player interactions with doors, buttons, levers, containers, bookshelves, and jukeboxes.
* Sign text, color, glow, wax, and modern double-sided signs.
* Player chat messages and commands.
* Player sessions including logins and logouts, player deaths, and username changes.
* Skull skin texture data on Paper servers and custom skull textures.
* WorldEdit changes and supported FAWE clipboard pastes.
* *...and more!*
## How to use the inspector
Once you have the inspector enabled with `/core inspect` or `/co i`, you can do the following:
* Left-click a block to see who placed that block.
* Right-click a block to see what adjacent block was removed.
* Right-click while placing a block in a location to see what block was removed at that location.
* Right-click while placing a block in another block to see who placed it. For example, place dirt in water to see who placed the water.
* Right-click a door, button, lever, container, or similar block to see who last used it.
## A Few Reviews
* *"It's easy to use and lightning fast when it comes to rollbacks."*
* *"I've been running a MC server since before Bukkit, so I've used just about every block logger out there. CoreProtect is the best and the fastest."*
* *"Go with CoreProtect. It's fast, updated frequently, and logs WorldEdit."*
* *"Overall it felt more natural, simpler, and much faster to use CoreProtect than Prism, which just doesn't compare."*
* *"CoreProtect brings complex logging and rollbacks, whilst at the same time keeping a low profile."*
* *Featured on [Linus Tech Tips](https://www.userfolio.com/uploads/coreprotect-linus.png).*
## Useful Links
**Documentation**
https://docs.coreprotect.net
**Commands**
https://docs.coreprotect.net/commands/
**Permissions**
https://docs.coreprotect.net/permissions/
**API Documentation**
https://docs.coreprotect.net/api/
**Feedback & Support**
https://github.com/PlayPro/CoreProtect/issues
**Discord**
Join us on Discord: https://discord.gg/b4DZ4jy
**Donate**
Enjoy using CoreProtect and want to show your support? [Join our Patreon!](https://www.patreon.com/coreprotect)
**Sponsors**
Thanks to [HostHorde](https://www.hosthorde.com) for sponsoring CoreProtect!
## Bug Reports
For any bug reports, please submit a ticket here:
https://github.com/PlayPro/CoreProtect/issues
Thanks for your support!
## bStats
[![bStats Graph Data](https://bstats.org/signatures/bukkit/CoreProtect.svg)](https://bstats.org/plugin/bukkit/CoreProtect)
## 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)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CONTRIBUTING.md#code-of-conduct)
+123
View File
@@ -0,0 +1,123 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
/* ------------------------------ Plugins ------------------------------ */
plugins {
id("java") // Import Java plugin.
id("java-library") // Import Java Library plugin.
id("com.diffplug.spotless") version "8.1.0" // Import Spotless plugin.
id("com.gradleup.shadow") version "8.3.9" // Import Shadow plugin.
id("checkstyle") // Import Checkstyle plugin.
eclipse // Import Eclipse plugin.
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
}
/* --------------------------- JDK / Kotlin ---------------------------- */
java {
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
toolchain { // Select Java toolchain.
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
}
}
kotlin { jvmToolchain(17) }
/* ----------------------------- Metadata ------------------------------ */
group = "net.coreprotect"
val version = "22.5" // Declare plugin version (will be in .jar).
val apiVersion = "1.19" // Declare minecraft server target version.
description = "Provides block protection for your server."
logger.info("Building version $version")
/* ----------------------------- Resources ----------------------------- */
tasks.named<ProcessResources>("processResources") {
val props = mapOf("version" to version, "apiVersion" to apiVersion)
inputs.properties(props) // Indicates to rerun if version changes.
filesMatching("plugin.yml") { expand(props) }
from("LICENSE") { into("/") } // Bundle licenses into jarfiles.
}
/* ---------------------------- Repos ---------------------------------- */
repositories {
mavenCentral() // Import the Maven Central Maven Repository.
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
maven("https://repo.papermc.io/repository/maven-public") // Import the PaperMC Maven Repository.
maven("https://repo.codemc.org/repository/maven-public") // Import the CodeMC Maven Repository.
maven("https://maven.enginehub.org/repo") // Import the EngineHub Maven Repository.
}
/* ---------------------- Java project deps ---------------------------- */
dependencies {
compileOnly("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT")
implementation(platform("com.intellectualsites.bom:bom-newest:1.45"))
implementation("com.zaxxer:HikariCP:5.0.1")
implementation("com.github.oshi:oshi-core:6.6.5")
}
/* ---------------------- Reproducible jars ---------------------------- */
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
/* ----------------------------- Shadow -------------------------------- */
artifacts { add("archives", tasks.named("shadowJar")) }
tasks.named<ShadowJar>("shadowJar") {
dependencies {
relocate("com.zaxxer", project.group.toString())
exclude(dependency("com.google.code.gson:.*"))
exclude(dependency("org.intellij:.*"))
exclude(dependency("org.jetbrains:.*"))
exclude(dependency("org.slf4j:.*"))
}
exclude("io.github.miniplaceholders.*") // Exclude the MiniPlaceholders package from being shadowed.
archiveClassifier.set("") // Use empty string instead of null.
minimize()
}
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar) } // Build depends on spotless and shadow.
/* --------------------------- Javac opts ------------------------------- */
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters") // Enable reflection for java code.
options.isFork = true // Run javac in its own process.
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
options.encoding = "UTF-8" // Use UTF-8 file encoding.
}
/* ----------------------------- Auto Formatting ------------------------ */
spotless {
java {
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
removeUnusedImports() // Remove imports that aren't being called.
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
}
}
checkstyle {
toolVersion = "10.18.1" // Declare checkstyle version to use.
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
}
tasks.named("compileJava") {
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
}
tasks.named("spotlessCheck") {
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
}
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
<property name="severity" value="error"/>
</module>
<module name="TreeWalker">
<module name="FinalLocalVariable"/>
<module name="AvoidStarImport"/>
<module name="Indentation">
<property name="severity" value="ignore"/>
</module>
</module>
<module name="RegexpSingleline">
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*&quot;Not yet implemented&quot;\s*\)\s*;"/>
<property name="message" value="Remove placeholder fail() and implement the test."/>
<property name="ignoreCase" value="true"/>
<property name="severity" value="warning"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="(?&lt;!\w)fail\s*\(\s*&quot;Not yet implemented&quot;\s*\)\s*;"/>
<property name="message" value="Remove placeholder fail() and implement the test."/>
<property name="severity" value="warning"/>
</module>
</module>
+404
View File
@@ -0,0 +1,404 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="23">
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
</profile>
</profiles>
+3 -3
View File
@@ -4,8 +4,8 @@ The CoreProtect API enables you to log your own block changes, perform lookups,
| API Details | |
| --- | --- |
| **API Version:** | 12 |
| **Plugin Version:** | v24.0+ |
| **API Version:** | 10 |
| **Plugin Version:** | v22.4+ |
| **Maven:** | [maven.playpro.com](https://maven.playpro.com) |
*Documentation for the API version 12 can be found [here](/api/version/v12/).*
*Documentation for the API version 10 can be found [here](/api/version/v10/).*
-530
View File
@@ -1,530 +0,0 @@
# API Version 11
The CoreProtect API enables you to log your own block changes, perform lookups, rollbacks, restores, and more.
| API Details | |
| --- | --- |
| **API Version:** | 11 |
| **Plugin Version:** | v23.1+ |
| **Maven:** | [maven.playpro.com](https://maven.playpro.com) |
---
## Upgrading from API v10
The changes from the previous API version are as follows:
- The following event was extended to include Location (mutable):
```java
CoreProtectPreLogEvent(String user, Location location)
```
- The old constructor remains for backward compatibility and is deprecated:
```java
@Deprecated
CoreProtectPreLogEvent(String user)
```
---
## Getting Started
Ensure you're using CoreProtect 23.1 or higher. Add it as an external jar to your plugin in your IDE.
Alternatively, if using Maven, you can add it via the repository https://maven.playpro.com (net.coreprotect, 23.1).
The first thing you need to do is get access to CoreProtect. You can do this by using code similar to the following:
```java
import net.coreprotect.CoreProtect;
import net.coreprotect.CoreProtectAPI;
private CoreProtectAPI getCoreProtect() {
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");
// Check that CoreProtect is loaded
if (plugin == null || !(plugin instanceof CoreProtect)) {
return null;
}
// Check that the API is enabled
CoreProtectAPI CoreProtect = ((CoreProtect) plugin).getAPI();
if (CoreProtect.isEnabled() == false) {
return null;
}
// Check that a compatible version of the API is loaded
if (CoreProtect.APIVersion() < 11) {
return null;
}
return CoreProtect;
}
```
With this code, you can then access the API with a call like the following:
```java
CoreProtectAPI api = getCoreProtect();
if (api != null){ // Ensure we have access to the API
api.testAPI(); // Will print out "[CoreProtect] API test successful." in the console.
}
```
Yay, you're now using the CoreProtect API!
---
## API Overview
### Available Methods
```java
boolean isEnabled()
void testAPI()
List<String[]> performLookup(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)
List<String[]> performRollback(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)
List<String[]> performRestore(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)
List<String[]> blockLookup(Block block, int time)
List<String[]> sessionLookup(String user, int time)
List<String[]> queueLookup(Block block)
ParseResult parseResult(String[] result)
boolean logChat(Player player, String message)
boolean logCommand(Player player, String command)
boolean logPlacement(String user, BlockState blockState)
boolean logPlacement(String user, Location location, Material type, BlockData blockData)
boolean logRemoval(String user, BlockState blockState)
boolean logRemoval(String user, Location location, Material type, BlockData blockData)
boolean logContainerTransaction(String user, Location location)
boolean logInteraction(String user, Location location)
boolean hasPlaced(String user, Block block, int time, int offset)
boolean hasRemoved(String user, Block block, int time, int offset)
void performPurge(int time)
```
---
### Available Events
The following events are emitted by CoreProtect.
#### CoreProtectPreLogEvent
Fired when a CoreProtect logger is about to log an action. Cancellable.
| Property | Description | Mutable |
| --- | --- | --- |
| User | The name of the user under which this action will be logged. | Yes |
| Location | The location where the action will be logged. | Yes |
| Cancelled | If cancelled, the action won't be logged to the database. | Yes |
---
### Method Usage
*Detailed method information is listed below.*
#### `isEnabled()`
Calling this will return true if the server has the CoreProtect API enabled, and false if it does not.
---
#### `testAPI()`
Running this will print out "[CoreProtect] API Test Successful." in the server console.
---
#### `performLookup(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)`
This will perform a lookup.
* **time:** Specify the amount of time to search back. "5" would return results from the last 5 seconds.
* **restrict_users:** Specify any usernames to perform the lookup on. Can be set to "null" if both a radius and a location are specified.
* **exclude_users:** Specify any usernames to exclude from the lookup. Can be set to "null".
* **restrict_blocks:** Specify a list of EntityType's or Material's to restrict the search to. Can be set to "null".
* **exclude_blocks:** Specify a list of EntityType's or Material's to exclude from the search. Can be set to "null".
* **action_list:** Specify a list of action types to restrict the search to. Can be set to "null"
* **radius:** Specify a radius to restrict the search to. A location must be specified if using this. Set to "0" to disable.
* **radius_location:** Specify a location to search around. Can be set to "null" if no radius is specified, and a user is specified.
---
#### `performRollback(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)`
This will perform a rollback. Method must be called async.
* **time:** Specify the amount of time to rollback. "5" would return results from the last 5 seconds.
* **restrict_users:** Specify any usernames to perform the rollback on. Can be set to "null" if both a radius and a location are specified.
* **exclude_users:** Specify any usernames to exclude from the rollback. Can be set to "null".
* **restrict_blocks:** Specify a list of EntityType's or Material's to restrict the rollback to. Can be set to "null".
* **exclude_blocks:** Specify a list of EntityType's or Material's to exclude from the rollback. Can be set to "null".
* **action_list:** Specify a list of action types to restrict the rollback to. Can be set to "null"
* **radius:** Specify a radius to restrict the rollback to. A location must be specified if using this. Set to "0" to disable.
* **radius_location:** Specify a location to rollback around. Can be set to "null" if no radius is specified, and a user is specified.
---
#### `performRestore(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)`
This will perform a restore.
* **time:** Specify the amount of time to restore. "5" would return results from the last 5 seconds.
* **restrict_users:** Specify any usernames to perform the restore on. Can be set to "null" if both a radius and a location are specified.
* **exclude_users:** Specify any usernames to exclude from the restore. Can be set to "null".
* **restrict_blocks:** Specify a list of EntityType's or Material's to restrict the restore to. Can be set to "null".
* **exclude_blocks:** Specify a list of EntityType's or Material's to exclude from the restore. Can be set to "null".
* **action_list:** Specify a list of action types to restrict the restore to. Can be set to "null"
* **radius:** Specify a radius to restrict the restore to. A location must be specified if using this. Set to "0" to disable.
* **radius_location:** Specify a location to restore around. Can be set to "null" if no radius is specified, and a user is specified.
---
#### `blockLookup(Block block, int time)`
This will perform a full lookup on a single block.
* **block:** The block to perform the lookup on.
* **time:** Specify the amount of time to lookup. "5" would return results from the last 5 seconds.
---
#### `queueLookup(Block block)`
This will search the consumer queue for changes on a block not yet saved in the database.
* **block:** The block to perform the lookup on.
---
#### `sessionLookup(String user, int time)`
This will perform a session lookup on a single player.
* **user:** The username to perform the lookup on.
* **time:** Specify the amount of time to lookup. "5" would return results from the last 5 seconds.
---
#### `ParseResult parseResult(String[] result)`
This will parse results from a lookup. You'll then be able to view the following:
* **getX():** Get the X coordinate of the block.
* **getY():** Get the Y coordinate of the block.
* **getZ():** Get the Z coordinate of the block.
* **getType():** Get the Material of the block.
* **getBlockData():** Get the BlockData of the block.
* **getPlayer():** Get the username as a string.
* **getTimestamp():** Get the time of the action.
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
* **isRolledBack():** If the block is currently rolled back or not.
* **worldName():** The name of the world the block is located in.
---
#### `logPlacement(String user, BlockState blockState)`
This will log a block as being placed. *(Thread safe)*
* **user:** Specify the username to log as having placed the block.
* **blockState:** Specify the BlockState of the block you're logging.
---
#### `logPlacement(String user, Location location, Material type, BlockData blockData)`
This will log a block as being placed.
* **user:** Specify the username to log as having placed the block.
* **location:** Specify the location of the block you're logging.
* **type:** Specify the Material of the block you're logging.
* **blockData:** Specify the BlockData of the block you're logging. Can be set to "null".
---
#### `logRemoval(String user, BlockState blockState)`
This will log a block as being removed/broken. *(Thread safe)*
* **user:** Specify the username to log as having removed the block.
* **blockState:** Specify the BlockState of the block you're logging.
---
#### `logRemoval(String user, Location location, Material type, BlockData blockData)`
This will log a block as being removed/broken, and will log the block's inventory (if applicable).
* **user:** Specify the username to log as having removed the block.
* **location:** Specify the location of the block you're logging.
* **type:** Specify the Material of the block you're logging.
* **blockData:** Specify the BlockData of the block you're logging. Can be set to "null".
---
#### `logContainerTransaction(String user, Location location)`
This will log any transactions made to a block's inventory immediately after calling the method.
* **user:** Specify the username to log as having added/removed the items.
* **location:** Specify the location of the block inventory you're logging.
---
#### `logInteraction(String user, Location location)`
This will log a block as having been interacted with.
* **user:** Specify the username to log as having caused the interaction.
* **location:** Specify the location of the interaction you're logging.
---
#### `hasPlaced(String user, Block block, int time, int offset)`
This will return true if a user has already placed a block at the location within the specified time limit.
* **user:** The username you're checking to see if they've placed a block already.
* **block:** The block you're checking.
* **time:** How far back to check. "5" would only check through the last 5 seconds of logged blocks.
* **offset:** A time offset. "2" would ignore the last 2 seconds of most recently ignored data. (0 = no offset)
---
#### `hasRemoved(String user, Block block, int time, int offset)`
This will return true if a user has already removed a block at the location within the specified time limit.
* **user:** The username you're checking to see if they've removed a block already.
* **block:** The block you're checking.
* **time:** How far back to check. "5" would only check through the last 5 seconds of logged blocks.
* **offset:** A time offset. "2" would ignore the last 2 seconds of most recently ignored data. (0 = no offset)
---
#### `performPurge(int time)`
This will perform a purge on the CoreProtect database.
* **time:** Purge any data earlier than this. "120" would purge any data older than 120 seconds (2 minutes).
---
### Examples
- Get the last 60 seconds of block data for the user "Notch".
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.performLookup(60, Arrays.asList("Notch"), null, null, null, null, 0, null);
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
// ...
}
}
}
```
---
- Get the last 60 seconds of block data for the user "Notch", excluding dirt and grass blocks.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<Object> exclude = Arrays.asList(Material.DIRT, Material.GRASS);
List<String[]> lookup = CoreProtect.performLookup(60, Arrays.asList("Notch"), null, null, exclude, null, 0, null);
if (lookup != null){
for (String[] value : lookup){
ParseResult result = CoreProtect.parseResult(value);
int x = result.getX();
int y = result.getY();
int z = result.getZ();
// ...
}
}
}
```
---
- Get the last 60 seconds of block data within 5 blocks of a location.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.performLookup(60, null, null, null, null, null, 5, location);
if (lookup != null){
for (String[] value : lookup){
ParseResult result = CoreProtect.parseResult(value);
int x = result.getX();
int y = result.getY();
int z = result.getZ();
// ...
}
}
}
```
---
- Rollbacks / restores use the same code structure as the above examples. For example:
```java
class BasicThread implements Runnable {
@Override
public void run() {
try {
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.performRollback(60, Arrays.asList("Notch"), null, null, null, null, 0, null);
if (lookup != null){
for (String[] value : lookup){
ParseResult result = CoreProtect.parseResult(value);
int x = result.getX();
int y = result.getY();
int z = result.getZ();
// ...
}
}
}
}
catch (Exception e){
e.printStackTrace();
}
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
```
---
- Check if the user "Notch" has already placed a block at a location within the last 60 seconds.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean hasPlaced = CoreProtect.hasPlaced("Notch", block, 60, 0);
// Search queue for pending changes
if (!hasPlaced){
List<String[]> lookup = CoreProtect.queueLookup(block);
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
if (parseResult.getActionId()==1 && parseResult.getPlayer().equals("Notch")){
hasPlaced = true;
break;
}
}
}
}
```
---
- Get the last 60 seconds of block data for a specific block.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
// ...
}
}
}
```
---
- Get the last 1 day of session data for the user "Notch".
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.sessionLookup("Notch", (24 * 60 * 60));
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
int action = parseResult.getActionId(); // 0 = logout, 1 = login
// ...
}
}
}
```
---
- Log the placement of a block at a location by the user "Notch".
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean success = CoreProtect.logPlacement("Notch", block.getLocation(), block.getType(), block.getData());
}
```
---
- Log adding/remove items in a chest (or some other block inventory).
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean success = CoreProtect.logContainerTransaction("Notch", inventory.getLocation());
// modify your container contents immediately after (e.g. [i]inventory.addItem(itemStack);[/i])
}
```
---
- Perform a multi-threaded placement check to see if the user "Notch" has already placed a block at a location within the last 60 seconds. This ignores the most recent 1 second of logged data, to account for the fact that that new block data may have already been logged, depending on your code.
```java
final Block block = null; //Should be an actual block
class BasicThread implements Runnable {
@Override
public void run() {
try {
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean hasPlaced = CoreProtect.hasPlaced("Notch", block, 60, 1);
}
}
catch (Exception e){
e.printStackTrace();
}
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
```
---
File diff suppressed because it is too large. Load diff
-72
View File
@@ -1,72 +0,0 @@
# Automatic Purging
Automatic purging removes old CoreProtect data on a daily schedule, helping keep database growth under control without requiring manual `/co purge` runs.
> **Note:** Automatic purging is not enabled by default. This feature is exclusive to CoreProtect 24.0+ [Patreon builds](http://patreon.com/coreprotect).
## Configuration
To enable automatic purging, set `auto-purge` in `config.yml` to the amount of data you want to keep:
```yaml
auto-purge: 180d
```
This example keeps the most recent 180 days of CoreProtect data and automatically removes older data.
Supported values use the same style as CoreProtect command times, such as `30d`, `12w`, or `6mo`. The minimum automatic purge value is `30d`. Set `auto-purge: false` to disable automatic purging.
## Schedule
Automatic purging runs once per day using your server's local time. By default, it runs at midnight.
To change the daily runtime, manually add `auto-purge-time: 03:30` to `config.yml`.<br>
Use 24-hour `HH:mm` server time.
After changing `auto-purge` or `auto-purge-time`, use `/co reload` or restart the server. Changes apply to the next scheduled run.
When automatic purging is enabled, CoreProtect logs the next scheduled run when the server starts and again after an automatic purge completes.
## How It Works
Automatic purging runs in the background and removes old data incrementally in small chunks, with short pauses between database work. The server can continue to be used normally while it runs.
Automatic purging uses the same CoreProtect data tables as manual purging, but it does not rebuild the SQLite database or optimize MySQL tables. It deletes old rows in place, which helps maintain the current database size over time but may not immediately reduce the database file size or table size on disk.
Only one automatic purge can run at a time. If the server shuts down, a manual purge starts, a database migration or conversion starts, or the consumer is manually paused, the automatic purge stops safely and can continue during the next scheduled run.
## Important Notes
* **Patreon exclusive:** Only available in CoreProtect 24.0+ [Patreon builds](http://patreon.com/coreprotect)
* **Not enabled by default:** Set `auto-purge` in `config.yml` to enable automatic purging
* **Background cleanup:** Automatic purging is designed to run while the server remains usable
## Existing Databases
If enabling automatic purging on a new database, no additional action is required.
If enabling automatic purging on an existing database, it is recommended to run a manual purge first using the same time value:
```text
/co purge t:180d
```
For MySQL, add `#optimize` if you want to reclaim disk space during the initial manual purge:
```text
/co purge t:180d #optimize
```
This lets the manual purge reduce the existing database size, while automatic purging helps keep the database from growing beyond the configured retention period afterward.
## Status
Use `/co status` to see how many rows have been automatically purged since the last server restart.
## Troubleshooting
**Automatic purging won't start:**
* Verify you're using a CoreProtect 24.0+ [Patreon build](http://patreon.com/coreprotect)
* Verify `auto-purge` is set to a valid value of at least `30d`
* Check the server console for automatic purge scheduling messages
-14
View File
@@ -16,7 +16,6 @@ ___
| [/co reload](#co-reload) | Reload the configuration file |
| [/co status](#co-status) | View the plugin status |
| [/co consumer](#co-consumer) | Toggle consumer processing |
| [/co migrate-db](#co-migrate-db) | Migrate between SQLite and MySQL |
### Alias Commands
@@ -129,19 +128,6 @@ ___
Console command to pause or resume consumer queue processing.
___
### /co migrate-db
Migrate your CoreProtect database between SQLite and MySQL. Console-only command.
| Command | Parameters |
| --- | --- |
| /co migrate-db | `<sqlite|mysql>` |
> **Note:** This feature is exclusive to CoreProtect 23.0+ Patreon builds for Patron supporters.
For complete migration instructions, safety guidelines, and troubleshooting information, see the [Database Migration documentation](/database-migration/).
___
## Parameter Details
+7 -23
View File
@@ -21,31 +21,15 @@ Secondary configuration files override the value specified in config.yml. If you
To disable logging for specific users, blocks or commands, simply do the following:
1. In the CoreProtect plugin directory, create a file named `blacklist.txt`.
2. Enter the names of the users, commands, blocks, or entities you'd like to disable logging for (each entry on a new line).
2. Enter the names of the users (or commands) you'd like to disable logging for (each username on a new line).
3. Either restart your server, or type "/co reload" in-game.
The blacklist supports disabling logs for:
- Users, which includes Players and non-player users, such as "#creeper"
- Commands, such as `/help`
- Blocks, such as minecraft:stone. Only `block` actions are affected.
- Entities, such as minecraft:creeper, which will disable logging the death for that entity. *Note: renamed entities will be logged even if blacklisted.*
- Filters can also be specified for a particular user, by using the `@` symbol after the specific item, block, or entity namespaced ID. The format is `id@user`. This will filter all `block`, `kill`, `item` and `container` actions involving that particular block, item or mob, only when caused by the specified player or non-player user.
- Items and container actions are only affected by filtered blacklist entries, not by generic item or block IDs.
*Please note that you must include the namespace (e.g. minecraft:) for blocks, entities and items.*
An example blacklist.txt file would look like this:
This can be used to disable logging for non-player users, such as "#creeper". For example, if you'd like to disable logging for the user "Notch", TNT explosions, stone blocks, and the "/help" command, the blacklist.txt file would look like this:
```text
Notch ; User
#tnt ; TNT explosions
/help ; Help command
minecraft:stone ; Stone blocks
minecraft:creeper ; Creeper entity
minecraft:shears@#dispenser ; Shears being dispensed
Notch
#tnt
/help
minecraft:stone
```
*Please note that to disable logging for blocks, CoreProtect v23+ is required.*
*To disable logging for entities or to use filtering, CoreProtect v24+ is required.*
*Please note that to disable logging for blocks, CoreProtect v23+ is required, and you must include the namespace. For example, to disable logging for dirt, you must add it as "minecraft:dirt".*
-145
View File
@@ -1,145 +0,0 @@
# Database Migration (SQLite ↔ MySQL)
CoreProtect 23.0+ includes the ability to migrate your database between SQLite and MySQL without losing any data.
> **Note:** Database migration functionality is exclusive to CoreProtect 23.0+ [Patreon builds](http://patreon.com/coreprotect) for Patron supporters.
## Overview
The `/co migrate-db` command allows you to seamlessly transfer all your CoreProtect data from SQLite to MySQL or vice versa. This is particularly useful when:
* Starting with SQLite and wanting to upgrade to MySQL for better performance
* Moving from MySQL back to SQLite for simpler server setups
* Transferring data between different server configurations
## Command Usage
| Command | Parameters | Description |
| --- | --- | --- |
| `/co migrate-db` | `<sqlite|mysql>` | Migrate to the specified database type |
**Examples:**
* `/co migrate-db mysql` - Migrate from SQLite to MySQL
* `/co migrate-db sqlite` - Migrate from MySQL to SQLite
> **Console Only:** This command can only be executed from the server console, not from in-game.
---
## Migration Process
### Step 1: Preparation
**Before starting the migration:**
1. Ensure your server is running with your current CoreProtect database
2. Configure your new database in `config.yml` (ensure `use-mysql` is updated correctly)
3. **Important:** Do NOT restart your server or use `/co reload` after modifying the config
### Step 2: Execute Migration
#### 1. **Run the migration command from your server console:**
```
co migrate-db <mysql|sqlite>
```
#### 2. **Monitor the progress:**
* The migration will display detailed progress information
* Large databases may take considerable time to complete
* Progress bars and speed indicators will show current status
#### 3. **Do not interrupt the process:**
* Avoid restarting your server during migration
* Let the process complete naturally
### Step 3: Post-Migration
**After successful completion:**
1. **Automatic switchover:** CoreProtect will automatically begin using the new database
2. **Verify configuration:** Ensure `use-mysql` is set correctly in your `config.yml` as per step 1
3. **Test functionality:** Perform basic CoreProtect operations to verify everything works
4. **Clean up:** Once satisfied, you may manually delete your old database files
---
## Important Considerations
### Migration Safety
* **Non-destructive process:** The migration does not modify or delete your existing database
* **Interrupted migration:** If something goes wrong, simply delete the new database and continue using the old one
* **Data verification:** The process includes automatic verification to ensure data integrity
### Performance & Requirements
* **Processing time:** Large databases with millions of records may take hours to migrate
* **Resource usage:** The migration process is resource-intensive and may impact server performance
* **Parallel processing:** SQLite to MySQL migrations use optimized parallel processing for better speed
### Restrictions & Limitations
* **Console only:** Cannot be executed from in-game chat
* **Interruption handling:** If interrupted, the target database must be manually wiped before restarting
* **Patreon exclusive:** Only available in CoreProtect 23.0+ [Patreon builds](http://patreon.com/coreprotect)
---
## Troubleshooting
### Common Issues
**Migration won't start:**
* Verify you're using a CoreProtect 23.0+ [Patreon build](http://patreon.com/coreprotect)
* Ensure you're not trying to migrate to the same database type
* Check that no other CoreProtect operations are running
**Migration interrupted:**
* Manually delete/wipe the target database
* Verify server stability before restarting migration
* Consider migrating during low-activity periods
**Performance issues:**
* Monitor server resources during migration
* Consider temporarily reducing server activity
* Large tables may cause temporary slowdowns
**Data verification failures:**
* Check database connectivity and permissions
* Review server logs for specific error messages
* Ensure sufficient disk space on target database
### Getting Help
If you encounter issues with database migration:
1. Check server logs for detailed error messages
2. Verify database permissions and connectivity
3. Ensure adequate system resources (RAM, CPU, disk space)
4. Contact support through the CoreProtect Discord with specific error details
---
## Technical Details
The migration process includes several advanced features:
* Batch processing with dynamic sizing based on performance
* Automatic retry mechanisms for temporary failures
* Data integrity verification comparing source and target records
* Progress tracking with estimated completion times
* Graceful error handling with detailed logging
The migration handles all CoreProtect data types including:
* Block changes and rollbacks
* Container transactions
* Player interactions and sessions
* Chat messages and commands
* User data and statistics
* All metadata and configuration data
-8
View File
@@ -2,8 +2,6 @@
For more information about CoreProtect, visit [coreprotect.net](http://coreprotect.net).
Looking for another platform? Visit [CoreProtect for Fabric](https://coreprotect.net/fabric) or [CoreProtect for Hytale](https://coreprotect.net/hytale).
## Getting Started
Please visit one of the following links for more information.
@@ -20,12 +18,6 @@ A list of all language codes that can be used with CoreProtect.
[**CoreProtect API Documentation**](/api/)
Log your own block changes, perform lookups, rollbacks, restores, and more.
[**Database Migration**](/database-migration/)
Migrate your CoreProtect database between SQLite and MySQL.
[**Automatic Purging**](/auto-purge/)
Automatically remove old CoreProtect data on a daily schedule.
[**Compatible Third-Party Plugins & Tools**](/tools-integrations/)
A list of plugins and tools that are compatible with CoreProtect.
-5
View File
@@ -39,9 +39,6 @@ The following permissions can be used to restrict functionality within the plugi
* **coreprotect.consumer** *(default: op)*
Allows access to the CoreProtect consumer command.
&nbsp;
* **coreprotect.give** *(default: false)*
Allows access to the CoreProtect give command.
&nbsp;
* **coreprotect.networking** *(default: op)*
Allows access to the CoreProtect networking API.
@@ -49,8 +46,6 @@ The following permissions can be used to restrict functionality within the plugi
## Child Permissions
> **Note:** Child permissions are not presently supported by [CoreProtect for Hytale](https://coreprotect.net/hytale).
* **coreprotect.lookup.block** *(default: op)*
Can be optionally used as a negative permission to prevent block lookups.
&nbsp;
+5 -86
View File
@@ -9,113 +9,32 @@ These plugins/tools are maintained by third parties, and may have issues outside
## Plugins
* **WorldEdit**
Use WorldEdit selections as a radius, and log your WorldEdit changes.
Use WorldEdit selections as a radius, and log your WorldEdit changes.
[https://dev.bukkit.org/projects/worldedit](https://dev.bukkit.org/projects/worldedit)
&nbsp;
* **CoreProtect-Anti-Xray**
Displays how many ores a player has destroyed in a specific time span.
Displays how many ores a player has destroyed in a specific time span.
[https://dev.bukkit.org/bukkit-plugins/coreprotect-anti-xray/](https://dev.bukkit.org/bukkit-plugins/coreprotect-anti-xray/)
&nbsp;
* **CoreProtect TNT**
The CoreProtect TNT extension adds logging for TNT and creeper explosion sources.
The CoreProtect TNT extension adds logging for TNT and creeper explosion sources.
[https://www.spigotmc.org/resources/coreprotect-tnt-log-tnt-creeper-explode-source.69609/](https://www.spigotmc.org/resources/coreprotect-tnt-log-tnt-creeper-explode-source.69609/)
&nbsp;
* **CoreProtect Time-Lapse**
CPTL is an add-on tool for CoreProtect used to create a time-lapse from historical data.
[https://modrinth.com/plugin/cptl](https://modrinth.com/plugin/cptl)
&nbsp;
* **LightUp**
Conveniently place temporary lighting with rollback safety via CoreProtect integration.
[https://modrinth.com/plugin/lightup](https://modrinth.com/plugin/lightup)
&nbsp;
* **Lumen**
Custom (virtual) lighting with undo/redo and built-in CoreProtect & FAWE integration.
[https://modrinth.com/plugin/lumen](https://modrinth.com/plugin/lumen)
&nbsp;
* **FRTrustSystem**
Simple trust/friends system that uses the CoreProtect API to determine block ownership for protections/notifications.
[https://modrinth.com/plugin/frtrustsystem](https://modrinth.com/plugin/frtrustsystem)
&nbsp;
* **Movecraft-CoreProtect**
Logs Movecraft “craft” movement into CoreProtect for auditing/rollback.
[https://hangar.papermc.io/Airship-Pirates/Movecraft-CoreProtect](https://hangar.papermc.io/Airship-Pirates/Movecraft-CoreProtect)
&nbsp;
* **M0-CoreCord**
Discord bridge for CoreProtect lookups and alerts (SQLite/MySQL supported).
[https://www.spigotmc.org/resources/m0-corecord-1-13-1-21-8.91863/](https://www.spigotmc.org/resources/m0-corecord-1-13-1-21-8.91863/)
&nbsp;
* **XRayHunter**
Hunt potential xrayers by analyzing ore-mining stats pulled from CoreProtect data.
[https://modrinth.com/plugin/xrayhunter](https://modrinth.com/plugin/xrayhunter)
&nbsp;
* **ShadowTrace (Server Plugin)**
Backend for the ShadowTrace client mod; queries CoreProtect to visualize players’ mined blocks in-game.
[https://modrinth.com/plugin/shadowtraceplugin](https://modrinth.com/plugin/shadowtraceplugin)
&nbsp;
* **WildInspect**
Custom inspect-mode powered by CoreProtect (with history/claim limits and more).
[https://www.spigotmc.org/resources/%E2%9A%A1%EF%B8%8F-wildinspect-%E2%9A%A1%EF%B8%8F-coreprotect-addon-history-limits-claim-limits-%E2%9A%A1%EF%B8%8F-1-21-5-support.87405/](https://www.spigotmc.org/resources/%E2%9A%A1%EF%B8%8F-wildinspect-%E2%9A%A1%EF%B8%8F-coreprotect-addon-history-limits-claim-limits-%E2%9A%A1%EF%B8%8F-1-21-5-support.87405/)
&nbsp;
* **ExplosionProtector**
Uses the CoreProtect API to prevent explosions from destroying player-placed blocks.
[https://www.spigotmc.org/resources/explosionprotector.124838/](https://www.spigotmc.org/resources/explosionprotector.124838/)
&nbsp;
* **Axiom Paper Plugin**
Server component for the Axiom editor; includes CoreProtect integration to log Axiom edits.
[https://modrinth.com/plugin/axiom-paper-plugin](https://modrinth.com/plugin/axiom-paper-plugin)
&nbsp;
* **BlocksHub**
Bridge API used by world-editing plugins (e.g., AWE/FAWE) to send edits to loggers like CoreProtect.
[https://www.spigotmc.org/resources/blockshub.331/](https://www.spigotmc.org/resources/blockshub.331/)
&nbsp;
* **SpitSTIK**
Fun projectile plugin with CoreProtect integration for item-frame logging.
[https://modrinth.com/plugin/spitstik](https://modrinth.com/plugin/spitstik)
&nbsp;
* **XRay Informer**
Ore-ratio checker that supports CoreProtect. *(last known MC: 1.12)*
[https://dev.bukkit.org/projects/xray-informer](https://dev.bukkit.org/projects/xray-informer)
&nbsp;
* **DesirePaths**
Logs automatically generated paths into CoreProtect for moderation/rollback.
[https://www.spigotmc.org/resources/desirepaths-dynamic-player-made-trails.109043/](https://www.spigotmc.org/resources/desirepaths-dynamic-player-made-trails.109043/)
&nbsp;
## Tools
* **CoreProtect Lookup Web Interface**
Search through your CoreProtect history with an easy-to-use web UI.
Search through your CoreProtect history with an easy-to-use interface.
[https://www.spigotmc.org/resources/coreprotect-lookup-web-interface.28033/](https://www.spigotmc.org/resources/coreprotect-lookup-web-interface.28033/)
&nbsp;
* **Watson**
Client-side mod that displays CoreProtect logs in 3D (optional server helper plugin available).
Watson is a client side Minecraft mod that displays CoreProtect logs in 3D.
[https://github.com/vacla/Watson](https://github.com/vacla/Watson)
&nbsp;
* **ShadowTrace (Client Mod)**
Client-side visualizer to view mined-block locations supplied by the ShadowTrace server plugin via CoreProtect.
[https://modrinth.com/mod/shadowtrace](https://modrinth.com/mod/shadowtrace)
&nbsp;
---
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+251
View File
@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original 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
#
# https://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.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# 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 ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# 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"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+94
View File
@@ -0,0 +1,94 @@
@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 https://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
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+47 -54
View File
@@ -6,26 +6,25 @@ AMOUNT_CHUNK: "{0} {Chunk|Chunks}"
AMOUNT_ENTITY: "{0} {Entität|Entitäten}"
AMOUNT_ITEM: "{0} {Item|Items}"
API_TEST: "API-Test erfolgreich."
CACHE_ERROR: "WARNUNG: Fehler beim Überprüfen des {0}-Zwischenspeichers."
CACHE_RELOAD: "Erzwingen des Nachladens von {Kartierungs|Welt}caches aus der Datenbank."
CACHE_ERROR: "WARNUNG: Fehler beim Validieren {0} Zwischenspeicher."
CACHE_RELOAD: "Erzwingen des Nachladens von {kartierung|welt} Caches aus der Datenbank."
CHECK_CONFIG: "Bitte überprüfe die config.yml"
COMMAND_CONSOLE: "Bitte führen Sie den Befehl von der Konsole aus."
COMMAND_NOT_FOUND: "Befehl \"{0}\" nicht gefunden."
COMMAND_THROTTLED: "Bitte warten Sie einen Moment und versuchen Sie es erneut."
CONSUMER_ERROR: "Die Verarbeitung der Verbraucherwarteschlange wurde bereits {angehalten|fortgesetzt}."
CONSUMER_TOGGLED: "Die Verarbeitung der Verbraucherwarteschlange wurde {angehalten|fortgesetzt}."
CONSUMER_ERROR: "Verbraucherwarteschlange wird bereits verarbeitet {angehalten|fortgesetzt}."
CONSUMER_TOGGLED: "Die Verarbeitung der Verbraucherwarteschlange wurde durchgeführt {angehalten|fortgesetzt}."
CONTAINER_HEADER: "Containertransaktionen"
CPU_CORES: "CPU-Kerne."
DATABASE_BUSY: "Datenbank beschäftigt. Bitte versuchen Sie es später erneut."
DATABASE_INDEX_ERROR: "Datenbankindizes können nicht geprüft werden."
DATABASE_INDEX_ERROR: "Datenbankindizes können nicht validiert werden."
DATABASE_LOCKED_1: "Datenbank gesperrt. Warte bis zu 15 Sekunden..."
DATABASE_LOCKED_2: "Datenbank wird bereits verwendet. Bitte versuche es später erneut."
DATABASE_LOCKED_3: "Um die Datenbanksperre zu deaktivieren, setzen Sie \"database-lock: false\"."
DATABASE_LOCKED_4: "Deaktivieren der Datenbanksperre kann zu Datenbeschädigungen führen."
DATABASE_LOCKED_4: "Das Deaktivieren der Datenbanksperre kann zu Datenbeschädigungen führen."
DATABASE_UNREACHABLE: "Datenbank ist nicht erreichbar. Daten verwerfen und herunterfahren."
DEVELOPMENT_BRANCH: "Entwicklungszweig erkannt, Patch-Skripte werden übersprungen."
DIRT_BLOCK: "Ein temporärer Sicherheitsblock wurde unter ihnen platziert."
DISABLE_SUCCESS: "{0} erfolgreich deaktiviert!"
DIRT_BLOCK: "Platziere einen Schmutzblock unter dir."
DISABLE_SUCCESS: "Erfolg! Deaktiviert {0}"
ENABLE_FAILED: "{0} war nicht in der Lage zu starten."
ENABLE_SUCCESS: "{0} ist jetzt aktiviert!"
ENJOY_COREPROTECT: "Dir gefällt {0}? Tritt unserem Discord bei!"
@@ -33,11 +32,11 @@ FINISHING_CONVERSION: "Abschluss der Datenkonvertierung. Bitte warten..."
FINISHING_LOGGING: "Abschluss der Datenprotokollierung. Bitte warten..."
FIRST_VERSION: "Anfangs-DB: {0}"
GLOBAL_LOOKUP: "Geben Sie keinen Radius an, um eine globale Suche durchzuführen."
GLOBAL_ROLLBACK: "Benutze \"{0}\" für einen globalen {Rollback|Restore}"
GLOBAL_ROLLBACK: "Benutze \"{0}\" um einen globalen {Rollback|Restore}"
HELP_ACTION_1: "Beschränken Sie die Suche auf eine Aktion."
HELP_ACTION_2: "Beispiele: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "Zusätzliche Informationen anzeigen."
HELP_EXCLUDE_1: "Bestimmte Blöcke/Benutzer ausschließen."
HELP_EXCLUDE_1: "Blöcke/Benutzer ausschließen."
HELP_EXCLUDE_2: "Beispiele: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} Hilfe"
HELP_INCLUDE_1: "Fügen Sie Blöcke/Entitäten ein."
@@ -74,19 +73,19 @@ HELP_ROLLBACK_COMMAND: "Rollback-Blockdaten."
HELP_STATUS: "Sehen Sie sich den Plugin-Status an."
HELP_STATUS_COMMAND: "Zeigt den Plugin-Status an."
HELP_TELEPORT: "Teleportieren."
HELP_TIME_1: "Geben Sie einen Zeitraum an."
HELP_TIME_1: "Geben Sie die Uhrzeit an."
HELP_TIME_2: "Beispiele: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "Geben Sie den/die Benutzer an."
HELP_USER_1: "Geben Sie die Benutzer an."
HELP_USER_2: "Beispiele: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" kann mit dieser Aktion nicht verwendet werden."
INSPECTOR_ERROR: "Inspektor bereits {aktiviert|deaktiviert}."
INSPECTOR_TOGGLED: "Inspektor jetzt {aktiviert|deaktiviert}."
INTEGRATION_ERROR: "Unfähig, {0} Protokollierung zu {initialisieren|deaktivieren}."
INTEGRATION_SUCCESS: "{0} Protokollierung erfolgreich {initialisiert|deaktiviert}."
INTEGRATION_VERSION: "Ungültige {0} Version gefunden."
INTEGRATION_ERROR: "Unfähig zu {initialisieren|deaktivieren} {0} Protokollierung."
INTEGRATION_SUCCESS: "{0} erfolgreich anmelden {initialisiert|deaktiviert}."
INTEGRATION_VERSION: "Ungültig {0} Version gefunden."
INTERACTIONS_HEADER: "Spielerinteraktionen"
INVALID_ACTION: "Das ist keine gültige Aktion."
INVALID_BRANCH_1: "Ungültige Plugin-Version (Branch wurde nicht gesetzt)."
INVALID_BRANCH_1: "Ungültige Plugin-Version (Verzweigung wurde nicht gesetzt)."
INVALID_BRANCH_2: "Um fortzufahren, setzen Sie den Projektzweig auf \"Entwicklung\"."
INVALID_BRANCH_3: "Das Ausführen von Entwicklungscode kann zu Datenbeschädigungen führen."
INVALID_CONTAINER: "Bitte überprüfen Sie zuerst einen gültigen Behälter."
@@ -103,7 +102,7 @@ LINK_DOWNLOAD: "Herunterladen: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "Blocknamen: {0}"
LINK_WIKI_ENTITY: "Entitätsnamen: {0}"
LOGGING_ITEMS: "{0} Elemente, die noch zu loggen sind. Bitte warten..."
LOGGING_ITEMS: "{0} Elemente, die noch zu loggen sind. Warten Sie mal..."
LOGGING_TIME_LIMIT: "Zeitlimit für die Protokollierung erreicht. Daten verwerfen und herunterfahren."
LOOKUP_BLOCK: "{0} {platziert|entfernt} {1}."
LOOKUP_CONTAINER: "{0} {hinzugefügt|entfernt} {1} {2}."
@@ -114,62 +113,58 @@ LOOKUP_LOGIN: "{0} {ein|aus}geloggt."
LOOKUP_PAGE: "Seite {0}"
LOOKUP_PROJECTILE: "{0} {geworfen|geschossen} {1} {2}."
LOOKUP_ROWS_FOUND: "{0} {Reihe|Reihen} gefunden."
LOOKUP_SEARCHING: "Suchen. Bitte warten..."
LOOKUP_SEARCHING: "Suche nachschlagen. Warten Sie mal..."
LOOKUP_STORAGE: "{0} {hinterlegt|abgehoben} {1} {2}."
LOOKUP_TIME: "vor {0}"
LOOKUP_USERNAME: "{0} eingeloggt als {1}."
MAXIMUM_RADIUS: "Der maximale {Nachschlag|Rollback|Restore} Radius ist {0}."
LOOKUP_USERNAME: "{0} Eingeloggt als {1}."
MAXIMUM_RADIUS: "Das Maximum {Nachschlagen|Rollback|Wiederherstellen} Radius ist {0}."
MISSING_ACTION_USER: "Um diese Aktion zu verwenden, geben Sie bitte einen Benutzer an."
MISSING_LOOKUP_TIME: "Bitte geben Sie den Zeitraum an, um {Nachzuschlagen|ein Rollback auszuführen|einen Restore auszuführen}."
MISSING_LOOKUP_USER: "Bitte geben Sie einen Benutzer oder {Block|Radius} an."
MISSING_LOOKUP_TIME: "Bitte geben Sie die Zeit an, um {Nachschlagen|Rollback|Wiederherstellen}."
MISSING_LOOKUP_USER: "Bitte geben Sie einen Benutzer an oder {Block|Radius}."
MISSING_PARAMETERS: "Bitte verwenden Sie \"{0}\"."
MISSING_ROLLBACK_RADIUS: "Sie haben keinen {Rollback|Restore} Radius angegeben."
MISSING_ROLLBACK_USER: "Sie haben keinen {Rollback|Restore} Benutzer angegeben."
MYSQL_UNAVAILABLE: "Verbindung zu MySQL Server nicht möglich."
NETWORK_CONNECTION: "Verbindung von {0} {erfolgreich|fehlgeschlagen}. Nutze {1} {2}."
NETWORK_TEST: "Netzwerktestdaten wurden erfolgreich gesendet."
NO_DATA: "Keine Daten bei {0} gefunden."
MISSING_ROLLBACK_RADIUS: "Sie haben nicht angegeben a {Zurücksetzen|Wiederherstellen} Radius."
MISSING_ROLLBACK_USER: "Sie haben nicht angegeben a {Zurücksetzen|Wiederherstellen} Benutzer."
MYSQL_UNAVAILABLE: "Verbindung zu nicht möglich MySQL Server."
NO_DATA: "Keine Daten gefunden bei {0}."
NO_DATA_LOCATION: "Keine {Daten|Transaktionen|Interaktionen|Nachrichten} gefunden."
NO_PERMISSION: "Du hast keine Erlaubnis das zu tun."
NO_RESULTS: "Keine Ergebnisse gefunden."
NO_RESULTS_PAGE: "Keine {Ergebnisse|Daten} für diese Seite gefunden."
NO_ROLLBACK: "Kein(en) {ausstehende(s|n)|vorherige(s|n)} Rollback/Restore gefunden."
PATCH_INTERRUPTED: "Upgrade unterbrochen. Wird bei einem Neustart erneut versucht."
PATCH_OUTDATED_1: "Datenbanken, die älter als {0} sind, können nicht aktualisiert werden."
PATCH_OUTDATED_2: "Bitte updaten Sie mit einer unterstützten Version von CoreProtect."
PATCH_PROCESSING: "Neue Daten werden verarbeitet. Bitte warten..."
PATCH_SKIP_UPDATE: "Überspringe {Tabellen|Index}{aktualisierung|erstellung|entfernung} bei {0}."
PATCH_STARTED: "Führe {0} Upgrade durch. Bitte warten..."
NO_ROLLBACK: "Nein {ausstehend|zurück} Rollback/Wiederherstellung gefunden."
PATCH_INTERRUPTED: "Upgrade unterbrochen. Werde es beim Neustart nochmal versuchen."
PATCH_OUTDATED_1: "Datenbanken, die älter als sind, können nicht aktualisiert werden {0}."
PATCH_OUTDATED_2: "Bitte aktualisieren Sie mit einer unterstützten Version von CoreProtect."
PATCH_PROCESSING: "Verarbeitung neuer Daten. Warten Sie mal..."
PATCH_SKIP_UPDATE: "Überspringen {Tabelle|Index} {Aktualisieren|Erstellen|Entfernen} auf {0}."
PATCH_STARTED: "Performing {0} Aktualisierung. Warten Sie mal..."
PATCH_SUCCESS: "Erfolgreich aktualisiert auf {0}."
PATCH_UPGRADING: "Datenbank-Upgrade im Gange. Bitte warten..."
PATCH_UPGRADING: "Datenbank-Upgrade im Gange. Warten Sie mal..."
PLEASE_SELECT: "Bitte auswählen: \"{0}\" oder \"{1}\"."
PREVIEW_CANCELLED: "Vorschau abgebrochen."
PREVIEW_CANCELLING: "Vorschau abbrechen..."
PREVIEW_IN_GAME: "Sie können Rollbacks nur im Spiel als Vorschau anzeigen."
PREVIEW_TRANSACTION: "Sie können keine {Behälter|Inventar}-Transaktionen als Vorschau anzeigen."
PRIMARY_THREAD_ERROR: "Diese API-Methode kann nicht im Haupt-Thread verwendet werden."
PREVIEW_IN_GAME: "Sie können Rollbacks nur im Spiel in der Vorschau anzeigen."
PREVIEW_TRANSACTION: "Sie können keine Vorschau anzeigen {Behälter|Inventar} Transaktionen."
PURGE_ABORTED: "Bereinigung fehlgeschlagen. Die Datenbank ist möglicherweise beschädigt."
PURGE_ERROR: "{0} Daten können nicht verarbeitet werden!"
PURGE_ERROR: "Kann nicht verarbeitet werden {0} Daten!"
PURGE_FAILED: "Bereinigung fehlgeschlagen. Bitte versuchen Sie es später erneut."
PURGE_IN_PROGRESS: "Bereinigung läuft. Bitte versuchen Sie es später erneut."
PURGE_MINIMUM_TIME: "Sie können nur Daten löschen, die älter als {0} {Tage|Stunden} sind."
PURGE_MINIMUM_TIME: "Sie können nur Daten löschen, die älter sind als {0} {Tage|Stunden}."
PURGE_NOTICE_1: "Bitte beachten Sie, dass dies einige Zeit dauern kann."
PURGE_NOTICE_2: "Starten Sie Ihren Server nicht neu, bis dies abgeschlossen ist."
PURGE_OPTIMIZING: "Optimierung der Datenbank. Bitte warten..."
PURGE_PROCESSING: "{0} Daten werden verarbeitet..."
PURGE_OPTIMIZING: "Optimierung der Datenbank. Warten Sie mal..."
PURGE_PROCESSING: "wird bearbeitet {0} Daten..."
PURGE_REPAIRING: "Versuch einer Reparatur. Dies könnte eine Weile dauern..."
PURGE_ROWS: "{0} {Reihe|Reihen} von Daten gelöscht."
PURGE_STARTED: "Datenbereinigung gestartet am \"{0}\"."
PURGE_SUCCESS: "Datenbereinigung erfolgreich."
RAM_STATS: "{0}GB / {1}GB RAM"
RELOAD_STARTED: "Konfiguration wird neu geladen - bitte warten."
RELOAD_SUCCESS: "Konfiguration erfolgreich neu geladen."
ROLLBACK_ABORTED: "Rollback oder Restore abgebrochen."
ROLLBACK_ABORTED: "Rollback oder Wiederherstellung abgebrochen."
ROLLBACK_CHUNKS_FOUND: "{0} {bearbeiteter|bearbeitete} {Chunk|Chunks} gefunden."
ROLLBACK_CHUNKS_MODIFIED: "{0}/{1} {Chunk|Chunks} bearbeitet."
ROLLBACK_COMPLETED: "{Rollback|Restore|Vorschau} für \"{0}\" abgeschlossen."
ROLLBACK_EXCLUDED_USERS: "{Ausgeschlossener Benutzer|Ausgeschlossene Benutzer}: \"{0}\"."
ROLLBACK_INCLUDE: "{Block|Entität|Ziel} {Typ|Typen} {einbezogen|ausgeschlossen}: \"{0}\"."
ROLLBACK_COMPLETED: "{Rollback|Wiederherstellen|Vorschau} abgeschlossen für \"{0}\"."
ROLLBACK_EXCLUDED_USERS: "Ausgeschlossen {Benutzer|Benutzer}: \"{0}\"."
ROLLBACK_INCLUDE: "{Eingeschlossen|Ausgeschlossen} {Block|Entität|Ziel} {Typ|Typen}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "Ein Rollback/Restore ist bereits im Gange."
ROLLBACK_LENGTH: "Zeit beansprucht: {0} {Sekunde|Sekunden}."
ROLLBACK_MODIFIED: "{Modifiziert|Modifiziert} {0}."
@@ -178,12 +173,11 @@ ROLLBACK_SELECTION: "Radius eingestellt auf \"{0}\"."
ROLLBACK_STARTED: "{Rollback|Restore|Vorschau} gestartet für \"{0}\"."
ROLLBACK_TIME: "Zeitspanne: {0}."
ROLLBACK_WORLD_ACTION: "Beschränkt auf {Welt|Aktion} \"{0}\"."
SIGN_HEADER: "Schildnachrichten"
SIGN_HEADER: "Nachrichten signieren"
STATUS_CONSUMER: "Warteschleife: {0} {Datensatz|Datensätze}"
STATUS_DATABASE: "Datenbank: {0}."
STATUS_INTEGRATION: "{0}: Integration {aktiviert|deaktiviert}."
STATUS_LICENSE: "Lizenz: {0}"
STATUS_SYSTEM: "System: {0}"
STATUS_VERSION: "Version: {0}"
TELEPORTED: "Teleportiert nach {0}."
TELEPORTED_SAFETY: "Hab dich in Sicherheit teleportiert."
@@ -192,17 +186,16 @@ TIME_DAYS: "{0} {Tag|Tage}"
TIME_HOURS: "{0} {Stunde|Stunden}"
TIME_MINUTES: "{0} {Minute|Minuten}"
TIME_SECONDS: "{0} {Sekunde|Sekunden}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {Woche|Wochen}"
UPDATE_ERROR: "Beim Suchen nach Updates ist ein Fehler aufgetreten."
UPDATE_HEADER: "{0} Aktualisieren"
UPDATE_NOTICE: "Hinweis: {0} ist nun verfügbar."
UPDATE_NOTICE: "Beachten: {0} ist nun verfügbar."
UPGRADE_IN_PROGRESS: "Upgrade läuft. Bitte versuchen Sie es später erneut."
USER_NOT_FOUND: "Benutzer \"{0}\" nicht gefunden."
USER_OFFLINE: "Der Benutzer \"{0}\" ist nicht online."
USING_MYSQL: "Verwenden von MySQL zur Datenspeicherung."
USING_SQLITE: "Verwenden von SQLite zur Datenspeicherung."
VALID_DONATION_KEY: "Gültiger Spendenschlüssel."
VERSION_NOTICE: "Version {0} ist nun verfügbar."
VERSION_NOTICE: "Ausführung {0} ist nun verfügbar."
VERSION_REQUIRED: "{0} {1} oder höher erforderlich."
WORLD_NOT_FOUND: "Welt \"{0}\" nicht gefunden."
-11
View File
@@ -66,9 +66,6 @@ HELP_PARAMS_6: "Include specific blocks/entities in the {lookup|rollback|restore
HELP_PARAMS_7: "Exclude blocks/users from the {lookup|rollback|restore}."
HELP_PURGE_1: "Delete data older than specified time."
HELP_PURGE_2: "For example, \"{0}\" will delete all data older than one month, and only keep the last 30 days of data."
HELP_PURGE_3: "Specify the amount of time to purge."
HELP_PURGE_4: "Specify a world to limit the purge to."
HELP_PURGE_5: "Include specific blocks in the purge."
HELP_PURGE_COMMAND: "Delete old block data."
HELP_RADIUS_1: "Specify a radius area."
HELP_RADIUS_2: "Examples: [r:10] (Only make changes within 10 blocks of you)"
@@ -97,8 +94,6 @@ INVALID_CONTAINER: "Please inspect a valid container first."
INVALID_DONATION_KEY: "Invalid donation key."
INVALID_INCLUDE: "\"{0}\" is an invalid block/entity name."
INVALID_INCLUDE_COMBO: "That is an invalid block/entity combination."
INVALID_ITEM_ID: "Please enter a valid item id."
INVALID_PARAMETER: "\"{0}\" is not a supported parameter."
INVALID_RADIUS: "Please enter a valid radius."
INVALID_SELECTION: "{0} selection not found."
INVALID_USERNAME: "\"{0}\" is an invalid username."
@@ -147,8 +142,6 @@ PATCH_PROCESSING: "Processing new data. Please wait..."
PATCH_SKIP_UPDATE: "Skipping {table|index} {update|creation|removal} on {0}."
PATCH_STARTED: "Performing {0} upgrade. Please wait..."
PATCH_SUCCESS: "Successfully upgraded to {0}."
PATCH_TABLE_COMPLETED: "Successfully updated {0} table."
PATCH_TABLE_STARTED: "Updating {0} table. Please wait..."
PATCH_UPGRADING: "Database upgrade in progress. Please wait..."
PLEASE_SELECT: "Please select: \"{0}\" or \"{1}\"."
PREVIEW_CANCELLED: "Preview cancelled."
@@ -187,7 +180,6 @@ ROLLBACK_STARTED: "{Rollback|Restore|Preview} started on \"{0}\"."
ROLLBACK_TIME: "Time range: {0}."
ROLLBACK_WORLD_ACTION: "Restricted to {world|action} \"{0}\"."
SIGN_HEADER: "Sign Messages"
STATUS_AUTO_PURGE: "Cleanup: {0} {row|rows} auto purged since restart."
STATUS_CONSUMER: "Consumer: {0} {item|items} in queue."
STATUS_DATABASE: "Database: Using {0}."
STATUS_INTEGRATION: "{0}: Integration {enabled|disabled}."
@@ -200,11 +192,8 @@ TELEPORT_PLAYERS: "Teleport command can only be used by players."
TIME_DAYS: "{0} {day|days}"
TIME_HOURS: "{0} {hour|hours}"
TIME_MINUTES: "{0} {minute|minutes}"
TIME_MONTHS: "{0} {month|months}"
TIME_SECONDS: "{0} {second|seconds}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {week|weeks}"
TIME_YEARS: "{0} {year|years}"
UPDATE_ERROR: "An error occurred while checking for updates."
UPDATE_HEADER: "{0} Update"
UPDATE_NOTICE: "Notice: {0} is now available."
-1
View File
@@ -192,7 +192,6 @@ TIME_DAYS: "{0} {día|días}"
TIME_HOURS: "{0} {hora|horas}"
TIME_MINUTES: "{0} {minuto|minutos}"
TIME_SECONDS: "{0} {segundo|segundos}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {semana|semanas}"
UPDATE_ERROR: "Un error ocurrió mientras se revisaban las actualizaciones."
UPDATE_HEADER: "Actualización {0}"
-1
View File
@@ -186,7 +186,6 @@ TIME_DAYS: "{0} {jour|jours}"
TIME_HOURS: "{0} {heure|heures}"
TIME_MINUTES: "{0} {minute|minutes}"
TIME_SECONDS: "{0} {seconde|secondes}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {semaine|semaines}"
UPDATE_ERROR: "Une erreur s'est produite lors de la recherche de mises à jour."
UPDATE_HEADER: "{0} Mettre à jour"
+182 -193
View File
@@ -1,212 +1,201 @@
# CoreProtect Language File (ja)
ACTION_NOT_SUPPORTED: "そのアクションはサポートされていません"
AMOUNT_BLOCK: "{0}{ブロック|ブロック}"
AMOUNT_CHUNK: "{0}{チャンク|チャンク}"
AMOUNT_ENTITY: "{0}体の{エンティティ|エンティティ}"
AMOUNT_ITEM: "{0}個の{アイテム|アイテム}"
API_TEST: "APIテストに成功しました"
CACHE_ERROR: "警告: 検証中にエラーが発生しました {0}"
CACHE_RELOAD: "データベースから{マッピング|ワールド}キャッシュを強制リロードします"
ACTION_NOT_SUPPORTED: "そのアクションはサポートされていません。"
AMOUNT_BLOCK: "{0} {ブロック|ブロック}"
AMOUNT_CHUNK: "{0} {チャンク|チャンク}"
AMOUNT_ENTITY: "{0} {エンティティ|エンティティ}"
AMOUNT_ITEM: "{0} {item|items}"
API_TEST: "APIテストが成功しました。"
CACHE_ERROR: "警告:検証中にエラーが発生しました {0}"
CACHE_RELOAD: "{マッピング|世界} のリロードを強制する(データベースからのキャッシュ)"
CHECK_CONFIG: "config.ymlを確認してください"
COMMAND_CONSOLE: "コンソールからコマンドを実行してください"
COMMAND_NOT_FOUND: "{0} は不明なコマンドです"
COMMAND_THROTTLED: "しばらく待ってから、もう一度お試しください"
CONSUMER_ERROR: "コンシューマーキューの処理は既に{一時停止|再開}されています"
CONSUMER_TOGGLED: "コンシューマーキューの処理が{一時停止|再開}されました"
CONTAINER_HEADER: "コンテナのトランザクション"
CPU_CORES: "CPUコア"
DATABASE_BUSY: "データベースがビジー状態です。後でもう一度お試しください"
DATABASE_INDEX_ERROR: "データベースインデックスを検証できません"
DATABASE_LOCKED_1: "データベースがロックされています。最大15秒間お待ちください"
DATABASE_LOCKED_2: "そのデータベースは既に使用されています。もう一度やり直してください"
DATABASE_LOCKED_3: "データベースロックを無効にするには、\"database-lock: false\"を設定してください"
DATABASE_LOCKED_4: "データベースロックを無効にすると、データが破損する可能性があります"
DATABASE_UNREACHABLE: "データベースにアクセスできません。データを破棄してシャットダウンします"
DEVELOPMENT_BRANCH: "開発ブランチが検出され、パッチスクリプトをスキップしました"
DIRT_BLOCK: "あなたの下に仮ブロックを設置しました"
DISABLE_SUCCESS: "{0} を無効化しました"
DONATION_KEY_REQUIRED: "このコマンドには有効な寄付キーが必要です。"
ENABLE_FAILED: "{0} を開始できませんでした"
ENABLE_SUCCESS: "{0} が有効化されました"
ENJOY_COREPROTECT: "{0} を楽しんでますか?ぜひDiscordにもご参加ください!"
FINISHING_CONVERSION: "データ変換を終了します。しばらくお待ちください..."
FINISHING_LOGGING: "データのロギングを終了します。しばらくお待ちください..."
FIRST_VERSION: "初期データベース: {0}"
GLOBAL_LOOKUP: "グローバル検索を行う際は、半径を指定しないでください"
GLOBAL_ROLLBACK: "{0}を使用してグローバル{ロールバック|復元}を実行してください"
HELP_ACTION_1: "検索対象をアクションのみに制限します"
HELP_ACTION_2: "例: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "追加情報を表示します"
HELP_EXCLUDE_1: "ブロック/ユーザーを除外します"
HELP_EXCLUDE_2: "例: [e:stone], [e:Notch], [e:stone,Notch]"
COMMAND_CONSOLE: "コンソールからコマンドを実行してください。"
COMMAND_NOT_FOUND: "指示 \"{0}\" 見つかりません。"
COMMAND_THROTTLED: "しばらく待ってから、もう一度お試しください。"
CONSUMER_ERROR: "すでにコンシューマキュー処理 {一時停止|再開}。"
CONSUMER_TOGGLED: "消費者キューの処理は {一時停止|再開}。"
CONTAINER_HEADER: "コンテナトランザクション"
DATABASE_BUSY: "データベースが無効です。後でもう一度やり直してください。"
DATABASE_INDEX_ERROR: "データベースインデックスを検証できません。"
DATABASE_LOCKED_1: "データベースがロックされています。最大15秒待機しています..."
DATABASE_LOCKED_2: "データベースはすでに使用されています。もう一度やり直してください。"
DATABASE_LOCKED_3: "データベースロックを無効にするには、「database-lock:false」を設定します。"
DATABASE_LOCKED_4: "データベースロックを無効にすると、データが破損する可能性があります。"
DATABASE_UNREACHABLE: "データベースにアクセスできません。データを破棄してシャットダウンします。"
DEVELOPMENT_BRANCH: "開発ブランチが検出され、パッチスクリプトをスキップしました。"
DIRT_BLOCK: "あなたの下にダートブロックを置きました。"
DISABLE_SUCCESS: "成功!無効 {0}"
ENABLE_FAILED: "{0} を開始できませんでした。"
ENABLE_SUCCESS: "これで {0} は有効になります!"
ENJOY_COREPROTECT: "{0} を楽しんでいますか?私たちのDiscordに参加しましょう!"
FINISHING_CONVERSION: "データ変換を終了します。お待ちください..."
FINISHING_LOGGING: "データの記録が終了します。お待ちください..."
FIRST_VERSION: "初期DB:{0}"
GLOBAL_LOOKUP: "グローバルルックアップを実行するために半径を指定しないでください。"
GLOBAL_ROLLBACK: "つかいます \"{0}「グローバルに {ロールバック|復元}"
HELP_ACTION_1: "ルックアップをアクションに制限します。"
HELP_ACTION_2: "例:[a:block]、 [a:+block]、 [a:-block] [a:click]、 [a:container]、 [a:inventory]、 [a:item]、 [a:kill]、 [a:chat]、 [a:command]、 [a:sign]、 [a:session]、 [a:username]"
HELP_COMMAND: "追加情報を表示します。"
HELP_EXCLUDE_1: "ブロック/ユーザーを除外します。"
HELP_EXCLUDE_2: "例:[e:stone]、 [e:Notch]、 [e:stone,Notch]"
HELP_HEADER: "{0} ヘルプ"
HELP_INCLUDE_1: "ブロック/エンティティを含めます"
HELP_INCLUDE_2: "例: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "インスペクターが有効な場合、次のことができます:"
HELP_INSPECT_2: "ブロックを左クリックして、誰がそのブロックを配置したかを確認します"
HELP_INSPECT_3: "ブロックを右クリックして、隣接するどのブロックが破壊されたかを確認します"
HELP_INSPECT_4: "ブロックを配置して、その場所でどのブロックが破壊されたかを確認します"
HELP_INSPECT_5: "液体中などにブロックを配置して、誰がそれを配置したかを確認します"
HELP_INSPECT_6: "ドアやチェストなどを右クリックして、誰が最後に使用したかを確認します"
HELP_INSPECT_7: "ヒント:\"/co i\"を使用すると、より手軽にインスペクターにアクセスできます"
HELP_INSPECT_COMMAND: "ブロックインスペクターのオン/オフを切り替えます"
HELP_LIST: "全てのコマンドのリストを表示します"
HELP_LOOKUP_1: "コマンドのショートカットです"
HELP_LOOKUP_2: "ブロックを調査した後に使用すると、ログを表示できます"
HELP_LOOKUP_COMMAND: "ブロックデータの詳細検索"
HELP_NO_INFO: "コマンド情報 \"{0}\" が見つかりません"
HELP_PARAMETER: "詳細なパラメータ情報については、{0}を参照してください"
HELP_PARAMS_1: "{検索|ロールバック|復元}を実行します"
HELP_PARAMS_2: "{検索|ロールバック|復元}するユーザーを指定します"
HELP_PARAMS_3: "{検索|ロールバック|復元}をする際に時間を指定します"
HELP_PARAMS_4: "{検索|ロールバック|復元}をする際に半径を指定します"
HELP_PARAMS_5: "{検索|ロールバック|復元}をする際にアクションを制限します"
HELP_PARAMS_6: "{検索|ロールバック|復元}をする際にブロック/エンティティを含めます"
HELP_PARAMS_7: "{検索|ロールバック|復元}をする際にブロック/ユーザーを除外します"
HELP_PURGE_1: "指定した時間より古いデータを削除します"
HELP_PURGE_2: "例えば、 \"{0}\" は、1か月より古い全てのデータを削除し、過去30日間のデータのみを保持します"
HELP_PURGE_COMMAND: "古いブロックデータを削除します"
HELP_RADIUS_1: "半径領域を指定します"
HELP_RADIUS_2: "例: [r:10] (注: 変更は10ブロック以内でのみ行ってください)"
HELP_RELOAD_COMMAND: "構成ファイルを再読み込みします"
HELP_RESTORE_COMMAND: "ブロックデータを復元します"
HELP_ROLLBACK_COMMAND: "ブロックデータをロールバックします"
HELP_STATUS: "プラグインのステータスとバージョン情報を表示します"
HELP_STATUS_COMMAND: "プラグインのステータスを表示します"
HELP_TELEPORT: "場所にテレポートします"
HELP_TIME_1: "検索する時間を指定します"
HELP_TIME_2: "例: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "検索するユーザーを指定します"
HELP_USER_2: "例: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "そのアクションで \"{0}\" は使用できません"
INSPECTOR_ERROR: "インスペクターは既に{有効|無効}になっています"
INSPECTOR_TOGGLED: "インスペクターが{有効|無効}になりました"
INTEGRATION_ERROR: "{0}のロギングを{初期化|無効化}できませんでした"
INTEGRATION_SUCCESS: "{0}のロギングが正常に{初期化|無効化}されました"
INTEGRATION_VERSION: "無効な{0}バージョンが見つかりました"
HELP_INCLUDE_1: "ブロック/エンティティを含めます。"
HELP_INCLUDE_2: "例:[i:stone]、 [i:zombie]、 [i:stone,wood,bedrock]"
HELP_INSPECT_1: "インスペクターを有効にすると、次のことができます。"
HELP_INSPECT_2: "左クリックして配置を確認します。"
HELP_INSPECT_3: "右クリックして、隣接する削除を表示します。"
HELP_INSPECT_4: "ブロックを配置して、削除を確認します。"
HELP_INSPECT_5: "ブロックを液体に入れて配置を確認します。"
HELP_INSPECT_6: "右クリックしてチェストトランザクションを表示します。"
HELP_INSPECT_7: "ヒント:「/co i」を使用して犯人を追跡できます"
HELP_INSPECT_COMMAND: "ブロックインスペクターを切り替えます。"
HELP_LIST: "すべてのコマンドのリストを表示します。"
HELP_LOOKUP_1: "コマンドショートカット。"
HELP_LOOKUP_2: "追加のページを表示します。"
HELP_LOOKUP_COMMAND: "ルックアップブロックデータ。"
HELP_NO_INFO: "コマンドの情報 \"{0}\" 見つかりません。"
HELP_PARAMETER: "詳細なパラメータ情報については、「{0}」を参照してください。"
HELP_PARAMS_1: "を実行します {ルックアップ|ロールバック|復元}。"
HELP_PARAMS_2: "ユーザーを指定して {ルックアップ|ロールバック|復元}。"
HELP_PARAMS_3: "時間を指定します {ルックアップ|ロールバック|復元}。"
HELP_PARAMS_4: "制限する {ルックアップ|ロールバック|復元} 半径に。"
HELP_PARAMS_5: "制限する {ルックアップ|ロールバック|復元} アクションに。"
HELP_PARAMS_6: "ブロック/エンティティをに含める {ルックアップ|ロールバック|復元}。"
HELP_PARAMS_7: "ブロック/ユーザーをから除外する {ルックアップ|ロールバック|復元}。"
HELP_PURGE_1: "古いデータを削除します。"
HELP_PURGE_2: "例えば、 \"{0}\" は、1か月より古いすべてのデータを削除し、過去30日間のデータのみを保持します。"
HELP_PURGE_COMMAND: "古いブロックデータを削除します。"
HELP_RADIUS_1: "半径領域を指定します。"
HELP_RADIUS_2: "例:[r:10] (変更は10ブロック以内でのみ行ってください)"
HELP_RELOAD_COMMAND: "構成ファイルを再ロードします。"
HELP_RESTORE_COMMAND: "ブロックデータを復元します。"
HELP_ROLLBACK_COMMAND: "ブロックデータをロールバックします。"
HELP_STATUS: "プラグインのステータスを表示します。"
HELP_STATUS_COMMAND: "プラグインのステータスを表示します。"
HELP_TELEPORT: "テレポートします。"
HELP_TIME_1: "時間を指定します。"
HELP_TIME_2: "例:[t:2w,5d,7h,2m,10s]、 [t:5d2h]、 [t:2.50h]"
HELP_USER_1: "ユーザーを指定します。"
HELP_USER_2: "例:[u:Notch]、 [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "そのアクションで「{0}」は使用できません。"
INSPECTOR_ERROR: "検査官モードが{有効|無効}です。"
INSPECTOR_TOGGLED: "検査官モードが{有効|無効}になりました。"
INTEGRATION_ERROR: "できません {初期化|無効化} {0} ロギング。"
INTEGRATION_SUCCESS: "{0} 正常にロギング {初期化|無効}。"
INTEGRATION_VERSION: "無効 {0} バージョンが見つかりました。"
INTERACTIONS_HEADER: "プレイヤーの相互作用"
INVALID_ACTION: "それは有効なアクションではありません"
INVALID_BRANCH_1: "プラグインのバージョンが無効です(ブランチが設定されていません)"
INVALID_BRANCH_2: "続行するには、プロジェクトブランチを \"development\" に設定してください"
INVALID_BRANCH_3: "開発者用コードを実行すると、データが破損する可能性があります"
INVALID_CONTAINER: "最初に有効なコンテナを調べてください"
INVALID_DONATION_KEY: "寄付キーが無効です"
INVALID_INCLUDE: "\"{0}\"は無効なブロック/エンティティ名です"
INVALID_INCLUDE_COMBO: "これは無効な型の組み合わせです"
INVALID_RADIUS: "有効な半径を入力してください"
INVALID_SELECTION: "{0} 選択が見つかりません"
INVALID_USERNAME: "\"{0}\"は無効なユーザー名です"
INVALID_WORLD: "有効なワールドを指定してください"
INVALID_ACTION: "それは有効なアクションではありません。"
INVALID_BRANCH_1: "プラグインのバージョンが無効です(ブランチが設定されていません)。"
INVALID_BRANCH_2: "続行するには、プロジェクトブランチを「開発」に設定します。"
INVALID_BRANCH_3: "開発コードを実行すると、データが破損する可能性があります。"
INVALID_CONTAINER: "最初に有効な貨物ブロックを調べてください。"
INVALID_DONATION_KEY: "寄付キーが無効です。"
INVALID_INCLUDE: "「{0}」は無効な値です。"
INVALID_INCLUDE_COMBO: "これは無効な型の組み合わせです。"
INVALID_RADIUS: "有効な半径を入力してください。"
INVALID_SELECTION: "{0} 選択が見つかりません。"
INVALID_USERNAME: "「{0}」は無効なユーザー名です。"
INVALID_WORLD: "有効なワールドを指定してください。"
LATEST_VERSION: "最新バージョン: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "ダウンロード: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "ブロック名: {0}"
LINK_WIKI_ENTITY: "エンティティ名: {0}"
LOGGING_ITEMS: "ログに記録すべきアイテムが{0}個残っています。しばらくお待ちください..."
LOGGING_TIME_LIMIT: "記録制限時間に達しました。データを破棄してシャットダウンします"
LOOKUP_BLOCK: "{0}が{1}を{設置した|破壊した}"
LOOKUP_CONTAINER: "{0}が{2}個の{1}を{追加した|取り出した}"
LOOKUP_HEADER: "{0} の検索結果"
LOOKUP_INTERACTION: "{0}が{1}を{クリックした|殺害した}"
LOOKUP_ITEM: "{0}が{2}個の{1}を{拾った|落とした}"
LOOKUP_LOGIN: "{0}の{ログイン|ログアウト}がログに記録されます"
LOOKUP_PAGE: "{0} ページ目"
LOOKUP_PROJECTILE: "{0}が{2}個の{1}を{投げた|撃った}"
LOOKUP_ROWS_FOUND: "{0}行見つかりました"
LOOKUP_SEARCHING: "検索中。しばらくお待ちください..."
LOOKUP_STORAGE: "{0}が{2}個の{1}を{預け入れた|引き出した}"
LOOKUP_TIME: "{0}前"
LOOKUP_USERNAME: "{0}が{1}としてログインしました"
MAXIMUM_RADIUS: "最大{0}ブロックの半径内で{検索|ロールバック|復元}を実行します"
MISSING_ACTION_USER: "そのアクションを使用するには、ユーザーを指定してください"
MISSING_LOOKUP_TIME: "{検索|ロールバック|復元}する時間を指定してください"
MISSING_LOOKUP_USER: "ユーザー、ブロック、または半径を指定してください"
MISSING_PARAMETERS: "\"{0}\" のパラメータが不足しています"
MISSING_ROLLBACK_RADIUS: "{ロールバック|復元}対象の半径を指定しませんでした"
MISSING_ROLLBACK_USER: "{ロールバック|復元}対象のユーザーを指定しませんでした"
MYSQL_UNAVAILABLE: "MySQLサーバーに接続できません"
NETWORK_CONNECTION: "{0}の接続に{成功|失敗}しました。{1}{2}を使用します"
NETWORK_TEST: "ネットワーク・テスト・データが正常に送信されました"
NO_DATA: "{0}でデータが見つかりません"
NO_DATA_LOCATION: "この場所には{データ|トランザクション|相互作用|メッセージ}が見つかりませんでした"
NO_PERMISSION: "あなたにはそれをする権限がありません"
NO_RESULTS: "結果が見つかりませんでした"
NO_RESULTS_PAGE: "このページには{結果|データ}は見つかりませんでした"
NO_ROLLBACK: "{保留中または以前の}ロールバック/復元は見つかりませんでした"
PATCH_INTERRUPTED: "アップグレードが中断されました。再起動時に再試行します"
PATCH_OUTDATED_1: "{0}より古いデータベースはアップグレードできません"
PATCH_OUTDATED_2: "CoreProtect がサポートされているバージョンにアップグレードしてください"
PATCH_PROCESSING: "新しいデータを処理しています。しばらくお待ちください..."
PATCH_SKIP_UPDATE: "{0}の{テーブル|インデックス}の{更新|作成|削除}をスキップします"
PATCH_STARTED: "{0} のアップグレードを実行します。しばらくお待ちください..."
PATCH_SUCCESS: "{0} は正常にアップグレードされました"
PATCH_UPGRADING: "データベースのアップグレードが進行中です。しばらくお待ちください..."
PLEASE_SELECT: "\"{0}\" または \"{1}\" を選択してください"
PREVIEW_CANCELLED: "プレビューがキャンセルされました"
LOGGING_ITEMS: "{0} ログに残されたアイテム。お待ちください..."
LOGGING_TIME_LIMIT: "記録制限時間に達しました。データを破棄してシャットダウンします。"
LOOKUP_BLOCK: "{0} {配置|壊れた} {1}。"
LOOKUP_CONTAINER: "{0} {追加|削除} {1} {2}。"
LOOKUP_HEADER: "{0} 結果"
LOOKUP_INTERACTION: "{0} {クリック|殺された} {1}。"
LOOKUP_ITEM: "{0} {拾った|落とした} {1} {2}。"
LOOKUP_LOGIN: "{0} ログに記録されます {in|out}。"
LOOKUP_PAGE: "ページ {0}"
LOOKUP_PROJECTILE: "{0} {投げた|ショット} {1} {2}。"
LOOKUP_ROWS_FOUND: "{0} {行|行} 見つかりました。"
LOOKUP_SEARCHING: "ルックアップ検索。お待ちください..."
LOOKUP_STORAGE: "{0} {預け入れ|撤回} {1} {2}。"
LOOKUP_TIME: "{0} 前に"
LOOKUP_USERNAME: "{1}が{0}としてログイン"
MAXIMUM_RADIUS: "最大 {ルックアップ|ロールバック|復元} 半径は {0}。"
MISSING_ACTION_USER: "そのアクションを使用するには、ユーザーを指定してください。"
MISSING_LOOKUP_TIME: "時間を指定してください({ルックアップ|ロールバック|復元})"
MISSING_LOOKUP_USER: "ユーザーを指定するか、 {ブロック|半径}を指定してください。"
MISSING_PARAMETERS: "\"{0}\"のパラメーターは存在していません。"
MISSING_ROLLBACK_RADIUS: "指定しませんでした {ロールバック|復元} 半径。"
MISSING_ROLLBACK_USER: "指定しませんでした {ロールバック|復元} ユーザー。"
MYSQL_UNAVAILABLE: "接続できません MySQL サーバ。"
NO_DATA: "{0}でデータが見つかりません。"
NO_DATA_LOCATION: "番号 {データ|トランザクション|相互作用|メッセージ} 見つかった。"
NO_PERMISSION: "あなたにはそれをする許可がありません。"
NO_RESULTS: "結果が見つかりません。"
NO_RESULTS_PAGE: "番号 {結果|データ} そのページで見つかりました。"
NO_ROLLBACK: "番号 {保留中|前へ} ロールバック/復元が見つかりました。"
PATCH_INTERRUPTED: "アップグレードが中断されました。再起動時に再試行します。"
PATCH_OUTDATED_1: "古いデータベースをアップグレードできません {0}。"
PATCH_OUTDATED_2: "CoreProtectがサポートされているバージョンでアップグレードしてください。"
PATCH_PROCESSING: "新しいデータを処理しています。お待ちください..."
PATCH_SKIP_UPDATE: "スキップ {テーブル|インデックス} {更新|作成|削除} の上 {0}。"
PATCH_STARTED: "実行する {0} アップグレード。お待ちください..."
PATCH_SUCCESS: "正常にアップグレードされました {0}。"
PATCH_UPGRADING: "データベースのアップグレードが進行中です。お待ちください..."
PLEASE_SELECT: "選んでください: \"{0}\" また \"{1}\" 。"
PREVIEW_CANCELLED: "プレビューがキャンセルされました。"
PREVIEW_CANCELLING: "プレビューをキャンセルしています..."
PREVIEW_IN_GAME: "ゲーム内でのみロールバックをプレビューできます"
PREVIEW_TRANSACTION: "{コンテナ|インベントリ}のトランザクションをプレビューすることはできません"
PRIMARY_THREAD_ERROR: "そのAPIメソッドはメインスレッドでは使用できません"
PURGE_ABORTED: "パージに失敗しました。データベースが破損している可能性があります"
PREVIEW_IN_GAME: "ゲーム内でのみロールバックをプレビューできます。"
PREVIEW_TRANSACTION: "プレビューできません {コンテナ|在庫} トランザクション。"
PURGE_ABORTED: "パージに失敗しました。データベースが破損している可能性があります。"
PURGE_ERROR: "{0} のデータを処理できません"
PURGE_FAILED: "パージに失敗しました。もう一度やり直してください"
PURGE_IN_PROGRESS: "パージは進行中です。もう一度やり直してください"
PURGE_MINIMUM_TIME: "パージできるのは、{0}{日|時間}より古いデータのみです"
PURGE_NOTICE_1: "これには時間がかかる場合があります..."
PURGE_NOTICE_2: "完了するまでサーバーを再起動しないでください"
PURGE_OPTIMIZING: "データベースの最適化をしています。しばらくお待ちください..."
PURGE_FAILED: "パージに失敗しました。後でもう一度やり直してください。"
PURGE_IN_PROGRESS: "進行中のパージ。後でもう一度やり直してください。"
PURGE_MINIMUM_TIME: "分離できるのは、より古いデータのみです。({0}{日|時間})"
PURGE_NOTICE_1: "これには時間がかかる場合がありますのでご注意ください。"
PURGE_NOTICE_2: "完了するまでサーバーを再起動しないでください。"
PURGE_OPTIMIZING: "データベースの最適化。お待ちください..."
PURGE_PROCESSING: "{0} のデータを処理中..."
PURGE_REPAIRING: "修復しようとしています。これには時間がかかる場合があります..."
PURGE_ROWS: "{0}行のデータが削除されました"
PURGE_STARTED: "データの削除は\"{0}\"で開始されました"
PURGE_SUCCESS: "データのパージに成功しました"
RAM_STATS: "{0}GB / {1}GB RAM"
RELOAD_STARTED: "構成の再読み込みをしています。しばらくお待ちください"
RELOAD_SUCCESS: "構成が正常に再読み込みされました"
ROLLBACK_ABORTED: "ロールバックまたは復元が中止されました"
ROLLBACK_CHUNKS_FOUND: "{0}個の{チャンク|チャンク}の変更が見つかりました"
ROLLBACK_CHUNKS_MODIFIED: "{0}/{1}個の{チャンク|チャンク}を{変更しました|変更中}"
ROLLBACK_COMPLETED: "{ロールバック|復元|プレビュー} は\"{0}\"で完了しました"
ROLLBACK_EXCLUDED_USERS: "除外するユーザー: \"{0}\" "
ROLLBACK_INCLUDE: "{含まれる|除外される}{ブロック|エンティティ|ターゲット}タイプ: \"{0}\""
ROLLBACK_IN_PROGRESS: "ロールバック/復元はすでに進行中です"
ROLLBACK_LENGTH: "所要時間: {0}{秒|秒間}"
ROLLBACK_MODIFIED: "{0}を{変更しました|変更中}"
ROLLBACK_RADIUS: "半径: {0}{ブロック|ブロック}"
ROLLBACK_SELECTION: "半径を\"{0}\"に設定しました"
ROLLBACK_STARTED: "{ロールバック|復元|プレビュー}が\"{0}\"で開始されました"
ROLLBACK_TIME: "時間範囲: {0}"
ROLLBACK_WORLD_ACTION: "{ワールド|アクション}を\"{0}\"に制限しました"
SIGN_HEADER: "看板のメッセージ"
STATUS_CONSUMER: "キューに{0}個の{アイテム|アイテム}があります"
STATUS_DATABASE: "データベース: {0}を使用中"
PURGE_ROWS: "{0}{行|行} のデータが削除されました。"
PURGE_STARTED: "データの削除は\"{0}\"で開始されました。"
PURGE_SUCCESS: "データの分離に成功しました。"
RELOAD_STARTED: "構成の再読み込み-しばらくお待ちください。"
RELOAD_SUCCESS: "構成が正常に再ロードされました。"
ROLLBACK_ABORTED: "ロールバックまたは復元が中止されました。"
ROLLBACK_CHUNKS_FOUND: "見つかった {0} {チャンク|チャンク} 変更します。"
ROLLBACK_CHUNKS_MODIFIED: "変更 {0}/{1} {チャンク|チャンク}。"
ROLLBACK_COMPLETED: "{ロールバック|復元|プレビュー} のために完成{0}\" 。"
ROLLBACK_EXCLUDED_USERS: "除外 {ユーザー|ユーザー}: \"{0}\" 。"
ROLLBACK_INCLUDE: "{含まれる|除外される} {ブロック|エンティティ|ターゲット} {タイプ|タイプ}: \"{0}\" 。"
ROLLBACK_IN_PROGRESS: "ロールバック/復元はすでに進行中です。"
ROLLBACK_LENGTH: "所要時間:{0} {秒|秒}。"
ROLLBACK_MODIFIED: "{変更|変更} {0}。"
ROLLBACK_RADIUS: "半径:{0} {ブロック|ブロック}。"
ROLLBACK_SELECTION: "半径を「{0}\" 。"
ROLLBACK_STARTED: "{ロールバック|復元|プレビュー} 「で始まった{0}\" 。"
ROLLBACK_TIME: "時間範囲:{0}。"
ROLLBACK_WORLD_ACTION: "{0}{世界|アクション}に制限があります。"
SIGN_HEADER: "メッセージに署名する"
STATUS_CONSUMER: "消費者: {0} {item|items} 順番待ち。"
STATUS_DATABASE: "データベース: 使用する {0}"
STATUS_INTEGRATION: "{0}: 統合 {有効|無効}"
STATUS_LICENSE: "ライセンス: {0}"
STATUS_SYSTEM: "システム: {0}"
STATUS_VERSION: "バージョン: {0}"
TELEPORTED: "{0} にテレポートしました"
TELEPORTED_SAFETY: "あなたを安全な場所にテレポートさせました"
TELEPORT_PLAYERS: "テレポートコマンドはプレイヤーのみが使用できます"
TIME_DAYS: "{0}{日|日間}"
TIME_HOURS: "{0}{時|時間}"
TIME_MINUTES: "{0}{分|分間}"
TIME_MONTHS: "{0}{ヶ月|ヶ月間}"
TIME_SECONDS: "{0}{秒|秒間}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0}{週|週間}"
TIME_YEARS: "{0}{年|年間}"
UPDATE_ERROR: "更新の確認中にエラーが発生しました"
TELEPORTED: "{0} にテレポート"
TELEPORTED_SAFETY: "安全にテレポートしました。"
TELEPORT_PLAYERS: "テレポートコマンドはプレイヤーだけが使用できます。"
TIME_DAYS: "{0} {日|日}"
TIME_HOURS: "{0} {時間|時間}"
TIME_MINUTES: "{0} {分|分}"
TIME_SECONDS: "{0} {秒|秒}"
TIME_WEEKS: "{0} {週|週}"
UPDATE_ERROR: "更新の確認中にエラーが発生しました。"
UPDATE_HEADER: "{0} アップデート"
UPDATE_NOTICE: "お知らせ: {0} が利用可能です"
UPGRADE_IN_PROGRESS: "アップグレードが進行中です。しばらくしてからもう一度やり直してください"
USER_NOT_FOUND: "ユーザー \"{0}\" が見つかりません"
USER_OFFLINE: "ユーザー \"{0}\" はオンラインではありません"
USING_MYSQL: "MySQL データストレージを使用します"
USING_SQLITE: "SQLite データストレージを使用します"
VALID_DONATION_KEY: "有効な寄付キーです"
VERSION_INCOMPATIBLE: "{0} {1} はサポートされていません"
VERSION_NOTICE: "バージョン {0} が利用可能です"
VERSION_REQUIRED: "{0} {1} 以上が必要です"
WORLD_NOT_FOUND: "ワールド \"{0}\" は見つかりませんでした"
UPDATE_NOTICE: "お知らせ: {0} が現在利用できます。"
UPGRADE_IN_PROGRESS: "アップグレードが進行中です。後でもう一度やり直してください。"
USER_NOT_FOUND: "ユーザー \"{0}\" 見つかりません。"
USER_OFFLINE: "ユーザー \"{0}\" はオンラインではありません。"
USING_MYSQL: "MySQL データストレージを使用します。"
USING_SQLITE: "SQLite データストレージを使用します。"
VALID_DONATION_KEY: "有効な寄付キーが必要です。"
VERSION_NOTICE: "バージョン {0} が現在利用できます。"
VERSION_REQUIRED: "{0} {1} 以上が必要です。"
WORLD_NOT_FOUND: "世界 \"{0}\" は見つかりませんでした。"
+71 -77
View File
@@ -1,37 +1,35 @@
# CoreProtect Language File (ko)
ACTION_NOT_SUPPORTED: "이 명령어는 해당 작업을 지원하지 않습니다."
AMOUNT_BLOCK: "{0}개의 {블록|블록}"
AMOUNT_CHUNK: "{0}개의 {청크|청크}"
AMOUNT_ENTITY: "{0}개의 {엔티티|엔티티}"
AMOUNT_ITEM: "{0}개의 {아이템|아이템}"
ACTION_NOT_SUPPORTED: "해당 명령어는 해당 작업을 지원하지 않습니다."
AMOUNT_BLOCK: "{0} {블록|블록}"
AMOUNT_CHUNK: "{0} {청크|청크}"
AMOUNT_ENTITY: "{0} {엔티티|엔티티}"
AMOUNT_ITEM: "{0} {항목|항목}"
API_TEST: "API 테스트가 성공했습니다."
CACHE_ERROR: "경고: {0} 캐시를 검증하는 중 오류가 발생했습니다."
CACHE_RELOAD: "데이터베이스에서 {매핑|월드} 캐시를 강제로 다시 로드합니다."
CHECK_CONFIG: "config.yml을 확인해주세요"
COMMAND_CONSOLE: "이 명령어는 콘솔에서만 실행할 수 있습니다."
CHECK_CONFIG: "config.yml을 확인하세요"
COMMAND_CONSOLE: "콘솔에서 명령어를 실행하세요."
COMMAND_NOT_FOUND: "\"{0}\" 명령어를 찾을 수 없습니다."
COMMAND_THROTTLED: "잠시 기다렸다가 다시 시도하세요."
CONSUMER_ERROR: "데이터베이스 처리가 이미 {일시정지|재개}되어 있습니다!"
CONSUMER_TOGGLED: "데이터베이스 처리가 {일시정지|재개}되었습니다."
COMMAND_THROTTLED: "잠시 기다렸다가 다시 시도하십시오."
CONSUMER_ERROR: "소비자 대기열 처리가 이미 {일시 중지|재개}되있습니다!"
CONSUMER_TOGGLED: "소비자 대기열 처리가 {일시 중지|재개}되었습니다."
CONTAINER_HEADER: "컨테이너 기록"
CPU_CORES: "CPU 코어"
DATABASE_BUSY: "데이터베이스가 사용 중입니다. 나중에 다시 시도하세요."
DATABASE_BUSY: "데이터베이스가 사용 중입니다. 나중에 다시 시도하십시오."
DATABASE_INDEX_ERROR: "데이터베이스 인덱스의 유효성을 검사할 수 없습니다."
DATABASE_LOCKED_1: "데이터베이스가 잠겼습니다. 최대 15초 대기 중..."
DATABASE_LOCKED_2: "데이터베이스가 이미 사용 중입니다. 다시 시도하세요."
DATABASE_LOCKED_3: "데이터베이스 잠금을 해제하려면 \"database-lock: false\"로 설정하세요."
DATABASE_LOCKED_4: "데이터베이스 잠금을 비활성화하면 데이터가 손상될 수도 있습니다."
DATABASE_LOCKED_2: "데이터베이스가 이미 사용 중입니다. 다시 시도하십시오."
DATABASE_LOCKED_3: "데이터베이스 잠금을 비활성화하려면 \"database-lock: false\"로 설정하세요."
DATABASE_LOCKED_4: "데이터베이스 잠금을 비활성화하면 데이터가 손상될 수 있습니다."
DATABASE_UNREACHABLE: "데이터베이스에 연결할 수 없습니다. 데이터를 삭제하고 종료합니다."
DEVELOPMENT_BRANCH: "개발 브랜치가 감지되어 패치 스크립트를 건너뜁니다."
DIRT_BLOCK: "당신 아래에 임시 안전 블록을 설치했습니다."
DIRT_BLOCK: "당신 아래에 흙 블록을 설치했습니다."
DISABLE_SUCCESS: "성공! {0} 비활성화됨"
DONATION_KEY_REQUIRED: "해당 명령어를 사용하려면 유효한 후원 키가 필요합니다."
ENABLE_FAILED: "{0}을(를) 시작할 수 없습니다."
ENABLE_SUCCESS: "{0}이(가) 성공적으로 활성화되었습니다!"
ENJOY_COREPROTECT: "{0}을(를) 잘 사용하고 계신가요? 그렇다면 저희의 Discord 서버에 참여하세요!"
ENJOY_COREPROTECT: "{0}을(를) 사용중이신가요? Discord 서버에 참여해보세요!"
FINISHING_CONVERSION: "데이터 변환을 완료하는 중입니다. 잠시 기다려 주세요..."
FINISHING_LOGGING: "데이터 로깅을 완료하는 중입니다. 잠시 기다려 주세요..."
FINISHING_LOGGING: "데이터 로깅을 완료하는 중입니다. 잠시 기다려 주십시오..."
FIRST_VERSION: "초기 DB: {0}"
GLOBAL_LOOKUP: "전체 조회를 수행하려면 반경을 지정하지 마세요."
GLOBAL_ROLLBACK: "전역 {롤백|복원}을 수행하려면 \"{0}\"을(를) 사용하세요."
@@ -44,43 +42,43 @@ HELP_HEADER: "{0} 도움말"
HELP_INCLUDE_1: "특정 블록/엔티티를 포함합니다."
HELP_INCLUDE_2: "예: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "로그 조사가 활성화되면 다음을 수행할 수 있습니다:"
HELP_INSPECT_2: "블록을 마우스 왼쪽 버튼으로 클릭하면 누가 그 블록을 설치했는지 확인할 수 있습니다."
HELP_INSPECT_3: "블록을 마우스 오른쪽 버튼으로 클릭하면 인접한 블록이 부서졌는지 확인할 수 있습니다."
HELP_INSPECT_4: "블록을 배치하여 해당 위치에서 어떤 블록이 부서졌는지 확인할 수 있습니다."
HELP_INSPECT_2: "누가 그 블록을 설치했는지 보려면 블록을 마우스 왼쪽 버튼으로 클릭하세요."
HELP_INSPECT_3: "블록을 마우스 오른쪽 버튼으로 클릭하면 인접한 블록이 깨졌는지 확인할 수 있습니다."
HELP_INSPECT_4: "블록을 배치하여 해당 위치에서 어떤 블록이 깨졌는지 확인하세요."
HELP_INSPECT_5: "누가 설치했는지 확인하려면 액체(등)에 블록을 배치하세요."
HELP_INSPECT_6: "문, 상자 등을 마우스 오른쪽 버튼으로 클릭하면 누가 마지막으로 사용했는지 확인할 수 있습니다."
HELP_INSPECT_7: "팁: 더 빠른 사용을 위해 \"/co i\"명령어를 사용할 수 있습니다."
HELP_INSPECT_7: "팁: 더 빠른 액세스를 위해 \"/co i\"명령어를 사용할 수 있습니다."
HELP_INSPECT_COMMAND: "블록 로그 조사를 켜거나 끕니다."
HELP_LIST: "모든 명령어 목록을 표시합니다."
HELP_LOOKUP_1: "단축 명령어."
HELP_LOOKUP_1: "명령어 단축키."
HELP_LOOKUP_2: "로그를 보려면 블록을 검사한 후 사용하세요."
HELP_LOOKUP_COMMAND: "고급 블록 데이터 조회."
HELP_NO_INFO: "\"{0}\" 명령어에 대한 정보가 없습니다."
HELP_NO_INFO: "\"{0}\" 명령어에 대한 정보를 찾을 수 없습니다."
HELP_PARAMETER: "자세한 매개변수 정보는 \"{0}\"을 참조하세요."
HELP_PARAMS_1: "{조회|롤백|복원}을(를) 수행합니다."
HELP_PARAMS_2: "{조회|롤백|복원}할 사용자를 지정합니다."
HELP_PARAMS_3: "{조회|롤백|복원}할 시간을 지정합니다."
HELP_PARAMS_4: "{조회|롤백|복원}을(를) 제한할 반경을 지정합니다."
HELP_PARAMS_1: "{조회|롤백|복원}을(를) 수행하세요."
HELP_PARAMS_2: "{조회|롤백|복원}할 사용자를 지정하세요."
HELP_PARAMS_3: "{조회|롤백|복원}에 걸리는 시간을 지정하세요."
HELP_PARAMS_4: "{조회|롤백|복원}을(를) 제한할 반경 영역을 지정하세요."
HELP_PARAMS_5: "{조회|롤백|복원}을(를) 특정 작업으로 제한합니다."
HELP_PARAMS_6: "{조회|롤백|복원}에 특정 블록/엔티티를 포함합니다."
HELP_PARAMS_7: "{조회|롤백|복원}에서 블록/사용자를 제외합니다."
HELP_PURGE_1: "지정된 시간보다 오래된 데이터를 삭제합니다."
HELP_PURGE_2: "예를 들어 \"{0}\"은(는) 한 달이 지난 모든 데이터를 삭제하고 지난 30일 동안의 데이터만 보관합니다."
HELP_PURGE_COMMAND: "오래된 블록 데이터를 삭제합니다."
HELP_RADIUS_1: "반경을 지정합니다."
HELP_RADIUS_2: "예: [r:10] (10블록 이내에서만 변경합니다.)"
HELP_RADIUS_1: "반경 영역을 지정하세요."
HELP_RADIUS_2: "예: [r:10] (10블록 이내에서만 변경하세요.)"
HELP_RELOAD_COMMAND: "구성 파일을 다시 로드합니다."
HELP_RESTORE_COMMAND: "블록 데이터를 복원합니다."
HELP_ROLLBACK_COMMAND: "블록 데이터를 롤백합니다."
HELP_STATUS: "플러그인 상태 및 버전 정보를 확인합니다."
HELP_STATUS: "플러그인 상태 및 버전 정보를 확인하세요."
HELP_STATUS_COMMAND: "플러그인 상태를 표시합니다."
HELP_TELEPORT: "특정 위치로 순간이동합니다."
HELP_TIME_1: "조회 시간을 지정합니다."
HELP_TIME_1: "조회 시간을 지정하세요."
HELP_TIME_2: "예: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "조회할 사용자를 지정합니다."
HELP_USER_1: "조회할 사용자를 지정하세요."
HELP_USER_2: "예: [u:notch], [u:notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\"은(는) 해당 작업과 함께 사용할 수 없습니다."
INSPECTOR_ERROR: "로그 조사가 이미 {활성화|비활성화}되어 있습니다!"
INSPECTOR_ERROR: "로그 조사가 이미 {활성화|비활성화}되있습니다!"
INSPECTOR_TOGGLED: "로그 조사가 {활성화|비활성화}되었습니다."
INTEGRATION_ERROR: "{0} 로깅을 {초기화|비활성화}할 수 없습니다."
INTEGRATION_SUCCESS: "{0} 로깅이 성공적으로 {초기화|비활성화}되었습니다."
@@ -89,13 +87,13 @@ INTERACTIONS_HEADER: "플레이어 상호작용"
INVALID_ACTION: "유효하지 않은 작업입니다."
INVALID_BRANCH_1: "잘못된 플러그인 버전(브랜치가 설정되지 않음)."
INVALID_BRANCH_2: "계속하려면 프로젝트 브랜치를 \"development\"로 설정하세요."
INVALID_BRANCH_3: "개발중인 코드를 실행하면 데이터 손상이 발생할 수도 있습니다."
INVALID_BRANCH_3: "개발 코드를 실행하면 데이터 손상이 발생할 수 있습니다."
INVALID_CONTAINER: "먼저 유효한 컨테이너를 검사하세요."
INVALID_DONATION_KEY: "잘못된 후원 키입니다."
INVALID_INCLUDE: "\"{0}\"은(는) 잘못된 블록/엔티티 이름입니다."
INVALID_INCLUDE_COMBO: "잘못된 블록/엔티티 조합입니다."
INVALID_RADIUS: "유효한 반경을 입력하세요."
INVALID_SELECTION: "{0} 선택된 항목을 찾을 수 없습니다."
INVALID_SELECTION: "{0} 선택을 찾을 수 없습니다."
INVALID_USERNAME: "\"{0}\"은(는) 잘못된 사용자 이름입니다."
INVALID_WORLD: "유효한 월드를 지정하세요."
LATEST_VERSION: "최신 버전: {0}"
@@ -105,29 +103,29 @@ LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "블록 이름: {0}"
LINK_WIKI_ENTITY: "엔티티 이름: {0}"
LOGGING_ITEMS: "{0} 아이템이 남았습니다. 잠시만 기다려 주세요..."
LOGGING_TIME_LIMIT: "로깅 시간 제한에 도달했습니다. 데이터를 삭제하고 종료합니다."
LOOKUP_BLOCK: "{0}이(가) {1}을(를) {설치|파괴}함"
LOOKUP_CONTAINER: "{0}이(가) {2}에서 {1}을(를) {추가|제거}함"
LOGGING_TIME_LIMIT: "로깅 시간 제한에 도달했습니다. 데이터를 폐기하고 종료합니다."
LOOKUP_BLOCK: "{0}이(가) {1}을(를) {설치|파괴}했습니다."
LOOKUP_CONTAINER: "{0}이(가) {2}에서 {1}을(를) {추가|제거}했습니다."
LOOKUP_HEADER: "{0} 조회 결과"
LOOKUP_INTERACTION: "{0}이(가) {1}을(를) {클릭함|죽임}
LOOKUP_ITEM: "{0}이(가) {2}에서 {1}을(를) {획득|드롭}함"
LOOKUP_LOGIN: "{0}이(가) {로그인|로그아웃}함"
LOOKUP_INTERACTION: "{0}이(가) {1}을(를) {클릭|처치}했습니다."
LOOKUP_ITEM: "{0}이(가) {2}에서 {1}을(를) {획득|드롭}했습니다."
LOOKUP_LOGIN: "{0}이(가) {로그인|로그아웃}했습니다."
LOOKUP_PAGE: "페이지 {0}"
LOOKUP_PROJECTILE: "{0}이(가) {2}에서 {1}을(를) {던짐|발사함}"
LOOKUP_PROJECTILE: "{0}이(가) {2}에서 {1}을(를) {던졌|발사했}습니다.."
LOOKUP_ROWS_FOUND: "{0} {열|열}이 발견되었습니다."
LOOKUP_SEARCHING: "조회 중입니다. 잠시만 기다려 주세요..."
LOOKUP_STORAGE: "{0}이(가) {2}에서 {1}을(를) {추가|제거}함"
LOOKUP_STORAGE: "{0}이(가) {2}에서 {1}을(를) {추가|제거}했습니다."
LOOKUP_TIME: "{0} 전"
LOOKUP_USERNAME: "{0}이(가) {1}으로 로그인함"
LOOKUP_USERNAME: "{0}이(가) {1}으로 로그인했습니다."
MAXIMUM_RADIUS: "최대 {조회|롤백|복원} 반경은 {0}입니다."
MISSING_ACTION_USER: "해당 작업을 사용하려면 사용자를 지정하세요."
MISSING_LOOKUP_TIME: "{조회|롤백|복원}할 시간을 지정하세요."
MISSING_LOOKUP_USER: "조회할 사용자 또는 {블록|반경}을 지정하세요."
MISSING_PARAMETERS: "\"{0}\"을(를) 사용하세요."
MISSING_ROLLBACK_RADIUS: "{롤백|복원}할 반경을 지정하지 않았습니다."
MISSING_ROLLBACK_USER: "{롤백|복원}할 사용자를 지정하지 않았습니다."
MISSING_ROLLBACK_RADIUS: "{롤백|복원} 반경을 지정하지 않았습니다."
MISSING_ROLLBACK_USER: "{롤백|복원} 사용자를 지정하지 않았습니다."
MYSQL_UNAVAILABLE: "MySQL 서버에 연결할 수 없습니다."
NETWORK_CONNECTION: "{0} 연결 {성공|실패}. {1} {2} 사용 중"
NETWORK_CONNECTION: "{0} 연결 {성공|실패}. {1} {2} 사용 중."
NETWORK_TEST: "네트워크 테스트 데이터가 성공적으로 전송되었습니다."
NO_DATA: "{0}에서 데이터를 찾을 수 없습니다."
NO_DATA_LOCATION: "해당 위치에서 {데이터|거래|상호작용|메시지}(을)를 찾을 수 없습니다."
@@ -135,7 +133,7 @@ NO_PERMISSION: "해당 작업을 수행할 권한이 없습니다."
NO_RESULTS: "결과를 찾을 수 없습니다."
NO_RESULTS_PAGE: "해당 페이지에 대한 {결과|데이터}를 찾을 수 없습니다."
NO_ROLLBACK: "{보류 중인|이전} 롤백/복원을 찾을 수 없습니다."
PATCH_INTERRUPTED: "업그레이드가 중단되었습니다. 서버를 재시작하면 재시도합니다."
PATCH_INTERRUPTED: "업그레이드가 중단되었습니다. 다시 시작할 때 재시도합니다."
PATCH_OUTDATED_1: "{0}보다 오래된 데이터베이스를 업그레이드할 수 없습니다."
PATCH_OUTDATED_2: "지원되는 CoreProtect 버전으로 업그레이드하세요."
PATCH_PROCESSING: "새 데이터를 처리 중입니다. 잠시 기다려 주세요..."
@@ -143,48 +141,45 @@ PATCH_SKIP_UPDATE: "{0}에서 {테이블|인덱스} {업데이트|생성|제거}
PATCH_STARTED: "{0} 업그레이드를 수행 중입니다. 잠시 기다려 주세요..."
PATCH_SUCCESS: "{0}으로 성공적으로 업그레이드되었습니다."
PATCH_UPGRADING: "데이터베이스 업그레이드가 진행 중입니다. 잠시 기다려 주세요..."
PLEASE_SELECT: "\"{0}\" 또는 \"{1}\" 중 하나를 선택하세요."
PLEASE_SELECT: "다음을 선택하세요: \"{0}\" 또는 \"{1}\"."
PREVIEW_CANCELLED: "미리보기가 취소되었습니다."
PREVIEW_CANCELLING: "미리보기 취소 중..."
PREVIEW_IN_GAME: "게임 내에서만 롤백 미리보기가 가능합니다."
PREVIEW_TRANSACTION: "{컨테이너|인벤토리} 기록은 미리보기할 수 없습니다."
PRIMARY_THREAD_ERROR: "기본 스레드에서는 API 메소드를 사용할 수 없습니다."
PURGE_ABORTED: "삭제에 실패하였습니다. 데이터베이스가 손상되었을 수도 있습니다."
PREVIEW_IN_GAME: "롤백을 미리보려면 게임 내에서만 가능합니다."
PREVIEW_TRANSACTION: "{컨테이너|인벤토리} 기록을 미리볼 수 없습니다."
PURGE_ABORTED: "삭제 실패. 데이터베이스가 손상되었을 수 있습니다."
PURGE_ERROR: "{0} 데이터를 처리할 수 없습니다!"
PURGE_FAILED: "삭제에 실패하였습니다. 나중에 다시 시도하세요."
PURGE_FAILED: "삭제 실패. 나중에 다시 시도하세요."
PURGE_IN_PROGRESS: "삭제가 진행 중입니다. 나중에 다시 시도하세요."
PURGE_MINIMUM_TIME: "{0} {일|시간}보다 오래된 데이터만 삭제할 수 있습니다."
PURGE_NOTICE_1: "이 작업은 시간이 걸릴 수 있습니다."
PURGE_NOTICE_2: "완료될 때까지 서버를 재시작하지 마세요."
PURGE_OPTIMIZING: "데이터베이스를 최적화 중입니다. 잠시 기다려 주세요..."
PURGE_OPTIMIZING: "데이터베이스 최적화 중입니다. 잠시 기다려 주세요..."
PURGE_PROCESSING: "{0} 데이터를 처리 중입니다..."
PURGE_REPAIRING: "복구 시도 중입니다. 시간이 걸릴 수 있습니다..."
PURGE_ROWS: "{0} {열|열}의 데이터가 삭제되었습니다."
PURGE_STARTED: "\"{0}\"에서 데이터 삭제 시작됨"
PURGE_STARTED: "\"{0}\"에서 데이터 삭제가 시작되었습니다."
PURGE_SUCCESS: "데이터 삭제가 성공적으로 완료되었습니다."
RAM_STATS: "램: {0}GB / {1}GB"
RELOAD_STARTED: "구성 리로드 중 - 잠시 기다려 주세요."
RELOAD_SUCCESS: "구성이 성공적으로 리로드되었습니다."
ROLLBACK_ABORTED: "롤백 또는 복원이 중단되었습니다."
ROLLBACK_CHUNKS_FOUND: "수정할 {청크|청크} {0}개를 찾았습니다."
ROLLBACK_CHUNKS_MODIFIED: "{1}개 중 {0}개의 {청크|청크} 수정됨"
ROLLBACK_CHUNKS_FOUND: "{0} {청크|청크}를 수정할 준비가 되었습니다."
ROLLBACK_CHUNKS_MODIFIED: "{1} 중 {0} {청크|청크}를 수정했습니다."
ROLLBACK_COMPLETED: "\"{0}\"에 대한 {롤백이|복원이|미리보기가} 완료되었습니다."
ROLLBACK_EXCLUDED_USERS: "제외된 {사용자|사용자}: \"{0}\""
ROLLBACK_INCLUDE: "{포함된|제외된} {블록|엔티티|대상} {타입|타입}: \"{0}\""
ROLLBACK_EXCLUDED_USERS: "제외된 {사용자|사용자}: \"{0}\"."
ROLLBACK_INCLUDE: "{포함된|제외된} {블록|엔티티|대상} {타입|타입}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "롤백/복원이 이미 진행 중입니다."
ROLLBACK_LENGTH: "소요 시간: {0} {초|초}"
ROLLBACK_MODIFIED: "{0}이(가) {수정됨|수정 중}"
ROLLBACK_RADIUS: "반경: {0} {블록|블록}"
ROLLBACK_LENGTH: "소요 시간: {0} {초|초}."
ROLLBACK_MODIFIED: "{0}이(가) {수정됨|수정 중}."
ROLLBACK_RADIUS: "반경: {0} {블록|블록}."
ROLLBACK_SELECTION: "반경이 \"{0}\"로 설정되었습니다."
ROLLBACK_STARTED: "\"{0}\"에서 {롤백이|복원이|미리보기가} 시작되었습니다."
ROLLBACK_TIME: "시간 범위: {0}"
ROLLBACK_WORLD_ACTION: "{월드|작업} \"{0}\"으로 제한됨"
ROLLBACK_TIME: "시간 범위: {0}."
ROLLBACK_WORLD_ACTION: "{월드|작업} \"{0}\"으로 제한됨."
SIGN_HEADER: "표지판 메시지"
STATUS_CONSUMER: "데이터베이스 처리: 대기 중인 {항목|항목} {0}개"
STATUS_DATABASE: "데이터베이스: {0} 사용 중"
STATUS_INTEGRATION: "{0}: 통합 {활성화됨|비활성화됨}"
STATUS_CONSUMER: "소비자: 대기 중인 {0} {항목|항목들}."
STATUS_DATABASE: "데이터베이스: {0} 사용 중."
STATUS_INTEGRATION: "{0}: 통합 {활성화됨|비활성화됨}."
STATUS_LICENSE: "라이선스: {0}"
STATUS_SYSTEM: "시스템: {0}"
STATUS_VERSION: "버전: {0}"
TELEPORTED: "{0}(으)로 텔레포트되었습니다."
TELEPORTED_SAFETY: "안전하게 텔레포트되었습니다."
@@ -193,17 +188,16 @@ TIME_DAYS: "{0} {일|일}"
TIME_HOURS: "{0} {시간|시간}"
TIME_MINUTES: "{0} {분|분}"
TIME_SECONDS: "{0} {초|초}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {주|주}"
UPDATE_ERROR: "업데이트 확인 중 오류가 발생했습니다."
UPDATE_HEADER: "{0} 업데이트"
UPDATE_NOTICE: "알림: {0}을(를) 사용할 수 있습니다."
UPDATE_NOTICE: "알림: {0}이(가) 이제 사용할 수 있습니다."
UPGRADE_IN_PROGRESS: "업그레이드가 진행 중입니다. 나중에 다시 시도하세요."
USER_NOT_FOUND: "사용자 \"{0}\"을(를) 찾을 수 없습니다."
USER_OFFLINE: "사용자 \"{0}\"은(는) 온라인 상태가 아닙니다."
USER_OFFLINE: "사용자 \"{0}\"이(가) 온라인 상태가 아닙니다."
USING_MYSQL: "데이터 저장에 MySQL을 사용 중입니다."
USING_SQLITE: "데이터 저장에 SQLite를 사용 중입니다."
VALID_DONATION_KEY: "유효한 후원 키입니다."
VERSION_NOTICE: "버전 {0}(를) 사용할 수 있습니다."
VERSION_NOTICE: "버전 {0}(를) 이제 사용할 수 있습니다."
VERSION_REQUIRED: "{0} {1} 이상이 필요합니다."
WORLD_NOT_FOUND: " \"{0}\"을(를) 찾을 수 없습니다."
WORLD_NOT_FOUND: " \"{0}\"을(를) 찾을 수 없습니다."
+103 -114
View File
@@ -1,21 +1,20 @@
# CoreProtect Language File (pl)
ACTION_NOT_SUPPORTED: "Ta akcja nie jest obsługiwana."
ACTION_NOT_SUPPORTED: "To działanie nie jest obsługiwane."
AMOUNT_BLOCK: "{0} {blok|bloki}"
AMOUNT_CHUNK: "{0} {chunk|chunków}"
AMOUNT_ENTITY: "{0} {byt|bytów}"
AMOUNT_CHUNK: "{0} {kawałek|kawałki}"
AMOUNT_ENTITY: "{0} {jednostka|jednostki}"
AMOUNT_ITEM: "{0} {przedmiot|przedmioty}"
API_TEST: "Test interfejsu API pomyślny."
CACHE_ERROR: "OSTRZEŻENIE: Błąd podczas walidacji {0} Pamięć podręczna."
CACHE_RELOAD: "Wymuszanie przeładowania {mapowanie|świat} pamięci podręczne z bazy danych."
CHECK_CONFIG: "Sprawdź plik config.yml"
COMMAND_CONSOLE: "Uruchom polecenie z konsoli."
COMMAND_NOT_FOUND: "Nie znaleziono komendy \"{0}\"."
COMMAND_NOT_FOUND: "Komenda \"{0}\" nie znaleziono."
COMMAND_THROTTLED: "Poczekaj chwilę i spróbuj ponownie."
CONSUMER_ERROR: "Przetwarzanie kolejki klientów jest już {wstrzymane|wznowione}."
CONSUMER_ERROR: "Przetwarzanie kolejki klientów już {wstrzymane|wznowione}."
CONSUMER_TOGGLED: "Przetwarzanie kolejki klientów zostało {wstrzymane|wznowione}."
CONTAINER_HEADER: "Transakcje kontenerowe"
CPU_CORES: "Rdzenie CPU."
DATABASE_BUSY: "Baza danych zajęta. Spróbuj ponownie później."
DATABASE_INDEX_ERROR: "Nie można zweryfikować indeksów bazy danych."
DATABASE_LOCKED_1: "Baza danych zablokowana. Czekam do 15 sekund..."
@@ -24,189 +23,179 @@ DATABASE_LOCKED_3: "Aby wyłączyć blokowanie bazy danych, ustaw \"database-loc
DATABASE_LOCKED_4: "Wyłączenie blokowania bazy danych może spowodować uszkodzenie danych."
DATABASE_UNREACHABLE: "Baza danych jest niedostępna. Odrzucanie danych i zamykanie."
DEVELOPMENT_BRANCH: "Wykryto gałąź deweloperską, pomijam skrypty poprawek."
DIRT_BLOCK: "Umieściłem pod Tobą tymczasowy blok bezpieczeństwa."
DONATION_KEY_REQUIRED: "Dla tej komendy wymagany jest prawidłowy klucz darowizny."
DISABLE_SUCCESS: "Sukces! Wyłączono {0}"
ENABLE_FAILED: "{0} nie mógł wystartować."
DIRT_BLOCK: "Umieściłem pod tobą blok brudu."
DISABLE_SUCCESS: "Sukces! Niepełnosprawny {0}"
ENABLE_FAILED: "{0} nie mógł rozpocząć."
ENABLE_SUCCESS: "{0} jest teraz włączony!"
ENJOY_COREPROTECT: "Podoba Ci się {0}? Dołącz do naszego Discorda!"
FINISHING_CONVERSION: "Kończenie konwersji danych. Proszę czekać..."
FINISHING_LOGGING: "Kończenie rejestracji danych. Proszę czekać..."
ENJOY_COREPROTECT: "Cieszyć się {0}? Dołączć do naszego Discord!"
FINISHING_CONVERSION: "Zakończenie konwersji danych. Proszę czekać..."
FINISHING_LOGGING: "Zakończenie rejestracji danych. Proszę czekać..."
FIRST_VERSION: "Początkowa baza danych: {0}"
GLOBAL_LOOKUP: "Nie określaj promienia, aby wykonać globalne wyszukiwanie."
GLOBAL_ROLLBACK: "Użyj \"{0}\", aby zrobić globalne {wycofywanie|przywracanie}"
HELP_ACTION_1: "Ogranicz wyszukiwanie do konkretnej akcji."
GLOBAL_ROLLBACK: "Posługiwać się \"{0}\" zrobić globalny {wycofywanie|przywracanie}"
HELP_ACTION_1: "Ogranicz wyszukiwanie do akcji."
HELP_ACTION_2: "Przykłady: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "Wyświetl dodatkowe informacje."
HELP_EXCLUDE_1: "Wyklucz bloki/użytkowników."
HELP_EXCLUDE_2: "Przykłady: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} Pomoc"
HELP_HEADER: "{0} Wsparcie"
HELP_INCLUDE_1: "Uwzględnij bloki/elementy."
HELP_INCLUDE_2: "Przykłady: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "Po włączeniu inspektora możesz:"
HELP_INSPECT_2: "Kliknij lewym przyciskiem myszy, aby zobaczyć kto postawił ten blok."
HELP_INSPECT_3: "Kliknij prawym przyciskiem myszy, aby zobaczyć jaki sąsiedni blok został usunięty."
HELP_INSPECT_4: "Umieść blok, aby zobaczyć jaki blok został usunięty w tym miejscu."
HELP_INSPECT_5: "Umieść blok w płynie, aby zobaczyć kto go postawił."
HELP_INSPECT_6: "Kliknij prawym przyciskiem myszy na drzwi, skrzynię, itp., aby zobaczyć, kto ostatnio z nich korzystał."
HELP_INSPECT_7: "Wskazówka: możesz użyć po prostu \"/co i\"."
HELP_INSPECT_2: "Kliknij lewym przyciskiem myszy, aby zobaczyć miejsce docelowe."
HELP_INSPECT_3: "Kliknij prawym przyciskiem myszy, aby zobaczyć sąsiednie usunięcia."
HELP_INSPECT_4: "Umieść blok, aby zobaczyć usunięcie."
HELP_INSPECT_5: "Umieść blok w płynie, aby zobaczyć umieszczenie."
HELP_INSPECT_6: "Kliknij prawym przyciskiem myszy, aby zobaczyć transakcje w skrzyniach."
HELP_INSPECT_7: "Wskazówka: możesz użyć tylko „/co i”."
HELP_INSPECT_COMMAND: "Przełącza inspektora bloków."
HELP_LIST: "Wyświetla listę wszystkich poleceń."
HELP_LOOKUP_1: "Skrót poleceń."
HELP_LOOKUP_2: "Zobacz dodatkowe strony."
HELP_LOOKUP_COMMAND: "Dane bloku wyszukiwania."
HELP_NO_INFO: "Nie znaleziono informacji dla polecenia \"{0}\"."
HELP_PARAMETER: "Proszę zobaczyć \"{0}\", aby uzyskać szczegółowe informacje o parametrach."
HELP_PARAMS_1: "Wykonaj {wyszukiwanie|wycofywanie|przywracanie}."
HELP_PARAMS_2: "Określ użytkowników do {wyszukiwania|wycofywania|przywracania}."
HELP_PARAMS_3: "Określ czas do {wyszukiwania|wycofywania|przywracania}."
HELP_PARAMS_4: "Ogranicz promień {wyszukiwania|wycofywania|przywracania}."
HELP_PARAMS_5: "Ogranicz akcję {wyszukiwania|wycofywania|przywracania}."
HELP_PARAMS_6: "Uwzględnij bloki/byty w {wyszukiwaniu|wycofywaniu|przywracaniu}."
HELP_PARAMS_7: "Wyklucz bloki/użytkowników z {wyszukiwania|wycofywania|przywracania}."
HELP_PURGE_1: "Usuń dane starsze od określonego czasu."
HELP_NO_INFO: "Informacje do polecenia \"{0}\" nie znaleziono."
HELP_PARAMETER: "Proszę zobaczyć \"{0}\" , aby uzyskać szczegółowe informacje o parametrach."
HELP_PARAMS_1: "Wykonaj {wyszukiwanie|przywracanie|przywracanie}."
HELP_PARAMS_2: "Określ użytkowników do {wyszukiwanie|przywracanie|przywracanie}."
HELP_PARAMS_3: "Określ czas, aby {wyszukiwanie|przywracanie|przywracanie}."
HELP_PARAMS_4: "Ogranicz {wyszukiwanie|wycofywanie|przywracanie} do promienia."
HELP_PARAMS_5: "Ogranicz {wyszukiwanie|wycofywanie|przywracanie} do działania."
HELP_PARAMS_6: "Uwzględnij bloki/elementy w {wyszukiwanie|przywracanie|przywracanie}."
HELP_PARAMS_7: "Wyklucz bloki/użytkowników z {wyszukiwanie|przywracanie|przywracanie}."
HELP_PURGE_1: "Usuń stare dane."
HELP_PURGE_2: "Na przykład, \"{0}” usunie wszystkie dane starsze niż jeden miesiąc i zachowa tylko dane z ostatnich 30 dni."
HELP_PURGE_COMMAND: "Usuń stare dane bloku."
HELP_RADIUS_1: "Określ promień obszaru."
HELP_RADIUS_1: "Określ obszar promienia."
HELP_RADIUS_2: "Przykłady: [r:10] (Dokonuj zmian tylko w promieniu 10 bloków od Ciebie)"
HELP_RELOAD_COMMAND: "Ponownie ładuje plik konfiguracyjny."
HELP_RESTORE_COMMAND: "Przywróć dane bloku."
HELP_ROLLBACK_COMMAND: "Wycofaj dane bloku."
HELP_STATUS: "Wyświetl stan i wersję pluginu."
HELP_STATUS_COMMAND: "Wyświetla stan pluginu."
HELP_STATUS: "Wyświetl stan wtyczki."
HELP_STATUS_COMMAND: "Wyświetla stan wtyczki."
HELP_TELEPORT: "Teleport."
HELP_TIME_1: "Określ czas."
HELP_TIME_2: "Przykłady: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "Określ użytkowników."
HELP_USER_2: "Przykłady: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" nie może być użyte z tą akcją."
INSPECTOR_ERROR: "Inspektor jest już {włączony|wyłączony}."
INSPECTOR_TOGGLED: "{Włączono|Wyłączono} inspektor."
INTEGRATION_ERROR: "Nie można {zainicjalizować|wyłączyć} logowania {0}."
INTEGRATION_SUCCESS: "Logowanie {0} pomyślnie {zainicjowane|wyłączone}."
INTEGRATION_VERSION: "Znaleziono nieprawidłową wersję {0}."
INCOMPATIBLE_ACTION: "\"{0}nie można użyć z tą akcją."
INSPECTOR_ERROR: "Inspektor już {włączone|wyłączone}."
INSPECTOR_TOGGLED: "Inspektor teraz {włączone|wyłączone}."
INTEGRATION_ERROR: "Niezdolny do {inicjalizuj|wyłącz} {0} Logowanie."
INTEGRATION_SUCCESS: "{0} logowanie pomyślnie {zainicjowane|wyłączone}."
INTEGRATION_VERSION: "Nieważny {0} znaleziono wersję."
INTERACTIONS_HEADER: "Interakcje graczy"
INVALID_ACTION: "To nie jest prawidłowa akcja."
INVALID_BRANCH_1: "Nieprawidłowa wersja pluginu (nie ustawiono gałęzi)."
INVALID_ACTION: "To nie jest prawidłowe działanie."
INVALID_BRANCH_1: "Nieprawidłowa wersja wtyczki (nie ustawiono gałęzi)."
INVALID_BRANCH_2: "Aby kontynuować, ustaw gałąź projektu na \"development\"."
INVALID_BRANCH_3: "Uruchomienie kodu programistycznego może spowodować uszkodzenie danych."
INVALID_CONTAINER: "Proszę najpierw sprawdzić prawidłowy pojemnik."
INVALID_DONATION_KEY: "Nieprawidłowy klucz darowizny."
INVALID_INCLUDE: "\"{0}\" to nieprawidłowa nazwa bloku/bytu."
INVALID_INCLUDE: "\"{0}„ to nieprawidłowa wartość."
INVALID_INCLUDE_COMBO: "To jest nieprawidłowa kombinacja typów."
INVALID_RADIUS: "Podaj poprawny promień."
INVALID_SELECTION: "{0} nie znaleziono wyboru."
INVALID_USERNAME: "\"{0}\" to nieprawidłowa nazwa użytkownika."
INVALID_USERNAME: "\"{0}„ to nieprawidłowa nazwa użytkownika."
INVALID_WORLD: "Podaj poprawny świat."
LATEST_VERSION: "Najnowsza wersja: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "Pobierz: {0}"
LINK_DOWNLOAD: "Ściągnij: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "Nazwy bloków: {0}"
LINK_WIKI_ENTITY: "Nazwy bytów: {0}"
LOGGING_ITEMS: "Pozostało {0} elementów do logowania. Proszę czekać..."
LINK_WIKI_ENTITY: "Nazwy podmiotów: {0}"
LOGGING_ITEMS: "{0} elementy pozostawione do zarejestrowania. Proszę czekać..."
LOGGING_TIME_LIMIT: "Osiągnięto limit czasu logowania. Odrzucanie danych i zamykanie."
LOOKUP_BLOCK: "{0} {postawił|zniszczył} {1}."
LOOKUP_CONTAINER: "{0} {dodał|usunął} {1} {2}."
LOOKUP_HEADER: "{0} Wyników Wyszukiwania"
LOOKUP_INTERACTION: "{0} {kliknął|zabił} {1}."
LOOKUP_ITEM: "{0} {podniósł|upuścił} {1} {2}."
LOOKUP_LOGIN: "{0} się {zalogował|wylogował}."
LOOKUP_BLOCK: "{0} {umieszczony|złamany} {1}."
LOOKUP_CONTAINER: "{0} {dodano|usunięto} {1} {2}."
LOOKUP_HEADER: "{0} Wyniki"
LOOKUP_INTERACTION: "{0} {kliknięty|zabity} {1}."
LOOKUP_ITEM: "{0} {odebrany|upuszczony} {1} {2}."
LOOKUP_LOGIN: "{0} zalogowany {w|na zewnątrz}."
LOOKUP_PAGE: "Strona {0}"
LOOKUP_PROJECTILE: "{0} {rzucił|strzelił} {1} {2}."
LOOKUP_ROWS_FOUND: "Znaleziono {0} {wiersz|wierszy}."
LOOKUP_PROJECTILE: "{0} {rzucił|strzał} {1} {2}."
LOOKUP_ROWS_FOUND: "{0} {wiersz|wiersze} znaleziony."
LOOKUP_SEARCHING: "Wyszukiwanie wyszukiwania. Proszę czekać..."
LOOKUP_STORAGE: "{0} {zdeponował|wyciągnął} {1} {2}."
LOOKUP_STORAGE: "{0} {zdeponowane|wycofane} {1} {2}."
LOOKUP_TIME: "{0} temu"
LOOKUP_USERNAME: "{0} zalogowany jako {1}."
MAXIMUM_RADIUS: "Maksymalny promień {wyszukiwania|wycofywania|przywracania} to {0}."
MAXIMUM_RADIUS: "Maksymalny {wyszukiwanie|wycofywanie|przywracanie} promień to {0}."
MISSING_ACTION_USER: "Aby skorzystać z tej akcji, określ użytkownika."
MISSING_LOOKUP_TIME: "Proszę określić czas {wyszukiwania|wycofywania|przywracania}."
MISSING_LOOKUP_TIME: "Proszę określić czas na {wyszukiwanie|przywracanie|przywracanie}."
MISSING_LOOKUP_USER: "Podaj użytkownika lub {blok|promień}."
MISSING_PARAMETERS: "Proszę użyć \"{0}\"."
MISSING_ROLLBACK_RADIUS: "Nie podałeś promienia {wycofywania|przywracania}."
MISSING_ROLLBACK_USER: "Nie podałeś użytkownika {wycofywania|przywracania}."
MYSQL_UNAVAILABLE: "Nie można się połączyć z serwerem MySQL."
NETWORK_CONNECTION: "Połączenie przez {0} {pomyślne|nieudane}. Używam {1} {2}."
NETWORK_TEST: "Pomyślnie wysłano dane testu sieci."
MISSING_PARAMETERS: "Proszę użyć \"{0}”."
MISSING_ROLLBACK_RADIUS: "Nie podałeś {wycofywanie|przywracanie} promień."
MISSING_ROLLBACK_USER: "Nie podałeś {wycofywanie|przywracanie} użytkownik."
MYSQL_UNAVAILABLE: "Nie można się połączyć z MySQL serwer."
NO_DATA: "Nie znaleziono danych w {0}."
NO_DATA_LOCATION: "Nie znaleziono {danych|transakcji|interakcji|wiadomości} w tym miejscu."
NO_DATA_LOCATION: "Nie {dane|transakcje|interakcje|wiadomości} znaleziony."
NO_PERMISSION: "Nie masz na to pozwolenia."
NO_RESULTS: "Nie znaleziono wyników."
NO_RESULTS_PAGE: "Nie znaleziono {wyników|danych} dla tej strony."
NO_ROLLBACK: "Nie znaleziono {oczekujących|poprzednich} wycofywań/przywracań."
PATCH_INTERRUPTED: "Aktualizacja przerwana. Spróbuję ponownie przy restarcie."
NO_RESULTS_PAGE: "Nie {wyniki|dane} znalezione dla tej strony."
NO_ROLLBACK: "Nie {oczekujące|poprzednie} znaleziono wycofywanie/przywracanie."
PATCH_INTERRUPTED: "Aktualizacja przerwana. Spróbuje ponownie po ponownym uruchomieniu."
PATCH_OUTDATED_1: "Nie można zaktualizować baz danych starszych niż {0}."
PATCH_OUTDATED_2: "Uaktualnij do obsługiwanej wersji CoreProtect."
PATCH_PROCESSING: "Przetwarzanie nowych danych. Proszę czekać..."
PATCH_SKIP_UPDATE: "Pomijam {tabeli|indeksu} {aktualizację|tworzenie|usuwanie} na {0}."
PATCH_STARTED: "Przeprowadzam aktualizację do {0}. Proszę czekać..."
PATCH_SKIP_UPDATE: "Skaczący {tabela|indeks} {aktualizacja|tworzenie|usuwanie} na {0}."
PATCH_STARTED: "Działający {0} Aktualizacja. Proszę czekać..."
PATCH_SUCCESS: "Pomyślnie uaktualniono do {0}."
PATCH_UPGRADING: "Trwa aktualizacja bazy danych. Proszę czekać..."
PLEASE_SELECT: "Proszę wybrać: \"{0}\" lub \"{1}\"."
PLEASE_SELECT: "Proszę wybrać: \"{0}\" lub \"{1}”."
PREVIEW_CANCELLED: "Podgląd anulowany."
PREVIEW_CANCELLING: "Anulowanie podglądu..."
PREVIEW_IN_GAME: "Możesz tylko podglądać wycofania w grze."
PREVIEW_TRANSACTION: "Nie możesz wyświetlić podglądu transakcji {kontenera|ekwipunku}."
PRIMARY_THREAD_ERROR: "Ta metoda API nie może być używana w głównym wątku."
PREVIEW_TRANSACTION: "Nie możesz wyświetlić podglądu {kontener|inwentarz} transakcje."
PURGE_ABORTED: "Czyszczenie nie powiodło się. Baza danych może być uszkodzona."
PURGE_ERROR: "Nie można przetworzyć danych {0}!"
PURGE_ERROR: "Nie można przetworzyć {0} dane!"
PURGE_FAILED: "Czyszczenie nie powiodło się. Spróbuj ponownie później."
PURGE_IN_PROGRESS: "Trwa czyszczenie. Spróbuj ponownie później."
PURGE_MINIMUM_TIME: "Możesz usunąć tylko dane starsze niż {0} {dni|godzin}."
PURGE_NOTICE_1: "Uwaga, może to zająć trochę czasu."
PURGE_NOTICE_2: "Nie restartuj serwera przed zakończeniem."
PURGE_MINIMUM_TIME: "Możesz usunąć tylko dane starsze niż {0} {dni|godziny}."
PURGE_NOTICE_1: "Pamiętaj, że może to zająć trochę czasu."
PURGE_NOTICE_2: "Nie uruchamiaj ponownie serwera przed zakończeniem."
PURGE_OPTIMIZING: "Optymalizacja bazy danych. Proszę czekać..."
PURGE_PROCESSING: "Przetwarzanie danych {0}..."
PURGE_PROCESSING: "Przetwarzanie {0} dane..."
PURGE_REPAIRING: "Próba naprawy. To może zająć troche czasu..."
PURGE_ROWS: "Usunięto {0} {wiersz|wierszy} danych."
PURGE_STARTED: "Usuwanie danych rozpoczęte na \"{0}\"."
PURGE_SUCCESS: "Czyszczenie danych zakończono pomyślnie."
RAM_STATS: "{0}GB / {1}GB RAM"
PURGE_ROWS: "{0} {wiersz|wiersze} usuniętych danych."
PURGE_STARTED: "Usuwanie danych rozpoczęte w dniu „{0}”."
PURGE_SUCCESS: "Udało się czyszczenie danych."
RELOAD_STARTED: "Ponowne ładowanie konfiguracji - proszę czekać."
RELOAD_SUCCESS: "Pomyślnie wczytano konfigurację."
ROLLBACK_ABORTED: "Wycofanie lub przywracanie zostało przerwane."
ROLLBACK_CHUNKS_FOUND: "Znaleziono {0} {chunk|chunków} do zmodyfikowania."
ROLLBACK_CHUNKS_MODIFIED: "Zmodyfikowano {0}/{1} {chunk|chunków}."
ROLLBACK_COMPLETED: "{Wycofywanie|Przywrócenie|Podgląd} ukończone dla \"{0}\"."
ROLLBACK_EXCLUDED_USERS: "{Wykluczony użytkownik|Wykluczeni użytkownicy}: \"{0}\"."
ROLLBACK_INCLUDE: "{Zawarte|Wykluczone} {bloku|bytu|celu} {typ|typy}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "Już trwa wycofywanie/przywracanie."
ROLLBACK_LENGTH: "Zajęty czas: {0} {sekunda|sekund}."
ROLLBACK_CHUNKS_FOUND: "Znaleziony {0} {kawałek|kawałki} modyfikować."
ROLLBACK_CHUNKS_MODIFIED: "Zmodyfikowane {0}/{1} {kawałek|kawałki}."
ROLLBACK_COMPLETED: "{Wycofanie|Przywróć|Podgląd} ukończone dla „{0}”."
ROLLBACK_EXCLUDED_USERS: "Wyłączony {użytkownik|użytkownicy}: \"{0}”."
ROLLBACK_INCLUDE: "{Zawarte|Wykluczone} {blok|jednostka|cel} {typ|typy}: \"{0}”."
ROLLBACK_IN_PROGRESS: "Trwa wycofywanie/przywracanie."
ROLLBACK_LENGTH: "Zajęty czas: {0} {sekunda|sekundy}."
ROLLBACK_MODIFIED: "{Zmodyfikowane|Modyfikowanie} {0}."
ROLLBACK_RADIUS: "Promień: {0} {blok|bloków}."
ROLLBACK_SELECTION: "Promień ustawiony na \"{0}\"."
ROLLBACK_STARTED: "{Wycofywanie|Przywrócenie|Podgląd} zaczęło się na \"{0}\"."
ROLLBACK_RADIUS: "Promień: {0} {blok|bloki}."
ROLLBACK_SELECTION: "Promień ustawiony na „{0}”."
ROLLBACK_STARTED: "{Wycofanie|Przywróć|Podgląd} zaczęło się \"{0}”."
ROLLBACK_TIME: "Zakres czasu: {0}."
ROLLBACK_WORLD_ACTION: "Ograniczony do {świata|akcji} \"{0}\"."
SIGN_HEADER: "Wiadomości Tabliczki"
STATUS_CONSUMER: "Konsument: {0} {przedmiot|przedmiotów} w kolejce."
STATUS_DATABASE: "Baza danych: Używa {0}."
STATUS_INTEGRATION: "{0}: Integracja {włączona|wyłączona}."
ROLLBACK_WORLD_ACTION: "Ograniczony do {świat|działanie} \"{0}”."
SIGN_HEADER: "Podpisz wiadomości"
STATUS_CONSUMER: "Konsument: {0} {przedmiot|przedmioty} w kolejce."
STATUS_DATABASE: "Baza danych: Korzystanie {0}."
STATUS_INTEGRATION: "{0}: Integracja {włączone|wyłączone}."
STATUS_LICENSE: "Licencja: {0}"
STATUS_SYSTEM: "System: {0}"
STATUS_VERSION: "Wersja: {0}"
TELEPORTED: "Teleportowany do {0}."
TELEPORTED_SAFETY: "Teleportowano Cię w bezpieczne miejsce."
TELEPORTED_SAFETY: "Teleportowano cię w bezpieczne miejsce."
TELEPORT_PLAYERS: "Polecenie Teleport może być używane tylko przez graczy."
TIME_DAYS: "{0} {dzień|dni}"
TIME_HOURS: "{0} {godzina|godzin(y)}"
TIME_MINUTES: "{0} {minuta|minut(y)}"
TIME_MONTHS: "{0} {miesiąc|miesięcy}"
TIME_SECONDS: "{0} {sekunda|sekund(y)}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {tydzień|tygodni(e)}"
TIME_YEARS: "{0} {rok|lat(a)}"
TIME_HOURS: "{0} {godzina|godziny}"
TIME_MINUTES: "{0} {minuta|minuty}"
TIME_SECONDS: "{0} {sekunda|sekundy}"
TIME_WEEKS: "{0} {tydzień|tygodnie}"
UPDATE_ERROR: "Wystąpił błąd podczas sprawdzania aktualizacji."
UPDATE_HEADER: "Aktualizacja {0}"
UPDATE_HEADER: "{0} Aktualizacja"
UPDATE_NOTICE: "Ogłoszenie: {0} jest teraz dostępne."
UPGRADE_IN_PROGRESS: "Trwa aktualizacja. Spróbuj ponownie później."
USER_NOT_FOUND: "Nie znaleziono użytkownika \"{0}\"."
USER_NOT_FOUND: "Użytkownik \"{0}\" nie znaleziono."
USER_OFFLINE: "Użytkownik \"{0}\" nie jest online."
USING_MYSQL: "MySQL używany do przechowywania danych."
USING_SQLITE: "SQLite używany do przechowywania danych."
USING_MYSQL: "Za pomocą MySQL do przechowywania danych."
USING_SQLITE: "Za pomocą SQLite do przechowywania danych."
VALID_DONATION_KEY: "Ważny klucz darowizny."
VERSION_INCOMPATIBLE: "{0} {1} nie jest wspierany."
VERSION_NOTICE: "Wersja {0} jest teraz dostępna."
VERSION_NOTICE: "Wersja {0} jest teraz dostępne."
VERSION_REQUIRED: "{0} {1} lub wyższy jest wymagany."
WORLD_NOT_FOUND: "Nie znaleziono świata \"{0}\"."
WORLD_NOT_FOUND: "Świat \"{0}\" nie znaleziono."
+6 -7
View File
@@ -46,7 +46,7 @@ HELP_INSPECT_2: "Щелкните левой кнопкой мыши по бло
HELP_INSPECT_3: "Щелкните блок правой кнопкой мыши, чтобы увидеть, какой соседний блок был сломан.."
HELP_INSPECT_4: "Поместите блок, чтобы увидеть, какой блок был сломан в этом месте."
HELP_INSPECT_5: "Поместите блок в жидкость (и т.п.), чтобы увидеть, кто его поместил."
HELP_INSPECT_6: "Щелкните правой кнопкой мыши дверь, сундук и т.д., чтобы узнать, кто последний использовал их."
HELP_INSPECT_6: "Щелкните правой кнопкой мыши дверь, сундук и т. Д., Чтобы узнать, кто последний использовал их."
HELP_INSPECT_7: "Подсказка: Вы можете использовать «/co i» для быстрого переключения режима инспектора."
HELP_INSPECT_COMMAND: "Включает или выключает режим инспектора блоков."
HELP_LIST: "Отображает список всех команд."
@@ -139,7 +139,7 @@ PATCH_SKIP_UPDATE: "{Пропущена таблица|Пропущен инде
PATCH_STARTED: "Выполняется обновление {0}. Пожалуйста, подождите..."
PATCH_SUCCESS: "Успешно обновлен до {0}."
PATCH_UPGRADING: "Выполняется обновление базы данных. Пожалуйста, подождите..."
PLEASE_SELECT: "Пожалуйста выберите: «{0}» или «{1}»."
PLEASE_SELECT: "Пожалуйта выберете: «{0}» или «{1}»."
PREVIEW_CANCELLED: "Предварительный просмотр отменен."
PREVIEW_CANCELLING: "Отмена предварительного просмотра..."
PREVIEW_IN_GAME: "Предварительный просмотр откатов доступен только в игре."
@@ -180,23 +180,22 @@ STATUS_INTEGRATION: "{0}: Интеграция {включена|отключе
STATUS_LICENSE: "Лицензия: {0}"
STATUS_VERSION: "Версия: {0}"
TELEPORTED: "Телепортирование в {0}."
TELEPORTED_SAFETY: "Телепортируем вас в безопасное место."
TELEPORT_PLAYERS: "Команду телепортации могут использовать только игроки."
TELEPORTED_SAFETY: "Телепортирование вас в безопасное место."
TELEPORT_PLAYERS: "Команду телепортации могут использовать только игроки.."
TIME_DAYS: "{0} {дня|дней}"
TIME_HOURS: "{0} {час|часов}"
TIME_MINUTES: "{0} {минута|минут}"
TIME_SECONDS: "{0} {секунда|секунд}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {неделя|недель}"
UPDATE_ERROR: "Произошла ошибка при проверке обновлений."
UPDATE_HEADER: "{0} Обновление"
UPDATE_NOTICE: "Примечание: теперь доступен {0}."
UPGRADE_IN_PROGRESS: "Выполняется обновление. Пожалуйста, повторите попытку позже."
USER_NOT_FOUND: "Пользователь «{0}» не найден."
USER_OFFLINE: "Пользователь \"{0}\" не в сети."
USER_OFFLINE: "Пользователь \"{0}\" нет в сети."
USING_MYSQL: "Для хранения данных используется MySQL."
USING_SQLITE: "Для хранения данных используется SQLite."
VALID_DONATION_KEY: "Действующий ключ пожертвования."
VERSION_NOTICE: "Версия {0} уже доступна!"
VERSION_REQUIRED: "{0} {1} или выше требуется."
WORLD_NOT_FOUND: "Мир «{0}» не найден."
WORLD_NOT_FOUND: "Мир «{0}» не найден."
-1
View File
@@ -186,7 +186,6 @@ TIME_DAYS: "{0} {gün|gün}"
TIME_HOURS: "{0} {saat|saat}"
TIME_MINUTES: "{0} {dakika|dakika}"
TIME_SECONDS: "{0} {saniye|saniye}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {hafta|hafta}"
UPDATE_ERROR: "Güncellemeler kontrol edilirken bir hata oluştu."
UPDATE_HEADER: "{0} Güncelleme"
-207
View File
@@ -1,207 +0,0 @@
# CoreProtect v24.0 Language Cache (tt)
ACTION_NOT_SUPPORTED: "Бу гамәл хупланмый."
AMOUNT_BLOCK: "{0} {блок|блоклар}"
AMOUNT_CHUNK: "{0} {кисәк|кисәкчәләр}"
AMOUNT_ENTITY: "{0} {зат|затлар}"
AMOUNT_ITEM: "{0} {әйбер|әйберләр}"
API_TEST: "API тесты уңышлы үтте."
CACHE_ERROR: "КИСӘТҮ: Валидацияләү вакытында хата килеп чыкты {0} кэш."
CACHE_RELOAD: "Мәҗбүри яңадан йөкләү {картага төшерү|дөнья} мәгълүмат базасыннан алынган кэшлар."
CHECK_CONFIG: "Зинһар, config.yml файлын тикшерегез"
COMMAND_CONSOLE: "Зинһар, команданы консольдән башкарыгыз."
COMMAND_NOT_FOUND: "Команда \"{0}\" табылмады.\""
COMMAND_THROTTLED: "Зинһар, бераз көтегез һәм кабатлап карагыз."
CONSUMER_ERROR: "Кулланучылар чиратлары эшкәртелә инде {туктатылган|дәвам иттерелгән}."
CONSUMER_TOGGLED: "Кулланучылар чиратларын эшкәртү {туктатылган|дәвам иттерелгән}."
CONTAINER_HEADER: "Контейнер транзакцияләре"
CPU_CORES: "Үзәк процессор үзәкләре."
DATABASE_BUSY: "Мәгълүмат базасы мәшгуль. Зинһар, соңрак кабатлап карагыз."
DATABASE_INDEX_ERROR: "Мәгълүмат базасы индексларын тикшереп булмый."
DATABASE_LOCKED_1: "Мәгълүмат базасы бикләнгән. 15 секундка кадәр көтәм..."
DATABASE_LOCKED_2: "Мәгълүмат базасы инде кулланыла. Зинһар, кабатлап карагыз."
DATABASE_LOCKED_3: "Мәгълүмат базасын блоклауны сүндерү өчен, \"database-lock: false\" куегыз."
DATABASE_LOCKED_4: "Мәгълүмат базасын блоклауны сүндерү мәгълүматларның бозылуына китерергә мөмкин."
DATABASE_UNREACHABLE: "Мәгълүматлар базасына кереп булмый. Мәгълүматларны юкка чыгаралар һәм сүндерәләр."
DEVELOPMENT_BRANCH: "Үсеш тармагы ачыкланды, патч скриптларын үткәреп җибәрә."
DIRT_BLOCK: "Сезнең астыгызга вакытлыча куркынычсызлык блогы куйдылар."
DISABLE_SUCCESS: "Уңышлы! Инвалид {0}"
ENABLE_FAILED: "{0} башлый алмады."
ENABLE_SUCCESS: "{0} хәзер активлаштырылган!"
ENJOY_COREPROTECT: "Рәхәтләнегез {0}Безнең белән кушылыгыз Discord!"
FINISHING_CONVERSION: "Мәгълүматларны үзгәртү тәмамлана. Зинһар, көтегез..."
FINISHING_LOGGING: "Мәгълүматларны теркәү тәмамлана. Зинһар, көтегез..."
FIRST_VERSION: "Башлангыч мәгълүмат базасы: {0}"
GLOBAL_LOOKUP: "Глобаль эзләү өчен радиус күрсәтмәгез."
GLOBAL_ROLLBACK: "Куллану \"{0}\" глобаль эш башкарырга {кире кайтару|торгызу}"
HELP_ACTION_1: "Эзләүне гамәл белән чикләгез."
HELP_ACTION_2: "Мисаллар: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "Өстәмә мәгълүматны күрсәтегез."
HELP_EXCLUDE_1: "Блокларны/кулланучыларны чыгарыгыз."
HELP_EXCLUDE_2: "Мисаллар: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} Ярдәм"
HELP_INCLUDE_1: "Блокларны/объектларны кертегез."
HELP_INCLUDE_2: "Мисаллар: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "Инспекторны кабызганда, сез:"
HELP_INSPECT_2: "Урынны карау өчен сул төймә белән басыгыз."
HELP_INSPECT_3: "Күршедәге бетерүләрне карау өчен уң төймә белән басыгыз."
HELP_INSPECT_4: "Алып ташлауны күрү өчен блок урнаштырыгыз."
HELP_INSPECT_5: "Урынын күрү өчен, сыеклыкка блок салыгыз."
HELP_INSPECT_6: "Күкрәк транзакцияләрен карау өчен уң төймә белән басыгыз."
HELP_INSPECT_7: "Киңәш: Сез бары тик \"/co i\" куллана аласыз."
HELP_INSPECT_COMMAND: "Блок инспекторын кабыза/яба."
HELP_LIST: "Барлык командалар исемлеген күрсәтә."
HELP_LOOKUP_1: "Команда кыска юлы"
HELP_LOOKUP_2: "Өстәмә битләрне карау."
HELP_LOOKUP_COMMAND: "Блок мәгълүматларын эзләү."
HELP_NO_INFO: "Команда өчен мәгълүмат \"{0}\" табылмады.\""
HELP_PARAMETER: "Зинһар, карагыз \"{0}\" параметрлар турында тулырак мәгълүмат алу өчен."
HELP_PARAMS_1: "Башкарыгыз {эзләү|кайтару|торгызу}."
HELP_PARAMS_2: "Кулланучыларны күрсәтегез {эзләү|кайтару|торгызу}."
HELP_PARAMS_3: "Вакытны күрсәтегез {эзләү|кайтару|торгызу}."
HELP_PARAMS_4: "Чикләү {эзләү|кайтару|торгызу} радиуска кадәр."
HELP_PARAMS_5: "Чикләү {эзләү|кайтару|торгызу} гамәленә."
HELP_PARAMS_6: "Блокларны/объектларны кертегез {эзләү|кайтару|торгызу}."
HELP_PARAMS_7: "Блокларны/кулланучыларны чыгарыгыз {эзләү|кайтару|торгызу}."
HELP_PURGE_1: "Иске мәгълүматларны бетерегез."
HELP_PURGE_2: "Мәсәлән, \"{0}\" бер айдан иске барлык мәгълүматларны бетерәчәк һәм соңгы 30 көнлек мәгълүматларны гына саклаячак.\""
HELP_PURGE_COMMAND: "Иске блок мәгълүматларын бетерегез."
HELP_RADIUS_1: "Радиус мәйданын күрсәтегез."
HELP_RADIUS_2: "Мисаллар: [r:10] (Үзгәрешләрне сездән 10 квартал эчендә генә кертегез)"
HELP_RELOAD_COMMAND: "Конфигурация файлын яңадан йөкли."
HELP_RESTORE_COMMAND: "Блок мәгълүматларын торгызу."
HELP_ROLLBACK_COMMAND: "Кире кайтару блогы мәгълүматлары."
HELP_STATUS: "Плагинның статусын карагыз."
HELP_STATUS_COMMAND: "Плагин статусын күрсәтә."
HELP_TELEPORT: "Телепорт."
HELP_TIME_1: "Вакытны күрсәтегез."
HELP_TIME_2: "Мисаллар: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "Кулланучыларны күрсәтегез."
HELP_USER_2: "Мисаллар: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" бу гамәл белән кулланыла алмый."
INSPECTOR_ERROR: "Инспектор инде {активлаштырылган|сүндерелгән}."
INSPECTOR_TOGGLED: "Инспектор хәзер {активлаштырылган|сүндерелгән}."
INTEGRATION_ERROR: "Мөмкин түгел {башлангыч хәлгә китерү|сүндерү} {0} агач эшкәртү"
INTEGRATION_SUCCESS: "{0} уңышлы теркәлү {башлангыч хәлгә китерелгән|сүндерелгән}."
INTEGRATION_VERSION: "Яраксыз {0} версиясе табылды."
INTERACTIONS_HEADER: "Уенчыларның үзара бәйләнеше"
INVALID_ACTION: "Бу дөрес гамәл түгел."
INVALID_BRANCH_1: "Плагин версиясе дөрес түгел (тармак куелмаган)."
INVALID_BRANCH_2: "Дәвам итү өчен, проект тармагын \"эшләү\"гә куегыз."
INVALID_BRANCH_3: "Эшләү кодын эшләтеп җибәрү мәгълүматларның бозылуына китерергә мөмкин."
INVALID_CONTAINER: "Зинһар, башта яраклы контейнерны тикшерегез."
INVALID_DONATION_KEY: "Иганә ачкычы дөрес түгел."
INVALID_INCLUDE: "\"{0}\" - яраксыз кыйммәт."
INVALID_INCLUDE_COMBO: "Бу яраксыз тип комбинациясе."
INVALID_RADIUS: "Зинһар, дөрес радиус кертегез."
INVALID_SELECTION: "{0} сайлау табылмады."
INVALID_USERNAME: "\"{0}\" - яраксыз кулланучы исеме."
INVALID_WORLD: "Зинһар, дөрес дөнья күрсәтегез."
LATEST_VERSION: "Соңгы версия: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "Йөкләү: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "Блок исемнәре: {0}"
LINK_WIKI_ENTITY: "Объект исемнәре: {0}"
LOGGING_ITEMS: "{0} Элемтәгә кертергә калган әйберләр. Зинһар, көтегез..."
LOGGING_TIME_LIMIT: "Журналлаштыру вакыты чикләнде. Мәгълүматлар юкка чыгарыла һәм сүндерелә."
LOOKUP_BLOCK: "{0} {урнаштырылган|ватык} {1}."
LOOKUP_CONTAINER: "{0} {өстәлде|алып ташланды} {1} {2}."
LOOKUP_HEADER: "{0} Нәтиҗәләр"
LOOKUP_INTERACTION: "{0} {басылды|үтерелде} {1}."
LOOKUP_ITEM: "{0} {алды|ташлады} {1} {2}."
LOOKUP_LOGIN: "{0} теркәлгән {керү|чыгу}."
LOOKUP_PAGE: "Бит {0}"
LOOKUP_PROJECTILE: "{0} {ыргытты|атты} {1} {2}."
LOOKUP_ROWS_FOUND: "{0} {рәт|рәтләр} табылган."
LOOKUP_SEARCHING: "Эзләү эзләнә. Зинһар, көтегез..."
LOOKUP_STORAGE: "{0} {салынган|алынган} {1} {2}."
LOOKUP_TIME: "{0} элек"
LOOKUP_USERNAME: "{0} буларак керде {1}."
MAXIMUM_RADIUS: "Максималь {эзләү|кайтару|торгызу} радиус {0}."
MISSING_ACTION_USER: "Бу гамәлне куллану өчен, зинһар, кулланучыны күрсәтегез."
MISSING_LOOKUP_TIME: "Зинһар, вакытны күрсәтегез {эзләү|кайтару|торгызу}."
MISSING_LOOKUP_USER: "Зинһар, кулланучыны күрсәтегез яки {блок|радиус}."
MISSING_PARAMETERS: "Зинһар, \" кулланыгыз{0}\"."
MISSING_ROLLBACK_RADIUS: "Сез күрсәтмәдегез {кире кайтару|торгызу} радиус."
MISSING_ROLLBACK_USER: "Сез күрсәтмәдегез {кире кайтару|торгызу} кулланучы."
MYSQL_UNAVAILABLE: "Тоташып булмый MySQL сервер."
NETWORK_CONNECTION: "Тоташу {0} {уңышлы|уңышсыз}Куллану {1} {2}."
NETWORK_TEST: "Челтәр сынау мәгълүматлары уңышлы җибәрелде."
NO_DATA: "Бернинди мәгълүмат табылмады {0}."
NO_DATA_LOCATION: "Юк {мәгълүматлар|транзакцияләр|үзара бәйләнешләр|хәбәрләр} табылган."
NO_PERMISSION: "Сезнең моны эшләргә рөхсәтегез юк."
NO_RESULTS: "Нәтиҗәләр табылмады."
NO_RESULTS_PAGE: "Юк {нәтиҗәләр|мәгълүматлар} шул бит өчен табылды."
NO_ROLLBACK: "Юк {көтелгән|алдагы} кире кайтару/торгызу табылды."
PATCH_INTERRUPTED: "Яңарту өзелде. Кабат эшләтеп җибәргәндә тагын бер кат тырышып карыйм."
PATCH_OUTDATED_1: "Искерәк мәгълүмат базаларын яңартып булмый {0}."
PATCH_OUTDATED_2: "Зинһар, ярдәм ителә торган версия белән яңартыгыз CoreProtect."
PATCH_PROCESSING: "Яңа мәгълүматлар эшкәртелә. Зинһар, көтегез..."
PATCH_SKIP_UPDATE: "Сикереп бару {таблица|индекс} {яңарту|булдыру|бетерү} өстендә {0}."
PATCH_STARTED: "Башкару {0} яңарту. Зинһар, көтегез..."
PATCH_SUCCESS: "Уңышлы рәвештә яңартылды {0}."
PATCH_UPGRADING: "Мәгълүмат базасы яңартыла. Зинһар, көтегез..."
PLEASE_SELECT: "Зинһар, сайлагыз: \"{0}\" яки \"{1}\"."
PREVIEW_CANCELLED: "Алдан карау юкка чыгарылды."
PREVIEW_CANCELLING: "Алдан карауны юкка чыгару..."
PREVIEW_IN_GAME: "Сез кире кайтаруларны уен эчендә генә карый аласыз."
PREVIEW_TRANSACTION: "Алдан карап булмый {контейнер|инвентаризация} транзакцияләр."
PRIMARY_THREAD_ERROR: "Бу API ысулын төп җептә кулланып булмый."
PURGE_ABORTED: "Чистарту уңышсыз тәмамланды. Мәгълүмат базасы бозылган булырга мөмкин."
PURGE_ERROR: "Эшкәртеп булмый {0} мәгълүматлар!"
PURGE_FAILED: "Чистарту уңышсыз тәмамланды. Зинһар, соңрак кабатлап карагыз."
PURGE_IN_PROGRESS: "Чистарту бара. Зинһар, соңрак кабатлап карагыз."
PURGE_MINIMUM_TIME: "Сез бары тик искерәк мәгълүматларны гына бетерә аласыз {0} {көннәр|сәгатьләр}."
PURGE_NOTICE_1: "Зинһар, игътибар итегез, бу бераз вакыт алырга мөмкин."
PURGE_NOTICE_2: "Серверны тәмамланганчы яңадан эшләтеп җибәрмәгез."
PURGE_OPTIMIZING: "Мәгълүмат базасы оптимальләштерелә. Зинһар, көтегез..."
PURGE_PROCESSING: "Эшкәртү {0} мәгълүматлар..."
PURGE_REPAIRING: "Төзәтергә тырышам. Бу бераз вакыт алырга мөмкин..."
PURGE_ROWS: "{0} {рәт|рәтләр} бетерелгән мәгълүматлар саны."
PURGE_STARTED: "Мәгълүматларны чистарту башланды \"{0}\"."
PURGE_SUCCESS: "Мәгълүматларны чистарту уңышлы тәмамланды."
RAM_STATS: "{0}ГБ / {1}ГБ оператив хәтер"
RELOAD_STARTED: "Конфигурация яңадан йөкләнә - зинһар, көтегез."
RELOAD_SUCCESS: "Конфигурация уңышлы яңадан йөкләнде."
ROLLBACK_ABORTED: "Кире кайтару яки торгызу туктатылды."
ROLLBACK_CHUNKS_FOUND: "Табылды {0} {кисәк|кисәк} үзгәртү өчен."
ROLLBACK_CHUNKS_MODIFIED: "Үзгәртелгән {0}/{1} {кисәк|кисәкчәләр}."
ROLLBACK_COMPLETED: "{Кире кайтару|Төзетү|Алдан карау} өчен тәмамланды \"{0}\"."
ROLLBACK_EXCLUDED_USERS: "Чыгарылган {кулланучы|кулланучылар}: \"{0}\"."
ROLLBACK_INCLUDE: "{Кертелгән|Чыгарылган} {блок|объект|максат} {төр|төрләр}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "Кире кайтару/торгызу процессы инде бара."
ROLLBACK_LENGTH: "Кирәкле вакыт: {0} {секунд|секунд}."
ROLLBACK_MODIFIED: "{Үзгәртелгән|Үзгәртелә} {0}."
ROLLBACK_RADIUS: "Радиус: {0} {блок|блоклар}."
ROLLBACK_SELECTION: "Радиус \"га куелды{0}\"."
ROLLBACK_STARTED: "{Кире кайтару|Төзетү|Алдан карау} башланды \"{0}\"."
ROLLBACK_TIME: "Вакыт диапазоны: {0}."
ROLLBACK_WORLD_ACTION: "Чикләнгән {дөнья|гамәл} \"{0}\"."
SIGN_HEADER: "Хәбәрләргә кул кую"
STATUS_CONSUMER: "Кулланучы: {0} {әйбер|әйберләр} чиратта"
STATUS_DATABASE: "Мәгълүмат базасы: Куллану {0}."
STATUS_INTEGRATION: "{0}: Интеграция {активлаштырылган|сүндерелгән}."
STATUS_LICENSE: "Лицензия: {0}"
STATUS_SYSTEM: "Система: {0}"
STATUS_VERSION: "Версия: {0}"
TELEPORTED: "Телепортацияләнгән {0}."
TELEPORTED_SAFETY: "Сезне куркынычсыз урынга телепортладылар."
TELEPORT_PLAYERS: "Телепорт командасын бары тик уенчылар гына куллана ала."
TIME_DAYS: "{0} {көн|көннәр}"
TIME_HOURS: "{0} {сәгать|сәгатьләр}"
TIME_MINUTES: "{0} {минут|минут}"
TIME_SECONDS: "{0} {секунд|секунд}"
TIME_WEEKS: "{0} {атна|атналар}"
UPDATE_ERROR: "Яңартуларны тикшергәндә хата килеп чыкты."
UPDATE_HEADER: "{0} Яңарту"
UPDATE_NOTICE: "Игътибар: {0} хәзер мөмкин."
UPGRADE_IN_PROGRESS: "Яңарту бара. Зинһар, соңрак кабатлап карагыз."
USER_NOT_FOUND: "Кулланучы \"{0}\" табылмады.\""
USER_OFFLINE: "Кулланучы \"{0}\" онлайн түгел.\""
USING_MYSQL: "Куллану MySQL мәгълүматларны саклау өчен."
USING_SQLITE: "Куллану SQLite мәгълүматларны саклау өчен."
VALID_DONATION_KEY: "Гамәлдәге иганә ачкычы."
VERSION_NOTICE: "Версия {0} хәзер мөмкин."
VERSION_REQUIRED: "{0} {1} яки аннан да югарырак таләп ителә."
WORLD_NOT_FOUND: "Дөнья \"{0}\" табылмады.\""
-1
View File
@@ -186,7 +186,6 @@ TIME_DAYS: "{0} {день|дні}"
TIME_HOURS: "{0} {година|години}"
TIME_MINUTES: "{0} {хвилина|хвилини}"
TIME_SECONDS: "{0} {секунда|секунди}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {тиждень|тиждень}"
UPDATE_ERROR: "Під час перевірки оновлень сталася помилка."
UPDATE_HEADER: "{0} Оновлення"
-1
View File
@@ -186,7 +186,6 @@ TIME_DAYS: "{0} {ngày|ngày}"
TIME_HOURS: "{0} {giờ|giờ}"
TIME_MINUTES: "{0} {phút|phút}"
TIME_SECONDS: "{0} {giây|giây}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {tuần|tuần}"
UPDATE_ERROR: "Đã xảy ra lỗi khi kiểm tra các bản cập nhật."
UPDATE_HEADER: "{0} Cập nhật"
+119 -130
View File
@@ -1,213 +1,202 @@
# CoreProtect Language File (zh-CN)
# Origin: Intelli, Translator: DreamVoid, StarWishsama, YuanYuanOwO, Halogly
# Origin: Intelli, Translator: DreamVoid, StarWishsama, YuanYuanOwO
ACTION_NOT_SUPPORTED: "此命令不支持该操作。"
ACTION_NOT_SUPPORTED: "该命令不支持该操作。"
AMOUNT_BLOCK: "{0}个{方块|方块}"
AMOUNT_CHUNK: "{0}个{区块|区块}"
AMOUNT_ENTITY: "{0}个{实体|实体}"
AMOUNT_ITEM: "{0}个{物品|物品}"
API_TEST: "API 测试成功。"
CACHE_ERROR: "警告:验证缓存 {0} 时出错。"
CACHE_RELOAD: "正在强制从数据库中重新加载{映射|世界}缓存。"
CACHE_ERROR: "警告: 验证缓存 {0} 时出错。"
CACHE_RELOAD: "正在强制从数据库中重新加载{映射|世界}的缓存。"
CHECK_CONFIG: "请检查 config.yml 文件"
COMMAND_CONSOLE: "请在控制台中运行此命令。"
COMMAND_NOT_FOUND: "命令 \"{0}\" 未找到。"
COMMAND_THROTTLED: "请稍后再试。"
COMMAND_NOT_FOUND: "找不到命令 \"{0}\""
COMMAND_THROTTLED: "请稍等片刻,然后重试。"
CONSUMER_ERROR: "数据处理队列已经{暂停|恢复}。"
CONSUMER_TOGGLED: "数据处理队列已{暂停|恢复}。"
CONSUMER_TOGGLED: "数据处理队列现已{暂停|恢复}。"
CONTAINER_HEADER: "容器物品变更记录"
CPU_CORES: "CPU 核心。"
DATABASE_BUSY: "数据库繁忙,请稍后再试。"
DATABASE_BUSY: "数据库繁忙,请稍后重试。"
DATABASE_INDEX_ERROR: "无法验证数据库索引。"
DATABASE_LOCKED_1: "数据库已锁定,请等待约15秒后再试..."
DATABASE_LOCKED_2: "数据库正在使用中,请稍后再试。"
DATABASE_LOCKED_3: "要禁用数据库锁定,请在配置文件中设置 \"database-lock: false\"。"
DATABASE_LOCKED_1: "数据库已被锁定,请等待至少15秒后重试..."
DATABASE_LOCKED_2: "数据库已在使用,请再试一次。"
DATABASE_LOCKED_3: "禁用数据库锁定,请在配置文件中设置 \"database-lock: false\"。"
DATABASE_LOCKED_4: "禁用数据库锁定可能会导致数据损坏。"
DATABASE_UNREACHABLE: "数据库连接失败,正在丢弃数据并关闭。"
DATABASE_UNREACHABLE: "数据库无法访问。正在丢弃数据并关闭。"
DEVELOPMENT_BRANCH: "检测到正在使用开发分支的版本,跳过使用补丁脚本。"
DIRT_BLOCK: "已在你的下方放置了一个泥土。"
DISABLE_SUCCESS: "已成功禁用 {0}!"
DONATION_KEY_REQUIRED: "需要有效的捐赠密钥才能执行此命令。"
ENABLE_FAILED: "无法启用 {0}。"
ENABLE_SUCCESS: "已成功启用 {0}!"
DISABLE_SUCCESS: "禁用 {0} 成功!"
ENABLE_FAILED: "无法启用 {0}!"
ENABLE_SUCCESS: "{0} 已成功启用!"
ENJOY_COREPROTECT: "对 {0} 感到满意吗?请加入我们的 Discord 频道!"
FINISHING_CONVERSION: "正在完成数据转换,请稍候..."
FINISHING_LOGGING: "正在完成数据记录,请稍候..."
FIRST_VERSION: "初始化数据库:{0}"
FINISHING_CONVERSION: "正在完成数据转换,请稍等..."
FINISHING_LOGGING: "正在完成数据记录,请稍等..."
FIRST_VERSION: "初始化数据库: {0}"
GLOBAL_LOOKUP: "请勿在执行全局查询时指定半径。"
GLOBAL_ROLLBACK: "使用 \"{0}\" 进行全局{回滚|恢复}操作"
HELP_ACTION_1: "将查询限制为一个操作。"
HELP_ACTION_2: "例子:[a:block],[a:+block],[a:-block],[a:click],[a:container],[a:inventory],[a:item],[a:kill],[a:chat],[a:command],[a:sign],[a:session],[a:username]"
HELP_ACTION_1: "将查询限制为一个动作。"
HELP_ACTION_2: "例子: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "显示附加信息。"
HELP_EXCLUDE_1: "排除方块/玩家。"
HELP_EXCLUDE_2: "例子:[e:stone],[e:Notch],[e:stone,Notch]"
HELP_EXCLUDE_2: "例子: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} 帮助"
HELP_INCLUDE_1: "包括方块/实体。"
HELP_INCLUDE_2: "例子:[i:stone],[i:zombie],[i:stone,wood,bedrock]"
HELP_INSPECT_1: "启用检查器后,你可以:"
HELP_INCLUDE_2: "例子: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "启用检查器后,你可以:"
HELP_INSPECT_2: "左键单击以查看方块放置记录。"
HELP_INSPECT_3: "右键单击以查看相邻方块破坏记录。"
HELP_INSPECT_4: "放置一个方块以查看放置位置的破坏记录。"
HELP_INSPECT_5: "在液体中放置一个方块以查看液体变更记录。"
HELP_INSPECT_6: "右键单击门、箱子等以查看交互记录。"
HELP_INSPECT_7: "提示:你可以使用 \"/co i\" 进行快速查询。"
HELP_INSPECT_COMMAND: "开启或关闭方块检查器。"
HELP_LIST: "列出所有命令。"
HELP_INSPECT_7: "提示: 你可以使用 \"/co i\" 进行快速查询。"
HELP_INSPECT_COMMAND: "开启或关闭方块检查状态。"
HELP_LIST: "显示所有命令的列表。"
HELP_LOOKUP_1: "命令快捷方式。"
HELP_LOOKUP_2: "检查方块后使用以查看日志。"
HELP_LOOKUP_2: "在查询记录后使用以查看日志"
HELP_LOOKUP_COMMAND: "高级方块数据查询。"
HELP_NO_INFO: "未找到命令 \"{0}\" 的信息。"
HELP_NO_INFO: "命令的信息 \"{0}\" 未找到。"
HELP_PARAMETER: "请参阅 \"{0}\" 了解详细的参数信息。"
HELP_PARAMS_1: "执行{查找|回滚|恢复}操作。"
HELP_PARAMS_2: "指定要{查找|回滚|恢复}的玩家。"
HELP_PARAMS_3: "指定要{查找|回滚|恢复}的时间。"
HELP_PARAMS_4: "指定一个半径区域以限制{查找|回滚|恢复}的范围。"
HELP_PARAMS_5: "将{查找|回滚|恢复}限制为一个操作。"
HELP_PARAMS_6: "{查找|回滚|恢复}时包括指定的方块/实体。"
HELP_PARAMS_7: "{查找|回滚|恢复}时排除指定的方块/玩家。"
HELP_PURGE_1: "删除早于指定时间的数据。"
HELP_PURGE_2: "例如,\"{0}\" 将删除超过一个月以上的所有数据,只保留最近30天的数据。"
HELP_PARAMS_2: "指定{查找|回滚|恢复}的玩家。"
HELP_PARAMS_3: "指定{查找|回滚|恢复}的时间。"
HELP_PARAMS_4: "限制{查找|回滚|恢复}的作用范围。"
HELP_PARAMS_5: "限制{查找|回滚|恢复}的动作。"
HELP_PARAMS_6: "{查找|回滚|恢复}时包括方块/实体。"
HELP_PARAMS_7: "{查找|回滚|恢复}时排除方块/玩家。"
HELP_PURGE_1: "删除指定时间的数据。"
HELP_PURGE_2: "例如,\"{0}\" 将删除超过一个月的所有数据,只保留最近30天的数据。"
HELP_PURGE_COMMAND: "删除旧的方块数据。"
HELP_RADIUS_1: "指定半径区域。"
HELP_RADIUS_2: "例子:[r:10](只会影响你周围十格方块的范围)"
HELP_RADIUS_2: "例子: [r:10] (只会影响你周围十格方块的范围)"
HELP_RELOAD_COMMAND: "重新加载配置文件。"
HELP_RESTORE_COMMAND: "恢复方块数据。"
HELP_ROLLBACK_COMMAND: "回滚方块数据。"
HELP_STATUS: "查看插件状态与版本信息。"
HELP_STATUS_COMMAND: "显示插件状态。"
HELP_TELEPORT: "传送到一个地点。"
HELP_TIME_1: "指定要查找的时间。"
HELP_TIME_2: "例子:[t:2w,5d,7h,2m,10s],[t:5d2h],[t:2.50h]"
HELP_USER_1: "指定要查找的玩家。"
HELP_USER_2: "例子:[u:Notch],[u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" 不能与那个操作一起使用。"
INSPECTOR_ERROR: "检查器已经{启用|禁用}。"
HELP_TIME_1: "指定时间。"
HELP_TIME_2: "例子: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "指定玩家。"
HELP_USER_2: "例子: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" 不能与那个动作一起使用。"
INSPECTOR_ERROR: "检查器已经{启用|禁用}了。"
INSPECTOR_TOGGLED: "检查器已{启用|禁用}。"
INTEGRATION_ERROR: "无法{初始化|禁用} {0} 的日志记录。"
INTEGRATION_SUCCESS: "已成功{初始化|禁用} {0} 的日志记录。"
INTEGRATION_VERSION: "{0} 版本无效。"
INTEGRATION_ERROR: "无法{初始化|禁用}与插件 {0} 的交互。"
INTEGRATION_SUCCESS: "与 {0} 的交互已成功{初始化|禁用}。"
INTEGRATION_VERSION: "发现 {0} 的版本不兼容。"
INTERACTIONS_HEADER: "玩家交互"
INVALID_ACTION: "这不是一个有效的操作。"
INVALID_BRANCH_1: "插件版本无效(尚未设置分支)。"
INVALID_BRANCH_2: "请将项目分支设置为 \"development\" 以继续。"
INVALID_ACTION: "这不是有效的动作。"
INVALID_BRANCH_1: "插件版本无效(未设置分支)。"
INVALID_BRANCH_2: "要继续,请将项目分支设置为 \"开发\"。"
INVALID_BRANCH_3: "运行开发版本的插件可能会导致数据损坏。"
INVALID_CONTAINER: "请先检查一个有效的容器。"
INVALID_CONTAINER: "请检查有效的容器。"
INVALID_DONATION_KEY: "无效的捐赠密钥。"
INVALID_INCLUDE: "\"{0}\" 是无效的方块/实体名称。"
INVALID_INCLUDE_COMBO: "那是无效的方块/实体组合。"
INVALID_RADIUS: "请输入有效的半径。"
INVALID_SELECTION: "未找到 {0} 的选择。"
INVALID_USERNAME: "玩家名 \"{0}\" 无效。"
INVALID_SELECTION: "没有找到 {0} 的选择。"
INVALID_USERNAME: "玩家名 \"{0}\" 不存在或已离线。"
INVALID_WORLD: "请指定一个有效的世界。"
LATEST_VERSION: "最新版本:{0}"
LINK_DISCORD: "Discord:{0}"
LINK_DOWNLOAD: "下载:{0}"
LINK_PATREON: "Patreon:{0}"
LINK_WIKI_BLOCK: "方块名称:{0}"
LINK_WIKI_ENTITY: "实体名称:{0}"
LOGGING_ITEMS: "{0}个物品等待记录,请稍候..."
LOGGING_TIME_LIMIT: "已达到日志时间限制,正在丢弃剩余的数据并关闭。"
LOOKUP_BLOCK: "{0} {放置|破坏}了 {1}。"
LOOKUP_CONTAINER: "{0} {放入|取出}了 {1} {2}。"
LATEST_VERSION: "最新版本: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "下载: {0}"
LINK_PATREON: "Patreon 页面: {0}"
LINK_WIKI_BLOCK: "方块名称: {0}"
LINK_WIKI_ENTITY: "实体名称: {0}"
LOGGING_ITEMS: "{0} 物品等待记录,请稍等..."
LOGGING_TIME_LIMIT: "已达到数据记录时间限制。正在丢弃剩余的数据并关闭。"
LOOKUP_BLOCK: "{0} {放置|破坏} {1}。"
LOOKUP_CONTAINER: "{0} {放入|取出} {1} {2}。"
LOOKUP_HEADER: "{0} 查询结果"
LOOKUP_INTERACTION: "{0} {点击|击杀}了 {1}。"
LOOKUP_ITEM: "{0} {拾起|丢弃}了 {1} {2}。"
LOOKUP_LOGIN: "{0} 已{登录|离开}。"
LOOKUP_INTERACTION: "{0} {点击|击杀} {1}."
LOOKUP_ITEM: "{0} {拾起|丢弃} {1} {2}."
LOOKUP_LOGIN: "{0} {登入|离开}."
LOOKUP_PAGE: "第 {0} 页"
LOOKUP_PROJECTILE: "{0} {扔出|发射}了 {1} {2}。"
LOOKUP_ROWS_FOUND: "{0} {行|行}已找到。"
LOOKUP_SEARCHING: "正在搜索,请稍候..."
LOOKUP_STORAGE: "{0} {放入|取出}了 {1} {2}。"
LOOKUP_TIME: "{0}前"
LOOKUP_USERNAME: "{0} 已登录为 {1}。"
MAXIMUM_RADIUS: "最大{查找|回滚|恢复}半径是 {0}。"
LOOKUP_PROJECTILE: "{0} {扔出|发射} {1} {2}."
LOOKUP_ROWS_FOUND: "已找到 {0}{行|行}。"
LOOKUP_SEARCHING: "正在搜索,请稍等..."
LOOKUP_STORAGE: "{0} {放入|取出} {1} {2}."
LOOKUP_TIME: "{0} 前"
LOOKUP_USERNAME: "{0} 已登入为 {1}."
MAXIMUM_RADIUS: "最大{查找|回滚|恢复}半径是 {0}."
MISSING_ACTION_USER: "要使用该标识符,请指定玩家名。"
MISSING_LOOKUP_TIME: "请指定要{查找|回滚|恢复}的时间。"
MISSING_LOOKUP_USER: "请指定要查找的玩家或{方块|半径}。"
MISSING_LOOKUP_TIME: "请指定{查找|回滚|恢复}时间."
MISSING_LOOKUP_USER: "请指定查找玩家或查找{方块|半径}."
MISSING_PARAMETERS: "请使用 \"{0}\"。"
MISSING_ROLLBACK_RADIUS: "你没有指定{回滚|恢复}的半径。"
MISSING_ROLLBACK_USER: "你没有指定{回滚|恢复}的玩家。"
MISSING_ROLLBACK_RADIUS: "你没有指定{回滚|恢复}半径。"
MISSING_ROLLBACK_USER: "你没有指定{回滚|恢复}的玩家操作。"
MYSQL_UNAVAILABLE: "无法连接到 MySQL 服务器。"
NETWORK_CONNECTION: "{0} 连接{成功|失败},正在使用 {1} {2}。"
NETWORK_TEST: "网络测试数据已成功发送。"
NO_DATA: "没有在 {0} 中找到数据。"
NO_DATA_LOCATION: "此位置找不到任何{数据|存取|交互|消息}记录。"
NO_DATA: "没有在 {0} 中找到数据"
NO_DATA_LOCATION: "此位置找不到任何{数据|存取|交互|消息}的记录。"
NO_PERMISSION: "你没有权限执行此操作。"
NO_RESULTS: "未找到结果。"
NO_RESULTS_PAGE: "没有在指定页面找到{结果|数据}。"
NO_ROLLBACK: "未找到{待处理的|上一个}回滚/恢复。"
NO_ROLLBACK: "没有找到{等待的|上一个}回滚/恢复。"
PATCH_INTERRUPTED: "升级已中断,将在服务器重新启动时重试。"
PATCH_OUTDATED_1: "无法升级早于 {0} 的数据库。"
PATCH_OUTDATED_2: "请升级到受支持的 CoreProtect 版本。"
PATCH_PROCESSING: "正在处理新数据,请稍候..."
PATCH_SKIP_UPDATE: "正在跳过 {0} 的{表格|索引}{更新|创建|删除}操作。"
PATCH_STARTED: "正在进行 {0} 升级,请稍候..."
PATCH_SUCCESS: "成功升级到 {0}。"
PATCH_UPGRADING: "正在进行数据库升级,请稍候..."
PLEASE_SELECT: "请选择:\"{0}\" 或 \"{1}\"。"
PATCH_PROCESSING: "正在处理新数据,请稍等..."
PATCH_SKIP_UPDATE: "在 {0} 跳过{表|索引}的{更新|创建|删除}。"
PATCH_STARTED: "正在准备更新到版本 {0},请稍等..."
PATCH_SUCCESS: "成功升级到版本 {0}。"
PATCH_UPGRADING: "正在进行数据库升级,请稍等..."
PLEASE_SELECT: "请选择: \"{0}\"或\"{1}\"。"
PREVIEW_CANCELLED: "预览已取消。"
PREVIEW_CANCELLING: "正在取消预览..."
PREVIEW_IN_GAME: "你只能在游戏中预览回滚操作。"
PREVIEW_TRANSACTION: "你不能预览{容器|背包}物品交换。"
PRIMARY_THREAD_ERROR: "该 API 方法不能在主线程上使用。"
PURGE_ABORTED: "清除失败,数据库可能已损坏。"
PURGE_ERROR: "无法处理 {0} 数据!"
PURGE_FAILED: "清除失败,请稍后再试。"
PURGE_FAILED: "数据清除失败,请稍后再试。"
PURGE_IN_PROGRESS: "正在清除数据,请稍后再试。"
PURGE_MINIMUM_TIME: "你只能清除{0}{天|小时}之前的数据。"
PURGE_MINIMUM_TIME: "你只能清除早于 {0} {天|小时}的数据."
PURGE_NOTICE_1: "请注意,这可能需要一些时间。"
PURGE_NOTICE_2: "完成前请勿重新启动服务器。"
PURGE_OPTIMIZING: "正在优化数据库,请稍候..."
PURGE_PROCESSING: "正在处理 {0} 的数据..."
PURGE_REPAIRING: "正在尝试修复。这可能需要一些时间..."
PURGE_ROWS: "{0}{行|行}数据已删除。"
PURGE_STARTED: "数据清除开始于 \"{0}\"。"
PURGE_SUCCESS: "数据已清除。"
RAM_STATS: "{0}GB / {1}GB 内存"
PURGE_NOTICE_2: "完成前不要重新启动服务器。"
PURGE_OPTIMIZING: "正在优化数据库,请稍等..."
PURGE_PROCESSING: "正在处理表 {0} 中的数据..."
PURGE_REPAIRING: "正在尝试修复,这可能需要一定的时间..."
PURGE_ROWS: "已删除 {0} {行|行}数据。"
PURGE_STARTED: "数据清除开始于\"{0}\"。"
PURGE_SUCCESS: "数据清除成功。"
RELOAD_STARTED: "正在重新加载配置文件 - 请稍候。"
RELOAD_SUCCESS: "配置文件已重新加载。"
RELOAD_SUCCESS: "配置文件已重新加载成功。"
ROLLBACK_ABORTED: "回滚或恢复已中止。"
ROLLBACK_CHUNKS_FOUND: "找到{0}个待修改的{区块|区块}。"
ROLLBACK_CHUNKS_MODIFIED: "{0}/{1}个{区块|区块}已修改。"
ROLLBACK_COMPLETED: "{0} 的{回滚|恢复|预览}操作已完成。"
ROLLBACK_EXCLUDED_USERS: "已排除{玩家|玩家}:\"{0}\"。"
ROLLBACK_INCLUDE: "{包括|不包括}的{方块|实体|目标}{类型|类型}:\"{0}\"。"
ROLLBACK_CHUNKS_FOUND: "找到 {0} 个{区块|区块}需要更改。"
ROLLBACK_CHUNKS_MODIFIED: "已修改 {0}/{1} 个{区块|区块}."
ROLLBACK_COMPLETED: "{回滚|恢复|预览}已对以下对象完成: {0}。"
ROLLBACK_EXCLUDED_USERS: "已排除{玩家|玩家}: \"{0}\"。"
ROLLBACK_INCLUDE: "{包括|不包括}{方块|实体|目标}{类型|类型}: \"{0}\"。"
ROLLBACK_IN_PROGRESS: "一个回滚/恢复操作已在进行。"
ROLLBACK_LENGTH: "花费时间:{0}{秒|秒}。"
ROLLBACK_MODIFIED: "{已修改|正在修改} {0}。"
ROLLBACK_RADIUS: "半径:{0}个{方块|方块}。"
ROLLBACK_SELECTION: "半径设置为 {0}\"。"
ROLLBACK_STARTED: "{回滚|恢复|预览}开始于 \"{0}\"。"
ROLLBACK_TIME: "时间范围:{0}。"
ROLLBACK_WORLD_ACTION: "限制为{世界|操作} \"{0}\"。"
SIGN_HEADER: "告示牌消息"
STATUS_CONSUMER: "数据处理器:{0}个{数据|数据}待处理。"
STATUS_DATABASE: "数据库:正在使用 {0}。"
STATUS_INTEGRATION: "{0}:{启用|禁用}合并。"
STATUS_LICENSE: "协议:{0}"
STATUS_SYSTEM: "系统:{0}"
STATUS_VERSION: "版本:{0}"
TELEPORTED: "传送到 {0}。"
TELEPORTED_SAFETY: "将你传送到安全的位置。"
ROLLBACK_LENGTH: "花费时间: {0}{秒|秒}."
ROLLBACK_MODIFIED: "{已修改|正在修改}{0}."
ROLLBACK_RADIUS: "半径: {0}个{方块|方块}."
ROLLBACK_SELECTION: "半径设置为\"{0}\"。"
ROLLBACK_STARTED: "{回滚|恢复|预览}于 \"{0}\" 开始。"
ROLLBACK_TIME: "时间范围: {0}."
ROLLBACK_WORLD_ACTION: "限制{世界|动作}为 \"{0}\"。"
SIGN_HEADER: "木牌消息"
STATUS_CONSUMER: "数据处理器: {0}个{数据|数据}待处理。"
STATUS_DATABASE: "数据库: 正在使用 {0}."
STATUS_INTEGRATION: "{0}: 合并{启用|禁用}."
STATUS_LICENSE: "协议: {0}"
STATUS_VERSION: "版本: {0}"
TELEPORTED: "传送到 {0}."
TELEPORTED_SAFETY: "将你传送到安全地点。"
TELEPORT_PLAYERS: "只有玩家才能使用传送命令。"
TIME_DAYS: "{0}{天|天}"
TIME_HOURS: "{0}{小时|小时}"
TIME_MINUTES: "{0}{分钟|分钟}"
TIME_MONTHS: "{0} {月|月}"
TIME_SECONDS: "{0}{秒|秒}"
TIME_UNITS: "{分钟|小时|天}"
TIME_WEEKS: "{0}{周|周}"
TIME_YEARS: "{0} {年|年}"
UPDATE_ERROR: "检查更新时出错。"
UPDATE_HEADER: "{0} 更新"
UPDATE_NOTICE: "注意:{0} 现在可用。"
UPDATE_NOTICE: "注意: {0} 现在可用。"
UPGRADE_IN_PROGRESS: "正在进行升级,请稍后再试。"
USER_NOT_FOUND: "玩家 \"{0}\" 未找到。"
USER_OFFLINE: "玩家 \"{0}\" 不在线。"
USER_NOT_FOUND: "玩家\"{0}\"未找到。"
USER_OFFLINE: "玩家\"{0}\"不在线。"
USING_MYSQL: "使用 MySQL 用于数据存储。"
USING_SQLITE: "使用 SQLite 用于数据存储。"
VALID_DONATION_KEY: "有效的捐赠密钥。"
VERSION_INCOMPATIBLE: "{0} {1} 不受支持。"
VERSION_NOTICE: "版本 {0} 现在可用。"
VERSION_REQUIRED: "{0} 需要使用 {1} 或更高版本。"
WORLD_NOT_FOUND: "世界 \"{0}\" 未找到。"
WORLD_NOT_FOUND: "找不到世界 \"{0}\"。"
-1
View File
@@ -193,7 +193,6 @@ TIME_DAYS: "{0} {天|天}"
TIME_HOURS: "{0} {小時|小時}"
TIME_MINUTES: "{0} {分鐘|分鐘}"
TIME_SECONDS: "{0} {秒|秒}"
TIME_UNITS: "{/m|/h|/d}"
TIME_WEEKS: "{0} {週|週}"
UPDATE_ERROR: "檢查更新時發生錯誤。"
UPDATE_HEADER: "{0} 更新"
-331
View File
@@ -1,331 +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>24.1</version>
<properties>
<project.branch></project.branch>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</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.15.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.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.6.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*:*:*</artifact>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.c</exclude>
<exclude>module-info.class</exclude>
<exclude>META-INF/versions/**/module-info.class</exclude>
<exclude>META-INF/maven/**/pom.properties</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.5</version>
<configuration>
<systemPropertyVariables>
<plugin.version>${project.version}</plugin.version>
</systemPropertyVariables>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>enforce</goal></goals>
<configuration>
<rules>
<requireNoRepositories>
<allowedRepositories>
<allowedRepository>central</allowedRepository>
<allowedRepository>enginehub-repo</allowedRepository>
<allowedRepository>spigot-repo</allowedRepository>
<allowedRepository>paper-repo</allowedRepository>
<allowedRepository>codemc-repo</allowedRepository>
<allowedRepository>jitpack.io</allowedRepository>
</allowedRepositories>
</requireNoRepositories>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>maven-install</id>
<activation>
<property>
<name>env.BUILD_ID</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>install-validation</id>
<phase>install</phase>
<configuration>
<target>
<delete>
<fileset dir="${project.build.directory}">
<include name="${project.build.finalName}-shaded.jar"/>
</fileset>
</delete>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>enginehub-repo</id>
<url>https://maven.enginehub.org/repo/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<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>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!--
paper-api: io.papermc.paper
paper-api (<= 1.16): com.destroystokyo.paper / 1.16.1-R0.1-SNAPSHOT
spigot-api: org.spigotmc
bukkit: org.bukkit
-->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>26.2.build.48-alpha</version> <!-- https://repo.papermc.io/repository/maven-public/ -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fastasyncworldedit</groupId>
<artifactId>FastAsyncWorldEdit-Core</artifactId>
<version>2.15.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fastasyncworldedit</groupId>
<artifactId>FastAsyncWorldEdit-Bukkit</artifactId>
<version>2.15.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>FastAsyncWorldEdit-Core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>7.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.25.4</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.25.4</version>
</dependency>
<dependency>
<groupId>com.github.DeadSilenceIV</groupId>
<artifactId>AdvancedChestsAPI</artifactId>
<version>3.2-BETA</version>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.23.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.23.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.21</artifactId>
<version>3.133.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.53.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.18.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.18.8</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
+1
View File
@@ -0,0 +1 @@
rootProject.name = "CoreProtect-OG"
+233 -16
View File
@@ -1,29 +1,45 @@
package net.coreprotect;
import java.io.File;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.plugin.Plugin;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
import org.bukkit.plugin.java.JavaPlugin;
import net.coreprotect.command.CommandHandler;
import net.coreprotect.command.TabHandler;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.language.Language;
import net.coreprotect.language.Phrase;
import net.coreprotect.services.PluginInitializationService;
import net.coreprotect.services.ShutdownService;
import net.coreprotect.listener.ListenerHandler;
import net.coreprotect.listener.player.PlayerQuitListener;
import net.coreprotect.paper.PaperAdapter;
import net.coreprotect.thread.CacheHandler;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Teleport;
import net.coreprotect.utility.Util;
/**
* Main class for the CoreProtect plugin
*/
public final class CoreProtect extends JavaPlugin {
private static CoreProtect instance;
/**
* Get the instance of CoreProtect
*
* @return This CoreProtect instance
*/
public static CoreProtect getInstance() {
return instance;
}
private final CoreProtectAPI api = new CoreProtectAPI();
@@ -34,32 +50,233 @@ public final class CoreProtect extends JavaPlugin {
* @return The CoreProtect API
*/
public CoreProtectAPI getAPI() {
return api;
}
@Override
public void onEnable() {
// Set plugin instance and data folder path
instance = this;
ConfigHandler.path = this.getDataFolder().getPath() + File.separator;
Language.loadPhrases();
// Initialize plugin using the initialization service
boolean initialized = PluginInitializationService.initializePlugin(this);
boolean start = performVersionChecks();
if (start) {
try {
Consumer.initialize(); // Prepare consumer (keep this here)
new ListenerHandler(this);
getCommand("coreprotect").setExecutor(CommandHandler.getInstance());
getCommand("coreprotect").setTabCompleter(new TabHandler());
getCommand("core").setExecutor(CommandHandler.getInstance());
getCommand("core").setTabCompleter(new TabHandler());
getCommand("co").setExecutor(CommandHandler.getInstance());
getCommand("co").setTabCompleter(new TabHandler());
final boolean exists = (new File(ConfigHandler.path)).exists();
if (!exists) {
new File(ConfigHandler.path).mkdir();
}
start = ConfigHandler.performInitialization(true); // Perform any necessary initialization
} catch (Exception error) {
error.printStackTrace();
start = false;
}
}
if (start) {
Util.sendConsoleComponentStartup(Bukkit.getServer().getConsoleSender(),
Phrase.build(Phrase.ENABLE_SUCCESS, ConfigHandler.EDITION_NAME));
if (Config.getGlobal().MYSQL) {
Chat.console(Phrase.build(Phrase.USING_MYSQL));
} else {
Chat.console(Phrase.build(Phrase.USING_SQLITE));
}
Chat.console("--------------------");
Chat.console(Phrase.build(Phrase.ENJOY_COREPROTECT, getPluginMeta().getName()));
Chat.console(Phrase.build(Phrase.LINK_DISCORD, "www.coreprotect.net/discord/"));
Chat.console("--------------------");
Scheduler.scheduleSyncDelayedTask(this, () -> {
try {
final Thread networkHandler = new Thread(new NetworkHandler(true, true));
networkHandler.start();
} catch (Exception error) {
error.printStackTrace();
}
}, 0);
final Thread cacheCleanUpThread = new Thread(new CacheHandler());
cacheCleanUpThread.start();
Consumer.startConsumer();
} else {
// Disable plugin if initialization failed
if (!initialized) {
Chat.console(Phrase.build(Phrase.ENABLE_FAILED, ConfigHandler.EDITION_NAME));
getServer().getPluginManager().disablePlugin(this);
}
}
@Override
public void onDisable() {
ShutdownService.safeShutdown(this);
safeShutdown(this);
}
public boolean isAdvancedChestsEnabled() {
Plugin advancedChests = getServer().getPluginManager().getPlugin("AdvancedChests");
return advancedChests != null && advancedChests.isEnabled();
private static boolean performVersionChecks() {
try {
final String[] bukkitVersion = Bukkit.getServer().getBukkitVersion().split("[-.]");
if (Util.newVersion(bukkitVersion[0] + "." + bukkitVersion[1], ConfigHandler.MINECRAFT_VERSION)) {
Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Minecraft", ConfigHandler.MINECRAFT_VERSION));
return false;
}
if (Util.newVersion(ConfigHandler.LATEST_VERSION, bukkitVersion[0] + "." + bukkitVersion[1])
&& Util.isBranch("master"))
{
Chat.console(Phrase.build(Phrase.VERSION_INCOMPATIBLE, "Minecraft",
bukkitVersion[0] + "." + bukkitVersion[1]));
return false;
}
final String[] javaVersion = (System.getProperty("java.version").replaceAll("[^0-9.]", "") + ".0")
.split("\\.");
if (Util.newVersion(javaVersion[0] + "." + javaVersion[1], ConfigHandler.JAVA_VERSION)) {
Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Java", ConfigHandler.JAVA_VERSION));
return false;
}
ConfigHandler.SERVER_VERSION = Integer.parseInt(bukkitVersion[1]);
} catch (Exception error) {
error.printStackTrace();
return false;
}
return true;
}
}
private static void safeShutdown(CoreProtect plugin) {
try {
/* if server is stopping, log disconnections of online players */
if (ConfigHandler.serverRunning && PaperAdapter.ADAPTER.isStopping(plugin.getServer())) {
plugin.getServer().getOnlinePlayers().forEach(PlayerQuitListener::queuePlayerQuit);
}
if (!ConfigHandler.isFolia) {
final Iterator<Entry<Location, BlockData>> iterator = Teleport.revertBlocks.entrySet().iterator();
while (iterator.hasNext()) {
final Entry<Location, BlockData> entry = iterator.next();
entry.getKey().getBlock().setBlockData(entry.getValue());
iterator.remove();
}
}
ConfigHandler.serverRunning = false;
final long shutdownTime = System.currentTimeMillis();
long alertTime = shutdownTime + (10 * 1000);
if (ConfigHandler.converterRunning) {
Chat.console(Phrase.build(Phrase.FINISHING_CONVERSION));
} else {
Chat.console(Phrase.build(Phrase.FINISHING_LOGGING));
}
if (ConfigHandler.migrationRunning) {
ConfigHandler.purgeRunning = false;
}
while ((Consumer.isRunning() || ConfigHandler.converterRunning) && !ConfigHandler.purgeRunning) {
final long time = System.currentTimeMillis();
if (time >= alertTime) {
if (!ConfigHandler.converterRunning) {
final int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
final int consumerCount = Consumer.getConsumerSize(consumerId)
+ Process.getCurrentConsumerSize();
Chat.console(Phrase.build(Phrase.LOGGING_ITEMS, "%,d".formatted(consumerCount)));
}
alertTime = alertTime + (30 * 1000);
} else if (!ConfigHandler.databaseReachable && (time - shutdownTime) >= (5 * 60 * 1000)) {
Chat.console(Phrase.build(Phrase.DATABASE_UNREACHABLE));
break;
} else if ((time - shutdownTime) >= (15 * 60 * 1000)) {
Chat.console(Phrase.build(Phrase.LOGGING_TIME_LIMIT));
break;
}
Thread.sleep(100);
}
ConfigHandler.performDisable();
Chat.console(Phrase.build(Phrase.DISABLE_SUCCESS, "CoreProtect v" + plugin.getPluginMeta().getVersion()));
} catch (Exception error) {
error.printStackTrace();
}
}
}
File diff suppressed because it is too large. Load diff
+44 -237
View File
@@ -1,284 +1,91 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.block.Block;
import net.coreprotect.api.result.BlockResult;
import net.coreprotect.api.result.ContainerResult;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.utility.BlockUtils;
import net.coreprotect.utility.StringUtils;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
import net.coreprotect.utility.Util;
import org.bukkit.block.Block;
/**
* Provides API methods for block-related lookups in the CoreProtect database.
*/
public class BlockAPI {
/**
* Private constructor to prevent instantiation.
* This is a utility class with static methods only.
*/
private BlockAPI() {
throw new IllegalStateException("API class");
}
/**
* Performs a lookup of block-related actions at the specified block.
*
* @param block
* The block to look up
* @param offset
* Time constraint in seconds (0 means no time constraint)
* @return List of results in a String array format
*/
public static List<String[]> performLookup(Block block, int offset) {
List<String[]> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
if (block == null) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
if (block == null) {
return result;
}
int x = block.getX();
int y = block.getY();
int z = block.getZ();
int time = (int) (System.currentTimeMillis() / 1000L);
int worldId = WorldUtils.getWorldId(block.getWorld().getName());
int worldId = Util.getWorldId(block.getWorld().getName());
int checkTime = 0;
if (offset > 0) {
checkTime = time - offset;
}
try (Statement statement = connection.createStatement()) {
String query = "SELECT time,user,action,type,data,blockdata,rolled_back FROM " + ConfigHandler.prefix + "block " + WorldUtils.getWidIndex("block") + "WHERE wid = '" + worldId + "' AND x = '" + x + "' AND z = '" + z + "' AND y = '" + y + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
try (ResultSet results = statement.executeQuery(query)) {
while (results.next()) {
String resultTime = results.getString("time");
int resultUserId = results.getInt("user");
String resultAction = results.getString("action");
int resultType = results.getInt("type");
String resultData = results.getString("data");
byte[] resultBlockData = results.getBytes("blockdata");
String resultRolledBack = results.getString("rolled_back");
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
UserStatement.loadName(connection, resultUserId);
}
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
String blockData = BlockUtils.byteDataToString(resultBlockData, resultType);
String[] lookupData = new String[] { resultTime, resultUser, String.valueOf(x), String.valueOf(y), String.valueOf(z), String.valueOf(resultType), resultData, resultAction, resultRolledBack, String.valueOf(worldId), blockData };
result.add(StringUtils.toStringArray(lookupData));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
/**
* Performs a typed lookup of block-related actions at the specified block.
*
* @param block
* The block to look up
* @param options
* Lookup options. User, time, and limit are applied; location and radius are ignored because the block supplies the exact location.
* @return List of results in a BlockResult format
*/
public static List<BlockResult> performLookup(Block block, LookupOptions options) {
List<BlockResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
if (block == null || block.getWorld() == null) {
return result;
}
if (options == null) {
options = LookupOptions.builder().build();
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
Integer userId = MessageAPI.getUserId(connection, options.getUser());
if (userId != null && userId == -1) {
return result;
}
Statement statement = connection.createStatement();
String query = "SELECT time,user,action,type,data,blockdata,rolled_back FROM " + ConfigHandler.prefix
+ "block " + Util.getWidIndex("block") + "WHERE wid = '" + worldId + "' AND x = '" + x
+ "' AND z = '" + z + "' AND y = '" + y + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
ResultSet results = statement.executeQuery(query);
int checkTime = 0;
if (options.getTime() > 0) {
checkTime = (int) (System.currentTimeMillis() / 1000L) - options.getTime();
}
while (results.next()) {
int x = block.getX();
int y = block.getY();
int z = block.getZ();
String worldName = block.getWorld().getName();
int worldId = WorldUtils.getWorldId(worldName);
String resultTime = results.getString("time");
int resultUserId = results.getInt("user");
String resultAction = results.getString("action");
int resultType = results.getInt("type");
String resultData = results.getString("data");
byte[] resultBlockData = results.getBytes("blockdata");
String resultRolledBack = results.getString("rolled_back");
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
StringBuilder query = new StringBuilder("SELECT time,user,action,type,data,blockdata,rolled_back,wid,x,y,z FROM ");
query.append(ConfigHandler.prefix).append("block ").append(WorldUtils.getWidIndex("block"));
query.append("WHERE wid = ? AND x = ? AND z = ? AND y = ? AND time > ?");
if (userId != null) {
query.append(" AND user = ?");
}
query.append(" ORDER BY rowid DESC");
if (options.hasLimit()) {
query.append(" LIMIT ").append(options.getLimitOffset()).append(", ").append(options.getLimitCount());
}
UserStatement.loadName(connection, resultUserId);
try (PreparedStatement statement = connection.prepareStatement(query.toString())) {
statement.setInt(1, worldId);
statement.setInt(2, x);
statement.setInt(3, z);
statement.setInt(4, y);
statement.setInt(5, checkTime);
if (userId != null) {
statement.setInt(6, userId);
}
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseBlockResult(connection, results, worldName));
}
}
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
String blockData = Util.byteDataToString(resultBlockData, resultType);
String[] lookupData = new String[] { resultTime, resultUser, String.valueOf(x), String.valueOf(y),
String.valueOf(z), String.valueOf(resultType), resultData, resultAction, resultRolledBack,
String.valueOf(worldId), blockData };
String[] lineData = Util.toStringArray(lookupData);
result.add(lineData);
}
}
catch (Exception e) {
ErrorReporter.report(e);
results.close();
statement.close();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* Performs a lookup of container transactions at the specified location.
*
* @param location
* The location to look up
* @param offset
* Time constraint in seconds (0 means no time constraint)
* @return List of results in a ContainerResult format
*/
public static List<ContainerResult> performContainerLookup(Location location, int offset) {
if (location == null) {
return new ArrayList<>();
}
return performContainerLookup(LookupOptions.builder().time(offset).location(location).build());
}
/**
* Performs a lookup of container transactions using shared lookup options.
*
* @param options
* Lookup options
* @return List of results in a ContainerResult format
*/
public static List<ContainerResult> performContainerLookup(LookupOptions options) {
List<ContainerResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
LookupFilter filter = LookupFilter.fromOptions(connection, options);
if (filter.hasInvalidUser() || filter.hasInvalidLocation()) {
return result;
}
StringBuilder query = new StringBuilder("SELECT time,user,wid,x,y,z,action,type,data,amount,metadata,rolled_back FROM ");
query.append(ConfigHandler.prefix).append("container ");
if (filter.hasLocation()) {
query.append(WorldUtils.getWidIndex("container"));
}
filter.appendWhere(query);
query.append(" ORDER BY rowid DESC");
filter.appendLimit(query);
try (PreparedStatement statement = connection.prepareStatement(query.toString())) {
filter.bind(statement);
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseContainerResult(connection, results));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
private static ContainerResult parseContainerResult(Connection connection, ResultSet results) throws Exception {
int resultUserId = results.getInt("user");
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
if (resultUser == null) {
resultUser = UserStatement.loadName(connection, resultUserId);
}
return new ContainerResult(
results.getLong("time"), resultUser, WorldUtils.getWorldName(results.getInt("wid")), results.getInt("x"), results.getInt("y"), results.getInt("z"),
results.getInt("type"), results.getInt("data"), results.getInt("amount"), results.getBytes("metadata"),
results.getInt("action"), results.getInt("rolled_back")
);
}
private static BlockResult parseBlockResult(Connection connection, ResultSet results, String worldName) throws Exception {
int resultUserId = results.getInt("user");
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
if (resultUser == null) {
resultUser = UserStatement.loadName(connection, resultUserId);
}
int resultType = results.getInt("type");
String blockData = BlockUtils.byteDataToString(results.getBytes("blockdata"), resultType);
return new BlockResult(
results.getLong("time"), resultUser, worldName, results.getInt("x"), results.getInt("y"), results.getInt("z"),
resultType, results.getInt("data"), blockData, results.getInt("action"), results.getInt("rolled_back")
);
}
}
@@ -1,45 +0,0 @@
package net.coreprotect.api;
import net.coreprotect.model.action.LookupActions;
/**
* CoreProtect action identifiers used by lookup filters.
*/
public enum CoreProtectAction {
BLOCK_BREAK(LookupActions.BLOCK_BREAK),
BLOCK_PLACE(LookupActions.BLOCK_PLACE),
INTERACTION(LookupActions.INTERACTION),
ENTITY_KILL(LookupActions.ENTITY_KILL),
CONTAINER(LookupActions.CONTAINER),
CHAT(LookupActions.CHAT),
COMMAND(LookupActions.COMMAND),
SESSION(LookupActions.SESSION),
USERNAME(LookupActions.USERNAME),
SIGN(LookupActions.SIGN),
ITEM(LookupActions.ITEM),
UNKNOWN(-1);
private final int id;
CoreProtectAction(int id) {
this.id = id;
}
public int id() {
return id;
}
public String actionString() {
return LookupActions.getActionString(id);
}
public static CoreProtectAction fromId(int id) {
for (CoreProtectAction action : values()) {
if (action.id == id) {
return action;
}
}
return UNKNOWN;
}
}
@@ -1,107 +0,0 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import net.coreprotect.api.result.InventoryResult;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
/**
* Provides API methods for normalized player inventory transaction lookups.
*/
public class InventoryAPI {
private InventoryAPI() {
throw new IllegalStateException("API class");
}
public static List<InventoryResult> performLookup(LookupOptions options) {
List<InventoryResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
if (options == null) {
options = LookupOptions.builder().build();
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
LookupFilter filter = LookupFilter.fromOptions(connection, options);
if (filter.hasInvalidUser() || filter.hasInvalidLocation()) {
return result;
}
StringBuilder whereBuilder = new StringBuilder();
filter.appendWhere(whereBuilder);
String where = whereBuilder.toString();
String query = buildQuery(where, options.hasLimit());
try (PreparedStatement statement = connection.prepareStatement(query)) {
int parameterIndex = filter.bind(statement);
parameterIndex = filter.bind(statement, parameterIndex);
parameterIndex = filter.bind(statement, parameterIndex);
if (options.hasLimit()) {
statement.setInt(parameterIndex++, options.getLimitOffset());
statement.setInt(parameterIndex, options.getLimitCount());
}
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseInventoryResult(connection, results));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
private static String buildQuery(String where, boolean hasLimit) {
StringBuilder query = new StringBuilder("SELECT * FROM (");
query.append("SELECT 0 AS source,rowid AS id,time,user,wid,x,y,z,type,data,1 AS amount,meta AS metadata,action,rolled_back FROM ")
.append(ConfigHandler.prefix).append("block ").append(where).append(" AND action = 1");
query.append(" UNION ALL ");
query.append("SELECT 1 AS source,rowid AS id,time,user,wid,x,y,z,type,data,amount,metadata,action,rolled_back FROM ")
.append(ConfigHandler.prefix).append("container ").append(where);
query.append(" UNION ALL ");
query.append("SELECT 2 AS source,rowid AS id,time,user,wid,x,y,z,type,0 AS data,amount,data AS metadata,action,rolled_back FROM ")
.append(ConfigHandler.prefix).append("item ").append(where);
query.append(") AS inventory_lookup ORDER BY time DESC, source DESC, id DESC");
if (hasLimit) {
query.append(" LIMIT ?, ?");
}
return query.toString();
}
private static InventoryResult parseInventoryResult(Connection connection, ResultSet results) throws Exception {
int userId = results.getInt("user");
String username = ConfigHandler.playerIdCacheReversed.get(userId);
if (username == null) {
username = UserStatement.loadName(connection, userId);
}
return new InventoryResult(
results.getLong("time"), username, WorldUtils.getWorldName(results.getInt("wid")),
results.getInt("x"), results.getInt("y"), results.getInt("z"),
results.getInt("type"), results.getInt("data"), results.getInt("amount"), results.getBytes("metadata"),
results.getInt("action"), results.getInt("rolled_back"), results.getInt("source")
);
}
}
@@ -1,90 +0,0 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import net.coreprotect.api.result.ItemResult;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.logger.ItemLogger;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
/**
* Provides API methods for world item transaction lookups.
*/
public class ItemAPI {
private ItemAPI() {
throw new IllegalStateException("API class");
}
public static List<ItemResult> performLookup(LookupOptions options) {
List<ItemResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
LookupFilter filter = LookupFilter.fromOptions(connection, options);
if (filter.hasInvalidUser() || filter.hasInvalidLocation()) {
return result;
}
StringBuilder query = new StringBuilder("SELECT time,user,wid,x,y,z,type,data,amount,action,rolled_back FROM ");
query.append(ConfigHandler.prefix).append("item ");
if (filter.hasLocation()) {
query.append(WorldUtils.getWidIndex("item"));
}
filter.appendWhere(query);
query.append(" AND action NOT IN (")
.append(ItemLogger.ITEM_BREAK).append(",")
.append(ItemLogger.ITEM_DESTROY).append(",")
.append(ItemLogger.ITEM_CREATE).append(",")
.append(ItemLogger.ITEM_SELL).append(",")
.append(ItemLogger.ITEM_BUY).append(")");
query.append(" ORDER BY rowid DESC");
filter.appendLimit(query);
try (PreparedStatement statement = connection.prepareStatement(query.toString())) {
filter.bind(statement);
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseItemResult(connection, results));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
private static ItemResult parseItemResult(Connection connection, ResultSet results) throws Exception {
int userId = results.getInt("user");
String username = ConfigHandler.playerIdCacheReversed.get(userId);
if (username == null) {
username = UserStatement.loadName(connection, userId);
}
return new ItemResult(
results.getLong("time"), username, WorldUtils.getWorldName(results.getInt("wid")),
results.getInt("x"), results.getInt("y"), results.getInt("z"),
results.getInt("type"), results.getInt("amount"), results.getBytes("data"),
results.getInt("action"), results.getInt("rolled_back")
);
}
}
@@ -1,109 +0,0 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import org.bukkit.Location;
import net.coreprotect.utility.WorldUtils;
final class LookupFilter {
private final Integer userId;
private final int checkTime;
private final Location location;
private final int radius;
private final int limitOffset;
private final int limitCount;
private LookupFilter(Integer userId, int checkTime, Location location, int radius, int limitOffset, int limitCount) {
this.userId = userId;
this.checkTime = checkTime;
this.location = location;
this.radius = radius;
this.limitOffset = limitOffset;
this.limitCount = limitCount;
}
static LookupFilter fromOptions(Connection connection, LookupOptions options) throws Exception {
if (options == null) {
options = LookupOptions.builder().build();
}
Integer userId = MessageAPI.getUserId(connection, options.getUser());
int checkTime = 0;
if (options.getTime() > 0) {
checkTime = (int) (System.currentTimeMillis() / 1000L) - options.getTime();
}
return new LookupFilter(userId, checkTime, options.getLocation(), options.getRadius(), options.getLimitOffset(), options.getLimitCount());
}
boolean hasInvalidUser() {
return userId != null && userId == -1;
}
boolean hasInvalidLocation() {
return location != null && location.getWorld() == null;
}
boolean hasLocation() {
return location != null;
}
void appendWhere(StringBuilder query) {
query.append("WHERE time > ?");
if (userId != null) {
query.append(" AND user = ?");
}
if (location != null) {
query.append(" AND wid = ?");
if (radius > 0) {
query.append(" AND x >= ? AND x <= ? AND z >= ? AND z <= ?");
}
else {
query.append(" AND x = ? AND y = ? AND z = ?");
}
}
}
void appendLimit(StringBuilder query) {
if (limitOffset >= 0 && limitCount >= 0) {
query.append(" LIMIT ").append(limitOffset).append(", ").append(limitCount);
}
}
int bind(PreparedStatement statement) throws Exception {
return bind(statement, 1);
}
int bind(PreparedStatement statement, int parameterIndex) throws Exception {
statement.setInt(parameterIndex++, checkTime);
if (userId != null) {
statement.setInt(parameterIndex++, userId);
}
if (location != null) {
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
statement.setInt(parameterIndex++, WorldUtils.getWorldId(location.getWorld().getName()));
if (radius > 0) {
statement.setInt(parameterIndex++, MessageAPI.clampToInt((long) x - radius));
statement.setInt(parameterIndex++, MessageAPI.clampToInt((long) x + radius));
statement.setInt(parameterIndex++, MessageAPI.clampToInt((long) z - radius));
statement.setInt(parameterIndex++, MessageAPI.clampToInt((long) z + radius));
}
else {
statement.setInt(parameterIndex++, x);
statement.setInt(parameterIndex++, y);
statement.setInt(parameterIndex++, z);
}
}
return parameterIndex;
}
}
@@ -1,100 +0,0 @@
package net.coreprotect.api;
import org.bukkit.Location;
/**
* Shared options for typed lookup API methods.
*/
public final class LookupOptions {
private final String user;
private final int time;
private final int radius;
private final Location location;
private final int limitOffset;
private final int limitCount;
private LookupOptions(Builder builder) {
this.user = builder.user;
this.time = builder.time;
this.radius = builder.radius;
this.location = builder.location;
this.limitOffset = builder.limitOffset;
this.limitCount = builder.limitCount;
}
public static Builder builder() {
return new Builder();
}
public String getUser() {
return user;
}
public int getTime() {
return time;
}
public int getRadius() {
return radius;
}
public Location getLocation() {
return location;
}
public int getLimitOffset() {
return limitOffset;
}
public int getLimitCount() {
return limitCount;
}
public boolean hasLimit() {
return limitOffset >= 0 && limitCount >= 0;
}
public static final class Builder {
private String user;
private int time;
private int radius = -1;
private Location location;
private int limitOffset = -1;
private int limitCount = -1;
private Builder() {
}
public Builder user(String user) {
this.user = user;
return this;
}
public Builder time(int time) {
this.time = time;
return this;
}
public Builder location(Location location) {
this.location = location;
this.radius = 0;
return this;
}
public Builder radius(Location location, int radius) {
this.location = location;
this.radius = radius;
return this;
}
public Builder limit(int offset, int count) {
this.limitOffset = offset;
this.limitCount = count;
return this;
}
public LookupOptions build() {
return new LookupOptions(this);
}
}
}
@@ -1,134 +0,0 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import net.coreprotect.api.result.MessageResult;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
/**
* Provides API methods for player chat and command lookups.
*/
public class MessageAPI {
private MessageAPI() {
throw new IllegalStateException("API class");
}
public static List<MessageResult> performChatLookup(String user, int offset) {
return performChatLookup(LookupOptions.builder().user(user).time(offset).build());
}
public static List<MessageResult> performChatLookup(LookupOptions options) {
return performLookup("chat", CoreProtectAction.CHAT, options);
}
public static List<MessageResult> performCommandLookup(String user, int offset) {
return performCommandLookup(LookupOptions.builder().user(user).time(offset).build());
}
public static List<MessageResult> performCommandLookup(LookupOptions options) {
return performLookup("command", CoreProtectAction.COMMAND, options);
}
private static List<MessageResult> performLookup(String table, CoreProtectAction action, LookupOptions options) {
List<MessageResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
LookupFilter filter = LookupFilter.fromOptions(connection, options);
if (filter.hasInvalidUser() || filter.hasInvalidLocation()) {
return result;
}
StringBuilder query = new StringBuilder("SELECT time,user,wid,x,y,z,message FROM ");
query.append(ConfigHandler.prefix).append(table).append(" ");
if (filter.hasLocation()) {
query.append(WorldUtils.getWidIndex(table));
}
filter.appendWhere(query);
query.append(" ORDER BY rowid DESC");
filter.appendLimit(query);
try (PreparedStatement statement = connection.prepareStatement(query.toString())) {
filter.bind(statement);
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseMessageResult(connection, results, action.id()));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
static Integer getUserId(Connection connection, String user) throws Exception {
if (user == null || user.isEmpty() || user.equalsIgnoreCase("#global")) {
return null;
}
Integer cachedId = ConfigHandler.playerIdCache.get(user.toLowerCase(java.util.Locale.ROOT));
if (cachedId != null) {
return cachedId;
}
String collate = Config.getGlobal().MYSQL ? "" : " COLLATE NOCASE";
try (PreparedStatement statement = connection.prepareStatement("SELECT rowid AS id FROM " + ConfigHandler.prefix + "user WHERE user = ?" + collate + " ORDER BY rowid ASC LIMIT 0, 1")) {
statement.setString(1, user);
try (ResultSet results = statement.executeQuery()) {
if (results.next()) {
int id = results.getInt("id");
ConfigHandler.playerIdCache.put(user.toLowerCase(java.util.Locale.ROOT), id);
ConfigHandler.playerIdCacheReversed.put(id, user);
return id;
}
}
}
return -1;
}
private static MessageResult parseMessageResult(Connection connection, ResultSet results, int actionId) throws Exception {
int userId = results.getInt("user");
String username = ConfigHandler.playerIdCacheReversed.get(userId);
if (username == null) {
username = UserStatement.loadName(connection, userId);
}
return new MessageResult(
results.getLong("time"), username, WorldUtils.getWorldName(results.getInt("wid")),
results.getInt("x"), results.getInt("y"), results.getInt("z"),
results.getString("message"), actionId
);
}
static int clampToInt(long value) {
if (value > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
else if (value < Integer.MIN_VALUE) {
return Integer.MIN_VALUE;
}
return (int) value;
}
}
@@ -3,141 +3,111 @@ package net.coreprotect.api;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import net.coreprotect.config.Config;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.consumer.Queue;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.utility.Util;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import net.coreprotect.config.Config;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.consumer.Queue;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.utility.MaterialUtils;
import net.coreprotect.utility.StringUtils;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
/**
* Provides API methods for looking up block-related actions in the processing queue.
* This class allows for retrieving actions that have not yet been saved to the database.
*/
public class QueueLookup extends Queue {
/**
* Private constructor to prevent instantiation.
* This is a utility class with static methods only.
*/
private QueueLookup() {
throw new IllegalStateException("API class");
}
/**
* Performs a lookup of block-related actions in the processing queue for the specified block.
* This allows retrieving actions that have not yet been committed to the database.
*
* @param block
* The block to look up in the processing queue
* @return List of results in a String array format, empty list if API is disabled or no results found
*/
public static List<String[]> performLookup(Block block) {
List<String[]> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
if (block == null) {
return result;
}
try {
// Determine total count of actions in the consumer queues
int consumerCount = calculateConsumerCount();
if (consumerCount == 0) {
return result;
int consumerCount = 0;
int currentConsumerSize = Process.getCurrentConsumerSize();
if (currentConsumerSize == 0) {
consumerCount = Consumer.getConsumerSize(0) + Consumer.getConsumerSize(1);
} else {
int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
consumerCount = Consumer.getConsumerSize(consumerId) + currentConsumerSize;
}
if (consumerCount == 0) {
return result;
}
// Get data from the current consumer
int currentConsumer = Consumer.currentConsumer;
ArrayList<Object[]> consumerData = Consumer.consumer.get(currentConsumer);
Map<Integer, String[]> users = Consumer.consumerUsers.get(currentConsumer);
Map<Integer, Object> consumerObject = Consumer.consumerObjects.get(currentConsumer);
// Current block location for comparison with actions in the queue
Location blockLocation = block.getLocation();
Location oldLocation = block.getLocation();
ListIterator<Object[]> iterator = consumerData.listIterator();
while (iterator.hasNext()) {
// Check for block actions in the processing queue
for (Object[] data : consumerData.toArray(Object[][]::new)) {
Object[] data = iterator.next();
int id = (int) data[0];
int action = (int) data[1];
// Only process block break and place actions
if (action != Process.BLOCK_BREAK && action != Process.BLOCK_PLACE) {
continue;
}
String[] userData = users.get(id);
Object objectData = consumerObject.get(id);
if (userData != null && objectData != null && (objectData instanceof BlockState)
&& ((BlockState) objectData).getLocation().equals(oldLocation))
{
// Verify the action pertains to the requested block
if (isActionForBlock(userData, objectData, blockLocation)) {
Material blockType = (Material) data[2];
int legacyData = (int) data[3];
String blockData = (String) data[7];
String user = userData[0];
BlockState blockState = (BlockState) objectData;
Location location = blockState.getLocation();
int worldId = WorldUtils.getWorldId(location.getWorld().getName());
int resultType = MaterialUtils.getBlockId(blockType);
int wid = Util.getWorldId(location.getWorld().getName());
int resultType = Util.getBlockId(blockType);
int time = (int) (System.currentTimeMillis() / 1000L);
String[] lookupData = new String[] { String.valueOf(time), user, String.valueOf(location.getBlockX()), String.valueOf(location.getBlockY()), String.valueOf(location.getBlockZ()), String.valueOf(resultType), String.valueOf(legacyData), String.valueOf(action), "0", String.valueOf(worldId), blockData };
String[] lookupData = new String[] { String.valueOf(time), user,
String.valueOf(location.getBlockX()), String.valueOf(location.getBlockY()),
String.valueOf(location.getBlockZ()), String.valueOf(resultType),
String.valueOf(legacyData), String.valueOf(action), "0", String.valueOf(wid), blockData };
String[] lineData = Util.toStringArray(lookupData);
result.add(lineData);
result.add(StringUtils.toStringArray(lookupData));
}
}
// Reverse the result list to match database lookup order (most recent first)
Collections.reverse(result);
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* Calculates the total count of actions in the consumer queues.
*
* @return The total count of actions in the consumer queues
*/
private static int calculateConsumerCount() {
int currentConsumerSize = Process.getCurrentConsumerSize();
if (currentConsumerSize == 0) {
return Consumer.getConsumerSize(0) + Consumer.getConsumerSize(1);
}
else {
int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
return Consumer.getConsumerSize(consumerId) + currentConsumerSize;
}
}
/**
* Determines if an action in the queue pertains to the specified block location.
*
* @param userData
* User data associated with the action
* @param objectData
* Object data associated with the action
* @param blockLocation
* Location of the block being looked up
* @return true if the action pertains to the specified block, false otherwise
*/
private static boolean isActionForBlock(String[] userData, Object objectData, Location blockLocation) {
return userData != null && objectData != null && (objectData instanceof BlockState) && ((BlockState) objectData).getLocation().equals(blockLocation);
}
}
@@ -1,231 +1,101 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import net.coreprotect.api.result.SessionResult;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
/**
* Provides API methods for looking up player session data in the CoreProtect database.
* Session data includes login/logout events and their associated timestamps and locations.
*/
public class SessionLookup {
/**
* The session type ID used for identifying session-related events.
*/
public static final int ID = 0;
/**
* Private constructor to prevent instantiation.
* This is a utility class with static methods only.
*/
private SessionLookup() {
throw new IllegalStateException("API class");
}
/**
* Performs a lookup of session-related actions for the specified user.
* This returns login and logout events within the specified time constraint.
*
* @param user
* The username to look up session data for
* @param offset
* Time constraint in seconds (0 means no time constraint)
* @return List of results in a String array format, empty list if API is disabled or no results found
*/
public static List<String[]> performLookup(String user, int offset) {
List<String[]> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
if (user == null) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
if (connection == null || user == null) {
return result;
}
// Prepare lookup parameters
String type = String.valueOf(ID);
int time = (int) (System.currentTimeMillis() / 1000L);
int checkTime = calculateCheckTime(time, offset);
int checkTime = 0;
if (offset > 0) {
// Get user ID from cache or load it
int userId = getUserId(connection, user);
checkTime = time - offset;
}
if (ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT)) == null) {
UserStatement.loadId(connection, user, null);
}
int userId = ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT));
// Query session data from database
try (Statement statement = connection.createStatement()) {
String query = buildSessionQuery(userId, checkTime);
try (ResultSet results = statement.executeQuery(query)) {
while (results.next()) {
String[] sessionData = extractSessionData(connection, results, type);
result.add(sessionData);
String query = "SELECT time,user,wid,x,y,z,action FROM " + ConfigHandler.prefix
+ "session WHERE user = '" + userId + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
ResultSet results = statement.executeQuery(query);
while (results.next()) {
String resultTime = results.getString("time");
int resultUserId = results.getInt("user");
String resultWorldId = results.getString("wid");
String resultX = results.getString("x");
String resultY = results.getString("y");
String resultZ = results.getString("z");
String resultAction = results.getString("action");
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
UserStatement.loadName(connection, resultUserId);
}
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
String[] lookupData = new String[] { resultTime, resultUser, resultX, resultY, resultZ,
resultWorldId, type, resultAction };
result.add(lookupData);
}
results.close();
}
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* Performs a typed lookup of session-related actions.
*
* @param options
* Lookup options
* @return List of typed session results, empty list if API is disabled or no results found
*/
public static List<SessionResult> performLookup(LookupOptions options) {
List<SessionResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
LookupFilter filter = LookupFilter.fromOptions(connection, options);
if (filter.hasInvalidUser() || filter.hasInvalidLocation()) {
return result;
}
StringBuilder query = new StringBuilder("SELECT time,user,wid,x,y,z,action FROM ");
query.append(ConfigHandler.prefix).append("session ");
if (filter.hasLocation()) {
query.append(WorldUtils.getWidIndex("session"));
}
filter.appendWhere(query);
query.append(" ORDER BY rowid DESC");
filter.appendLimit(query);
try (PreparedStatement statement = connection.prepareStatement(query.toString())) {
filter.bind(statement);
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseSessionResult(connection, results));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
/**
* Calculates the time threshold for the session lookup.
*
* @param currentTime
* The current time in seconds
* @param offset
* The time offset in seconds
* @return The calculated time threshold
*/
private static int calculateCheckTime(int currentTime, int offset) {
return (offset > 0) ? currentTime - offset : 0;
}
/**
* Gets the user ID for the specified username.
* If the user ID is not in the cache, it will be loaded from the database.
*
* @param connection
* The database connection
* @param username
* The username to get the ID for
* @return The user ID
*/
private static int getUserId(Connection connection, String username) {
String lowerUsername = username.toLowerCase(Locale.ROOT);
if (ConfigHandler.playerIdCache.get(lowerUsername) == null) {
UserStatement.loadId(connection, username, null);
}
return ConfigHandler.playerIdCache.get(lowerUsername);
}
/**
* Builds the SQL query for retrieving session data.
*
* @param userId
* The user ID to query for
* @param checkTime
* The time threshold for the query
* @return The SQL query string
*/
private static String buildSessionQuery(int userId, int checkTime) {
return "SELECT time,user,wid,x,y,z,action FROM " + ConfigHandler.prefix + "session WHERE user = '" + userId + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
}
/**
* Extracts session data from a result set row.
*
* @param connection
* The database connection
* @param results
* The result set to extract data from
* @param type
* The session type ID
* @return An array of session data values
* @throws Exception
* if an error occurs while extracting data
*/
private static String[] extractSessionData(Connection connection, ResultSet results, String type) throws Exception {
String resultTime = results.getString("time");
int resultUserId = results.getInt("user");
String resultWorldId = results.getString("wid");
String resultX = results.getString("x");
String resultY = results.getString("y");
String resultZ = results.getString("z");
String resultAction = results.getString("action");
// Get username from cache or load it
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
UserStatement.loadName(connection, resultUserId);
}
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
// Create and return the session data array
return new String[] { resultTime, resultUser, resultX, resultY, resultZ, resultWorldId, type, resultAction };
}
private static SessionResult parseSessionResult(Connection connection, ResultSet results) throws Exception {
int userId = results.getInt("user");
String username = ConfigHandler.playerIdCacheReversed.get(userId);
if (username == null) {
username = UserStatement.loadName(connection, userId);
}
return new SessionResult(
results.getLong("time"), username, WorldUtils.getWorldName(results.getInt("wid")),
results.getInt("x"), results.getInt("y"), results.getInt("z"), results.getInt("action")
);
}
}
@@ -1,110 +0,0 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import net.coreprotect.api.result.SignResult;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.model.action.SignActions;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
/**
* Provides API methods for sign text lookups.
*/
public class SignAPI {
private SignAPI() {
throw new IllegalStateException("API class");
}
public static List<SignResult> performLookup(Location location, int offset) {
if (location == null) {
return new ArrayList<>();
}
return performLookup(LookupOptions.builder().time(offset).location(location).build());
}
public static List<SignResult> performLookup(LookupOptions options) {
List<SignResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
LookupFilter filter = LookupFilter.fromOptions(connection, options);
if (filter.hasInvalidUser() || filter.hasInvalidLocation()) {
return result;
}
StringBuilder query = new StringBuilder("SELECT time,user,wid,x,y,z,action,color,color_secondary,data,waxed,face,line_1,line_2,line_3,line_4,line_5,line_6,line_7,line_8 FROM ");
query.append(ConfigHandler.prefix).append("sign ");
if (filter.hasLocation()) {
query.append(WorldUtils.getWidIndex("sign"));
}
filter.appendWhere(query);
query.append(" AND action = '").append(SignActions.PLACE).append("' AND (LENGTH(line_1) > 0 OR LENGTH(line_2) > 0 OR LENGTH(line_3) > 0 OR LENGTH(line_4) > 0 OR LENGTH(line_5) > 0 OR LENGTH(line_6) > 0 OR LENGTH(line_7) > 0 OR LENGTH(line_8) > 0)");
query.append(" ORDER BY rowid DESC");
filter.appendLimit(query);
try (PreparedStatement statement = connection.prepareStatement(query.toString())) {
filter.bind(statement);
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseSignResult(connection, results));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
private static SignResult parseSignResult(Connection connection, ResultSet results) throws Exception {
int userId = results.getInt("user");
String username = ConfigHandler.playerIdCacheReversed.get(userId);
if (username == null) {
username = UserStatement.loadName(connection, userId);
}
String[] lines = new String[] {
valueOrEmpty(results.getString("line_1")),
valueOrEmpty(results.getString("line_2")),
valueOrEmpty(results.getString("line_3")),
valueOrEmpty(results.getString("line_4")),
valueOrEmpty(results.getString("line_5")),
valueOrEmpty(results.getString("line_6")),
valueOrEmpty(results.getString("line_7")),
valueOrEmpty(results.getString("line_8"))
};
return new SignResult(
results.getLong("time"), username, WorldUtils.getWorldName(results.getInt("wid")),
results.getInt("x"), results.getInt("y"), results.getInt("z"),
results.getInt("action"), results.getInt("color"), results.getInt("color_secondary"),
results.getInt("data"), results.getInt("waxed") == 1, results.getInt("face") == 0, lines
);
}
private static String valueOrEmpty(String value) {
return value == null ? "" : value;
}
}
@@ -1,151 +0,0 @@
package net.coreprotect.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import net.coreprotect.api.result.UsernameResult;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.utility.ErrorReporter;
/**
* Provides API methods for username history lookups.
*/
public class UsernameAPI {
private UsernameAPI() {
throw new IllegalStateException("API class");
}
public static List<UsernameResult> performLookup(String user, int offset) {
return performLookup(LookupOptions.builder().user(user).time(offset).build());
}
public static List<UsernameResult> performLookup(LookupOptions options) {
List<UsernameResult> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
if (options == null) {
options = LookupOptions.builder().build();
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null) {
return result;
}
Set<String> uuids = getUuids(connection, options.getUser());
if (uuids == null) {
return result;
}
int checkTime = 0;
if (options.getTime() > 0) {
checkTime = (int) (System.currentTimeMillis() / 1000L) - options.getTime();
}
StringBuilder query = new StringBuilder("SELECT time,uuid,user FROM ");
query.append(ConfigHandler.prefix).append("username_log WHERE time > ?");
if (!uuids.isEmpty()) {
query.append(" AND uuid IN (");
appendPlaceholders(query, uuids.size());
query.append(")");
}
query.append(" ORDER BY rowid DESC");
if (options.hasLimit()) {
query.append(" LIMIT ").append(options.getLimitOffset()).append(", ").append(options.getLimitCount());
}
try (PreparedStatement statement = connection.prepareStatement(query.toString())) {
int parameterIndex = 1;
statement.setInt(parameterIndex++, checkTime);
for (String uuid : uuids) {
statement.setString(parameterIndex++, uuid);
}
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(parseUsernameResult(results));
}
}
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
private static void appendPlaceholders(StringBuilder query, int count) {
for (int index = 0; index < count; index++) {
if (index > 0) {
query.append(",");
}
query.append("?");
}
}
private static Set<String> getUuids(Connection connection, String user) throws Exception {
Set<String> result = new LinkedHashSet<>();
if (user == null || user.isEmpty() || user.equalsIgnoreCase("#global")) {
return result;
}
String cachedUuid = ConfigHandler.uuidCache.get(user.toLowerCase(Locale.ROOT));
if (cachedUuid != null) {
result.add(cachedUuid);
}
String collate = Config.getGlobal().MYSQL ? "" : " COLLATE NOCASE";
try (PreparedStatement statement = connection.prepareStatement("SELECT uuid FROM " + ConfigHandler.prefix + "user WHERE user = ?" + collate)) {
statement.setString(1, user);
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(results.getString("uuid"));
}
}
}
try (PreparedStatement statement = connection.prepareStatement("SELECT uuid FROM " + ConfigHandler.prefix + "username_log WHERE user = ?" + collate)) {
statement.setString(1, user);
try (ResultSet results = statement.executeQuery()) {
while (results.next()) {
result.add(results.getString("uuid"));
}
}
}
if (looksLikeUuid(user)) {
result.add(user);
}
return result.isEmpty() ? null : result;
}
private static boolean looksLikeUuid(String value) {
return value.length() == 36 && value.charAt(8) == '-' && value.charAt(13) == '-' && value.charAt(18) == '-' && value.charAt(23) == '-';
}
private static UsernameResult parseUsernameResult(ResultSet results) throws Exception {
String uuid = results.getString("uuid");
String username = results.getString("user");
String player = ConfigHandler.uuidCacheReversed.get(uuid);
if (player == null) {
player = username;
}
return new UsernameResult(results.getLong("time"), uuid, username, player);
}
}
@@ -1,131 +0,0 @@
package net.coreprotect.api.result;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.EntityType;
import net.coreprotect.model.action.LookupActions;
import net.coreprotect.utility.BlockUtils;
import net.coreprotect.utility.BlockTypeUtils;
import net.coreprotect.utility.EntityUtils;
import net.coreprotect.utility.MaterialUtils;
import net.coreprotect.utility.StringUtils;
/**
* Represents a logged block action.
*/
public class BlockResult implements CoreProtectResult {
private final long time;
private final String username;
private final String world;
private final int x;
private final int y;
private final int z;
private final int type;
private final int data;
private final String blockData;
private final int actionId;
private final int rolledBack;
public BlockResult(long time, String username, String world, int x, int y, int z, int type, int data, String blockData, int actionId, int rolledBack) {
this.time = time;
this.username = username;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.type = type;
this.data = data;
this.blockData = blockData;
this.actionId = actionId;
this.rolledBack = rolledBack;
}
public int getActionId() {
return actionId;
}
public String getActionString() {
return LookupActions.getActionString(actionId);
}
@Deprecated
public int getData() {
return data;
}
public String getPlayer() {
return username;
}
public long getTimestamp() {
return time * 1000L;
}
public Material getType() {
if (actionId == LookupActions.ENTITY_KILL) {
return null;
}
Material material = MaterialUtils.getType(type);
if (material == null) {
return null;
}
String typeName = material.name().toLowerCase(Locale.ROOT);
return MaterialUtils.getType(StringUtils.nameFilter(typeName, data));
}
public EntityType getEntityType() {
if (actionId != LookupActions.ENTITY_KILL) {
return null;
}
if (type == 0) {
return EntityType.PLAYER;
}
return EntityUtils.getEntityType(type);
}
public BlockData getBlockData() {
if (actionId == LookupActions.ENTITY_KILL) {
return null;
}
if (blockData == null || blockData.isEmpty()) {
Material material = getType();
if (material != null) {
return material.createBlockData();
}
return BlockUtils.createBlockData(type);
}
BlockData result = BlockTypeUtils.createBlockDataFromString(blockData);
return result != null ? result : Bukkit.getServer().createBlockData(blockData);
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
public boolean isRolledBack() {
return rolledBack == 1 || rolledBack == 3;
}
public String worldName() {
return world;
}
}
@@ -1,173 +0,0 @@
package net.coreprotect.api.result;
import org.bukkit.Material;
import net.coreprotect.model.item.ItemTransactionActions;
import net.coreprotect.utility.MaterialUtils;
/**
* Represents the result of a container action lookup with typed fields.
*/
public class ContainerResult implements CoreProtectResult {
private final long time;
private final String username;
private final String world;
private final int x;
private final int y;
private final int z;
private final int type;
private final int data;
private final int amount;
private final byte[] metadata;
private final int action;
private final int rolledBack;
/**
* Creates a new ContainerResult with the specified parameters.
*
* @param time The timestamp in seconds
* @param username The username of the player who performed the action
* @param world The world name where the action occurred
* @param x The X coordinate
* @param y The Y coordinate
* @param z The Z coordinate
* @param type The material type ID
* @param data The data value
* @param amount The amount of items
* @param metadata The item metadata
* @param action The action ID
* @param rolledBack Whether the action has been rolled back
*/
public ContainerResult(long time, String username, String world, int x, int y, int z,
int type, int data, int amount, byte[] metadata, int action, int rolledBack) {
this.time = time;
this.username = username != null ? username : "";
this.world = world != null ? world : "";
this.x = x;
this.y = y;
this.z = z;
this.type = type;
this.data = data;
this.amount = amount;
this.metadata = metadata != null ? metadata.clone() : null;
this.action = action;
this.rolledBack = rolledBack;
}
/**
* Gets the action ID.
*
* @return The action ID
*/
public int getActionId() {
return action;
}
/**
* Gets the action as a human-readable string.
*
* @return "remove", "add", or "unknown"
*/
public String getActionString() {
return ItemTransactionActions.getActionString(action);
}
/**
* Gets the data value.
*
* @return The data value
*/
public int getData() {
return data;
}
/**
* Gets the amount of items.
*
* @return The amount
*/
public int getAmount() {
return amount;
}
/**
* Gets the username of the player who performed the action.
*
* @return The player username
*/
public String getPlayer() {
return username;
}
/**
* Gets the timestamp in milliseconds.
*
* @return The timestamp in milliseconds
*/
public long getTimestamp() {
return time * 1000L;
}
/**
* Gets the material type of the item.
*
* @return The Material, or null if unknown
*/
public Material getType() {
return MaterialUtils.getType(type);
}
/**
* Gets the X coordinate.
*
* @return The X coordinate
*/
public int getX() {
return x;
}
/**
* Gets the Y coordinate.
*
* @return The Y coordinate
*/
public int getY() {
return y;
}
/**
* Gets the Z coordinate.
*
* @return The Z coordinate
*/
public int getZ() {
return z;
}
/**
* Gets the item metadata.
*
* @return A copy of the metadata array, or null if no metadata
*/
public byte[] getMetadata() {
return metadata != null ? metadata.clone() : null;
}
/**
* Checks if this action has been rolled back.
*
* @return true if rolled back, false otherwise
*/
public boolean isRolledBack() {
return rolledBack == 1 || rolledBack == 3;
}
/**
* Gets the world name where the action occurred.
*
* @return The world name
*/
public String worldName() {
return world;
}
}
@@ -1,22 +0,0 @@
package net.coreprotect.api.result;
/**
* Common fields shared by typed CoreProtect lookup results.
*/
public interface CoreProtectResult {
int getActionId();
String getActionString();
String getPlayer();
long getTimestamp();
int getX();
int getY();
int getZ();
String worldName();
}
@@ -1,120 +0,0 @@
package net.coreprotect.api.result;
import org.bukkit.Material;
import net.coreprotect.model.item.InventorySources;
import net.coreprotect.model.item.ItemTransactionActions;
import net.coreprotect.utility.ItemUtils;
import net.coreprotect.utility.MaterialUtils;
/**
* Represents a normalized player inventory transaction.
*/
public class InventoryResult implements CoreProtectResult {
private final long time;
private final String username;
private final String world;
private final int x;
private final int y;
private final int z;
private final int type;
private final int data;
private final int amount;
private final byte[] metadata;
private final int actionId;
private final int transactionActionId;
private final int rolledBack;
private final int sourceId;
public InventoryResult(long time, String username, String world, int x, int y, int z, int type, int data, int amount, byte[] metadata, int transactionActionId, int rolledBack, int sourceId) {
this.time = time;
this.username = username;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.type = type;
this.data = data;
this.amount = amount;
this.metadata = metadata != null ? metadata.clone() : null;
this.transactionActionId = transactionActionId;
this.rolledBack = rolledBack;
this.sourceId = sourceId;
this.actionId = ItemTransactionActions.getInventoryActionId(transactionActionId);
}
public int getActionId() {
return actionId;
}
public String getActionString() {
return ItemTransactionActions.getActionString(actionId);
}
public int getAmount() {
return amount;
}
@Deprecated
public int getData() {
return data;
}
public byte[] getMetadata() {
return metadata != null ? metadata.clone() : null;
}
public String getPlayer() {
return username;
}
public int getSourceId() {
return sourceId;
}
public String getSource() {
return InventorySources.getSourceString(sourceId);
}
public long getTimestamp() {
return time * 1000L;
}
public int getTransactionActionId() {
return transactionActionId;
}
public String getTransactionActionString() {
return ItemTransactionActions.getActionString(transactionActionId);
}
public Material getType() {
Material material = MaterialUtils.getType(type);
if (sourceId == InventorySources.BLOCK) {
return ItemUtils.itemFilter(material, true);
}
return material;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
public boolean isRolledBack() {
return rolledBack == 2 || rolledBack == 3;
}
public String worldName() {
return world;
}
}
@@ -1,85 +0,0 @@
package net.coreprotect.api.result;
import org.bukkit.Material;
import net.coreprotect.model.item.ItemTransactionActions;
import net.coreprotect.utility.MaterialUtils;
/**
* Represents a logged world item transaction.
*/
public class ItemResult implements CoreProtectResult {
private final long time;
private final String username;
private final String world;
private final int x;
private final int y;
private final int z;
private final int type;
private final int amount;
private final byte[] metadata;
private final int actionId;
private final int rolledBack;
public ItemResult(long time, String username, String world, int x, int y, int z, int type, int amount, byte[] metadata, int actionId, int rolledBack) {
this.time = time;
this.username = username;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.type = type;
this.amount = amount;
this.metadata = metadata != null ? metadata.clone() : null;
this.actionId = actionId;
this.rolledBack = rolledBack;
}
public int getActionId() {
return actionId;
}
public String getActionString() {
return ItemTransactionActions.getActionString(actionId);
}
public int getAmount() {
return amount;
}
public byte[] getMetadata() {
return metadata != null ? metadata.clone() : null;
}
public String getPlayer() {
return username;
}
public long getTimestamp() {
return time * 1000L;
}
public Material getType() {
return MaterialUtils.getType(type);
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
public boolean isRolledBack() {
return rolledBack == 1 || rolledBack == 3;
}
public String worldName() {
return world;
}
}
@@ -1,64 +0,0 @@
package net.coreprotect.api.result;
import net.coreprotect.model.action.LookupActions;
/**
* Represents a logged player chat message or command.
*/
public class MessageResult implements CoreProtectResult {
private final long time;
private final String username;
private final String world;
private final int x;
private final int y;
private final int z;
private final String message;
private final int actionId;
public MessageResult(long time, String username, String world, int x, int y, int z, String message, int actionId) {
this.time = time;
this.username = username;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.message = message;
this.actionId = actionId;
}
public int getActionId() {
return actionId;
}
public String getActionString() {
return LookupActions.getActionString(actionId);
}
public String getMessage() {
return message;
}
public String getPlayer() {
return username;
}
public long getTimestamp() {
return time * 1000L;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
public String worldName() {
return world;
}
}
@@ -1,124 +0,0 @@
package net.coreprotect.api.result;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import net.coreprotect.api.SessionLookup;
import net.coreprotect.model.action.LookupActions;
import net.coreprotect.model.action.SessionActions;
import net.coreprotect.utility.BlockUtils;
import net.coreprotect.utility.BlockTypeUtils;
import net.coreprotect.utility.EntityUtils;
import net.coreprotect.utility.MaterialUtils;
import net.coreprotect.utility.StringUtils;
import net.coreprotect.utility.WorldUtils;
public class ParseResult implements CoreProtectResult {
private final String[] parse;
public ParseResult(String[] data) {
parse = data;
}
public int getActionId() {
return Integer.parseInt(parse[7]);
}
public String getActionString() {
int actionID = Integer.parseInt(parse[7]);
if (parse.length < 13 && Integer.parseInt(parse[6]) == SessionLookup.ID) {
return SessionActions.getActionString(actionID);
}
return LookupActions.getActionString(actionID);
}
@Deprecated
public int getData() {
return Integer.parseInt(parse[6]);
}
public String getPlayer() {
return parse[1];
}
@Deprecated
public int getTime() {
return Integer.parseInt(parse[0]);
}
public long getTimestamp() {
return Long.parseLong(parse[0]) * 1000L;
}
public Material getType() {
if (parse.length < 13) {
return null;
}
int actionID = this.getActionId();
int type = Integer.parseInt(parse[5]);
String typeName;
if (actionID == 3) {
typeName = EntityUtils.getEntityType(type).name();
}
else {
Material material = MaterialUtils.getType(type);
if (material == null) {
return null;
}
typeName = material.name().toLowerCase(Locale.ROOT);
typeName = StringUtils.nameFilter(typeName, this.getData());
}
return MaterialUtils.getType(typeName);
}
public BlockData getBlockData() {
if (parse.length < 13) {
return null;
}
String blockData = parse[12];
if (blockData == null || blockData.length() == 0) {
Material type = getType();
if (type != null) {
return type.createBlockData();
}
return BlockUtils.createBlockData(Integer.parseInt(parse[5]));
}
BlockData result = BlockTypeUtils.createBlockDataFromString(blockData);
return result != null ? result : Bukkit.getServer().createBlockData(blockData);
}
public int getX() {
return Integer.parseInt(parse[2]);
}
public int getY() {
return Integer.parseInt(parse[3]);
}
public int getZ() {
return Integer.parseInt(parse[4]);
}
public boolean isRolledBack() {
if (parse.length < 13) {
return false;
}
return (Integer.parseInt(parse[8]) == 1 || Integer.parseInt(parse[8]) == 3);
}
public String worldName() {
return WorldUtils.getWorldName(Integer.parseInt(parse.length < 13 ? parse[5] : parse[9]));
}
}
@@ -1,58 +0,0 @@
package net.coreprotect.api.result;
import net.coreprotect.model.action.SessionActions;
/**
* Represents a logged player login or logout session event.
*/
public class SessionResult implements CoreProtectResult {
private final long time;
private final String username;
private final String world;
private final int x;
private final int y;
private final int z;
private final int actionId;
public SessionResult(long time, String username, String world, int x, int y, int z, int actionId) {
this.time = time;
this.username = username;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.actionId = actionId;
}
public int getActionId() {
return actionId;
}
public String getActionString() {
return SessionActions.getActionString(actionId);
}
public String getPlayer() {
return username;
}
public long getTimestamp() {
return time * 1000L;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
public String worldName() {
return world;
}
}
@@ -1,129 +0,0 @@
package net.coreprotect.api.result;
import net.coreprotect.model.action.SignActions;
import net.coreprotect.utility.BlockUtils;
/**
* Represents logged sign text.
*/
public class SignResult implements CoreProtectResult {
private final long time;
private final String username;
private final String world;
private final int x;
private final int y;
private final int z;
private final int actionId;
private final int color;
private final int colorSecondary;
private final int data;
private final boolean waxed;
private final boolean front;
private final String[] lines;
public SignResult(long time, String username, String world, int x, int y, int z, int actionId, int color, int colorSecondary, int data, boolean waxed, boolean front, String[] lines) {
this.time = time;
this.username = username;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.actionId = actionId;
this.color = color;
this.colorSecondary = colorSecondary;
this.data = data;
this.waxed = waxed;
this.front = front;
this.lines = lines.clone();
}
public int getActionId() {
return actionId;
}
public String getActionString() {
return SignActions.getActionString(actionId);
}
public int getColor() {
return color;
}
public int getColorSecondary() {
return colorSecondary;
}
public int getData() {
return data;
}
public String getLine(int line) {
if (line < 0 || line >= lines.length) {
return "";
}
return lines[line];
}
public String[] getLines() {
return lines.clone();
}
public String getMessage() {
StringBuilder message = new StringBuilder();
int startLine = front ? 0 : 4;
int endLine = front ? 4 : 8;
for (int index = startLine; index < endLine; index++) {
String line = lines[index];
if (line != null && !line.isEmpty()) {
message.append(line);
if (!line.endsWith(" ")) {
message.append(" ");
}
}
}
return message.toString();
}
public String getPlayer() {
return username;
}
public long getTimestamp() {
return time * 1000L;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
public boolean isBackGlowing() {
return BlockUtils.isSideGlowing(false, data);
}
public boolean isFront() {
return front;
}
public boolean isFrontGlowing() {
return BlockUtils.isSideGlowing(true, data);
}
public boolean isWaxed() {
return waxed;
}
public String worldName() {
return world;
}
}
@@ -1,60 +0,0 @@
package net.coreprotect.api.result;
import net.coreprotect.model.action.LookupActions;
/**
* Represents a logged username used by a player UUID.
*/
public class UsernameResult implements CoreProtectResult {
private final long time;
private final String uuid;
private final String username;
private final String player;
public UsernameResult(long time, String uuid, String username, String player) {
this.time = time;
this.uuid = uuid;
this.username = username;
this.player = player;
}
public int getActionId() {
return LookupActions.USERNAME;
}
public String getActionString() {
return LookupActions.getActionString(getActionId());
}
public String getPlayer() {
return player;
}
public long getTimestamp() {
return time * 1000L;
}
public String getUsername() {
return username;
}
public String getUuid() {
return uuid;
}
public int getX() {
return 0;
}
public int getY() {
return 0;
}
public int getZ() {
return 0;
}
public String worldName() {
return "";
}
}
@@ -1,23 +1,15 @@
package net.coreprotect.bukkit;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.bukkit.Art;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.utility.Util;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
@@ -28,12 +20,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting;
import org.bukkit.entity.Villager;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe;
@@ -43,20 +30,9 @@ import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionType;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.utility.BlockUtils;
/**
* Base adapter implementation for Bukkit API compatibility.
* Provides default implementations for methods that work across multiple Minecraft versions.
* Version-specific implementations extend this class to provide specialized behavior.
*/
public class BukkitAdapter implements BukkitInterface {
/** The currently active adapter instance */
public static BukkitInterface ADAPTER;
// Version constants for Bukkit implementations
public static final int BUKKIT_V1_13 = 13;
public static final int BUKKIT_V1_14 = 14;
public static final int BUKKIT_V1_15 = 15;
@@ -65,200 +41,92 @@ public class BukkitAdapter implements BukkitInterface {
public static final int BUKKIT_V1_18 = 18;
public static final int BUKKIT_V1_19 = 19;
public static final int BUKKIT_V1_20 = 20;
public static final int BUKKIT_V1_21 = 21;
public static final int BUKKIT_V26_0 = 26000;
public static final int BUKKIT_V26_1 = 26010;
public static final int BUKKIT_V26_2 = 26020;
public static int getAdapterVersion(int major, int minor) {
return getAdapterVersion(major, minor, 0);
}
public static int getAdapterVersion(int major, int minor, int patch) {
return major == 1 ? minor : (major * 1000) + (minor * 10) + patch;
}
/**
* Initializes the appropriate Bukkit adapter based on the server version.
* This method should be called during plugin initialization.
*/
public static void loadAdapter() {
switch (ConfigHandler.SERVER_VERSION) {
case BUKKIT_V1_13:
case BUKKIT_V1_14:
case BUKKIT_V1_15:
case BUKKIT_V1_16:
ADAPTER = new BukkitAdapter();
BukkitAdapter.ADAPTER = new BukkitAdapter();
break;
case BUKKIT_V1_17:
ADAPTER = new Bukkit_v1_17();
BukkitAdapter.ADAPTER = new Bukkit_v1_17();
break;
case BUKKIT_V1_18:
ADAPTER = new Bukkit_v1_18();
BukkitAdapter.ADAPTER = new Bukkit_v1_18();
break;
case BUKKIT_V1_19:
ADAPTER = new Bukkit_v1_19();
break;
case BUKKIT_V1_20:
ADAPTER = new Bukkit_v1_20();
break;
case BUKKIT_V1_21:
case BUKKIT_V26_0:
case BUKKIT_V26_1:
ADAPTER = new Bukkit_v1_21();
break;
case BUKKIT_V26_2:
ADAPTER = new Bukkit_v26_2();
BukkitAdapter.ADAPTER = new Bukkit_v1_19();
break;
default:
ADAPTER = ConfigHandler.SERVER_VERSION >= BUKKIT_V26_2 ? new Bukkit_v26_2() : new Bukkit_v1_21();
BukkitAdapter.ADAPTER = new Bukkit_v1_19();
break;
}
}
// -------------------- Basic data conversion methods --------------------
public static Set<Material> EMPTY_SET = new HashSet<>(Arrays.asList());
}
}
@Override
public String parseLegacyName(String name) {
return name;
}
@Override
public int getLegacyBlockId(Material material) {
return -1;
}
// -------------------- Entity methods --------------------
return -1;
}
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
return false;
}
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
return false;
}
@Override
public void addMerchantRecipeMeta(MerchantRecipe recipe, List<Object> recipeData) {
}
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list,
List<List<Map<String, Object>>> metadata, int slot)
{
@Override
public void setMerchantRecipeMeta(MerchantRecipe recipe, List<?> recipeData) {
}
@Override
public void refreshVillagerBrain(Villager villager) {
try {
Object handle = villager.getClass().getMethod("getHandle").invoke(villager);
Object level = villager.getWorld().getClass().getMethod("getHandle").invoke(villager.getWorld());
invokeSingleArgumentMethod(handle, "refreshBrain", level);
}
catch (Exception e) {
}
}
@Override
public void getWolfVariant(org.bukkit.entity.Wolf wolf, List<Object> info) {
// Base implementation does nothing - Wolf variants only exist in 1.21+
}
@Override
public void setWolfVariant(org.bukkit.entity.Wolf wolf, Object value) {
// Base implementation does nothing - Wolf variants only exist in 1.21+
}
@Override
public EntityType getEntityType(Material material) {
switch (material) {
case END_CRYSTAL:
return EntityType.valueOf("ENDER_CRYSTAL");
default:
return EntityType.UNKNOWN;
}
}
// -------------------- Item handling methods --------------------
@Override
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot) {
return false;
}
@Override
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map) {
return false;
}
@Override
public Material getPlantSeeds(Material material) {
switch (material) {
case WHEAT:
return Material.WHEAT_SEEDS;
case PUMPKIN_STEM:
return Material.PUMPKIN_SEEDS;
case MELON_STEM:
return Material.MELON_SEEDS;
case BEETROOTS:
return Material.BEETROOT_SEEDS;
default:
return material;
}
}
@Override
public ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack) {
return null;
}
@Override
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack) {
PotionData data = arrow.getBasePotionData();
if (data.getType() != PotionType.valueOf("UNCRAFTABLE")) {
itemStack = new ItemStack(Material.TIPPED_ARROW);
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
meta.setBasePotionData(data);
for (PotionEffect effect : arrow.getCustomEffects()) {
meta.addCustomEffect(effect, false);
}
itemStack.setItemMeta(meta);
}
return itemStack;
}
private static void invokeSingleArgumentMethod(Object target, String methodName, Object argument) {
if (target == null || argument == null) {
return;
}
for (Method method : target.getClass().getMethods()) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (method.getName().equals(methodName) && parameterTypes.length == 1 && parameterTypes[0].isInstance(argument)) {
try {
method.invoke(target, argument);
}
catch (Exception e) {
}
return;
}
}
}
// -------------------- Block methods --------------------
@Override
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin) {
if (blockData instanceof Directional && blockData instanceof FaceAttachable) {
Directional directional = (Directional) blockData;
FaceAttachable faceAttachable = (FaceAttachable) blockData;
boolean scanButton = false;
switch (faceAttachable.getAttachedFace()) {
case WALL:
scanButton = (scanMin < 5 && scanBlock.getRelative(directional.getFacing().getOppositeFace()).getLocation().equals(block.getLocation()));
scanButton = (scanMin < 5 && scanBlock.getRelative(directional.getFacing().getOppositeFace())
.getLocation().equals(block.getLocation()));
break;
case FLOOR:
scanButton = (scanMin == 5);
@@ -268,237 +136,282 @@ public class BukkitAdapter implements BukkitInterface {
break;
default:
break;
}
return scanButton;
}
return true; // unvalidated attachments default to true
}
@Override
public int getMinHeight(World world) {
return 0;
}
@Override
public Material getBucketContents(Material material) {
return Material.AIR;
}
@Override
public boolean hasBlockType(String key) {
return false;
}
@Override
public BlockData createBlockData(String key) {
return null;
}
@Override
public BlockData createBlockDataFromString(String blockData) {
return null;
}
@Override
public boolean isInvisible(Material material) {
return BlockUtils.isAir(material);
}
// -------------------- Special block type checkers --------------------
@Override
public boolean isItemFrame(Material material) {
return material == Material.ITEM_FRAME;
return (material == Material.ITEM_FRAME);
}
@Override
public Material getFrameType(Entity entity) {
return Material.ITEM_FRAME;
}
@Override
public Material getFrameType(EntityType type) {
return type == EntityType.ITEM_FRAME ? Material.ITEM_FRAME : null;
}
@Override
public Class<?> getFrameClass(Material material) {
return ItemFrame.class;
}
@Override
public boolean isDecoratedPot(Material material) {
return false;
}
@Override
public boolean isSuspiciousBlock(Material material) {
return false;
}
@Override
public boolean isSign(Material material) {
return Tag.SIGNS.isTagged(material);
}
@Override
public boolean isChiseledBookshelf(Material material) {
return false;
}
@Override
public boolean isBookshelfBook(Material material) {
return false;
}
@Override
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event) {
return null;
}
// -------------------- Sign handling methods --------------------
@Override
public String getLine(Sign sign, int line) {
if (line < 4) {
return sign.getLine(line);
}
else {
return "";
}
}
@Override
public void setLine(Sign sign, int line, String string) {
if (string == null) {
string = "";
}
if (line < 4) {
sign.setLine(line, string);
}
}
@Override
public boolean isSignFront(SignChangeEvent event) {
return true;
}
@Override
public boolean isGlowing(Sign sign, boolean isFront) {
return false;
}
@Override
public boolean isWaxed(Sign sign) {
return false;
}
@Override
public boolean shouldLogExplosion(Event event){
return true;
public boolean isInvisible(Material material) {
return Util.isAir(material);
}
@Override
public Material getExplodedBlock(BlockExplodeEvent event){
// accoding to the Bukkit docs this will always return air
return event.getBlock().getType();
public ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack) {
return null;
}
@Override
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
// Base implementation does nothing
return;
}
@Override
public void setColor(Sign sign, boolean isFront, int color) {
if (!isFront) {
return;
}
sign.setColor(DyeColor.getByColor(Color.fromRGB(color)));
}
@Override
public void setWaxed(Sign sign, boolean isWaxed) {
// Base implementation does nothing
return;
}
@Override
public int getColor(Sign sign, boolean isFront) {
if (isFront) {
return sign.getColor().getColor().asRGB();
}
return 0;
}
// -------------------- Registry methods --------------------
@Override
public Material getPlantSeeds(Material material) {
switch (material) {
case WHEAT:
material = Material.WHEAT_SEEDS;
break;
case PUMPKIN_STEM:
material = Material.PUMPKIN_SEEDS;
break;
case MELON_STEM:
material = Material.MELON_SEEDS;
break;
case BEETROOTS:
material = Material.BEETROOT_SEEDS;
break;
default:
}
return material;
}
@Override
public boolean isDecoratedPot(Material material) {
return false;
}
@Override
public boolean isSuspiciousBlock(Material material) {
return false;
}
@Override
public boolean isSign(Material material) {
return Tag.SIGNS.isTagged(material);
}
@Override
public boolean isChiseledBookshelf(Material material) {
return false;
}
@Override
public boolean isBookshelfBook(Material material) {
return false;
}
@Override
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event) {
return null;
}
@Override
public String getLine(Sign sign, int line) {
if (line < 4) {
return sign.getLine(line);
} else {
return "";
}
}
@Override
public void setLine(Sign sign, int line, String string) {
if (string == null) {
string = "";
}
if (line < 4) {
sign.setLine(line, string);
}
}
@Override
public boolean isSignFront(SignChangeEvent event) {
return true;
}
@Override
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack) {
PotionData data = arrow.getBasePotionData();
if (data.getType() != PotionType.valueOf("UNCRAFTABLE")) {
itemStack = new ItemStack(Material.TIPPED_ARROW);
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
meta.setBasePotionData(data);
for (PotionEffect effect : arrow.getCustomEffects()) {
meta.addCustomEffect(effect, false);
}
itemStack.setItemMeta(meta);
}
return itemStack;
}
@Override
public EntityType getEntityType(Material material) {
switch (material) {
case END_CRYSTAL:
return EntityType.valueOf("ENDER_CRYSTAL");
default:
return EntityType.UNKNOWN;
}
}
@Override
public Object getRegistryKey(Object value) {
return value;
}
@Override
public Object getRegistryValue(String key, Object tClass) {
return null;
}
@Override
public String getPaintingArtKey(Painting painting) {
try {
return painting.getArt().name();
}
catch (IncompatibleClassChangeError e) {
return painting.getArt().toString();
}
}
@Override
public Art getPaintingArt(String name) {
if (name == null || name.isBlank()) {
return null;
}
return Art.getByName(name.toUpperCase(Locale.ROOT));
}
@Override
public boolean isCrafter(InventoryType type) {
return false;
}
@Override
public boolean isBundle(Material material) {
return false;
}
@Override
public boolean isCopperChest(Material material) {
return false;
}
@Override
public boolean isShelf(Material material){
return false;
}
@Override
public List<Location> getShelfInteractionLocations(Block block, BlockFace blockFace) {
return Collections.emptyList();
}
@Override
public Set<Material> copperChestMaterials() {
return EMPTY_SET;
}
@Override
public Set<Material> shelfMaterials() {
return EMPTY_SET;
}
}
@@ -2,14 +2,9 @@ package net.coreprotect.bukkit;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Art;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
@@ -17,519 +12,83 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting;
import org.bukkit.entity.Villager;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe;
import org.bukkit.inventory.meta.ItemMeta;
/**
* Interface for Bukkit API compatibility across different Minecraft versions.
* Each method provides version-specific implementations to handle differences
* between Minecraft/Bukkit API versions.
*/
public interface BukkitInterface {
// --------------------------------------------------------------------------
// Block-related methods
// --------------------------------------------------------------------------
/**
* Checks if a block is attached to another block.
*
* @param block
* The base block
* @param scanBlock
* The block to check for attachment
* @param blockData
* The block data
* @param scanMin
* The minimum scan value
* @return true if the block is attached, false otherwise
*/
boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin);
/**
* Gets the minimum height of a world.
*
* @param world
* The world
* @return The minimum height
*/
int getMinHeight(World world);
/**
* Gets the legacy block ID for a material.
*
* @param material
* The material
* @return The legacy block ID, or -1 if not applicable
*/
int getLegacyBlockId(Material material);
/**
* Gets the contents of a bucket material.
*
* @param material
* The bucket material
* @return The material inside the bucket, or AIR if not applicable
*/
Material getBucketContents(Material material);
/**
* Checks whether the runtime supports and contains a block type key.
*
* @param key
* The namespaced block key
* @return true if the block type exists, false otherwise
*/
boolean hasBlockType(String key);
/**
* Creates default block data for a block type key.
*
* @param key
* The namespaced block key
* @return The block data, or null if unsupported/unavailable
*/
BlockData createBlockData(String key);
/**
* Creates block data from a serialized block data string.
*
* @param blockData
* The serialized block data
* @return The block data, or null if unsupported/unavailable
*/
BlockData createBlockDataFromString(String blockData);
// --------------------------------------------------------------------------
// Material type checking methods
// --------------------------------------------------------------------------
/**
* Checks if a material is an item frame.
*
* @param material
* The material to check
* @return true if the material is an item frame, false otherwise
*/
boolean isItemFrame(Material material);
/**
* Checks if a material is invisible.
*
* @param material
* The material to check
* @return true if the material is invisible, false otherwise
*/
boolean isInvisible(Material material);
/**
* Checks if a material is a decorated pot.
*
* @param material
* The material to check
* @return true if the material is a decorated pot, false otherwise
*/
boolean isDecoratedPot(Material material);
/**
* Checks if a material is a suspicious block.
*
* @param material
* The material to check
* @return true if the material is a suspicious block, false otherwise
*/
boolean isSuspiciousBlock(Material material);
/**
* Checks if a material is a sign.
*
* @param material
* The material to check
* @return true if the material is a sign, false otherwise
*/
boolean isSign(Material material);
/**
* Checks if a material is a chiseled bookshelf.
*
* @param material
* The material to check
* @return true if the material is a chiseled bookshelf, false otherwise
*/
boolean isChiseledBookshelf(Material material);
/**
* Checks if a material is a shelf of any wood kind.
*
* @param material
* The material to check
* @return true if the material is a shelf, false otherwise
*/
boolean isShelf(Material material);
List<Location> getShelfInteractionLocations(Block block, BlockFace blockFace);
/**
* Checks if a material is a bookshelf book.
*
* @param material
* The material to check
* @return true if the material is a bookshelf book, false otherwise
*/
boolean isBookshelfBook(Material material);
/**
* Checks if a material is a bundle.
*
* @param material
* The material to check
* @return true if the material is a bundle, false otherwise
*/
boolean isBundle(Material material);
/**
* Gets the seeds material for a plant material.
*
* @param material
* The plant material
* @return The seeds material
*/
Material getPlantSeeds(Material material);
// --------------------------------------------------------------------------
// Item and inventory methods
// --------------------------------------------------------------------------
/**
* Adjusts an ingredient in a merchant recipe.
*
* @param recipe
* The merchant recipe
* @param itemStack
* The item stack
* @return The adjusted item stack, or null if not applicable
*/
ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack);
/**
* Gets metadata from an item meta.
*
* @param itemMeta
* The item meta
* @param list
* The list to populate with metadata
* @param metadata
* The metadata list to populate
* @param slot
* The slot
* @return true if metadata was extracted, false otherwise
*/
boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot);
/**
* Sets metadata on an item stack.
*
* @param rowType
* The material type
* @param itemstack
* The item stack
* @param map
* The metadata map
* @return true if metadata was set, false otherwise
*/
boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map);
/**
* Gets a book from a chiseled bookshelf.
*
* @param blockState
* The block state
* @param event
* The player interact event
* @return The book item stack, or null if not applicable
*/
ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event);
/**
* Gets arrow metadata for an item stack.
*
* @param arrow
* The arrow entity
* @param itemStack
* The item stack
* @return The item stack with arrow metadata
*/
ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack);
// --------------------------------------------------------------------------
// Entity methods
// --------------------------------------------------------------------------
/**
* Gets metadata from a living entity.
*
* @param entity
* The living entity
* @param info
* The list to populate with entity metadata
* @return true if metadata was extracted, false otherwise
*/
boolean getEntityMeta(LivingEntity entity, List<Object> info);
/**
* Sets metadata on an entity.
*
* @param entity
* The entity
* @param value
* The metadata value
* @param count
* The count
* @return true if metadata was set, false otherwise
*/
boolean setEntityMeta(Entity entity, Object value, int count);
void addMerchantRecipeMeta(MerchantRecipe recipe, List<Object> recipeData);
void setMerchantRecipeMeta(MerchantRecipe recipe, List<?> recipeData);
void refreshVillagerBrain(Villager villager);
/**
* Gets the wolf variant and adds it to the info list.
* Only implemented in Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param info
* The list to add the variant information to
*/
void getWolfVariant(org.bukkit.entity.Wolf wolf, List<Object> info);
/**
* Sets the wolf variant from the provided value.
* Only implemented in Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param value
* The variant value to set
*/
void setWolfVariant(org.bukkit.entity.Wolf wolf, Object value);
/**
* Gets the frame type for an entity.
*
* @param entity
* The entity
* @return The frame material type
*/
Material getFrameType(Entity entity);
/**
* Gets the frame type for an entity type.
*
* @param type
* The entity type
* @return The frame material type
*/
Material getFrameType(EntityType type);
/**
* Gets the entity type for a material.
*
* @param material
* The material
* @return The entity type
*/
EntityType getEntityType(Material material);
/**
* Gets the frame class for a material.
*
* @param material
* The material
* @return The frame class
*/
Class<?> getFrameClass(Material material);
// --------------------------------------------------------------------------
// Sign methods
// --------------------------------------------------------------------------
/**
* Checks if a sign is glowing.
*
* @param sign
* The sign
* @param isFront
* Whether to check the front side
* @return true if the sign is glowing, false otherwise
*/
boolean isGlowing(Sign sign, boolean isFront);
/**
* Checks if a sign is waxed.
*
* @param sign
* The sign
* @return true if the sign is waxed, false otherwise
*/
boolean isWaxed(Sign sign);
/**
* Sets whether a sign is glowing.
*
* @param sign
* The sign
* @param isFront
* Whether to set the front side
* @param isGlowing
* Whether the sign should be glowing
*/
void setGlowing(Sign sign, boolean isFront, boolean isGlowing);
/**
* Sets the color of a sign.
*
* @param sign
* The sign
* @param isFront
* Whether to set the front side
* @param color
* The color RGB value
*/
void setColor(Sign sign, boolean isFront, int color);
/**
* Sets whether a sign is waxed.
*
* @param sign
* The sign
* @param isWaxed
* Whether the sign should be waxed
*/
void setWaxed(Sign sign, boolean isWaxed);
/**
* Gets the color of a sign.
*
* @param sign
* The sign
* @param isFront
* Whether to get the front side color
* @return The color RGB value
*/
int getColor(Sign sign, boolean isFront);
/**
* Gets a line of text from a sign.
*
* @param sign
* The sign
* @param line
* The line number (0-based)
* @return The text on the line
*/
String getLine(Sign sign, int line);
/**
* Sets a line of text on a sign.
*
* @param sign
* The sign
* @param line
* The line number (0-based)
* @param string
* The text to set
*/
void setLine(Sign sign, int line, String string);
/**
* Checks if a sign change event is for the front side of the sign.
*
* @param event
* The sign change event
* @return true if the event is for the front side, false otherwise
*/
boolean isSignFront(SignChangeEvent event);
/**
* Checks whether an explosion event should be logged or not. (i.e. wind charge explosions)
*
* @param event
* The explosion event (Block or Entity ExplodeEvent)
* @return true if the explosion should affect blocks
*/
boolean shouldLogExplosion(Event event);
/**
* Gets the material of the block that exploded
*
* @param event
* The block explosion event
* @return the material of the block that caused the explosion
*/
Material getExplodedBlock(BlockExplodeEvent event);
// --------------------------------------------------------------------------
// Registry methods
// --------------------------------------------------------------------------
/**
* Gets the registry key for a value.
*
* @param value
* The value
* @return The registry key
*/
Object getRegistryKey(Object value);
/**
* Gets a registry value by key and class.
*
* @param key
* The key
* @param tClass
* The class
* @return The registry value
*/
Object getRegistryValue(String key, Object tClass);
String getPaintingArtKey(Painting painting);
Art getPaintingArt(String name);
/**
* Parses a legacy material name.
*
* @param name
* The legacy name
* @return The parsed name
*/
String parseLegacyName(String name);
boolean isCrafter(InventoryType type);
boolean isCopperChest(Material material);
Set<Material> copperChestMaterials();
Set<Material> shelfMaterials();
public ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack);
public Material getBucketContents(Material material);
public Material getFrameType(Entity entity);
public Material getFrameType(EntityType type);
public Class<?> getFrameClass(Material material);
public String parseLegacyName(String name);
public boolean getEntityMeta(LivingEntity entity, List<Object> info);
public boolean setEntityMeta(Entity entity, Object value, int count);
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list,
List<List<Map<String, Object>>> metadata, int slot);
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map);
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin);
public boolean isItemFrame(Material material);
public boolean isGlowing(Sign sign, boolean isFront);
public boolean isInvisible(Material material);
public boolean isWaxed(Sign sign);
public int getMinHeight(World world);
public int getLegacyBlockId(Material material);
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing);
public void setColor(Sign sign, boolean isFront, int color);
public void setWaxed(Sign sign, boolean isWaxed);
public int getColor(Sign sign, boolean isFront);
public Material getPlantSeeds(Material material);
public boolean isDecoratedPot(Material material);
public boolean isSuspiciousBlock(Material material);
public boolean isSign(Material material);
public boolean isChiseledBookshelf(Material material);
public boolean isBookshelfBook(Material material);
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event);
public String getLine(Sign sign, int line);
public void setLine(Sign sign, int line, String string);
public boolean isSignFront(SignChangeEvent event);
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack);
public EntityType getEntityType(Material material);
public Object getRegistryKey(Object value);
public Object getRegistryValue(String key, Object tClass);
}
@@ -5,7 +5,8 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.Util;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@@ -24,112 +25,182 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BundleMeta;
import org.bukkit.inventory.meta.ItemMeta;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.ItemUtils;
import net.coreprotect.utility.MaterialUtils;
public class Bukkit_v1_17 extends BukkitAdapter implements BukkitInterface {
/**
* Bukkit adapter implementation for Minecraft 1.17.
* Provides version-specific implementations for the BukkitInterface
* to handle features introduced in the 1.17 update.
*/
public class Bukkit_v1_17 extends BukkitAdapter {
/**
* Initializes the Bukkit_v1_17 adapter with 1.17-specific block groups.
* Sets up collections of blocks with similar behavior for efficient handling.
*/
public Bukkit_v1_17() {
initializeBlockGroups();
}
/**
* Initializes all the block groups for Minecraft 1.17.
* This includes new blocks like amethyst, candles, pointed dripstone, etc.
*/
private void initializeBlockGroups() {
BlockGroup.TRACK_ANY = new HashSet<>(Arrays.asList(Material.PISTON_HEAD, Material.LEVER, Material.BELL, Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER, Material.GLOW_LICHEN));
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO, Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT, Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH, Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS, Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN, Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
BlockGroup.TRACK_TOP_BOTTOM = new HashSet<>(Arrays.asList(Material.POINTED_DRIPSTONE, Material.BIG_DRIPLEAF_STEM));
BlockGroup.TRACK_BOTTOM = new HashSet<>(Arrays.asList(Material.WEEPING_VINES, Material.CAVE_VINES, Material.CAVE_VINES_PLANT, Material.HANGING_ROOTS));
BlockGroup.VINES = new HashSet<>(Arrays.asList(Material.VINE, Material.WEEPING_VINES, Material.TWISTING_VINES, Material.CAVE_VINES));
BlockGroup.CANDLES = new HashSet<>(Arrays.asList(Material.CANDLE, Material.BLACK_CANDLE, Material.BLUE_CANDLE, Material.BROWN_CANDLE, Material.CYAN_CANDLE, Material.GRAY_CANDLE, Material.GREEN_CANDLE, Material.LIGHT_BLUE_CANDLE, Material.LIGHT_GRAY_CANDLE, Material.LIME_CANDLE, Material.MAGENTA_CANDLE, Material.ORANGE_CANDLE, Material.PINK_CANDLE, Material.PURPLE_CANDLE, Material.RED_CANDLE, Material.WHITE_CANDLE, Material.YELLOW_CANDLE, Material.CANDLE_CAKE, Material.BLACK_CANDLE_CAKE, Material.BLUE_CANDLE_CAKE, Material.BROWN_CANDLE_CAKE, Material.CYAN_CANDLE_CAKE, Material.GRAY_CANDLE_CAKE, Material.GREEN_CANDLE_CAKE, Material.LIGHT_BLUE_CANDLE_CAKE, Material.LIGHT_GRAY_CANDLE_CAKE, Material.LIME_CANDLE_CAKE, Material.MAGENTA_CANDLE_CAKE, Material.ORANGE_CANDLE_CAKE, Material.PINK_CANDLE_CAKE, Material.PURPLE_CANDLE_CAKE, Material.RED_CANDLE_CAKE, Material.WHITE_CANDLE_CAKE, Material.YELLOW_CANDLE_CAKE));
BlockGroup.AMETHYST = new HashSet<>(Arrays.asList(Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER));
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));
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF, Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
BlockGroup.TRACK_ANY = new HashSet<>(Arrays.asList(Material.PISTON_HEAD, Material.LEVER, Material.BELL,
Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD,
Material.AMETHYST_CLUSTER, Material.GLOW_LICHEN));
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO,
Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE,
Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING,
Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING,
Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION,
Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP,
Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY,
Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT,
Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN,
Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER,
Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER,
Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER,
Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER,
Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW,
Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM,
Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER,
Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY,
Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH,
Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS,
Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN,
Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
BlockGroup.TRACK_TOP_BOTTOM = new HashSet<>(
Arrays.asList(Material.POINTED_DRIPSTONE, Material.BIG_DRIPLEAF_STEM));
BlockGroup.TRACK_BOTTOM = new HashSet<>(Arrays.asList(Material.WEEPING_VINES, Material.CAVE_VINES,
Material.CAVE_VINES_PLANT, Material.HANGING_ROOTS));
BlockGroup.VINES = new HashSet<>(
Arrays.asList(Material.VINE, Material.WEEPING_VINES, Material.TWISTING_VINES, Material.CAVE_VINES));
BlockGroup.CANDLES = new HashSet<>(Arrays.asList(Material.CANDLE, Material.BLACK_CANDLE, Material.BLUE_CANDLE,
Material.BROWN_CANDLE, Material.CYAN_CANDLE, Material.GRAY_CANDLE, Material.GREEN_CANDLE,
Material.LIGHT_BLUE_CANDLE, Material.LIGHT_GRAY_CANDLE, Material.LIME_CANDLE, Material.MAGENTA_CANDLE,
Material.ORANGE_CANDLE, Material.PINK_CANDLE, Material.PURPLE_CANDLE, Material.RED_CANDLE,
Material.WHITE_CANDLE, Material.YELLOW_CANDLE, Material.CANDLE_CAKE, Material.BLACK_CANDLE_CAKE,
Material.BLUE_CANDLE_CAKE, Material.BROWN_CANDLE_CAKE, Material.CYAN_CANDLE_CAKE,
Material.GRAY_CANDLE_CAKE, Material.GREEN_CANDLE_CAKE, Material.LIGHT_BLUE_CANDLE_CAKE,
Material.LIGHT_GRAY_CANDLE_CAKE, Material.LIME_CANDLE_CAKE, Material.MAGENTA_CANDLE_CAKE,
Material.ORANGE_CANDLE_CAKE, Material.PINK_CANDLE_CAKE, Material.PURPLE_CANDLE_CAKE,
Material.RED_CANDLE_CAKE, Material.WHITE_CANDLE_CAKE, Material.YELLOW_CANDLE_CAKE));
BlockGroup.AMETHYST = new HashSet<>(Arrays.asList(Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD,
Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER));
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));
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER,
Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH,
Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING,
Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA,
Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION,
Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP,
Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY,
Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH,
Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH,
Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL,
Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.SOUL_TORCH,
Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF,
Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
BlockGroup.VERTICAL_TOP_BOTTOM = new HashSet<>(Arrays.asList(Material.BIG_DRIPLEAF_STEM));
}
@Override
public String parseLegacyName(String name) {
switch (name) {
case "GRASS_PATH":
return "DIRT_PATH";
name = "DIRT_PATH";
break;
default:
return name;
break;
}
return name;
}
@Override
public int getLegacyBlockId(Material material) {
switch (material) {
case DIRT_PATH:
return MaterialUtils.getBlockId("GRASS_PATH", false);
return Util.getBlockId("GRASS_PATH", false);
default:
return -1;
}
}
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
if (entity instanceof Axolotl) {
Axolotl axolotl = (Axolotl) entity;
info.add(axolotl.getVariant());
return true;
}
else if (entity instanceof Goat) {
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
info.add(goat.isScreaming());
} else if (super.getEntityMeta(entity, info)) {
return true;
} else {
return false;
}
return super.getEntityMeta(entity, info);
return true;
}
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
if (entity instanceof Axolotl) {
Axolotl axolotl = (Axolotl) entity;
if (count == 0) {
org.bukkit.entity.Axolotl.Variant variant = (org.bukkit.entity.Axolotl.Variant) value;
axolotl.setVariant(variant);
return true;
org.bukkit.entity.Axolotl.Variant set = (org.bukkit.entity.Axolotl.Variant) value;
axolotl.setVariant(set);
}
}
else if (entity instanceof Goat) {
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
if (count == 0) {
boolean isScreaming = (Boolean) value;
goat.setScreaming(isScreaming);
return true;
boolean set = (Boolean) value;
goat.setScreaming(set);
}
} else if (super.setEntityMeta(entity, value, count)) {
return true;
} else {
return false;
}
return super.setEntityMeta(entity, value, count);
return true;
}
@Override
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot) {
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list,
List<List<Map<String, Object>>> metadata, int slot)
{
if (itemMeta instanceof BundleMeta) {
BundleMeta meta = (BundleMeta) itemMeta;
BundleMeta subMeta = (BundleMeta) meta.clone();
meta.setItems(null);
@@ -137,113 +208,177 @@ public class Bukkit_v1_17 extends BukkitAdapter {
metadata.add(list);
if (subMeta.hasItems()) {
list = new ArrayList<>();
for (ItemStack itemStack : subMeta.getItems()) {
Map<String, Object> itemMap = ItemUtils.serializeItemStack(itemStack, null, slot);
Map<String, Object> itemMap = Util.serializeItemStack(itemStack, null, slot);
if (itemMap.size() > 0) {
list.add(itemMap);
}
}
metadata.add(list);
}
} else if (super.getItemMeta(itemMeta, list, metadata, slot)) {
return true;
} else {
return false;
}
return super.getItemMeta(itemMeta, list, metadata, slot);
}
return true;
@Override
public boolean isBundle(Material material) {
return material == Material.BUNDLE;
}
@Override
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map) {
if (BukkitAdapter.ADAPTER.isBundle(rowType)) {
if ((rowType == Material.BUNDLE)) {
BundleMeta meta = (BundleMeta) itemstack.getItemMeta();
for (Map<String, Object> itemData : map) {
ItemStack itemStack = ItemUtils.unserializeItemStack(itemData);
ItemStack itemStack = Util.unserializeItemStack(itemData);
if (itemStack != null) {
meta.addItem(itemStack);
}
}
itemstack.setItemMeta(meta);
} else if (super.setItemMeta(rowType, itemstack, map)) {
return true;
} else {
return false;
}
return super.setItemMeta(rowType, itemstack, map);
return true;
}
@Override
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin) {
if (blockData instanceof PointedDripstone) {
PointedDripstone pointedDripstone = (PointedDripstone) blockData;
BlockFace blockFace = pointedDripstone.getVerticalDirection();
boolean adjacent = scanBlock.getRelative(blockFace.getOppositeFace()).getLocation().equals(block.getLocation());
return adjacent;
boolean adjacent = scanBlock.getRelative(blockFace.getOppositeFace()).getLocation()
.equals(block.getLocation());
if (!adjacent) {
return false;
}
} else if (!super.isAttached(block, scanBlock, blockData, scanMin)) {
return false;
}
return super.isAttached(block, scanBlock, blockData, scanMin);
return true;
}
@Override
public int getMinHeight(World world) {
return world.getMinHeight();
}
@Override
public Material getBucketContents(Material material) {
return (material == Material.POWDER_SNOW_BUCKET) ? Material.POWDER_SNOW : Material.AIR;
return (material == Material.POWDER_SNOW_BUCKET ? Material.POWDER_SNOW : Material.AIR);
}
@Override
public boolean isItemFrame(Material material) {
return (material == Material.ITEM_FRAME || material == Material.GLOW_ITEM_FRAME);
}
@Override
public Material getFrameType(Entity entity) {
return (entity instanceof GlowItemFrame) ? Material.GLOW_ITEM_FRAME : Material.ITEM_FRAME;
}
@Override
public Material getFrameType(EntityType type) {
switch (type) {
case ITEM_FRAME:
return Material.ITEM_FRAME;
case GLOW_ITEM_FRAME:
return Material.GLOW_ITEM_FRAME;
default:
return null;
}
}
@Override
public Class<?> getFrameClass(Material material) {
return (material == Material.GLOW_ITEM_FRAME) ? GlowItemFrame.class : ItemFrame.class;
}
@Override
public boolean isGlowing(Sign sign, boolean isFront) {
if (!isFront) {
return false;
}
return sign.isGlowingText();
}
@Override
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
if (!isFront) {
return;
}
sign.setGlowingText(isGlowing);
}
@Override
public boolean isInvisible(Material material) {
return material.isAir() || material == Material.LIGHT;
}
}
@@ -3,60 +3,37 @@ package net.coreprotect.bukkit;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe;
/**
* Bukkit adapter implementation for Minecraft 1.18.
* Provides version-specific implementations for the BukkitInterface
* to handle features introduced in the 1.18 update.
*/
public class Bukkit_v1_18 extends Bukkit_v1_17 {
public class Bukkit_v1_18 extends Bukkit_v1_17 implements BukkitInterface {
/**
* Flag to track whether the MerchantRecipe.adjust() method is available.
* This is initialized on first use and prevents repeated reflection checks.
* - null: Not yet checked
* - true: Method exists and should be used
* - false: Method doesn't exist or failed, fallback to parent implementation
*/
private Boolean hasAdjustMethod = null;
private Boolean hasAdjust = null;
/**
* Adjusts an ingredient in a merchant recipe for version 1.18+.
* This handles changes to the MerchantRecipe API introduced in Bukkit 1.18.1.
*
* @param recipe
* The merchant recipe
* @param itemStack
* The item stack to adjust
* @return The adjusted item stack, or null if adjustment not supported or fails
*/
@Override
public ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack) {
if (itemStack == null) {
return null;
}
try {
// First-time detection of adjust method availability
if (hasAdjustMethod == null) {
hasAdjustMethod = true;
// Test if the adjust method exists using reflection
if (hasAdjust == null) {
hasAdjust = true;
MerchantRecipe.class.getMethod("adjust", ItemStack.class); // Bukkit 1.18.1+
}
// Skip if we've already determined the method isn't available
else if (Boolean.FALSE.equals(hasAdjustMethod)) {
return super.adjustIngredient(recipe, itemStack);
} else if (Boolean.FALSE.equals(hasAdjust)) {
return null;
}
// Create a clone to avoid modifying the original itemStack
ItemStack adjustedStack = itemStack.clone();
recipe.adjust(adjustedStack);
return adjustedStack;
} catch (Exception e) {
hasAdjust = false;
return null;
}
catch (Exception e) {
// Method doesn't exist or failed, mark it for future calls
hasAdjustMethod = false;
return super.adjustIngredient(recipe, itemStack);
}
}
}
@@ -3,7 +3,7 @@ package net.coreprotect.bukkit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import net.coreprotect.model.BlockGroup;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Frog;
@@ -11,230 +11,194 @@ import org.bukkit.entity.Goat;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Tadpole;
import net.coreprotect.model.BlockGroup;
public class Bukkit_v1_19 extends Bukkit_v1_18 implements BukkitInterface {
/**
* Bukkit adapter implementation for Minecraft 1.19.
* Provides version-specific implementations for the BukkitInterface
* to handle features introduced in the 1.19 update, including:
* - New block types (mangrove)
* - New entity types (frogs, tadpoles)
* - Updates to existing entities (goats)
* - Sculk blocks
*/
public class Bukkit_v1_19 extends Bukkit_v1_18 {
/**
* Initializes the Bukkit_v1_19 adapter with 1.19-specific block groups.
* Sets up collections of blocks with similar behavior for efficient handling.
*/
public Bukkit_v1_19() {
initializeBlockGroups();
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO,
Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE,
Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING,
Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING,
Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN,
Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM,
Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP,
Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM,
Material.REDSTONE_WIRE, Material.WHEAT, Material.MANGROVE_SIGN, Material.ACACIA_SIGN,
Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN,
Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER,
Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER,
Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER,
Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER,
Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS,
Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT,
Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC,
Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART,
Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH,
Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS,
Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN,
Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
BlockGroup.TRACK_SIDE = new HashSet<>(Arrays.asList(Material.WALL_TORCH, Material.REDSTONE_WALL_TORCH,
Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.ACTIVATOR_RAIL,
Material.WHITE_BED, Material.ORANGE_BED, Material.MAGENTA_BED, Material.LIGHT_BLUE_BED,
Material.YELLOW_BED, Material.LIME_BED, Material.PINK_BED, Material.GRAY_BED, Material.LIGHT_GRAY_BED,
Material.CYAN_BED, Material.PURPLE_BED, Material.BLUE_BED, Material.BROWN_BED, Material.GREEN_BED,
Material.RED_BED, Material.BLACK_BED, Material.LADDER, Material.MANGROVE_WALL_SIGN,
Material.ACACIA_WALL_SIGN, Material.BIRCH_WALL_SIGN, Material.DARK_OAK_WALL_SIGN,
Material.JUNGLE_WALL_SIGN, Material.OAK_WALL_SIGN, Material.SPRUCE_WALL_SIGN, Material.VINE,
Material.COCOA, Material.TRIPWIRE_HOOK, Material.WHITE_WALL_BANNER, Material.ORANGE_WALL_BANNER,
Material.MAGENTA_WALL_BANNER, Material.LIGHT_BLUE_WALL_BANNER, Material.YELLOW_WALL_BANNER,
Material.LIME_WALL_BANNER, Material.PINK_WALL_BANNER, Material.GRAY_WALL_BANNER,
Material.LIGHT_GRAY_WALL_BANNER, Material.CYAN_WALL_BANNER, Material.PURPLE_WALL_BANNER,
Material.BLUE_WALL_BANNER, Material.BROWN_WALL_BANNER, Material.GREEN_WALL_BANNER,
Material.RED_WALL_BANNER, Material.BLACK_WALL_BANNER, Material.SOUL_WALL_TORCH,
Material.CRIMSON_WALL_SIGN, Material.WARPED_WALL_SIGN));
BlockGroup.DOORS = new HashSet<>(Arrays.asList(Material.OAK_DOOR, Material.SPRUCE_DOOR, Material.BIRCH_DOOR,
Material.JUNGLE_DOOR, Material.MANGROVE_DOOR, Material.ACACIA_DOOR, Material.DARK_OAK_DOOR,
Material.CRIMSON_DOOR, Material.WARPED_DOOR));
BlockGroup.BUTTONS = new HashSet<>(Arrays.asList(Material.STONE_BUTTON, Material.OAK_BUTTON,
Material.MANGROVE_BUTTON, Material.ACACIA_BUTTON, Material.BIRCH_BUTTON, Material.DARK_OAK_BUTTON,
Material.JUNGLE_BUTTON, Material.SPRUCE_BUTTON, Material.POLISHED_BLACKSTONE_BUTTON,
Material.CRIMSON_BUTTON, Material.WARPED_BUTTON));
BlockGroup.PRESSURE_PLATES = new HashSet<>(Arrays.asList(Material.STONE_PRESSURE_PLATE,
Material.MANGROVE_PRESSURE_PLATE, Material.ACACIA_PRESSURE_PLATE, Material.BIRCH_PRESSURE_PLATE,
Material.DARK_OAK_PRESSURE_PLATE, Material.HEAVY_WEIGHTED_PRESSURE_PLATE,
Material.JUNGLE_PRESSURE_PLATE, Material.LIGHT_WEIGHTED_PRESSURE_PLATE, Material.OAK_PRESSURE_PLATE,
Material.SPRUCE_PRESSURE_PLATE, Material.CRIMSON_PRESSURE_PLATE, Material.WARPED_PRESSURE_PLATE,
Material.POLISHED_BLACKSTONE_PRESSURE_PLATE));
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));
BlockGroup.SAFE_INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.LEVER, 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.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.CRIMSON_FENCE_GATE,
Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER,
Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH,
Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING,
Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER,
Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH,
Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET,
Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP,
Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH,
Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER,
Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE,
Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT,
Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF,
Material.BIG_DRIPLEAF, Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
BlockGroup.SCULK = new HashSet<>(
Arrays.asList(Material.SCULK, Material.SCULK_VEIN, Material.SCULK_SENSOR, Material.SCULK_SHRIEKER));
}
/**
* Initializes all the block groups for Minecraft 1.19.
* This organizes blocks into functional categories for efficient lookups and operations.
*/
private void initializeBlockGroups() {
// Blocks that need tracking from the top face
initializeTrackTopBlocks();
// Blocks that need tracking from the side
initializeTrackSideBlocks();
// Door blocks
initializeDoorBlocks();
// Button blocks
initializeButtonBlocks();
// Pressure plate blocks
initializePressurePlateBlocks();
// Blocks that can be interacted with
initializeInteractBlocks();
// Blocks that can be safely interacted with (won't cause block updates)
initializeSafeInteractBlocks();
// Blocks that can't have other blocks attached to them
initializeNonAttachableBlocks();
// Sculk blocks (new in 1.19)
initializeSculkBlocks();
}
/**
* Initializes blocks that need tracking from their top face.
*/
private void initializeTrackTopBlocks() {
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO, Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT, Material.MANGROVE_SIGN, Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH, Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS, Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN, Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
}
/**
* Initializes blocks that need tracking from their side.
*/
private void initializeTrackSideBlocks() {
BlockGroup.TRACK_SIDE = new HashSet<>(Arrays.asList(Material.WALL_TORCH, Material.REDSTONE_WALL_TORCH, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.ACTIVATOR_RAIL, Material.WHITE_BED, Material.ORANGE_BED, Material.MAGENTA_BED, Material.LIGHT_BLUE_BED, Material.YELLOW_BED, Material.LIME_BED, Material.PINK_BED, Material.GRAY_BED, Material.LIGHT_GRAY_BED, Material.CYAN_BED, Material.PURPLE_BED, Material.BLUE_BED, Material.BROWN_BED, Material.GREEN_BED, Material.RED_BED, Material.BLACK_BED, Material.LADDER, Material.MANGROVE_WALL_SIGN, Material.ACACIA_WALL_SIGN, Material.BIRCH_WALL_SIGN, Material.DARK_OAK_WALL_SIGN, Material.JUNGLE_WALL_SIGN, Material.OAK_WALL_SIGN, Material.SPRUCE_WALL_SIGN, Material.VINE, Material.COCOA, Material.TRIPWIRE_HOOK, Material.WHITE_WALL_BANNER, Material.ORANGE_WALL_BANNER, Material.MAGENTA_WALL_BANNER, Material.LIGHT_BLUE_WALL_BANNER, Material.YELLOW_WALL_BANNER, Material.LIME_WALL_BANNER, Material.PINK_WALL_BANNER, Material.GRAY_WALL_BANNER, Material.LIGHT_GRAY_WALL_BANNER, Material.CYAN_WALL_BANNER, Material.PURPLE_WALL_BANNER, Material.BLUE_WALL_BANNER, Material.BROWN_WALL_BANNER, Material.GREEN_WALL_BANNER, Material.RED_WALL_BANNER, Material.BLACK_WALL_BANNER, Material.SOUL_WALL_TORCH, Material.CRIMSON_WALL_SIGN, Material.WARPED_WALL_SIGN));
}
/**
* Initializes door blocks.
*/
private void initializeDoorBlocks() {
BlockGroup.DOORS = new HashSet<>(Arrays.asList(Material.OAK_DOOR, Material.SPRUCE_DOOR, Material.BIRCH_DOOR, Material.JUNGLE_DOOR, Material.MANGROVE_DOOR, Material.ACACIA_DOOR, Material.DARK_OAK_DOOR, Material.CRIMSON_DOOR, Material.WARPED_DOOR));
}
/**
* Initializes button blocks.
*/
private void initializeButtonBlocks() {
BlockGroup.BUTTONS = new HashSet<>(Arrays.asList(Material.STONE_BUTTON, Material.OAK_BUTTON, Material.MANGROVE_BUTTON, Material.ACACIA_BUTTON, Material.BIRCH_BUTTON, Material.DARK_OAK_BUTTON, Material.JUNGLE_BUTTON, Material.SPRUCE_BUTTON, Material.POLISHED_BLACKSTONE_BUTTON, Material.CRIMSON_BUTTON, Material.WARPED_BUTTON));
}
/**
* Initializes pressure plate blocks.
*/
private void initializePressurePlateBlocks() {
BlockGroup.PRESSURE_PLATES = new HashSet<>(Arrays.asList(Material.STONE_PRESSURE_PLATE, Material.MANGROVE_PRESSURE_PLATE, Material.ACACIA_PRESSURE_PLATE, Material.BIRCH_PRESSURE_PLATE, Material.DARK_OAK_PRESSURE_PLATE, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, Material.JUNGLE_PRESSURE_PLATE, Material.LIGHT_WEIGHTED_PRESSURE_PLATE, Material.OAK_PRESSURE_PLATE, Material.SPRUCE_PRESSURE_PLATE, Material.CRIMSON_PRESSURE_PLATE, Material.WARPED_PRESSURE_PLATE, Material.POLISHED_BLACKSTONE_PRESSURE_PLATE));
}
/**
* Initializes blocks that can be interacted with.
*/
private void initializeInteractBlocks() {
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));
}
/**
* Initializes blocks that can be safely interacted with.
*/
private void initializeSafeInteractBlocks() {
BlockGroup.SAFE_INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.LEVER, 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.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.CRIMSON_FENCE_GATE, Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
}
/**
* Initializes blocks that can't have other blocks attached to them.
*/
private void initializeNonAttachableBlocks() {
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF, Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
}
/**
* Initializes sculk blocks (new in 1.19).
*/
private void initializeSculkBlocks() {
BlockGroup.SCULK = new HashSet<>(Arrays.asList(Material.SCULK, Material.SCULK_VEIN, Material.SCULK_SENSOR, Material.SCULK_SHRIEKER));
}
/**
* Gets metadata from a living entity specific to 1.19.
* Handles Frog, Tadpole, and updated Goat entities.
*
* @param entity
* The living entity
* @param info
* The list to populate with entity metadata
* @return true if metadata was extracted, false otherwise
*/
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
if (entity == null || info == null) {
if (entity instanceof Frog) {
Frog frog = (Frog) entity;
info.add(BukkitAdapter.ADAPTER.getRegistryKey(frog.getVariant()));
} else if (entity instanceof Tadpole) {
Tadpole tadpole = (Tadpole) entity;
info.add(tadpole.getAge());
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
info.add(goat.isScreaming());
info.add(goat.hasLeftHorn());
info.add(goat.hasRightHorn());
} else if (super.getEntityMeta(entity, info)) {
return true;
} else {
return false;
}
try {
if (entity instanceof Frog) {
Frog frog = (Frog) entity;
info.add(BukkitAdapter.ADAPTER.getRegistryKey(frog.getVariant()));
return true;
}
else if (entity instanceof Tadpole) {
Tadpole tadpole = (Tadpole) entity;
info.add(tadpole.getAge());
return true;
}
else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
info.add(goat.isScreaming());
info.add(goat.hasLeftHorn());
info.add(goat.hasRightHorn());
return true;
}
return true;
// Fall back to parent implementation if not a known 1.19 entity
return super.getEntityMeta(entity, info);
}
catch (Exception e) {
// Log error or handle exception if needed
return false;
}
}
/**
* Sets metadata on an entity specific to 1.19.
* Handles Frog, Tadpole, and updated Goat entities.
*
* @param entity
* The entity
* @param value
* The metadata value
* @param count
* The index of the metadata property
* @return true if metadata was set, false otherwise
*/
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
if (entity == null || value == null) {
if (entity instanceof Frog) {
Frog frog = (Frog) entity;
if (count == 0) {
if (value instanceof String) {
value = BukkitAdapter.ADAPTER.getRegistryValue((String) value, Frog.Variant.class);
}
Frog.Variant set = (Frog.Variant) value;
frog.setVariant(set);
}
} else if (entity instanceof Tadpole) {
Tadpole tadpole = (Tadpole) entity;
if (count == 0) {
int set = (int) value;
tadpole.setAge(set);
}
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
boolean set = (Boolean) value;
if (count == 0) {
goat.setScreaming(set);
} else if (count == 1) {
goat.setLeftHorn(set);
} else if (count == 2) {
goat.setRightHorn(set);
}
} else if (super.setEntityMeta(entity, value, count)) {
return true;
} else {
return false;
}
try {
if (entity instanceof Frog) {
Frog frog = (Frog) entity;
if (count == 0) {
// Convert string registry key to variant if needed
if (value instanceof String) {
value = BukkitAdapter.ADAPTER.getRegistryValue((String) value, Frog.Variant.class);
}
frog.setVariant((Frog.Variant) value);
return true;
}
}
else if (entity instanceof Tadpole) {
Tadpole tadpole = (Tadpole) entity;
if (count == 0) {
tadpole.setAge((int) value);
return true;
}
}
else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
boolean boolValue = (Boolean) value;
return true;
switch (count) {
case 0:
goat.setScreaming(boolValue);
return true;
case 1:
goat.setLeftHorn(boolValue);
return true;
case 2:
goat.setRightHorn(boolValue);
return true;
default:
// Invalid count for goat
return false;
}
}
// Fall back to parent implementation if not a known 1.19 entity
return super.setEntityMeta(entity, value, count);
}
catch (Exception e) {
// Log error or handle exception if needed
return false;
}
}
}
@@ -1,322 +0,0 @@
package net.coreprotect.bukkit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.block.BlockState;
import org.bukkit.block.ChiseledBookshelf;
import org.bukkit.block.Sign;
import org.bukkit.block.sign.Side;
import org.bukkit.entity.Arrow;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionType;
import net.coreprotect.model.BlockGroup;
/**
* Bukkit adapter implementation for Minecraft 1.20.
* Provides version-specific implementations for the BukkitInterface
* to handle features introduced in the 1.20 update, including:
* - Updated sign handling with front/back sides
* - New block types (chiseled bookshelf, decorated pot)
* - Suspicious blocks (sand/gravel)
* - Arrow potion handling
*/
public class Bukkit_v1_20 extends Bukkit_v1_19 {
private Boolean hasClickedPosition;
private Boolean hasBasePotionType;
/**
* Initializes the Bukkit_v1_20 adapter with 1.20-specific block groups and mappings.
* Sets up collections of blocks with similar behavior for efficient handling.
*/
public Bukkit_v1_20() {
initializeBlockGroups();
initializeTaggedBlocks();
}
/**
* Initializes the block groups specific to Minecraft 1.20.
*/
private void initializeBlockGroups() {
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));
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));
}
/**
* Initializes blocks based on Bukkit Tags for 1.20.
*/
private void initializeTaggedBlocks() {
// Clear and update button blocks from tag
BlockGroup.BUTTONS.clear();
BlockGroup.BUTTONS.addAll(Tag.BUTTONS.getValues());
// Clear and update pressure plate blocks from tag
BlockGroup.PRESSURE_PLATES.clear();
BlockGroup.PRESSURE_PLATES.addAll(Tag.PRESSURE_PLATES.getValues());
// Add all doors from tag
addMissingTaggedBlocks(Tag.DOORS.getValues(), BlockGroup.DOORS);
// Add all fence gates to interaction blocks
addMissingTaggedBlocks(Tag.FENCE_GATES.getValues(), BlockGroup.INTERACT_BLOCKS);
addMissingTaggedBlocks(Tag.FENCE_GATES.getValues(), BlockGroup.SAFE_INTERACT_BLOCKS);
// Add all wooden trapdoors to interaction blocks
addMissingTaggedBlocks(Tag.WOODEN_TRAPDOORS.getValues(), BlockGroup.INTERACT_BLOCKS);
addMissingTaggedBlocks(Tag.WOODEN_TRAPDOORS.getValues(), BlockGroup.SAFE_INTERACT_BLOCKS);
// Add hanging signs to bottom-tracked blocks
addMissingTaggedBlocks(Tag.CEILING_HANGING_SIGNS.getValues(), BlockGroup.TRACK_BOTTOM);
// Add wall signs to side-tracked blocks
addMissingTaggedBlocks(Tag.WALL_SIGNS.getValues(), BlockGroup.TRACK_SIDE);
// Add saplings to top-tracked and non-attachable blocks
addMissingTaggedBlocks(Tag.SAPLINGS.getValues(), BlockGroup.TRACK_TOP);
addMissingTaggedBlocks(Tag.SAPLINGS.getValues(), BlockGroup.NON_ATTACHABLE);
// Add flowers to top-tracked and non-attachable blocks
addMissingTaggedBlocks(Tag.FLOWERS.getValues(), BlockGroup.TRACK_TOP);
addMissingTaggedBlocks(Tag.FLOWERS.getValues(), BlockGroup.NON_ATTACHABLE);
// Add signs (except wall signs) to top-tracked blocks
for (Material value : Tag.SIGNS.getValues()) {
if (!Tag.WALL_SIGNS.isTagged(value) && !BlockGroup.TRACK_TOP.contains(value)) {
BlockGroup.TRACK_TOP.add(value);
}
}
}
/**
* Helper method to add missing blocks from a tag to a block group.
*
* @param taggedBlocks
* The collection of blocks from a tag
* @param targetGroup
* The block group to add missing blocks to
*/
private void addMissingTaggedBlocks(Iterable<Material> taggedBlocks, Set<Material> targetGroup) {
for (Material value : taggedBlocks) {
if (!targetGroup.contains(value)) {
targetGroup.add(value);
}
}
}
@Override
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
Side side = isFront ? Side.FRONT : Side.BACK;
sign.getSide(side).setGlowingText(isGlowing);
}
@Override
public String parseLegacyName(String name) {
switch (name) {
case "GRASS_PATH":
return "DIRT_PATH";
case "GRASS":
return "SHORT_GRASS";
case "SCUTE":
return "TURTLE_SCUTE";
default:
// Fallback until this method is moved up into v1_21
if ("SHORT_GRASS".equals(name) && Material.getMaterial(name) == null) {
return "GRASS";
}
return name;
}
}
@Override
public void setColor(Sign sign, boolean isFront, int color) {
Side side = isFront ? Side.FRONT : Side.BACK;
sign.getSide(side).setColor(DyeColor.getByColor(Color.fromRGB(color)));
}
@Override
public void setWaxed(Sign sign, boolean isWaxed) {
sign.setWaxed(isWaxed);
}
@Override
public int getColor(Sign sign, boolean isFront) {
Side side = isFront ? Side.FRONT : Side.BACK;
return sign.getSide(side).getColor().getColor().asRGB();
}
@Override
public boolean isGlowing(Sign sign, boolean isFront) {
Side side = isFront ? Side.FRONT : Side.BACK;
return sign.getSide(side).isGlowingText();
}
@Override
public boolean isWaxed(Sign sign) {
return sign.isWaxed();
}
@Override
public Material getPlantSeeds(Material material) {
switch (material) {
case WHEAT:
return Material.WHEAT_SEEDS;
case PUMPKIN_STEM:
return Material.PUMPKIN_SEEDS;
case MELON_STEM:
return Material.MELON_SEEDS;
case BEETROOTS:
return Material.BEETROOT_SEEDS;
case TORCHFLOWER_CROP:
return Material.TORCHFLOWER_SEEDS;
default:
return material;
}
}
@Override
public boolean isDecoratedPot(Material material) {
return material == Material.DECORATED_POT;
}
@Override
public boolean isSuspiciousBlock(Material material) {
return material == Material.SUSPICIOUS_GRAVEL || material == Material.SUSPICIOUS_SAND;
}
@Override
public boolean isSign(Material material) {
return Tag.ALL_SIGNS.isTagged(material);
}
@Override
public boolean isChiseledBookshelf(Material material) {
return material == Material.CHISELED_BOOKSHELF;
}
@Override
public boolean isBookshelfBook(Material material) {
return Tag.ITEMS_BOOKSHELF_BOOKS.isTagged(material);
}
@Override
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event) {
try {
if (hasClickedPosition == null) {
hasClickedPosition = true;
// Check if getClickedPosition method exists (Bukkit 1.20.1+)
PlayerInteractEvent.class.getMethod("getClickedPosition");
}
else if (Boolean.FALSE.equals(hasClickedPosition)) {
return null; // Method doesn't exist, return null
}
ChiseledBookshelf bookshelf = (ChiseledBookshelf) blockState;
int slot = bookshelf.getSlot(event.getClickedPosition());
ItemStack book = bookshelf.getInventory().getItem(slot);
return book == null ? new ItemStack(Material.AIR) : book;
}
catch (Exception e) {
hasClickedPosition = false;
return null;
}
}
@Override
public String getLine(Sign sign, int line) {
if (line < 4) {
return sign.getSide(Side.FRONT).getLine(line);
}
else {
return sign.getSide(Side.BACK).getLine(line - 4);
}
}
@Override
public void setLine(Sign sign, int line, String string) {
string = string == null ? "" : string;
if (line < 4) {
sign.getSide(Side.FRONT).setLine(line, string);
}
else {
sign.getSide(Side.BACK).setLine(line - 4, string);
}
}
@Override
public boolean isSignFront(SignChangeEvent event) {
return event.getSide().equals(Side.FRONT);
}
@Override
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack) {
try {
if (hasBasePotionType == null) {
hasBasePotionType = true;
// Check if getBasePotionType method exists (Bukkit 1.20.2+)
Arrow.class.getMethod("getBasePotionType");
}
else if (Boolean.FALSE.equals(hasBasePotionType)) {
return super.getArrowMeta(arrow, itemStack);
}
// Apply potion effects to the arrow
PotionType potionType = arrow.getBasePotionType();
Color color = arrow.getColor();
if (potionType != null || color != null) {
itemStack = new ItemStack(Material.TIPPED_ARROW);
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
meta.setBasePotionType(potionType);
meta.setColor(color);
for (PotionEffect effect : arrow.getCustomEffects()) {
meta.addCustomEffect(effect, false);
}
itemStack.setItemMeta(meta);
}
return itemStack;
}
catch (Exception e) {
hasBasePotionType = false;
return super.getArrowMeta(arrow, itemStack);
}
}
@Override
public Material getExplodedBlock(BlockExplodeEvent event){
// accoding to the Bukkit docs this will always return air
return event.getExplodedBlockState().getType();
}
@Override
public void addMerchantRecipeMeta(MerchantRecipe recipe, List<Object> recipeData) {
recipeData.add(recipe.getDemand());
}
@Override
public void setMerchantRecipeMeta(MerchantRecipe recipe, List<?> recipeData) {
if (recipeData.size() > 7 && recipeData.get(7) instanceof Number) {
recipe.setDemand(((Number) recipeData.get(7)).intValue());
}
}
}
@@ -1,447 +0,0 @@
package net.coreprotect.bukkit;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import org.bukkit.Art;
import org.bukkit.Bukkit;
import org.bukkit.ExplosionResult;
import org.bukkit.Keyed;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockType;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Painting;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryType;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.BlockTypeUtils;
/**
* Bukkit adapter implementation for Minecraft 1.21.
* Provides version-specific implementations for the BukkitInterface
* to handle features introduced in the 1.21 update, including:
* - New block types (crafter)
* - Registry handling for named objects
* - Updated interaction blocks
*/
public class Bukkit_v1_21 extends Bukkit_v1_20 {
public static Set<Material> COPPER_CHESTS = new HashSet<>(Arrays.asList());
public static Set<Material> SHELVES = new HashSet<>(Arrays.asList());
public static Set<Material> BUNDLES = new HashSet<>(Arrays.asList());
/**
* Initializes the Bukkit_v1_21 adapter with 1.21-specific block groups and mappings.
* Sets up collections of blocks with similar behavior for efficient handling.
*/
public Bukkit_v1_21() {
initializeBlockGroups();
initializeTrapdoorBlocks();
initializeBundles();
BlockGroup.INTERACT_BLOCKS.addAll(copperChestMaterials());
BlockGroup.CONTAINERS.addAll(copperChestMaterials());
BlockGroup.UPDATE_STATE.addAll(copperChestMaterials());
BlockGroup.CONTAINERS.addAll(shelfMaterials());
}
/**
* Initializes the block groups specific to Minecraft 1.21.
* Updates container, interaction, and update state blocks with new 1.21 blocks.
*/
private void initializeBlockGroups() {
addToBlockGroupIfMissing(Material.CRAFTER, BlockGroup.CONTAINERS);
addToBlockGroupIfMissing(Material.CRAFTER, BlockGroup.INTERACT_BLOCKS);
addToBlockGroupIfMissing(Material.CRAFTER, BlockGroup.UPDATE_STATE);
}
/**
* Initializes trapdoor blocks for interaction handling.
* Excludes iron trapdoors as they cannot be directly interacted with.
*/
private void initializeTrapdoorBlocks() {
for (Material value : Tag.TRAPDOORS.getValues()) {
// Iron trapdoors are not directly interactable
if (value == Material.IRON_TRAPDOOR) {
continue;
}
// Add to interaction blocks if not already present
addToBlockGroupIfMissing(value, BlockGroup.INTERACT_BLOCKS);
addToBlockGroupIfMissing(value, BlockGroup.SAFE_INTERACT_BLOCKS);
}
}
/**
* Initializes the bundles group to enable the ability to roll back dyed bundles correctly.
* It needs to check whether dyed bundles exist because they were added in 1.21.2.
*/
public void initializeBundles(){
if (BUNDLES.isEmpty()) {
Tag<Material> bundleTag = getMaterialTag(Tag.REGISTRY_ITEMS, "bundles");
if (bundleTag != null) {
BUNDLES.addAll(bundleTag.getValues());
}
if (BUNDLES.isEmpty()) {
addMaterialsEndingWith(BUNDLES, "_BUNDLE");
}
BUNDLES.add(Material.BUNDLE);
}
}
/**
* Helper method to add a block to a block group if it's not already present.
*
* @param block
* The block to add
* @param group
* The group to add the block to
*/
private void addToBlockGroupIfMissing(Material block, Set<Material> group) {
if (!group.contains(block)) {
group.add(block);
}
}
@Override
public boolean hasBlockType(String key) {
return getBlockType(key) != null;
}
@Override
public BlockData createBlockData(String key) {
try {
BlockType blockType = getBlockType(key);
return blockType == null ? null : blockType.createBlockData();
}
catch (Exception e) {
return null;
}
}
@Override
public BlockData createBlockDataFromString(String blockData) {
try {
BlockType blockType = getBlockType(BlockTypeUtils.getBlockDataKey(blockData));
if (blockType == null) {
return null;
}
String states = BlockTypeUtils.getBlockDataStates(blockData);
return states == null ? blockType.createBlockData() : blockType.createBlockData(states);
}
catch (Exception e) {
return null;
}
}
private BlockType getBlockType(String key) {
NamespacedKey namespacedKey = NamespacedKey.fromString(BlockTypeUtils.normalizeKey(key));
return namespacedKey == null ? null : Registry.BLOCK.get(namespacedKey);
}
/**
* Gets the EntityType corresponding to a Material.
* Maps Material to its equivalent EntityType for entity handling.
*
* @param material
* The material to convert
* @return The corresponding EntityType, or UNKNOWN if not mappable
*/
@Override
public EntityType getEntityType(Material material) {
switch (material) {
case END_CRYSTAL:
return EntityType.valueOf("END_CRYSTAL");
default:
return EntityType.UNKNOWN;
}
}
/**
* Gets a registry key string from a keyed object.
* Used for serializing objects that implement Keyed.
*
* @param value
* The keyed object
* @return The string representation of the registry key
*/
@Override
public Object getRegistryKey(Object value) {
return ((Keyed) value).getKey().toString();
}
/**
* Gets a registry value from a key string and class.
* Used for deserializing registry objects.
*
* @param key
* The registry key as a string
* @param tClass
* The class of the registry
* @return The registry value
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@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);
}
@Override
public String getPaintingArtKey(Painting painting) {
try {
NamespacedKey key = Registry.ART.getKey(painting.getArt());
if (key != null) {
return normalizePaintingArtKey(key.toString());
}
}
catch (Exception e) {
}
return normalizePaintingArtKey(super.getPaintingArtKey(painting));
}
@Override
public Art getPaintingArt(String name) {
NamespacedKey key = NamespacedKey.fromString(normalizePaintingArtLookupKey(name));
if (key != null) {
Art art = Registry.ART.get(key);
if (art != null) {
return art;
}
}
return super.getPaintingArt(name);
}
private String normalizePaintingArtKey(String name) {
if (name == null) {
return "";
}
String normalized = name.toLowerCase(Locale.ROOT).trim();
if (normalized.startsWith("minecraft:")) {
return normalized.substring("minecraft:".length());
}
return normalized;
}
private String normalizePaintingArtLookupKey(String name) {
String normalized = normalizePaintingArtKey(name);
return normalized.contains(":") ? normalized : "minecraft:" + normalized;
}
/**
* Gets the wolf variant and adds it to the info list.
* This functionality is specific to Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param info
* The list to add the variant information to
*/
@Override
public void getWolfVariant(org.bukkit.entity.Wolf wolf, List<Object> info) {
// Add the variant to the info list
info.add(getRegistryKey(wolf.getVariant()));
}
/**
* Sets the wolf variant from the provided value.
* This functionality is specific to Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param value
* The variant value to set
*/
@Override
public void setWolfVariant(org.bukkit.entity.Wolf wolf, Object value) {
if (value instanceof String) {
value = getRegistryValue((String) value, org.bukkit.entity.Wolf.Variant.class);
}
org.bukkit.entity.Wolf.Variant variant = (org.bukkit.entity.Wolf.Variant) value;
wolf.setVariant(variant);
}
@Override
public boolean isCrafter(InventoryType type) {
return type == InventoryType.CRAFTER;
}
@Override
public boolean isCopperChest(Material material) {
if (COPPER_CHESTS.contains(material) && material != Material.CHEST) {
return true;
}
return false;
}
@Override
public boolean isShelf(Material material) {
return SHELVES.contains(material);
}
@Override
public boolean isBundle(Material material) {
return BUNDLES.contains(material);
}
@Override
public Set<Material> copperChestMaterials() {
if (COPPER_CHESTS.isEmpty()) {
Material copperChest = Material.getMaterial("COPPER_CHEST");
if (copperChest == null) {
COPPER_CHESTS.add(Material.CHEST);
}
else {
COPPER_CHESTS.add(Material.getMaterial("COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("EXPOSED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WEATHERED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("OXIDIZED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_EXPOSED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_WEATHERED_COPPER_CHEST"));
COPPER_CHESTS.add(Material.getMaterial("WAXED_OXIDIZED_COPPER_CHEST"));
}
}
return COPPER_CHESTS;
}
@Override
public Set<Material> shelfMaterials() {
if (SHELVES.isEmpty()) {
Tag<Material> shelfTag = getMaterialTag(Tag.REGISTRY_BLOCKS, "wooden_shelves");
if (shelfTag != null) {
SHELVES.addAll(shelfTag.getValues());
}
if (SHELVES.isEmpty()) {
addMaterialsEndingWith(SHELVES, "_SHELF");
}
}
return SHELVES;
}
@Override
public List<Location> getShelfInteractionLocations(Block block, BlockFace blockFace) {
List<Location> locations = new ArrayList<>();
BlockData blockData = block.getBlockData();
BlockFace facing = getShelfFacing(blockData);
if (facing == null) {
locations.add(block.getLocation());
return locations;
}
if (blockFace != facing) {
return locations;
}
String sideChain = getShelfSideChain(blockData);
if ("UNCONNECTED".equals(sideChain)) {
locations.add(block.getLocation());
return locations;
}
Block center = block;
int directionX = facing.getModX();
int directionZ = facing.getModZ();
if ("LEFT".equals(sideChain)) {
center = center.getRelative(directionZ, 0, -directionX);
}
else if ("RIGHT".equals(sideChain)) {
center = center.getRelative(-directionZ, 0, directionX);
}
String centerSideChain = getShelfSideChain(center.getBlockData());
if (centerSideChain == null) {
locations.add(block.getLocation());
return locations;
}
locations.add(center.getLocation());
if (!"CENTER".equals(centerSideChain)) {
locations.add(block.getLocation());
return locations;
}
locations.add(center.getRelative(-directionZ, 0, directionX).getLocation());
locations.add(center.getRelative(directionZ, 0, -directionX).getLocation());
return locations;
}
private static Tag<Material> getMaterialTag(String registry, String key) {
return Bukkit.getTag(registry, NamespacedKey.minecraft(key), Material.class);
}
private static void addMaterialsEndingWith(Set<Material> materials, String suffix) {
for (Material material : Material.values()) {
if (material.name().endsWith(suffix)) {
materials.add(material);
}
}
}
private static BlockFace getShelfFacing(BlockData blockData) {
Object facing = invokeNoArgumentMethod(blockData, "getFacing");
return facing instanceof BlockFace ? (BlockFace) facing : null;
}
private static String getShelfSideChain(BlockData blockData) {
Object sideChain = invokeNoArgumentMethod(blockData, "getSideChain");
return sideChain == null ? null : sideChain.toString();
}
private static Object invokeNoArgumentMethod(Object target, String methodName) {
if (target == null) {
return null;
}
try {
Method method = target.getClass().getMethod(methodName);
return method.invoke(target);
}
catch (ReflectiveOperationException | LinkageError e) {
return null;
}
}
@Override
public boolean shouldLogExplosion(Event event){
ExplosionResult result = null;
if (event instanceof EntityExplodeEvent){
result = ((EntityExplodeEvent)event).getExplosionResult();
} else if (event instanceof BlockExplodeEvent){
result = ((BlockExplodeEvent)event).getExplosionResult();
}
return !(result == ExplosionResult.KEEP ||
result == ExplosionResult.TRIGGER_BLOCK
);
}
}
@@ -1,35 +0,0 @@
package net.coreprotect.bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Speleothem;
import net.coreprotect.model.BlockGroup;
/**
* Bukkit adapter implementation for Minecraft 26.2.
*/
public class Bukkit_v26_2 extends Bukkit_v1_21 {
public Bukkit_v26_2() {
initializeBlockGroups();
}
private void initializeBlockGroups() {
BlockGroup.TRACK_TOP_BOTTOM.add(Material.SULFUR_SPIKE);
}
@Override
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin) {
if (blockData instanceof Speleothem) {
Speleothem speleothem = (Speleothem) blockData;
BlockFace blockFace = speleothem.getVerticalDirection();
return scanBlock.getRelative(blockFace.getOppositeFace()).getLocation().equals(block.getLocation());
}
return super.isAttached(block, scanBlock, blockData, scanMin);
}
}
@@ -1,22 +1,23 @@
package net.coreprotect.command;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ErrorReporter;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class ApplyCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long startTime = (Long) list.get(0);
long endTime = (Long) list.get(1);
@@ -24,25 +25,41 @@ public class ApplyCommand {
Location location = (Location) list.get(3);
boolean valid = false;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("#preview")) {
valid = true;
args[i] = args[i].replaceAll("#preview", "");
}
}
if (!valid) {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
} else {
ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
}
} else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,22 +1,23 @@
package net.coreprotect.command;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ErrorReporter;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class CancelCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long startTime = (Long) list.get(0);
long endTime = (Long) list.get(1);
@@ -24,25 +25,41 @@ public class CancelCommand {
Location location = (Location) list.get(3);
boolean valid = false;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("#preview")) {
valid = true;
args[i] = args[i].replaceAll("#preview", "#preview_cancel");
}
}
if (!valid) {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
} else {
ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
}
} else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
}
}
File diff suppressed because it is too large. Load diff
@@ -1,326 +0,0 @@
package net.coreprotect.command;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.coreprotect.command.parser.*;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
/**
* Main parser class for CoreProtect commands.
* Delegates to specialized parser classes for specific functionality.
*/
public class CommandParser {
/**
* Parse page number from command arguments
*
* @param argumentArray
* The command arguments
* @return The modified argument array
*/
protected static String[] parsePage(String[] argumentArray) {
return ActionParser.parsePage(argumentArray);
}
/**
* Parse action type from command arguments
*
* @param inputArguments
* The command arguments
* @return A list of action type integers
*/
protected static List<Integer> parseAction(String[] inputArguments) {
return ActionParser.parseAction(inputArguments);
}
/**
* Parse coordinates from command arguments
*
* @param location
* The base location
* @param inputArguments
* The command arguments
* @param worldId
* The world ID
* @return The parsed location
*/
protected static Location parseCoordinates(Location location, String[] inputArguments, int worldId) {
return LocationParser.parseCoordinates(location, inputArguments, worldId);
}
/**
* Parse count flag from command arguments
*
* @param inputArguments
* The command arguments
* @return true if the count flag is present
*/
protected static boolean parseCount(String[] inputArguments) {
return ActionParser.parseCount(inputArguments);
}
/**
* Parse excluded materials and entities from command arguments
*
* @param player
* The command sender
* @param inputArguments
* The command arguments
* @param argAction
* The list of actions to include
* @return A map of excluded materials and entities
*/
protected static Map<Object, Boolean> parseExcluded(CommandSender player, String[] inputArguments, List<Integer> argAction) {
return MaterialParser.parseExcluded(player, inputArguments, argAction);
}
/**
* Parse excluded users from command arguments
*
* @param player
* The command sender
* @param inputArguments
* The command arguments
* @return A list of excluded users
*/
protected static List<String> parseExcludedUsers(CommandSender player, String[] inputArguments) {
return UserParser.parseExcludedUsers(player, inputArguments);
}
/**
* Parse force global flag from command arguments
*
* @param inputArguments
* The command arguments
* @return true if global search should be forced
*/
protected static boolean parseForceGlobal(String[] inputArguments) {
return WorldParser.parseForceGlobal(inputArguments);
}
/**
* Parse location from command sender and command arguments
*
* @param user
* The command sender
* @param argumentArray
* The command arguments
* @return The parsed location
*/
protected static Location parseLocation(CommandSender user, String[] argumentArray) {
return LocationParser.parseLocation(user, argumentArray);
}
/**
* Parse noisy/verbose flag from command arguments
*
* @param inputArguments
* The command arguments
* @return 1 if noisy/verbose mode is enabled, 0 otherwise
*/
protected static int parseNoisy(String[] inputArguments) {
return ActionParser.parseNoisy(inputArguments);
}
/**
* Parse preview flag from command arguments
*
* @param inputArguments
* The command arguments
* @return 1 for preview, 2 for preview cancel, 0 otherwise
*/
protected static int parsePreview(String[] inputArguments) {
return ActionParser.parsePreview(inputArguments);
}
/**
* Parse radius from command arguments
*
* @param inputArguments
* The command arguments
* @param user
* The command sender
* @param location
* The base location
* @return The parsed radius
*/
protected static Integer[] parseRadius(String[] inputArguments, CommandSender user, Location location) {
Integer[] result = LocationParser.parseRadius(inputArguments, user, location);
// Handle WorldEdit case which LocationParser returned as null
if (result == null && WorldParser.parseWorldEdit(inputArguments)) {
if (user.getServer().getPluginManager().getPlugin("WorldEdit") != null) {
Integer[] worldEditResult = WorldEditHandler.runWorldEditCommand(user);
if (worldEditResult != null) {
result = worldEditResult;
}
}
}
return result;
}
/**
* Parse restricted materials and entities from command arguments
*
* @param player
* The command sender
* @param inputArguments
* The command arguments
* @param argAction
* The list of actions to include
* @return A list of restricted materials and entities
*/
protected static List<Object> parseRestricted(CommandSender player, String[] inputArguments, List<Integer> argAction) {
return MaterialParser.parseRestricted(player, inputArguments, argAction);
}
/**
* Parse time from command arguments
*
* @param inputArguments
* The command arguments
* @return An array of two longs - [time1, time2]
*/
protected static long[] parseTime(String[] inputArguments) {
return TimeParser.parseTime(inputArguments);
}
/**
* Parse time string from command arguments for display
*
* @param inputArguments
* The command arguments
* @return A formatted time string
*/
protected static String parseTimeString(String[] inputArguments) {
return TimeParser.parseTimeString(inputArguments);
}
/**
* Parse rows from command arguments
*
* @param inputArguments
* The command arguments
* @return The number of rows
*/
protected static int parseRows(String[] inputArguments) {
return TimeParser.parseRows(inputArguments);
}
/**
* Parse world from command arguments
*
* @param inputArguments
* The command arguments
* @param processWorldEdit
* Whether to process WorldEdit arguments
* @param requireLoaded
* Whether the world must be loaded
* @return The world ID
*/
protected static int parseWorld(String[] inputArguments, boolean processWorldEdit, boolean requireLoaded) {
return WorldParser.parseWorld(inputArguments, processWorldEdit, requireLoaded);
}
/**
* Parse whether to use WorldEdit for radius
*
* @param inputArguments
* The command arguments
* @return true if WorldEdit should be used
*/
protected static boolean parseWorldEdit(String[] inputArguments) {
return WorldParser.parseWorldEdit(inputArguments);
}
/**
* Parse world name from command arguments
*
* @param inputArguments
* The command arguments
* @param processWorldEdit
* Whether to process WorldEdit arguments
* @return The world name
*/
protected static String parseWorldName(String[] inputArguments, boolean processWorldEdit) {
return WorldParser.parseWorldName(inputArguments, processWorldEdit);
}
/**
* Get a map of block tags and their associated materials
*
* @return A map of block tags and their associated materials
*/
protected static Map<String, Set<Material>> getTags() {
return MaterialParser.getTags();
}
/**
* Check if an argument matches a block tag
*
* @param argument
* The argument to check
* @return true if the argument matches a block tag
*/
protected static boolean checkTags(String argument) {
return MaterialParser.checkTags(argument);
}
/**
* Check if an argument matches a block tag and add the associated materials to the list
*
* @param argument
* The argument to check
* @param list
* The list to add the associated materials to
* @return true if the argument matches a block tag
*/
protected static boolean checkTags(String argument, Map<Object, Boolean> list) {
return MaterialParser.checkTags(argument, list);
}
/**
* Check if an argument matches a block tag and add the associated materials to the list
*
* @param argument
* The argument to check
* @param list
* The list to add the associated materials to
* @return true if the argument matches a block tag
*/
protected static boolean checkTags(String argument, List<Object> list) {
return MaterialParser.checkTags(argument, list);
}
/**
* Parse users from command arguments
*
* @param inputArguments
* The command arguments
* @return A list of parsed users
*/
protected static List<String> parseUsers(String[] inputArguments) {
return UserParser.parseUsers(inputArguments);
}
/**
* Helper method for formatting BigDecimal values
*
* @param input
* The BigDecimal value to format
* @return The formatted string
*/
private static String timeString(BigDecimal input) {
return input.stripTrailingZeros().toPlainString();
}
protected static Integer parseGivableItemId(String[] inputArguments) {
return GivableItemIdParser.parseGivableItemId(inputArguments);
}
}
@@ -1,69 +1,105 @@
package net.coreprotect.command;
import java.util.Locale;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
public class ConsumerCommand {
private ConsumerCommand() {
throw new IllegalStateException("Command class");
}
protected static void runCommand(final CommandSender player, boolean permission, String[] args) {
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
if (!(player instanceof ConsoleCommandSender)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_CONSOLE));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_CONSOLE));
return;
}
if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (args.length == 2) {
String action = args[1].toLowerCase(Locale.ROOT);
boolean pauseCommand = (action.equals("pause") || action.equals("disable") || action.equals("stop"));
boolean resumeCommand = (action.equals("resume") || action.equals("enable") || action.equals("start"));
if (pauseCommand || resumeCommand) {
if (ConfigHandler.pauseConsumer) {
if (pauseCommand) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_ERROR, Selector.FIRST)); // already paused
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_ERROR, Selector.FIRST)); // already paused
} else {
ConfigHandler.pauseConsumer = false;
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.SECOND)); // now started
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.SECOND)); // now started
}
}
else {
} else {
if (resumeCommand) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_ERROR, Selector.SECOND)); // already running
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_ERROR, Selector.SECOND)); // already running
} else {
ConfigHandler.pauseConsumer = true;
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.FIRST)); // now paused
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.FIRST)); // now paused
}
}
return;
}
}
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, Color.WHITE, "/co consumer <pause|resume>"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, Color.WHITE, "/co consumer <pause|resume>"));
}
}
@@ -1,40 +0,0 @@
package net.coreprotect.command;
import net.coreprotect.language.Phrase;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.ChatMessage;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ItemUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class GiveCommand {
public static void runCommand(CommandSender sender, Command command, boolean permission, String[] args) {
if (!permission) {
Chat.sendMessage(sender, new ChatMessage(Phrase.build(Phrase.NO_PERMISSION)).build());
return;
}
Integer itemId = CommandParser.parseGivableItemId(args);
if (itemId == null) {
Chat.sendMessage(sender, new ChatMessage(Phrase.build(Phrase.MISSING_PARAMETERS, Color.WHITE, "/" + command.getName() + " give <itemId>")).build());
return;
}
ItemStack item = ItemUtils.getGivableItem(itemId);
if (item == null) {
Chat.sendMessage(sender, new ChatMessage(Phrase.build(Phrase.INVALID_ITEM_ID)).build());
return;
}
if (!(sender instanceof Player)) {
Chat.sendMessage(sender, new ChatMessage(Phrase.build(Phrase.ACTION_NOT_SUPPORTED)).build());
return;
}
Player player = (Player) sender;
player.getInventory().addItem(item);
}
}
@@ -1,27 +1,35 @@
package net.coreprotect.command;
import java.util.Locale;
import org.bukkit.command.CommandSender;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
public class HelpCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
int resultc = args.length;
if (permission) {
if (resultc > 1) {
String helpcommand_original = args[1];
String helpcommand = args[1].toLowerCase(Locale.ROOT);
helpcommand = helpcommand.replaceAll("[^a-zA-Z]", "");
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA
+ Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
if (helpcommand.equals("help")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co help " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LIST));
}
else if (helpcommand.equals("inspect") || helpcommand.equals("inspector") || helpcommand.equals("in")) {
Chat.sendMessage(player,
Color.DARK_AQUA + "/co help " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LIST));
} else if (helpcommand.equals("inspect") || helpcommand.equals("inspector")
|| helpcommand.equals("in"))
{
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.HELP_INSPECT_1));
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_2));
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_3));
@@ -29,104 +37,188 @@ public class HelpCommand {
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_5));
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_6));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_INSPECT_7));
}
else if (helpcommand.equals("params") || helpcommand.equals("param") || helpcommand.equals("parameters") || helpcommand.equals("parameter")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup " + Color.GREY + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_2, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_3, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_4, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_5, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_6, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_7, Selector.FIRST));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
}
else if (helpcommand.equals("rollback") || helpcommand.equals("rollbacks") || helpcommand.equals("rb") || helpcommand.equals("ro")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co rollback " + Color.GREY + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_2, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_3, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_4, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_5, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_6, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_7, Selector.SECOND));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
}
else if (helpcommand.equals("restore") || helpcommand.equals("restores") || helpcommand.equals("re") || helpcommand.equals("rs")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co restore " + Color.GREY + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_2, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_3, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_4, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_5, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_6, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_7, Selector.THIRD));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
}
else if (helpcommand.equals("lookup") || helpcommand.equals("lookups") || helpcommand.equals("l")) {
} else if (helpcommand.equals("params") || helpcommand.equals("param")
|| helpcommand.equals("parameters") || helpcommand.equals("parameter"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup " + Color.GREY + "<params> " + Color.WHITE
+ "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_2, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_3, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_4, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_5, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_6, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_7, Selector.FIRST));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
} else if (helpcommand.equals("rollback") || helpcommand.equals("rollbacks") || helpcommand.equals("rb")
|| helpcommand.equals("ro"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co rollback " + Color.GREY + "<params> " + Color.WHITE
+ "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_2, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_3, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_4, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_5, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_6, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_7, Selector.SECOND));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
} else if (helpcommand.equals("restore") || helpcommand.equals("restores") || helpcommand.equals("re")
|| helpcommand.equals("rs"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co restore " + Color.GREY + "<params> " + Color.WHITE
+ "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_2, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_3, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_4, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_5, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_6, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_7, Selector.THIRD));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
} else if (helpcommand.equals("lookup") || helpcommand.equals("lookups") || helpcommand.equals("l")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup <params>");
Chat.sendMessage(player, Color.DARK_AQUA + "/co l <params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_1));
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup <page> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_2));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help params"));
}
else if (helpcommand.equals("purge") || helpcommand.equals("purges")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co purge " + Color.GREY + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_1));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_3));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<world> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_4));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_5));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PURGE_2, "/co purge t:30d"));
}
else if (helpcommand.equals("reload")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co reload " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RELOAD_COMMAND));
}
else if (helpcommand.equals("status")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co status " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_STATUS));
}
else if (helpcommand.equals("teleport")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co teleport <world> <x> <y> <z> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_TELEPORT));
}
else if (helpcommand.equals("u") || helpcommand.equals("user") || helpcommand.equals("users") || helpcommand.equals("uuser") || helpcommand.equals("uusers")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_USER_1));
Chat.sendMessage(player, Color.DARK_AQUA + "/co l <params> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_LOOKUP_1));
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup <page> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_LOOKUP_2));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help params"));
} else if (helpcommand.equals("purge") || helpcommand.equals("purges")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co purge t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PURGE_1));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + "" + Phrase.build(Phrase.HELP_PURGE_2, "/co purge t:30d"));
} else if (helpcommand.equals("reload")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co reload " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_RELOAD_COMMAND));
} else if (helpcommand.equals("status")) {
Chat.sendMessage(player,
Color.DARK_AQUA + "/co status " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_STATUS));
} else if (helpcommand.equals("teleport")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co teleport <world> <x> <y> <z> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_TELEPORT));
} else if (helpcommand.equals("u") || helpcommand.equals("user") || helpcommand.equals("users")
|| helpcommand.equals("uuser") || helpcommand.equals("uusers"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_USER_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_USER_2));
}
else if (helpcommand.equals("t") || helpcommand.equals("time") || helpcommand.equals("ttime")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_TIME_1));
} else if (helpcommand.equals("t") || helpcommand.equals("time") || helpcommand.equals("ttime")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_TIME_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_TIME_2));
}
else if (helpcommand.equals("r") || helpcommand.equals("radius") || helpcommand.equals("rradius")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RADIUS_1));
} else if (helpcommand.equals("r") || helpcommand.equals("radius") || helpcommand.equals("rradius")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_RADIUS_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_RADIUS_2));
}
else if (helpcommand.equals("a") || helpcommand.equals("action") || helpcommand.equals("actions") || helpcommand.equals("aaction")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_ACTION_1));
} else if (helpcommand.equals("a") || helpcommand.equals("action") || helpcommand.equals("actions")
|| helpcommand.equals("aaction"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_ACTION_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_ACTION_2));
}
else if (helpcommand.equals("i") || helpcommand.equals("include") || helpcommand.equals("iinclude") || helpcommand.equals("b") || helpcommand.equals("block") || helpcommand.equals("blocks") || helpcommand.equals("bblock") || helpcommand.equals("bblocks")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_INCLUDE_1));
} else if (helpcommand.equals("i") || helpcommand.equals("include") || helpcommand.equals("iinclude")
|| helpcommand.equals("b") || helpcommand.equals("block") || helpcommand.equals("blocks")
|| helpcommand.equals("bblock") || helpcommand.equals("bblocks"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_INCLUDE_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_INCLUDE_2));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.LINK_WIKI_ENTITY, "https://coreprotect.net/wiki-entities"));
}
else if (helpcommand.equals("e") || helpcommand.equals("exclude") || helpcommand.equals("eexclude")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_EXCLUDE_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC
+ Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
Chat.sendMessage(player, Color.GREY + Color.ITALIC
+ Phrase.build(Phrase.LINK_WIKI_ENTITY, "https://coreprotect.net/wiki-entities"));
} else if (helpcommand.equals("e") || helpcommand.equals("exclude") || helpcommand.equals("eexclude")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_EXCLUDE_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_EXCLUDE_2));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
}
else {
Chat.sendMessage(player, Color.WHITE + Phrase.build(Phrase.HELP_NO_INFO, Color.WHITE, "/co help " + helpcommand_original));
Chat.sendMessage(player, Color.GREY + Color.ITALIC
+ Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
} else {
Chat.sendMessage(player, Color.WHITE
+ Phrase.build(Phrase.HELP_NO_INFO, Color.WHITE, "/co help " + helpcommand_original));
}
} else {
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA
+ Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
Chat.sendMessage(player, Color.DARK_AQUA + "/co help " + Color.GREY + "<command> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "inspect " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_INSPECT_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "rollback " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_ROLLBACK_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "restore " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RESTORE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "lookup " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "purge " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "reload " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_RELOAD_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "status " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_STATUS_COMMAND));
}
else {
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
Chat.sendMessage(player, Color.DARK_AQUA + "/co help " + Color.GREY + "<command> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "inspect " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_INSPECT_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "rollback " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_ROLLBACK_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "restore " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RESTORE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "lookup " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "purge " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "reload " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RELOAD_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "status " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_STATUS_COMMAND));
}
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
@@ -1,52 +1,75 @@
package net.coreprotect.command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
public class InspectCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
if (permission) {
int command = -1;
ConfigHandler.inspecting.putIfAbsent(player.getName(), false);
if (args.length > 1) {
String action = args[1];
if (action.equalsIgnoreCase("on")) {
command = 1;
}
else if (action.equalsIgnoreCase("off")) {
} else if (action.equalsIgnoreCase("off")) {
command = 0;
}
}
if (!ConfigHandler.inspecting.get(player.getName())) {
if (command == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_ERROR, Selector.SECOND)); // already disabled
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.FIRST)); // now enabled
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_ERROR, Selector.SECOND)); // already disabled
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.FIRST)); // now enabled
ConfigHandler.inspecting.put(player.getName(), true);
}
}
else {
} else {
if (command == 1) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_ERROR, Selector.FIRST)); // already enabled
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.SECOND)); // now disabled
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_ERROR, Selector.FIRST)); // already enabled
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.SECOND)); // now disabled
ConfigHandler.inspecting.put(player.getName(), false);
}
}
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
File diff suppressed because it is too large. Load diff
@@ -1,26 +1,34 @@
package net.coreprotect.command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.Config;
import net.coreprotect.language.Phrase;
import net.coreprotect.listener.channel.PluginChannelListener;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ErrorReporter;
import org.bukkit.command.CommandSender;
public class NetworkDebugCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
if (!permission || !Config.getGlobal().NETWORK_DEBUG) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
try {
PluginChannelListener.getInstance().sendTest(player, args.length == 2 ? args[1] : "");
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
}
}
@@ -10,13 +10,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
@@ -28,125 +21,117 @@ import net.coreprotect.patch.Patch;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.ChatMessage;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.EntityUtils;
import net.coreprotect.utility.MaterialUtils;
import net.coreprotect.utility.VersionUtils;
import net.coreprotect.utility.ErrorReporter;
import net.coreprotect.utility.Util;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class PurgeCommand extends Consumer {
public static final List<String> PURGE_TABLES = Arrays.asList("sign", "container", "item", "skull", "session", "chat", "command", "entity", "block");
private static String findUnsupportedPurgeArgument(String[] args) {
boolean includeContinuation = false;
for (int i = 1; i < args.length; i++) {
String token = args[i].trim();
if (token.length() == 0) {
continue;
}
String argument = token.toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (includeContinuation) {
includeContinuation = argument.endsWith(",");
continue;
}
if (argument.equals("#optimize")) {
continue;
}
if (argument.startsWith("i:") || argument.startsWith("include:") || argument.startsWith("item:") || argument.startsWith("items:") || argument.startsWith("b:") || argument.startsWith("block:") || argument.startsWith("blocks:")) {
String includeValues = argument.replaceAll("include:", "").replaceAll("i:", "").replaceAll("items:", "").replaceAll("item:", "").replaceAll("blocks:", "").replaceAll("block:", "").replaceAll("b:", "");
includeContinuation = includeValues.length() == 0 || includeValues.endsWith(",");
continue;
}
if (argument.startsWith("t:") || argument.startsWith("time:")) {
continue;
}
if (argument.startsWith("r:") || argument.startsWith("radius:")) {
continue;
}
if (argument.contains(":")) {
return token;
}
}
return null;
}
protected static void runCommand(final CommandSender player, boolean permission, String[] args) {
int resultc = args.length;
Location location = CommandParser.parseLocation(player, args);
final Integer[] argRadius = CommandParser.parseRadius(args, player, location);
final List<Integer> argAction = CommandParser.parseAction(args);
final List<Object> argBlocks = CommandParser.parseRestricted(player, args, argAction);
final Map<Object, Boolean> argExclude = CommandParser.parseExcluded(player, args, argAction);
final List<String> argExcludeUsers = CommandParser.parseExcludedUsers(player, args);
final long[] argTime = CommandParser.parseTime(args);
final int argWid = CommandParser.parseWorld(args, false, false);
Location location = CommandHandler.parseLocation(player, args);
final Integer[] argRadius = CommandHandler.parseRadius(args, player, location);
final List<Integer> argAction = CommandHandler.parseAction(args);
final List<Object> argBlocks = CommandHandler.parseRestricted(player, args, argAction);
final Map<Object, Boolean> argExclude = CommandHandler.parseExcluded(player, args, argAction);
final List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
final long[] argTime = CommandHandler.parseTime(args);
final int argWid = CommandHandler.parseWorld(args, false, false);
final List<Integer> supportedActions = Arrays.asList();
long startTime = argTime[1] > 0 ? argTime[0] : 0;
long endTime = argTime[1] > 0 ? argTime[1] : argTime[0];
if (argBlocks == null || argExclude == null || argExcludeUsers == null) {
return;
}
if (ConfigHandler.converterRunning || ConfigHandler.migrationRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
if (resultc <= 1) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return;
}
String unsupportedArgument = findUnsupportedPurgeArgument(args);
if (unsupportedArgument != null) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_PARAMETER, unsupportedArgument));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co help purge"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return;
}
if (endTime <= 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return;
}
if (argRadius != null) {
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.INVALID_WORLD)).build());
return;
}
if (argWid == -1) {
String worldName = CommandParser.parseWorldName(args, false);
String worldName = CommandHandler.parseWorldName(args, false);
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.WORLD_NOT_FOUND, worldName)).build());
return;
}
if (player instanceof Player && endTime < 2592000) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "30", Selector.FIRST)); // 30 days
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PURGE_MINIMUM_TIME, "30", Selector.FIRST)); // 30 days
return;
}
else if (endTime < 86400) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "24", Selector.SECOND)); // 24 hours
} else if (endTime < 86400) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PURGE_MINIMUM_TIME, "24", Selector.SECOND)); // 24 hours
return;
}
for (int action : argAction) {
if (!supportedActions.contains(action)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
// Functions.sendMessage(player, new ChatMessage("Please specify a valid purge action.").build());
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
// Functions.sendMessage(player, new ChatMessage("Please specify a valid purge
// action.").build());
return;
}
}
StringBuilder restrict = new StringBuilder();
@@ -158,81 +143,94 @@ public class PurgeCommand extends Consumer {
int restrictCount = 0;
if (argBlocks.size() > 0) {
StringBuilder includeListMaterial = new StringBuilder();
StringBuilder includeListEntity = new StringBuilder();
for (Object restrictTarget : argBlocks) {
String targetName = "";
if (restrictTarget instanceof Material) {
targetName = ((Material) restrictTarget).name();
if (includeListMaterial.length() == 0) {
includeListMaterial = includeListMaterial.append(MaterialUtils.getBlockId(targetName, false));
}
else {
includeListMaterial.append(",").append(MaterialUtils.getBlockId(targetName, false));
includeListMaterial = includeListMaterial.append(Util.getBlockId(targetName, false));
} else {
includeListMaterial.append(",").append(Util.getBlockId(targetName, false));
}
/* Include legacy IDs */
int legacyId = BukkitAdapter.ADAPTER.getLegacyBlockId((Material) restrictTarget);
if (legacyId > 0) {
includeListMaterial.append(",").append(legacyId);
}
targetName = ((Material) restrictTarget).name().toLowerCase(Locale.ROOT);
item = (!item ? !(((Material) restrictTarget).isBlock()) : item);
hasBlock = true;
}
else if (restrictTarget instanceof EntityType) {
} else if (restrictTarget instanceof EntityType) {
targetName = ((EntityType) restrictTarget).name();
if (includeListEntity.length() == 0) {
includeListEntity = includeListEntity.append(EntityUtils.getEntityId(targetName, false));
}
else {
includeListEntity.append(",").append(EntityUtils.getEntityId(targetName, false));
includeListEntity = includeListEntity.append(Util.getEntityId(targetName, false));
} else {
includeListEntity.append(",").append(Util.getEntityId(targetName, false));
}
targetName = ((EntityType) restrictTarget).name().toLowerCase(Locale.ROOT);
entity = true;
}
else if (restrictTarget instanceof String) {
int blockId = MaterialUtils.getBlockId((String) restrictTarget, false);
if (includeListMaterial.length() == 0) {
includeListMaterial = includeListMaterial.append(blockId);
}
else {
includeListMaterial.append(",").append(blockId);
}
targetName = ((String) restrictTarget).toLowerCase(Locale.ROOT);
hasBlock = true;
}
if (restrictCount == 0) {
restrict = restrict.append("" + targetName + "");
}
else {
} else {
restrict.append(", ").append(targetName);
}
restrictCount++;
}
includeBlock = includeListMaterial.toString();
includeEntity = includeListEntity.toString();
}
if (entity) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
return;
}
boolean optimizeCheck = false;
for (String arg : args) {
if (arg.trim().equalsIgnoreCase("#optimize")) {
optimizeCheck = true;
break;
}
}
final StringBuilder restrictTargets = restrict;
@@ -245,7 +243,9 @@ public class PurgeCommand extends Consumer {
@Override
public void run() {
try {
long timestamp = (System.currentTimeMillis() / 1000L);
long timeStart = startTime > 0 ? (timestamp - startTime) : 0;
long timeEnd = timestamp - endTime;
@@ -253,28 +253,42 @@ public class PurgeCommand extends Consumer {
Connection connection = null;
for (int i = 0; i <= 5; i++) {
connection = Database.getConnection(false, 500);
if (connection != null) {
break;
}
Thread.sleep(1000);
}
if (connection == null) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.DATABASE_BUSY));
return;
}
if (argWid > 0) {
String worldName = CommandParser.parseWorldName(args, false);
String worldName = CommandHandler.parseWorldName(args, false);
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_STARTED, worldName));
}
else {
} else {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_STARTED, "#global"));
}
if (hasBlockRestriction) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.ROLLBACK_INCLUDE, restrictTargets.toString(), Selector.FIRST, Selector.FIRST, (restrictCountFinal == 1 ? Selector.FIRST : Selector.SECOND))); // include
Chat.sendGlobalMessage(player,
Phrase.build(Phrase.ROLLBACK_INCLUDE, restrictTargets.toString(), Selector.FIRST,
Selector.FIRST, (restrictCountFinal == 1 ? Selector.FIRST : Selector.SECOND))); // include
}
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_NOTICE_1));
@@ -282,8 +296,11 @@ public class PurgeCommand extends Consumer {
ConfigHandler.purgeRunning = true;
while (!Consumer.pausedSuccess) {
Thread.sleep(1);
}
Consumer.isPaused = true;
String query = "";
@@ -292,280 +309,401 @@ public class PurgeCommand extends Consumer {
String purgePrefix = "tmp_" + ConfigHandler.prefix;
if (!Config.getGlobal().MYSQL) {
query = "ATTACH DATABASE '" + ConfigHandler.path + ConfigHandler.sqlite + ".tmp' AS tmp_db";
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
purgePrefix = "tmp_db." + ConfigHandler.prefix;
}
Integer[] lastVersion = Patch.getDatabaseVersion(connection, true);
boolean newVersion = VersionUtils.newVersion(lastVersion, VersionUtils.getInternalPluginVersion());
boolean newVersion = Util.newVersion(lastVersion, Util.getInternalPluginVersion());
if (newVersion && !ConfigHandler.EDITION_BRANCH.contains("-dev")) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_FAILED));
Consumer.isPaused = false;
ConfigHandler.purgeRunning = false;
return;
}
if (!Config.getGlobal().MYSQL) {
for (String table : ConfigHandler.databaseTables) {
try {
query = "DROP TABLE IF EXISTS " + purgePrefix + table + "";
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
}
Database.createDatabaseTables(purgePrefix, false, null, Config.getGlobal().MYSQL, true);
Database.createDatabaseTables(purgePrefix, null, Config.getGlobal().MYSQL, true);
}
List<String> worldTables = Arrays.asList("sign", "container", "item", "session", "chat", "command", "block");
List<String> purgeTables = Arrays.asList("sign", "container", "item", "skull", "session", "chat",
"command", "entity", "block");
List<String> worldTables = Arrays.asList("sign", "container", "item", "session", "chat", "command",
"block");
List<String> restrictTables = Arrays.asList("block");
List<String> excludeTables = Arrays.asList("database_lock"); // don't insert data into these tables
for (String table : ConfigHandler.databaseTables) {
String tableName = table.replaceAll("_", " ");
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_PROCESSING, tableName));
if (!Config.getGlobal().MYSQL) {
String columns = "";
ResultSet rs = connection.createStatement().executeQuery("SELECT * FROM " + purgePrefix + table);
ResultSet rs = connection.createStatement()
.executeQuery("SELECT * FROM " + purgePrefix + table);
ResultSetMetaData resultSetMetaData = rs.getMetaData();
int columnCount = resultSetMetaData.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
String name = resultSetMetaData.getColumnName(i);
if (columns.length() == 0) {
columns = name;
}
else {
} else {
columns = columns + "," + name;
}
}
rs.close();
boolean error = false;
if (!excludeTables.contains(table)) {
try {
boolean purge = true;
String timeLimit = "";
if (PURGE_TABLES.contains(table)) {
if (purgeTables.contains(table)) {
String blockRestriction = "(";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type NOT IN(" + includeBlockFinal + ") OR (type IN(" + includeBlockFinal + ") AND ";
}
else if (hasBlockRestriction) {
blockRestriction = "type NOT IN(" + includeBlockFinal + ") OR (type IN("
+ includeBlockFinal + ") AND ";
} else if (hasBlockRestriction) {
purge = false;
}
if (argWid > 0 && worldTables.contains(table)) {
timeLimit = " WHERE (" + blockRestriction + "wid = '" + argWid + "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart + "'))) OR (wid != '" + argWid + "')";
}
else if (argWid == 0 && purge) {
timeLimit = " WHERE " + blockRestriction + "(time >= '" + timeEnd + "' OR time < '" + timeStart + "'))";
timeLimit = " WHERE (" + blockRestriction + "wid = '" + argWid
+ "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart
+ "'))) OR (wid != '" + argWid + "')";
} else if (argWid == 0 && purge) {
timeLimit = " WHERE " + blockRestriction + "(time >= '" + timeEnd
+ "' OR time < '" + timeStart + "'))";
}
}
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + timeLimit;
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM "
+ ConfigHandler.prefix + table + timeLimit;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
error = true;
ErrorReporter.report(e);
e.printStackTrace();
}
}
if (error) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_ERROR, tableName));
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_REPAIRING));
try {
query = "DELETE FROM " + purgePrefix + table;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
try {
query = "REINDEX " + ConfigHandler.prefix + table;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
try {
String index = " NOT INDEXED";
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + index;
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM "
+ ConfigHandler.prefix + table + index;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
abort = true;
break;
}
try {
boolean purge = PURGE_TABLES.contains(table);
boolean purge = purgeTables.contains(table);
String blockRestriction = "";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type IN(" + includeBlockFinal + ") AND ";
}
else if (hasBlockRestriction) {
} else if (hasBlockRestriction) {
purge = false;
}
String worldRestriction = "";
if (argWid > 0 && worldTables.contains(table)) {
worldRestriction = " AND wid = '" + argWid + "'";
}
else if (argWid > 0) {
} else if (argWid > 0) {
purge = false;
}
if (purge) {
query = "DELETE FROM " + purgePrefix + table + " WHERE " + blockRestriction + "time < '" + timeEnd + "' AND time >= '" + timeStart + "'" + worldRestriction;
query = "DELETE FROM " + purgePrefix + table + " WHERE " + blockRestriction
+ "time < '" + timeEnd + "' AND time >= '" + timeStart + "'"
+ worldRestriction;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
}
if (PURGE_TABLES.contains(table)) {
if (purgeTables.contains(table)) {
int oldCount = 0;
try {
query = "SELECT COUNT(*) as count FROM " + ConfigHandler.prefix + table + " LIMIT 0, 1";
query = "SELECT COUNT(*) as count FROM " + ConfigHandler.prefix + table
+ " LIMIT 0, 1";
preparedStmt = connection.prepareStatement(query);
ResultSet resultSet = preparedStmt.executeQuery();
while (resultSet.next()) {
oldCount = resultSet.getInt("count");
}
resultSet.close();
preparedStmt.close();
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
int new_count = 0;
try {
query = "SELECT COUNT(*) as count FROM " + purgePrefix + table + " LIMIT 0, 1";
preparedStmt = connection.prepareStatement(query);
ResultSet resultSet = preparedStmt.executeQuery();
while (resultSet.next()) {
new_count = resultSet.getInt("count");
}
resultSet.close();
preparedStmt.close();
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
removed = removed + (oldCount - new_count);
}
}
if (Config.getGlobal().MYSQL) {
try {
boolean purge = PURGE_TABLES.contains(table);
boolean purge = purgeTables.contains(table);
String blockRestriction = "";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type IN(" + includeBlockFinal + ") AND ";
}
else if (hasBlockRestriction) {
} else if (hasBlockRestriction) {
purge = false;
}
String worldRestriction = "";
if (argWid > 0 && worldTables.contains(table)) {
worldRestriction = " AND wid = '" + argWid + "'";
}
else if (argWid > 0) {
} else if (argWid > 0) {
purge = false;
}
if (purge) {
query = "DELETE FROM " + ConfigHandler.prefix + table + " WHERE " + blockRestriction + "time < '" + timeEnd + "' AND time >= '" + timeStart + "'" + worldRestriction;
query = "DELETE FROM " + ConfigHandler.prefix + table + " WHERE " + blockRestriction
+ "time < '" + timeEnd + "' AND time >= '" + timeStart + "'"
+ worldRestriction;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
removed = removed + preparedStmt.getUpdateCount();
preparedStmt.close();
}
}
catch (Exception e) {
if (!ConfigHandler.serverRunning) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_FAILED));
return;
}
ErrorReporter.report(e);
} catch (Exception e) {
if (!ConfigHandler.serverRunning) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_FAILED));
return;
}
e.printStackTrace();
}
}
}
if (Config.getGlobal().MYSQL && optimize) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_OPTIMIZING));
for (String table : ConfigHandler.databaseTables) {
query = "OPTIMIZE LOCAL TABLE " + ConfigHandler.prefix + table + "";
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
}
connection.close();
if (abort) {
if (!Config.getGlobal().MYSQL) {
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).delete();
}
ConfigHandler.loadDatabase();
Chat.sendGlobalMessage(player, Color.RED + Phrase.build(Phrase.PURGE_ABORTED));
Consumer.isPaused = false;
ConfigHandler.purgeRunning = false;
return;
}
if (!Config.getGlobal().MYSQL) {
(new File(ConfigHandler.path + ConfigHandler.sqlite)).delete();
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).renameTo(new File(ConfigHandler.path + ConfigHandler.sqlite));
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp"))
.renameTo(new File(ConfigHandler.path + ConfigHandler.sqlite));
}
ConfigHandler.loadDatabase();
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_SUCCESS));
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_ROWS, NumberFormat.getInstance().format(removed), (removed == 1 ? Selector.FIRST : Selector.SECOND)));
}
catch (Exception e) {
Chat.sendGlobalMessage(player,
Phrase.build(Phrase.PURGE_ROWS, NumberFormat.getInstance().format(removed),
(removed == 1 ? Selector.FIRST : Selector.SECOND)));
} catch (Exception e) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_FAILED));
ErrorReporter.report(e);
e.printStackTrace();
}
Consumer.isPaused = false;
ConfigHandler.purgeRunning = false;
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
}
}
@@ -1,67 +1,104 @@
package net.coreprotect.command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.language.Phrase;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ErrorReporter;
import org.bukkit.command.CommandSender;
public class ReloadCommand {
protected static void runCommand(final CommandSender player, boolean permission, String[] args) {
if (permission) {
if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (ConfigHandler.lookupThrottle.get(player.getName()) != null) {
Object[] lookupThrottle = ConfigHandler.lookupThrottle.get(player.getName());
if ((boolean) lookupThrottle[0] || ((System.currentTimeMillis() - (long) lookupThrottle[1])) < 100) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
return;
}
}
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { true, System.currentTimeMillis() });
class BasicThread implements Runnable {
@Override
public void run() {
try {
if (Consumer.isPaused) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.RELOAD_STARTED));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.RELOAD_STARTED));
}
while (Consumer.isPaused) {
Thread.sleep(1);
}
Consumer.isPaused = true;
ConfigHandler.performInitialization(false);
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.RELOAD_SUCCESS));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.RELOAD_SUCCESS));
Thread networkHandler = new Thread(new NetworkHandler(false, false));
networkHandler.start();
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
Consumer.isPaused = false;
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
ConfigHandler.lookupThrottle.put(player.getName(),
new Object[]
{ false, System.currentTimeMillis() });
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
@@ -6,7 +6,17 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.ContainerRollback;
import net.coreprotect.database.Database;
import net.coreprotect.database.lookup.PlayerLookup;
import net.coreprotect.database.rollback.Rollback;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -19,240 +29,373 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.ContainerRollback;
import net.coreprotect.database.Database;
import net.coreprotect.database.lookup.PlayerLookup;
import net.coreprotect.database.rollback.Rollback;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.model.action.LookupActions;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
public class RollbackRestoreCommand {
public static void runCommand(CommandSender player, Command command, boolean permission, String[] args, Location argLocation, long forceStart, long forceEnd) {
Location lo = (argLocation != null ? argLocation : CommandParser.parseLocation(player, args));
protected static void runCommand(CommandSender player, Command command, boolean permission, String[] args,
Location argLocation, long forceStart, long forceEnd)
{
Location lo = (argLocation != null ? argLocation : CommandHandler.parseLocation(player, args));
List<String> argUuids = new ArrayList<>();
List<String> argUsers = CommandParser.parseUsers(args);
Integer[] argRadius = CommandParser.parseRadius(args, player, lo);
int argNoisy = CommandParser.parseNoisy(args);
List<Integer> argAction = CommandParser.parseAction(args);
List<Object> argBlocks = CommandParser.parseRestricted(player, args, argAction);
Map<Object, Boolean> argExclude = CommandParser.parseExcluded(player, args, argAction);
List<String> argExcludeUsers = CommandParser.parseExcludedUsers(player, args);
String ts = CommandParser.parseTimeString(args);
long[] argTime = CommandParser.parseTime(args);
List<String> argUsers = CommandHandler.parseUsers(args);
Integer[] argRadius = CommandHandler.parseRadius(args, player, lo);
int argNoisy = CommandHandler.parseNoisy(args);
List<Integer> argAction = CommandHandler.parseAction(args);
List<Object> argBlocks = CommandHandler.parseRestricted(player, args, argAction);
Map<Object, Boolean> argExclude = CommandHandler.parseExcluded(player, args, argAction);
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
String ts = CommandHandler.parseTimeString(args);
long[] argTime = CommandHandler.parseTime(args);
long startTime = argTime[0];
long endTime = argTime[1];
int argWid = CommandParser.parseWorld(args, true, true);
boolean count = CommandParser.parseCount(args);
boolean worldedit = CommandParser.parseWorldEdit(args);
boolean forceglobal = CommandParser.parseForceGlobal(args);
int preview = CommandParser.parsePreview(args);
int argWid = CommandHandler.parseWorld(args, true, true);
boolean count = CommandHandler.parseCount(args);
boolean worldedit = CommandHandler.parseWorldEdit(args);
boolean forceglobal = CommandHandler.parseForceGlobal(args);
int preview = CommandHandler.parsePreview(args);
String corecommand = args[0].toLowerCase(Locale.ROOT);
if (argBlocks == null || argExclude == null || argExcludeUsers == null) {
return;
}
/* check for invalid block/entity combinations (include) */
boolean hasBlock = false;
boolean hasEntity = false;
for (Object arg : argBlocks) {
if (arg instanceof Material || arg instanceof String) {
if (arg instanceof Material) {
hasBlock = true;
}
else if (arg instanceof EntityType) {
} else if (arg instanceof EntityType) {
hasEntity = true;
if (argAction.size() == 0) {
argAction.add(LookupActions.ENTITY_KILL);
}
else if (!argAction.contains(LookupActions.ENTITY_KILL)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
argAction.add(3);
} else if (!argAction.contains(3)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
return;
}
}
}
/* check for invalid block/entity combinations (exclude) */
for (Object arg : argExclude.keySet()) {
if (arg instanceof Material || arg instanceof String) {
if (arg instanceof Material) {
hasBlock = true;
}
else if (arg instanceof EntityType) {
} else if (arg instanceof EntityType) {
hasEntity = true;
if (argAction.size() == 0) {
argAction.add(LookupActions.ENTITY_KILL);
}
else if (!argAction.contains(LookupActions.ENTITY_KILL)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
argAction.add(3);
} else if (!argAction.contains(3)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
return;
}
}
}
if (hasBlock && hasEntity) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
return;
}
if (count) {
LookupCommand.runCommand(player, command, permission, args);
return;
}
if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (argWid == -1) {
String worldName = CommandParser.parseWorldName(args, true);
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.WORLD_NOT_FOUND, worldName));
String worldName = CommandHandler.parseWorldName(args, true);
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.WORLD_NOT_FOUND, worldName));
return;
}
if (preview > 0 && (!(player instanceof Player))) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_IN_GAME));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_IN_GAME));
return;
}
if (argAction.contains(-1)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_ACTION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_ACTION));
return;
}
if (worldedit && argRadius == null) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_SELECTION, "WorldEdit"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_SELECTION, "WorldEdit"));
return;
}
if (argRadius != null && argRadius[0] == -1) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_RADIUS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_RADIUS));
return;
}
if (ConfigHandler.activeRollbacks.get(player.getName()) != null) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_IN_PROGRESS));
return;
}
if (ConfigHandler.lookupThrottle.get(player.getName()) != null) {
Object[] lookupThrottle = ConfigHandler.lookupThrottle.get(player.getName());
if ((boolean) lookupThrottle[0] || ((System.currentTimeMillis() - (long) lookupThrottle[1])) < 100) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
return;
}
}
if (preview > 1 && forceStart <= 0) {
preview = 1;
}
if (permission) {
int a = 0;
if (corecommand.equals("restore") || corecommand.equals("rs") || corecommand.equals("re")) {
a = 1;
}
final int finalAction = a;
int DEFAULT_RADIUS = Config.getGlobal().DEFAULT_RADIUS;
if ((player instanceof Player || player instanceof BlockCommandSender) && argRadius == null && DEFAULT_RADIUS > 0 && !forceglobal && !argAction.contains(LookupActions.ITEM)) {
if ((player instanceof Player || player instanceof BlockCommandSender) && argRadius == null
&& DEFAULT_RADIUS > 0 && !forceglobal && !argAction.contains(11))
{
Location location = lo;
int xmin = location.getBlockX() - DEFAULT_RADIUS;
int xmax = location.getBlockX() + DEFAULT_RADIUS;
int zmin = location.getBlockZ() - DEFAULT_RADIUS;
int zmax = location.getBlockZ() + DEFAULT_RADIUS;
argRadius = new Integer[] { DEFAULT_RADIUS, xmin, xmax, null, null, zmin, zmax, 0 };
}
// if (arg_radius==-2)arg_radius = -1;
int g = 1;
if (argUsers.contains("#global")) {
if (argRadius == null) {
g = 0;
}
}
if (argUsers.size() == 0 && (argWid > 0 || forceglobal) && argRadius == null) {
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.FIRST));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.FIRST));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.SECOND));
}
return;
}
if (LookupActions.isInventoryLookup(argAction)) {
if (argAction.contains(4) && argAction.contains(11)) { // a:inventory
if (argUsers.size() == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ACTION_USER));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ACTION_USER));
return;
}
argExclude.put(Material.FIRE, false);
argExclude.put(Material.WATER, false);
argExclude.put(Material.FARMLAND, false);
argExcludeUsers.add("#hopper");
}
else if (!argAction.contains(LookupActions.CONTAINER) && Config.getGlobal().EXCLUDE_TNT && !argExclude.containsKey(Material.TNT) && !argBlocks.contains(Material.TNT)) {
} else if (!argAction.contains(4) && Config.getGlobal().EXCLUDE_TNT && !argExclude.containsKey(Material.TNT)
&& !argBlocks.contains(Material.TNT))
{
argExclude.put(Material.TNT, true);
}
if (g == 1 && (argUsers.size() > 0 || (argUsers.size() == 0 && argRadius != null))) {
Integer MAX_RADIUS = Config.getGlobal().MAX_RADIUS;
if (argRadius != null) {
int radiusValue = argRadius[0];
if (radiusValue > MAX_RADIUS && MAX_RADIUS > 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MAXIMUM_RADIUS, MAX_RADIUS.toString(), (finalAction == 0 ? Selector.SECOND : Selector.THIRD)));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.GLOBAL_ROLLBACK, "r:#global", (finalAction == 0 ? Selector.FIRST : Selector.SECOND)));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MAXIMUM_RADIUS, MAX_RADIUS.toString(),
(finalAction == 0 ? Selector.SECOND : Selector.THIRD)));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.GLOBAL_ROLLBACK, "r:#global",
(finalAction == 0 ? Selector.FIRST : Selector.SECOND)));
return;
}
}
if (argAction.size() > 0) {
if (argAction.contains(LookupActions.CONTAINER)) {
if (argAction.contains(4)) {
if (argUsers.contains("#global") || (argUsers.size() == 0 && argRadius == null)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ACTION_USER));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ACTION_USER));
return;
}
else if (preview > 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_TRANSACTION, !argAction.contains(LookupActions.ITEM) ? Selector.FIRST : Selector.SECOND));
} else if (preview > 0) {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PREVIEW_TRANSACTION,
!argAction.contains(11) ? Selector.FIRST : Selector.SECOND));
return;
}
}
if (argAction.contains(LookupActions.SESSION) || (argAction.contains(LookupActions.ITEM) && !argAction.contains(LookupActions.CONTAINER)) || (!argAction.contains(LookupActions.BLOCK_BREAK) && !argAction.contains(LookupActions.BLOCK_PLACE) && !argAction.contains(LookupActions.ENTITY_KILL) && !argAction.contains(LookupActions.CONTAINER))) {
if (argAction.contains(8) || (argAction.contains(11) && !argAction.contains(4))
|| (!argAction.contains(0) && !argAction.contains(1) && !argAction.contains(3)
&& !argAction.contains(4)))
{
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
}
return;
}
}
if (argUsers.size() == 0) {
argUsers.add("#global");
}
List<String> rollbackusers = argUsers;
int c = 0;
for (String ruser : rollbackusers) {
List<Player> players = Bukkit.getServer().matchPlayer(ruser); // here
for (Player p : players) {
if (p.getName().equalsIgnoreCase(ruser)) {
ruser = p.getName();
rollbackusers.set(c, ruser);
}
}
c++;
if (LookupActions.isInventoryLookup(argAction)) {
if (argAction.contains(4) && argAction.contains(11)) {
Player onlineUser = Bukkit.getServer().getPlayer(ruser);
if (onlineUser == null || !onlineUser.isOnline()) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.USER_OFFLINE, ruser));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.USER_OFFLINE, ruser));
return;
}
}
}
int wid = 0;
@@ -260,29 +403,45 @@ public class RollbackRestoreCommand {
int y = 0;
int z = 0;
if (rollbackusers.contains("#container")) {
if (argAction.contains(LookupActions.ITEM)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_USERNAME, "#container"));
if (argAction.contains(11)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_USERNAME, "#container"));
return;
}
boolean valid = false;
if (ConfigHandler.lookupType.get(player.getName()) != null) {
int lookupType = ConfigHandler.lookupType.get(player.getName());
if (lookupType == 1) {
valid = true;
}
else if (lookupType == 5) {
} else if (lookupType == 5) {
if (ConfigHandler.lookupUlist.get(player.getName()).contains("#container")) {
valid = true;
}
}
}
if (valid) {
if (preview > 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_TRANSACTION, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PREVIEW_TRANSACTION, Selector.FIRST));
return;
}
else {
} else {
String lcommand = ConfigHandler.lookupCommand.get(player.getName());
String[] data = lcommand.split("\\.");
x = Integer.parseInt(data[0]);
@@ -292,12 +451,16 @@ public class RollbackRestoreCommand {
argAction.add(5);
argRadius = null;
argWid = 0;
lo = new Location(Bukkit.getServer().getWorld(WorldUtils.getWorldName(wid)), x, y, z);
lo = new Location(Bukkit.getServer().getWorld(Util.getWorldName(wid)), x, y, z);
Block block = lo.getBlock();
if (block.getState() instanceof Chest) {
BlockFace[] blockFaces = new BlockFace[] { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
BlockFace[] blockFaces = new BlockFace[] { BlockFace.NORTH, BlockFace.EAST,
BlockFace.SOUTH, BlockFace.WEST };
for (BlockFace face : blockFaces) {
if (block.getRelative(face, 1).getState() instanceof Chest) {
Block relative = block.getRelative(face, 1);
int x2 = relative.getX();
int z2 = relative.getZ();
@@ -306,30 +469,43 @@ public class RollbackRestoreCommand {
lo.setX(newX);
lo.setZ(newZ);
break;
}
}
}
}
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_CONTAINER));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_CONTAINER));
return;
}
}
final List<String> rollbackusers2 = rollbackusers;
if (startTime > 0) {
long unixtimestamp = (System.currentTimeMillis() / 1000L);
long timeStart = unixtimestamp - startTime;
long timeEnd = endTime > 0 ? (unixtimestamp - endTime) : 0;
if (forceStart > 0) {
timeStart = forceStart;
timeEnd = forceEnd;
}
final long finalTimeStart = timeStart;
final long finalTimeEnd = timeEnd;
final Integer[] radius = argRadius;
try {
final CommandSender player2 = player;
final int noisy = argNoisy;
final String rtime = ts;
@@ -346,147 +522,257 @@ public class RollbackRestoreCommand {
ConfigHandler.activeRollbacks.put(player.getName(), true);
class BasicThread2 implements Runnable {
@Override
public void run() {
try (Connection connection = Database.getConnection(false, 1000)) {
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { true, System.currentTimeMillis() });
ConfigHandler.lookupThrottle.put(player.getName(),
new Object[]
{ true, System.currentTimeMillis() });
int action = finalAction;
Location location = locationFinal;
if (connection != null) {
Statement statement = connection.createStatement();
String baduser = "";
boolean exists = false;
for (String check : rollbackusers2) {
if (!check.equals("#global") && !check.equals("#container")) {
exists = PlayerLookup.playerExists(connection, check);
if (!exists) {
baduser = check;
break;
}
}
else {
} else {
exists = true;
}
}
if (exists) {
for (String check : euserlist) {
if (!check.equals("#global") && !check.equals("#hopper")) {
exists = PlayerLookup.playerExists(connection, check);
if (!exists) {
baduser = check;
break;
}
}
else if (check.equals("#global")) {
} else if (check.equals("#global")) {
baduser = "#global";
exists = false;
}
}
}
if (exists) {
boolean restrictWorld = false;
if (radius != null) {
restrictWorld = true;
}
if (location == null) {
restrictWorld = false;
}
if (finalArgWid > 0) {
restrictWorld = true;
location = new Location(Bukkit.getServer().getWorld(WorldUtils.getWorldName(finalArgWid)), 0, 0, 0);
location = new Location(
Bukkit.getServer().getWorld(Util.getWorldName(finalArgWid)), 0,
0, 0);
}
boolean verbose = false;
if (noisy == 1) {
verbose = true;
}
String users = "";
for (String value : rollbackusers2) {
if (users.length() == 0) {
users = "" + value + "";
}
else {
} else {
users = users + ", " + value;
}
}
if (users.equals("#global") && restrictWorld) {
// chat output only, don't pass into any functions
users = "#" + location.getWorld().getName();
}
if (finalPreview == 2) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_CANCELLING));
}
else if (finalPreview == 1) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.THIRD));
}
else if (action == 0) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.FIRST));
}
else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.SECOND));
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- " + Phrase.build(Phrase.PREVIEW_CANCELLING));
} else if (finalPreview == 1) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- "
+ Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.THIRD));
} else if (action == 0) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- "
+ Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.FIRST));
} else {
Chat.sendMessage(player2,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ROLLBACK_STARTED, users,
Selector.SECOND));
}
if (finalArgAction.contains(5)) {
ContainerRollback.performContainerRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, finalTimeStart, finalTimeEnd, restrictWorld, false, verbose, action);
}
else {
Rollback.performRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, finalTimeStart, finalTimeEnd, restrictWorld, false, verbose, action, finalPreview);
ContainerRollback.performContainerRollbackRestore(statement, player2,
uuidList, rollbackusers2, rtime, blist, elist, euserlist,
finalArgAction, location, radius, finalTimeStart, finalTimeEnd,
restrictWorld, false, verbose, action);
} else {
Rollback.performRollbackRestore(statement, player2, uuidList,
rollbackusers2, rtime, blist, elist, euserlist, finalArgAction,
location, radius, finalTimeStart, finalTimeEnd, restrictWorld,
false, verbose, action, finalPreview);
}
if (finalPreview < 2) {
List<Object> list = new ArrayList<>();
list.add(finalTimeStart);
list.add(finalTimeEnd);
list.add(finalArgs);
list.add(locationFinal);
ConfigHandler.lastRollback.put(player2.getName(), list);
}
} else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- " + Phrase.build(Phrase.USER_NOT_FOUND, baduser));
}
else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.USER_NOT_FOUND, baduser));
}
statement.close();
} else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.DATABASE_BUSY));
}
else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
}
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
if (ConfigHandler.activeRollbacks.get(player2.getName()) != null) {
ConfigHandler.activeRollbacks.remove(player2.getName());
}
ConfigHandler.lookupThrottle.put(player2.getName(), new Object[] { false, System.currentTimeMillis() });
ConfigHandler.lookupThrottle.put(player2.getName(),
new Object[]
{ false, System.currentTimeMillis() });
}
}
Runnable runnable = new BasicThread2();
Thread thread = new Thread(runnable);
thread.start();
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
}
else {
} else {
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.SECOND));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.SECOND));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.THIRD));
}
}
}
else {
} else {
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.FIRST)); // rollback
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.SECOND)); // restore
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.FIRST)); // rollback
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.SECOND)); // restore
}
}
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
@@ -1,11 +1,6 @@
package net.coreprotect.command;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import net.coreprotect.CoreProtect;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
@@ -17,171 +12,240 @@ import net.coreprotect.patch.Patch;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.SystemUtils;
import net.coreprotect.utility.VersionUtils;
import net.coreprotect.utility.ErrorReporter;
import net.coreprotect.utility.Util;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
public class StatusCommand {
private static ConcurrentHashMap<String, Boolean> alert = new ConcurrentHashMap<>();
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
class BasicThread implements Runnable {
@Override
public void run() {
try {
CoreProtect instance = CoreProtect.getInstance();
PluginDescriptionFile pdfFile = instance.getDescription();
String versionCheck = "";
if (Config.getGlobal().CHECK_UPDATES) {
String latestVersion = NetworkHandler.latestVersion();
String latestEdgeVersion = NetworkHandler.latestEdgeVersion();
if (latestVersion != null) {
versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestVersion) + ")";
}
else if (latestEdgeVersion != null && !VersionUtils.isCommunityEdition()) {
versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestEdgeVersion) + ")";
}
}
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect" + (VersionUtils.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "") + Color.WHITE + " -----");
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_VERSION, Color.WHITE, ConfigHandler.EDITION_NAME + " v" + pdfFile.getVersion() + ".") + versionCheck);
Chat.sendMessage(player,
Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect"
+ (Util.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "")
+ Color.WHITE + " -----");
Chat.sendMessage(player,
Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_VERSION, Color.WHITE,
ConfigHandler.EDITION_NAME + " v" + pdfFile.getVersion() + ".")
+ versionCheck);
String donationKey = NetworkHandler.donationKey();
if (donationKey != null) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE, Phrase.build(Phrase.VALID_DONATION_KEY)) + " (" + donationKey + ")");
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE, Phrase.build(Phrase.INVALID_DONATION_KEY)) + Color.GREY + Color.ITALIC + " (" + Phrase.build(Phrase.CHECK_CONFIG) + ")");
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE,
Phrase.build(Phrase.VALID_DONATION_KEY)) + " (" + donationKey + ")");
} else {
Chat.sendMessage(player,
Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE,
Phrase.build(Phrase.INVALID_DONATION_KEY))
+ Color.GREY + Color.ITALIC + " (" + Phrase.build(Phrase.CHECK_CONFIG) + ")");
}
/*
Items processed (since server start)
Items processed (last 60 minutes)
* Items processed (since server start) Items processed (last 60 minutes)
*/
// Using MySQL/SQLite (Database Size: 587MB)
String firstVersion = Patch.getFirstVersion();
if (firstVersion.length() > 0) {
firstVersion = " (" + Phrase.build(Phrase.FIRST_VERSION, firstVersion) + ")";
}
if (Config.getGlobal().MYSQL) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "MySQL") + firstVersion);
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "SQLite") + firstVersion);
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "MySQL") + firstVersion);
} else {
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "SQLite") + firstVersion);
}
if (ConfigHandler.worldeditEnabled) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.FIRST));
}
else if (instance.getServer().getPluginManager().getPlugin("WorldEdit") != null) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.FIRST));
} else if (instance.getServer().getPluginManager().getPlugin("WorldEdit") != null) {
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.SECOND));
}
try {
int consumerCount = 0;
int currentConsumerSize = Process.getCurrentConsumerSize();
if (currentConsumerSize == 0) {
consumerCount = Consumer.getConsumerSize(0) + Consumer.getConsumerSize(1);
}
else {
} else {
int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
consumerCount = Consumer.getConsumerSize(consumerId) + currentConsumerSize;
}
if (consumerCount >= 1 && (player instanceof Player)) {
if (Config.getConfig(((Player) player).getWorld()).PLAYER_COMMANDS) {
consumerCount = consumerCount - 1;
}
}
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_CONSUMER, Color.WHITE, String.format("%,d", consumerCount), (consumerCount == 1 ? Selector.FIRST : Selector.SECOND)));
}
catch (Exception e) {
ErrorReporter.report(e);
}
Chat.sendMessage(player,
Color.DARK_AQUA + Phrase.build(Phrase.STATUS_CONSUMER, Color.WHITE,
String.format("%,d", consumerCount),
(consumerCount == 1 ? Selector.FIRST : Selector.SECOND)));
long autoPurgeRowsPurged = ConfigHandler.autoPurgeRowsPurged.get();
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_AUTO_PURGE, Color.WHITE, String.format("%,d", autoPurgeRowsPurged), (autoPurgeRowsPurged == 1 ? Selector.FIRST : Selector.SECOND)));
} catch (Exception e) {
e.printStackTrace();
}
try {
String cpuInfo = "x" + Runtime.getRuntime().availableProcessors() + " " + Phrase.build(Phrase.CPU_CORES);
String cpuInfo = "";
if (ConfigHandler.processorInfo != null) {
String modelName = ConfigHandler.processorInfo.getName();
String modelName = ConfigHandler.processorInfo.getProcessorIdentifier().getName();
if (modelName.contains(" CPU")) {
String[] split = modelName.split(" CPU")[0].split(" ");
modelName = split[split.length - 1];
}
else if (modelName.contains(" Processor")) {
} else if (modelName.contains(" Processor")) {
String[] split = modelName.split(" Processor")[0].split(" ");
modelName = split[split.length - 1];
}
String cpuSpeed = String.valueOf(ConfigHandler.processorInfo.getMaxFrequency());
double speedVal = Long.valueOf(cpuSpeed) / 1000000000.0;
String cpuSpeed = String.valueOf(ConfigHandler.processorInfo.getMaxFreq());
cpuSpeed = String.format("%.2f", Long.valueOf(cpuSpeed) / 1000000000.0);
cpuInfo = "x" + Runtime.getRuntime().availableProcessors() + " " + cpuSpeed + "GHz "
+ modelName + ".";
// Fix for Apple Silicon processors reporting 0 GHz
if (speedVal < 0.01 && SystemUtils.isAppleSilicon()) {
Double appleSiliconSpeed = SystemUtils.getAppleSiliconSpeed();
if (appleSiliconSpeed != null) {
speedVal = appleSiliconSpeed;
}
}
} else {
cpuInfo = "x" + Runtime.getRuntime().availableProcessors() + " "
+ Phrase.build(Phrase.CPU_CORES);
cpuSpeed = String.format("%.2f", speedVal);
if (speedVal >= 0.01) {
cpuInfo = "x" + Runtime.getRuntime().availableProcessors() + " " + cpuSpeed + "GHz " + modelName + ".";
}
}
int mb = 1024 * 1024;
Runtime runtime = Runtime.getRuntime();
String usedRAM = String.format("%.2f", Double.valueOf((runtime.totalMemory() - runtime.freeMemory()) / mb) / 1000.0);
String usedRAM = String.format("%.2f",
Double.valueOf((runtime.totalMemory() - runtime.freeMemory()) / mb) / 1000.0);
String totalRAM = String.format("%.2f", Double.valueOf(runtime.maxMemory() / mb) / 1000.0);
String systemInformation = Phrase.build(Phrase.RAM_STATS, usedRAM, totalRAM);
if (cpuInfo.length() > 0) {
systemInformation = cpuInfo + " (" + systemInformation + ")";
}
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_SYSTEM, Color.WHITE, systemInformation));
}
catch (Exception e) {
ErrorReporter.report(e);
Chat.sendMessage(player,
Color.DARK_AQUA + Phrase.build(Phrase.STATUS_SYSTEM, Color.WHITE, systemInformation));
} catch (Exception e) {
e.printStackTrace();
}
// Functions.sendMessage(player, Color.DARK_AQUA + "Website: " + Color.WHITE + "www.coreprotect.net/updates/");
// Functions.sendMessage(player, Color.DARK_AQUA + "Website: " + Color.WHITE +
// "www.coreprotect.net/updates/");
// Functions.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.LINK_DISCORD, Color.WHITE + "www.coreprotect.net/discord/").replaceFirst(":", ":" + Color.WHITE));
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.LINK_DISCORD, Color.WHITE, "www.coreprotect.net/discord/"));
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.LINK_PATREON, Color.WHITE, "www.patreon.com/coreprotect/"));
// Functions.sendMessage(player, Color.DARK_AQUA +
// Phrase.build(Phrase.LINK_DISCORD, Color.WHITE +
// "www.coreprotect.net/discord/").replaceFirst(":", ":" + Color.WHITE));
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.LINK_DISCORD, Color.WHITE, "www.coreprotect.net/discord/"));
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.LINK_PATREON, Color.WHITE, "www.patreon.com/coreprotect/"));
if (player.isOp() && alert.get(player.getName()) == null) {
alert.put(player.getName(), true);
if (instance.getServer().getPluginManager().getPlugin("CoreEdit") == null) {
Thread.sleep(500);
/*
Functions.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "Recommended Plugin " + Color.WHITE + "-----");
Functions.sendMessage(player, Color.DARK_AQUA + "Notice: " + Color.WHITE + "Enjoy CoreProtect? Check out CoreEdit!");
Functions.sendMessage(player, Color.DARK_AQUA + "Download: " + Color.WHITE + "www.coreedit.net/download/");
*/
* Functions.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA +
* "Recommended Plugin " + Color.WHITE + "-----"); Functions.sendMessage(player,
* Color.DARK_AQUA + "Notice: " + Color.WHITE +
* "Enjoy CoreProtect? Check out CoreEdit!"); Functions.sendMessage(player,
* Color.DARK_AQUA + "Download: " + Color.WHITE + "www.coreedit.net/download/");
*/
}
}
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
}
}
File diff suppressed because it is too large. Load diff
@@ -1,11 +1,5 @@
package net.coreprotect.command;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.coreprotect.CoreProtect;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
@@ -14,51 +8,71 @@ import net.coreprotect.utility.Chat;
import net.coreprotect.utility.ChatMessage;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Teleport;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class TeleportCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
int resultc = args.length;
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
if (!(player instanceof Player)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.TELEPORT_PLAYERS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.TELEPORT_PLAYERS));
return;
}
if (ConfigHandler.teleportThrottle.get(player.getName()) != null) {
Object[] lookupThrottle = ConfigHandler.teleportThrottle.get(player.getName());
if ((boolean) lookupThrottle[0] || ((System.currentTimeMillis() - (long) lookupThrottle[1])) < 500) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_THROTTLED));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_THROTTLED));
return;
}
}
if (resultc < 3) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
return;
}
String worldName = args[1];
int wid = WorldUtils.matchWorld(worldName);
int wid = Util.matchWorld(worldName);
if (wid == -1 && resultc >= 5) {
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.WORLD_NOT_FOUND, worldName)).build());
return;
}
Location location = ((Player) player).getLocation().clone();
World world = location.getWorld();
if (wid > -1) {
world = Bukkit.getServer().getWorld(WorldUtils.getWorldName(wid));
if (world == null) {
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.WORLD_NOT_FOUND, worldName)).build());
return;
}
world = Bukkit.getServer().getWorld(Util.getWorldName(wid));
}
String x = null;
@@ -66,36 +80,55 @@ public class TeleportCommand {
String z = null;
for (int i = 1; i < args.length; i++) {
if (i == 1 && wid > -1) {
continue;
}
if (x == null) {
x = args[i].replaceAll("[^0-9.\\-]", "");
}
else if (z == null) {
} else if (z == null) {
z = args[i].replaceAll("[^0-9.\\-]", "");
}
else if (y == null) {
} else if (y == null) {
y = z;
z = args[i].replaceAll("[^0-9.\\-]", "");
}
}
if (y == null) {
if (location.getBlockY() > 63) {
location.setY(63);
}
y = Double.toString(location.getY());
}
String xValidate = x.replaceAll("[^.\\-]", "");
String yValidate = y.replaceAll("[^.\\-]", "");
String zValidate = z.replaceAll("[^.\\-]", "");
if ((x.length() == 0 || x.length() >= 12 || x.equals(xValidate)) || (y.length() == 0 || y.length() >= 12 || y.equals(yValidate)) || (z.length() == 0 || z.length() >= 12 || z.equals(zValidate))) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
if ((x.length() == 0 || x.length() >= 12 || x.equals(xValidate))
|| (y.length() == 0 || y.length() >= 12 || y.equals(yValidate))
|| (z.length() == 0 || z.length() >= 12 || z.equals(zValidate)))
{
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
return;
}
location.setWorld(world);
@@ -106,14 +139,20 @@ public class TeleportCommand {
int chunkX = location.getBlockX() >> 4;
int chunkZ = location.getBlockZ() >> 4;
Scheduler.runTask(CoreProtect.getInstance(), () -> {
if (!location.getWorld().isChunkLoaded(chunkX, chunkZ)) {
location.getWorld().getChunkAt(location);
}
// Teleport the player to a safe location
Teleport.performSafeTeleport(((Player) player), location, true);
}, location);
ConfigHandler.teleportThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
}
}
@@ -1,54 +1,74 @@
package net.coreprotect.command;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ErrorReporter;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class UndoCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long startTime = (Long) list.get(0);
long endTime = (Long) list.get(1);
args = (String[]) list.get(2);
Location location = (Location) list.get(3);
for (String arg : args) {
if (arg.equals("#preview")) {
CancelCommand.runCommand(user, command, permission, args);
return;
}
}
boolean valid = true;
if (args[0].equals("rollback") || args[0].equals("rb") || args[0].equals("ro")) {
args[0] = "restore";
}
else if (args[0].equals("restore") || args[0].equals("rs") || args[0].equals("re")) {
} else if (args[0].equals("restore") || args[0].equals("rs") || args[0].equals("re")) {
args[0] = "rollback";
}
else {
} else {
valid = false;
}
if (valid) {
ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
}
} else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.SECOND));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.SECOND));
}
}
catch (Exception e) {
ErrorReporter.report(e);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,43 +1,51 @@
package net.coreprotect.command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.World;
import net.coreprotect.worldedit.WorldEditLogger;
import net.coreprotect.utility.ErrorReporter;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class WorldEditHandler {
protected static Integer[] runWorldEditCommand(CommandSender user) {
Integer[] result = null;
try {
WorldEditPlugin worldEdit = WorldEditLogger.getWorldEdit(user.getServer());
if (worldEdit != null && user instanceof Player) {
LocalSession session = worldEdit.getSession((Player) user);
World world = session.getSelectionWorld();
if (world != null) {
Region region = session.getSelection(world);
if (region != null && world.getName().equals(((Player) user).getWorld().getName())) {
BlockVector3 block = region.getMinimumPoint();
int x = block.getBlockX();
int y = block.getBlockY();
int z = block.getBlockZ();
int x = block.x();
int y = block.y();
int z = block.z();
int width = region.getWidth();
int height = region.getHeight();
int length = region.getLength();
int max = width;
if (height > max) {
max = height;
}
if (length > max) {
max = length;
}
int xMin = x;
int xMax = x + (width - 1);
int yMin = y;
@@ -45,13 +53,21 @@ public class WorldEditHandler {
int zMin = z;
int zMax = z + (length - 1);
result = new Integer[] { max, xMin, xMax, yMin, yMax, zMin, zMax, 1 };
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
return result;
}
}
@@ -1,91 +0,0 @@
package net.coreprotect.command.lookup;
import java.sql.Connection;
import java.sql.Statement;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.lookup.BlockLookup;
import net.coreprotect.database.lookup.InteractionLookup;
import net.coreprotect.database.lookup.SignMessageLookup;
import net.coreprotect.language.Phrase;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ErrorReporter;
public class BlockLookupThread implements Runnable {
private final CommandSender player;
private final Command command;
private final Block block;
private final BlockState blockState;
private final int page;
private final int limit;
private final int type;
public BlockLookupThread(CommandSender player, Command command, Block block, BlockState blockState, int page, int limit, int type) {
this.player = player;
this.command = command;
this.block = block;
this.blockState = blockState;
this.page = page;
this.limit = limit;
this.type = type;
}
@Override
public void run() {
try (Connection connection = Database.getConnection(true)) {
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { true, System.currentTimeMillis() });
if (connection != null) {
Statement statement = connection.createStatement();
if (type == 8) {
java.util.List<String> signData = SignMessageLookup.performLookup(command.getName(), statement, blockState.getLocation(), player, page, limit);
for (String signMessage : signData) {
String bypass = null;
if (signMessage.contains("\n")) {
String[] split = signMessage.split("\n");
signMessage = split[0];
bypass = split[1];
}
if (signMessage.length() > 0) {
Chat.sendComponent(player, signMessage, bypass);
}
}
}
else {
String blockdata = null;
if (type == 7) {
blockdata = InteractionLookup.performLookup(command.getName(), statement, block, player, 0, page, limit);
}
else {
blockdata = BlockLookup.performLookup(command.getName(), statement, blockState, player, 0, page, limit);
}
if (blockdata.contains("\n")) {
for (String b : blockdata.split("\n")) {
Chat.sendComponent(player, b);
}
}
else if (blockdata.length() > 0) {
Chat.sendComponent(player, blockdata);
}
}
statement.close();
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
}
}
@@ -1,56 +0,0 @@
package net.coreprotect.command.lookup;
import java.sql.Connection;
import java.sql.Statement;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.lookup.ChestTransactionLookup;
import net.coreprotect.language.Phrase;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.ErrorReporter;
public class ChestTransactionLookupThread implements Runnable {
private final CommandSender player;
private final Command command;
private final Location location;
private final int page;
private final int limit;
public ChestTransactionLookupThread(CommandSender player, Command command, Location location, int page, int limit) {
this.player = player;
this.command = command;
this.location = location;
this.page = page;
this.limit = limit;
}
@Override
public void run() {
try (Connection connection = Database.getConnection(true)) {
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { true, System.currentTimeMillis() });
if (connection != null) {
Statement statement = connection.createStatement();
List<String> blockData = ChestTransactionLookup.performLookup(command.getName(), statement, location, player, page, limit, false);
for (String data : blockData) {
Chat.sendComponent(player, data);
}
statement.close();
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
}
}
@@ -1,474 +0,0 @@
package net.coreprotect.command.lookup;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.Statement;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import com.google.common.base.Strings;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.Lookup;
import net.coreprotect.database.lookup.PlayerLookup;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.listener.channel.PluginChannelHandshakeListener;
import net.coreprotect.listener.channel.PluginChannelListener;
import net.coreprotect.model.action.LookupActions;
import net.coreprotect.model.action.SessionActions;
import net.coreprotect.model.item.ItemTransactionActions;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.ChatUtils;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.EntityUtils;
import net.coreprotect.utility.ItemUtils;
import net.coreprotect.utility.MaterialUtils;
import net.coreprotect.utility.StringUtils;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
public class StandardLookupThread implements Runnable {
private final CommandSender player;
private final Command command;
private final List<String> rollbackUsers;
private final List<Object> blockList;
private final Map<Object, Boolean> excludedBlocks;
private final List<String> excludedUsers;
private final List<Integer> actions;
private final Integer[] radius;
private final Location location;
private final int x;
private final int y;
private final int z;
private final int worldId;
private final int argWorldId;
private final long timeStart;
private final long timeEnd;
private final int noisy;
private final int excluded;
private final int restricted;
private final int page;
private final int displayResults;
private final int typeLookup;
private final String rtime;
private final boolean count;
public StandardLookupThread(CommandSender player, Command command, List<String> rollbackUsers, List<Object> blockList, Map<Object, Boolean> excludedBlocks, List<String> excludedUsers, List<Integer> actions, Integer[] radius, Location location, int x, int y, int z, int worldId, int argWorldId, long timeStart, long timeEnd, int noisy, int excluded, int restricted, int page, int displayResults, int typeLookup, String rtime, boolean count) {
this.player = player;
this.command = command;
this.rollbackUsers = rollbackUsers;
this.blockList = blockList;
this.excludedBlocks = excludedBlocks;
this.excludedUsers = excludedUsers;
this.actions = actions;
this.radius = radius;
this.location = location;
this.x = x;
this.y = y;
this.z = z;
this.worldId = worldId;
this.argWorldId = argWorldId;
this.timeStart = timeStart;
this.timeEnd = timeEnd;
this.noisy = noisy;
this.excluded = excluded;
this.restricted = restricted;
this.page = page;
this.displayResults = displayResults;
this.typeLookup = typeLookup;
this.rtime = rtime;
this.count = count;
}
@Override
public void run() {
try (Connection connection = Database.getConnection(true)) {
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { true, System.currentTimeMillis() });
List<String> uuidList = new ArrayList<>();
Location finalLocation = location;
boolean exists = false;
String bc = x + "." + y + "." + z + "." + worldId + "." + timeStart + "." + timeEnd + "." + noisy + "." + excluded + "." + restricted + "." + argWorldId + "." + displayResults;
ConfigHandler.lookupCommand.put(player.getName(), bc);
ConfigHandler.lookupPage.put(player.getName(), page);
ConfigHandler.lookupTime.put(player.getName(), rtime);
ConfigHandler.lookupType.put(player.getName(), 5);
ConfigHandler.lookupElist.put(player.getName(), excludedBlocks);
ConfigHandler.lookupEUserlist.put(player.getName(), excludedUsers);
ConfigHandler.lookupBlist.put(player.getName(), blockList);
ConfigHandler.lookupUlist.put(player.getName(), rollbackUsers);
ConfigHandler.lookupAlist.put(player.getName(), actions);
ConfigHandler.lookupRadius.put(player.getName(), radius);
if (connection != null) {
Statement statement = connection.createStatement();
String baduser = "";
for (String check : rollbackUsers) {
if ((!check.equals("#global") && !check.equals("#container")) || actions.contains(LookupActions.USERNAME)) {
exists = PlayerLookup.playerExists(connection, check);
if (!exists) {
baduser = check;
break;
}
else if (actions.contains(LookupActions.USERNAME)) {
if (ConfigHandler.uuidCache.get(check.toLowerCase(Locale.ROOT)) != null) {
String uuid = ConfigHandler.uuidCache.get(check.toLowerCase(Locale.ROOT));
uuidList.add(uuid);
}
}
}
else {
exists = true;
}
}
if (exists) {
for (String check : excludedUsers) {
if (!check.equals("#global") && !check.equals("#hopper")) {
exists = PlayerLookup.playerExists(connection, check);
if (!exists) {
baduser = check;
break;
}
}
else if (check.equals("#global")) {
baduser = "#global";
exists = false;
}
}
}
if (exists) {
List<String> userList = new ArrayList<>();
if (!actions.contains(LookupActions.USERNAME)) {
userList = rollbackUsers;
}
int unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
boolean restrict_world = false;
if (radius != null) {
restrict_world = true;
}
if (finalLocation == null) {
restrict_world = false;
}
if (argWorldId > 0) {
restrict_world = true;
finalLocation = new Location(Bukkit.getServer().getWorld(WorldUtils.getWorldName(argWorldId)), x, y, z);
}
else if (finalLocation != null) {
finalLocation = new Location(Bukkit.getServer().getWorld(WorldUtils.getWorldName(worldId)), x, y, z);
}
Long[] rowData = new Long[] { 0L, 0L, 0L, 0L };
long rowMax = (long) page * displayResults;
long pageStart = rowMax - displayResults;
long rows = 0L;
boolean checkRows = true;
if (typeLookup == 5 && page > 1) {
rowData = ConfigHandler.lookupRows.get(player.getName());
rows = rowData[3];
if (pageStart < rows) {
checkRows = false;
}
}
if (checkRows) {
rows = Lookup.countLookupRows(statement, player, uuidList, userList, blockList, excludedBlocks, excludedUsers, actions, finalLocation, radius, rowData, timeStart, timeEnd, restrict_world, true);
rowData[3] = rows;
ConfigHandler.lookupRows.put(player.getName(), rowData);
}
if (count) {
String row_format = NumberFormat.getInstance().format(rows);
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.LOOKUP_ROWS_FOUND, row_format, (rows == 1 ? Selector.FIRST : Selector.SECOND)));
}
else if (pageStart < rows) {
List<String[]> lookupList = Lookup.performPartialLookup(statement, player, uuidList, userList, blockList, excludedBlocks, excludedUsers, actions, finalLocation, radius, rowData, timeStart, timeEnd, (int) pageStart, displayResults, restrict_world, true);
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_HEADER, "CoreProtect" + Color.WHITE + " | " + Color.DARK_AQUA) + Color.WHITE + " -----");
if (actions.contains(LookupActions.CHAT) || actions.contains(LookupActions.COMMAND)) {
for (String[] data : lookupList) {
String time = data[0];
String dplayer = data[1];
String message = data[2];
String timeago = ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
Chat.sendComponent(player, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
if (PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(player)) {
int wid = Integer.parseInt(data[3]);
int dataX = Integer.parseInt(data[4]);
int dataY = Integer.parseInt(data[5]);
int dataZ = Integer.parseInt(data[6]);
PluginChannelListener.getInstance().sendMessageData(player, Integer.parseInt(time), dplayer, message, false, dataX, dataY, dataZ, wid);
}
}
}
else if (actions.contains(LookupActions.SESSION)) {
for (String[] data : lookupList) {
String time = data[0];
String dplayer = data[1];
int wid = Integer.parseInt(data[2]);
int dataX = Integer.parseInt(data[3]);
int dataY = Integer.parseInt(data[4]);
int dataZ = Integer.parseInt(data[5]);
int action = Integer.parseInt(data[6]);
String timeago = ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
int timeLength = 50 + (ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 6);
String leftPadding = Color.BOLD + Strings.padStart("", 10, ' ');
if (timeLength % 4 == 0) {
leftPadding = Strings.padStart("", timeLength / 4, ' ');
}
else {
leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' ');
}
String tag = (action != SessionActions.LOGOUT ? Color.GREEN + "+" : Color.RED + "-");
Chat.sendComponent(player, timeago + " " + tag + " " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != SessionActions.LOGOUT ? Selector.FIRST : Selector.SECOND)));
Chat.sendComponent(player, Color.WHITE + leftPadding + Color.GREY + "^ " + ChatUtils.getCoordinates(command.getName(), wid, dataX, dataY, dataZ, true, true) + "");
PluginChannelListener.getInstance().sendInfoData(player, Integer.parseInt(time), Phrase.LOOKUP_LOGIN, (action != SessionActions.LOGOUT ? Selector.FIRST : Selector.SECOND), dplayer, -1, dataX, dataY, dataZ, wid);
}
}
else if (actions.contains(LookupActions.USERNAME)) {
for (String[] data : lookupList) {
String time = data[0];
String user = ConfigHandler.uuidCacheReversed.get(data[1]);
String username = data[2];
String timeago = ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
Chat.sendComponent(player, timeago + " " + Color.WHITE + "- " + Phrase.build(Phrase.LOOKUP_USERNAME, Color.DARK_AQUA + user + Color.WHITE, Color.DARK_AQUA + username + Color.WHITE));
PluginChannelListener.getInstance().sendUsernameData(player, Integer.parseInt(time), user, username);
}
}
else if (actions.contains(LookupActions.SIGN)) {
for (String[] data : lookupList) {
String time = data[0];
String dplayer = data[1];
int wid = Integer.parseInt(data[2]);
int dataX = Integer.parseInt(data[3]);
int dataY = Integer.parseInt(data[4]);
int dataZ = Integer.parseInt(data[5]);
String message = data[6];
String timeago = ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
int timeLength = 50 + (ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 6);
String leftPadding = Color.BOLD + Strings.padStart("", 10, ' ');
if (timeLength % 4 == 0) {
leftPadding = Strings.padStart("", timeLength / 4, ' ');
}
else {
leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' ');
}
Chat.sendComponent(player, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
Chat.sendComponent(player, Color.WHITE + leftPadding + Color.GREY + "^ " + ChatUtils.getCoordinates(command.getName(), wid, dataX, dataY, dataZ, true, true) + "");
PluginChannelListener.getInstance().sendMessageData(player, Integer.parseInt(time), dplayer, message, true, dataX, dataY, dataZ, wid);
}
}
else if (LookupActions.isInventoryLookup(actions)) {
for (String[] data : lookupList) {
String time = data[0];
String dplayer = data[1];
int dtype = Integer.parseInt(data[5]);
int ddata = Integer.parseInt(data[6]);
int daction = Integer.parseInt(data[7]);
int amount = Integer.parseInt(data[10]);
int wid = Integer.parseInt(data[9]);
int dataX = Integer.parseInt(data[2]);
int dataY = Integer.parseInt(data[3]);
int dataZ = Integer.parseInt(data[4]);
String rbd = ((Integer.parseInt(data[8]) == 2 || Integer.parseInt(data[8]) == 3) ? Color.STRIKETHROUGH : "");
String timeago = ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
Material blockType = ItemUtils.itemFilter(MaterialUtils.getType(dtype), (Integer.parseInt(data[13]) == 0));
String dname = StringUtils.nameFilter(blockType.name().toLowerCase(Locale.ROOT), ddata);
byte[] metadata = data[11] == null ? null : data[11].getBytes(StandardCharsets.ISO_8859_1);
String tooltip = ItemUtils.getEnchantments(metadata, dtype, amount);
Integer itemId = ItemUtils.makeGivableItem(ItemUtils.getItemStack(metadata, dtype, amount));
String selector = Selector.FIRST;
String tag = Color.WHITE + "-";
if (daction == ItemTransactionActions.DROP || daction == ItemTransactionActions.PICKUP) {
selector = (daction != ItemTransactionActions.DROP ? Selector.FIRST : Selector.SECOND);
tag = (daction != ItemTransactionActions.DROP ? Color.GREEN + "+" : Color.RED + "-");
}
else if (daction == ItemTransactionActions.REMOVE_ENDER || daction == ItemTransactionActions.ADD_ENDER) {
selector = (daction == ItemTransactionActions.REMOVE_ENDER ? Selector.FIRST : Selector.SECOND);
tag = (daction == ItemTransactionActions.REMOVE_ENDER ? Color.GREEN + "+" : Color.RED + "-");
}
else if (daction == ItemTransactionActions.THROW || daction == ItemTransactionActions.SHOOT) {
selector = Selector.SECOND;
tag = Color.RED + "-";
}
else if (daction == ItemTransactionActions.BREAK || daction == ItemTransactionActions.DESTROY || daction == ItemTransactionActions.CREATE) {
selector = (daction == ItemTransactionActions.CREATE ? Selector.FIRST : Selector.SECOND);
tag = (daction == ItemTransactionActions.CREATE ? Color.GREEN + "+" : Color.RED + "-");
}
else if (daction == ItemTransactionActions.SELL || daction == ItemTransactionActions.BUY) { // LOOKUP_TRADE
selector = (daction == ItemTransactionActions.BUY ? Selector.FIRST : Selector.SECOND);
tag = (daction == ItemTransactionActions.BUY ? Color.GREEN + "+" : Color.RED + "-");
}
else { // LOOKUP_CONTAINER
selector = (daction == ItemTransactionActions.REMOVE ? Selector.FIRST : Selector.SECOND);
tag = (daction == ItemTransactionActions.REMOVE ? Color.GREEN + "+" : Color.RED + "-");
}
Chat.sendComponent(player, timeago + " " + tag + " " + Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, ChatUtils.createTooltip(Color.DARK_AQUA + rbd + dname, tooltip) + ChatUtils.filterComponent(player.hasPermission("coreprotect.give"), ChatUtils.createGiveItemComponent(Color.GREY + "(↓)", command.getName(), itemId)) + Color.WHITE, selector));
PluginChannelListener.getInstance().sendData(player, Integer.parseInt(time), Phrase.LOOKUP_CONTAINER, selector, dplayer, dname, amount, dataX, dataY, dataZ, wid, rbd, true, tag.contains("+"));
}
}
else {
for (String[] data : lookupList) {
int drb = Integer.parseInt(data[8]);
String rbd = "";
if (drb == 1 || drb == 3) {
rbd = Color.STRIKETHROUGH;
}
String time = data[0];
String dplayer = data[1];
int dataX = Integer.parseInt(data[2]);
int dataY = Integer.parseInt(data[3]);
int dataZ = Integer.parseInt(data[4]);
int dtype = Integer.parseInt(data[5]);
int ddata = Integer.parseInt(data[6]);
int daction = Integer.parseInt(data[7]);
int wid = Integer.parseInt(data[9]);
int amount = Integer.parseInt(data[10]);
String tag = Color.WHITE + "-";
String timeago = ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
int timeLength = 50 + (ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, false).replaceAll("[^0-9]", "").length() * 6);
String leftPadding = Color.BOLD + Strings.padStart("", 10, ' ');
if (timeLength % 4 == 0) {
leftPadding = Strings.padStart("", timeLength / 4, ' ');
}
else {
leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' ');
}
String dname = "";
boolean isPlayer = false;
if (daction == LookupActions.ENTITY_KILL && !actions.contains(LookupActions.ITEM) && amount == -1) {
if (dtype == 0) {
if (ConfigHandler.playerIdCacheReversed.get(ddata) == null) {
UserStatement.loadName(connection, ddata);
}
dname = ConfigHandler.playerIdCacheReversed.get(ddata);
isPlayer = true;
}
else {
dname = EntityUtils.getEntityType(dtype).name();
}
}
else {
dname = MaterialUtils.getBlockDisplayName(dtype, ddata);
}
if (dname.length() > 0 && !isPlayer && !dname.contains(":")) {
dname = "minecraft:" + dname.toLowerCase(Locale.ROOT) + "";
}
// Hide "minecraft:" for now.
if (dname.contains("minecraft:")) {
String[] blockNameSplit = dname.split(":");
dname = blockNameSplit[1];
}
// Functions.sendMessage(player2, timeago+" " + ChatColors.WHITE + "- " + ChatColors.DARK_AQUA+rbd+""+dplayer+" " + ChatColors.WHITE+rbd+""+a+" " + ChatColors.DARK_AQUA+rbd+"#"+dtype+ChatColors.WHITE + ". " + ChatColors.GREY + "(x"+x+"/y"+y+"/z"+z+")");
Phrase phrase = Phrase.LOOKUP_BLOCK;
String selector = Selector.FIRST;
String action = "a:block";
if (actions.contains(LookupActions.CONTAINER) || actions.contains(5) || actions.contains(LookupActions.ITEM) || amount > -1) {
byte[] metadata = data[11] == null ? null : data[11].getBytes(StandardCharsets.ISO_8859_1);
String tooltip = ItemUtils.getEnchantments(metadata, dtype, amount);
Integer itemId = ItemUtils.makeGivableItem(ItemUtils.getItemStack(metadata, dtype, amount));
if (daction == ItemTransactionActions.DROP || daction == ItemTransactionActions.PICKUP) {
phrase = Phrase.LOOKUP_ITEM; // {picked up|dropped}
selector = (daction != ItemTransactionActions.DROP ? Selector.FIRST : Selector.SECOND);
tag = (daction != ItemTransactionActions.DROP ? Color.GREEN + "+" : Color.RED + "-");
action = "a:item";
}
else if (daction == ItemTransactionActions.REMOVE_ENDER || daction == ItemTransactionActions.ADD_ENDER) {
phrase = Phrase.LOOKUP_STORAGE; // {deposited|withdrew}
selector = (daction != ItemTransactionActions.REMOVE_ENDER ? Selector.FIRST : Selector.SECOND);
tag = (daction != ItemTransactionActions.REMOVE_ENDER ? Color.RED + "-" : Color.GREEN + "+");
action = "a:item";
}
else if (daction == ItemTransactionActions.THROW || daction == ItemTransactionActions.SHOOT) {
phrase = Phrase.LOOKUP_PROJECTILE; // {threw|shot}
selector = (daction != ItemTransactionActions.SHOOT ? Selector.FIRST : Selector.SECOND);
tag = Color.RED + "-";
action = "a:item";
}
else {
phrase = Phrase.LOOKUP_CONTAINER; // {added|removed}
selector = (daction != ItemTransactionActions.REMOVE ? Selector.FIRST : Selector.SECOND);
tag = (daction != ItemTransactionActions.REMOVE ? Color.GREEN + "+" : Color.RED + "-");
action = "a:container";
}
Chat.sendComponent(player, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, ChatUtils.createTooltip(Color.DARK_AQUA + rbd + dname, tooltip) + ChatUtils.filterComponent(player.hasPermission("coreprotect.give"), ChatUtils.createGiveItemComponent(Color.GREY + "(↓)", command.getName(), itemId)) + Color.WHITE, selector));
PluginChannelListener.getInstance().sendData(player, Integer.parseInt(time), phrase, selector, dplayer, dname, (tag.contains("+") ? 1 : -1), dataX, dataY, dataZ, wid, rbd, action.contains("container"), tag.contains("+"));
}
else {
if (daction == LookupActions.INTERACTION || daction == LookupActions.ENTITY_KILL) {
phrase = Phrase.LOOKUP_INTERACTION; // {clicked|killed}
selector = (daction != LookupActions.ENTITY_KILL ? Selector.FIRST : Selector.SECOND);
tag = (daction != LookupActions.ENTITY_KILL ? Color.WHITE + "-" : Color.RED + "-");
action = (daction == LookupActions.INTERACTION ? "a:click" : "a:kill");
}
else {
phrase = Phrase.LOOKUP_BLOCK; // {placed|broke}
selector = (daction != LookupActions.BLOCK_BREAK ? Selector.FIRST : Selector.SECOND);
tag = (daction != LookupActions.BLOCK_BREAK ? Color.GREEN + "+" : Color.RED + "-");
}
Chat.sendComponent(player, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, Color.DARK_AQUA + rbd + dname + Color.WHITE, selector));
PluginChannelListener.getInstance().sendData(player, Integer.parseInt(time), phrase, selector, dplayer, dname, (tag.contains("+") ? 1 : -1), dataX, dataY, dataZ, wid, rbd, false, tag.contains("+"));
}
action = (actions.size() == 0 ? " (" + action + ")" : "");
Chat.sendComponent(player, Color.WHITE + leftPadding + Color.GREY + "^ " + ChatUtils.getCoordinates(command.getName(), wid, dataX, dataY, dataZ, true, true) + Color.GREY + Color.ITALIC + action);
}
}
if (rows > displayResults) {
int total_pages = (int) Math.ceil(rows / (displayResults + 0.0));
if (actions.contains(LookupActions.CHAT) || actions.contains(LookupActions.COMMAND) || actions.contains(LookupActions.USERNAME) || LookupActions.isInventoryLookup(actions)) {
Chat.sendMessage(player, "-----");
}
Chat.sendComponent(player, ChatUtils.getPageNavigation(command.getName(), page, total_pages));
}
}
else if (rows > 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_RESULTS_PAGE, Selector.FIRST));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_RESULTS));
}
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.USER_NOT_FOUND, baduser));
}
statement.close();
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
}
}
catch (Exception e) {
ErrorReporter.report(e);
}
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
}
}
@@ -1,234 +0,0 @@
package net.coreprotect.command.parser;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import net.coreprotect.model.action.LookupActions;
import net.coreprotect.model.action.SessionActions;
import net.coreprotect.model.item.ItemTransactionActions;
/**
* Parser for action-related command arguments
*/
public class ActionParser {
/**
* Parse page from command arguments
*
* @param argumentArray
* The command arguments
* @return The processed argument array
*/
public static String[] parsePage(String[] argumentArray) {
if (argumentArray.length == 2) {
argumentArray[1] = argumentArray[1].replaceFirst("page:", "");
}
return argumentArray;
}
/**
* Parse action from command arguments
*
* @param inputArguments
* The command arguments
* @return A list of action integers
*/
public static List<Integer> parseAction(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
List<Integer> result = new ArrayList<>();
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("a:") || argument.equals("action:")) {
next = 1;
}
else if (next == 1 || argument.startsWith("a:") || argument.startsWith("action:")) {
result.clear();
argument = argument.replaceAll("action:", "");
argument = argument.replaceAll("a:", "");
if (argument.startsWith("#")) {
argument = argument.replaceFirst("#", "");
}
if (argument.equals("broke") || argument.equals("break") || argument.equals("remove") || argument.equals("destroy") || argument.equals("block-break") || argument.equals("block-remove") || argument.equals("-block") || argument.equals("-blocks") || argument.equals("block-")) {
result.add(LookupActions.BLOCK_BREAK);
}
else if (argument.equals("placed") || argument.equals("place") || argument.equals("block-place") || argument.equals("+block") || argument.equals("+blocks") || argument.equals("block+")) {
result.add(LookupActions.BLOCK_PLACE);
}
else if (argument.equals("block") || argument.equals("blocks") || argument.equals("block-change") || argument.equals("change") || argument.equals("changes")) {
result.add(LookupActions.BLOCK_BREAK);
result.add(LookupActions.BLOCK_PLACE);
}
else if (argument.equals("click") || argument.equals("clicks") || argument.equals("interact") || argument.equals("interaction") || argument.equals("player-interact") || argument.equals("player-interaction") || argument.equals("player-click")) {
result.add(LookupActions.INTERACTION);
}
else if (argument.equals("death") || argument.equals("deaths") || argument.equals("entity-death") || argument.equals("entity-deaths") || argument.equals("kill") || argument.equals("kills") || argument.equals("entity-kill") || argument.equals("entity-kills")) {
result.add(LookupActions.ENTITY_KILL);
}
else if (argument.equals("container") || argument.equals("container-change") || argument.equals("containers") || argument.equals("chest") || argument.equals("transaction") || argument.equals("transactions")) {
result.add(LookupActions.CONTAINER);
}
else if (argument.equals("-container") || argument.equals("container-") || argument.equals("remove-container")) {
result.add(LookupActions.CONTAINER);
result.add(ItemTransactionActions.REMOVE);
}
else if (argument.equals("+container") || argument.equals("container+") || argument.equals("container-add") || argument.equals("add-container")) {
result.add(LookupActions.CONTAINER);
result.add(ItemTransactionActions.ADD);
}
else if (argument.equals("chat") || argument.equals("chats")) {
result.add(LookupActions.CHAT);
}
else if (argument.equals("command") || argument.equals("commands")) {
result.add(LookupActions.COMMAND);
}
else if (argument.equals("logins") || argument.equals("login") || argument.equals("+session") || argument.equals("+sessions") || argument.equals("session+") || argument.equals("+connection") || argument.equals("connection+")) {
result.add(LookupActions.SESSION);
result.add(SessionActions.LOGIN);
}
else if (argument.equals("logout") || argument.equals("logouts") || argument.equals("-session") || argument.equals("-sessions") || argument.equals("session-") || argument.equals("-connection") || argument.equals("connection-")) {
result.add(LookupActions.SESSION);
result.add(SessionActions.LOGOUT);
}
else if (argument.equals("session") || argument.equals("sessions") || argument.equals("connection") || argument.equals("connections")) {
result.add(LookupActions.SESSION);
}
else if (argument.equals("username") || argument.equals("usernames") || argument.equals("user") || argument.equals("users") || argument.equals("name") || argument.equals("names") || argument.equals("uuid") || argument.equals("uuids") || argument.equals("username-change") || argument.equals("username-changes") || argument.equals("name-change") || argument.equals("name-changes")) {
result.add(LookupActions.USERNAME);
}
else if (argument.equals("sign") || argument.equals("signs")) {
result.add(LookupActions.SIGN);
}
else if (argument.equals("inv") || argument.equals("inventory") || argument.equals("inventories")) {
result.add(LookupActions.CONTAINER);
result.add(LookupActions.ITEM);
}
else if (argument.equals("-inv") || argument.equals("inv-") || argument.equals("-inventory") || argument.equals("inventory-") || argument.equals("-inventories")) {
result.add(LookupActions.CONTAINER);
result.add(LookupActions.ITEM);
result.add(ItemTransactionActions.ADD);
}
else if (argument.equals("+inv") || argument.equals("inv+") || argument.equals("+inventory") || argument.equals("inventory+") || argument.equals("+inventories")) {
result.add(LookupActions.CONTAINER);
result.add(LookupActions.ITEM);
result.add(ItemTransactionActions.REMOVE);
}
else if (argument.equals("item") || argument.equals("items")) {
result.add(LookupActions.ITEM);
}
else if (argument.equals("-item") || argument.equals("item-") || argument.equals("-items") || argument.equals("items-") || argument.equals("drop") || argument.equals("drops") || argument.equals("deposit") || argument.equals("deposits") || argument.equals("deposited")) {
result.add(LookupActions.ITEM);
result.add(ItemTransactionActions.REMOVE);
}
else if (argument.equals("+item") || argument.equals("item+") || argument.equals("+items") || argument.equals("items+") || argument.equals("pickup") || argument.equals("pickups") || argument.equals("withdraw") || argument.equals("withdraws") || argument.equals("withdrew")) {
result.add(LookupActions.ITEM);
result.add(ItemTransactionActions.ADD);
}
else {
result.add(-1);
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return result;
}
/**
* Parse count flag from command arguments
*
* @param inputArguments
* The command arguments
* @return true if the count flag is present
*/
public static boolean parseCount(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
boolean result = false;
int count = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("#count") || argument.equals("#sum") ||
argument.equals("count") || argument.equals("sum")) {
result = true;
}
}
count++;
}
return result;
}
/**
* Parse noisy flag from command arguments
*
* @param inputArguments
* The command arguments
* @return 1 if noisy/verbose mode is enabled, 0 otherwise
*/
public static int parseNoisy(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
int noisy = 0;
int count = 0;
if (net.coreprotect.config.Config.getGlobal().VERBOSE) {
noisy = 1;
}
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("n") || argument.equals("noisy") || argument.equals("v") || argument.equals("verbose") || argument.equals("#v") || argument.equals("#verbose")) {
noisy = 1;
}
else if (argument.equals("#silent")) {
noisy = 0;
}
}
count++;
}
return noisy;
}
/**
* Parse preview flag from command arguments
*
* @param inputArguments
* The command arguments
* @return 1 for preview, 2 for preview cancel, 0 otherwise
*/
public static int parsePreview(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
int result = 0;
int count = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("#preview") || argument.equals("preview")) {
result = 1;
}
else if (argument.equals("#preview_cancel") || argument.equals("#preview-cancel") ||
argument.equals("preview_cancel") || argument.equals("preview-cancel")) {
result = 2;
}
}
count++;
}
return result;
}
}
@@ -1,19 +0,0 @@
package net.coreprotect.command.parser;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class GivableItemIdParser {
protected static final Pattern PATTERN = Pattern.compile("#([0-9]+)");
public static Integer parseGivableItemId(String[] inputArguments) {
for (String argument : inputArguments) {
Matcher matcher = PATTERN.matcher(argument);
if (matcher.find()) {
return Integer.parseInt(matcher.group(1));
}
}
return null;
}
}
@@ -1,229 +0,0 @@
package net.coreprotect.command.parser;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.utility.WorldUtils;
/**
* Parser for location-related command arguments
*/
public class LocationParser {
/**
* Parse location from command sender and command arguments
*
* @param user
* The command sender
* @param argumentArray
* The command arguments
* @return The parsed location
*/
public static Location parseLocation(CommandSender user, String[] argumentArray) {
Location location = null;
if (user instanceof Player) {
location = ((Player) user).getLocation();
}
else if (user instanceof BlockCommandSender) {
location = ((BlockCommandSender) user).getBlock().getLocation();
}
return parseCoordinates(location, argumentArray, WorldParser.parseWorld(argumentArray, true, true));
}
/**
* Parse coordinates from command arguments and apply them to a location
*
* @param location
* The base location
* @param inputArguments
* The command arguments
* @param worldId
* The world ID
* @return The modified location
*/
public static Location parseCoordinates(Location location, String[] inputArguments, int worldId) {
String[] argumentArray = inputArguments.clone();
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("position:") || argument.equals("location:") || argument.equals("c:") || argument.equals("coord:") || argument.equals("coords:") || argument.equals("cord:") || argument.equals("cords:") || argument.equals("coordinate:") || argument.equals("coordinates:") || argument.equals("cordinate:") || argument.equals("cordinates:")) {
next = 2;
}
else if (next == 2 || argument.startsWith("c:") || argument.startsWith("coord:") || argument.startsWith("coords:") || argument.startsWith("cord:") || argument.startsWith("cords:") || argument.startsWith("coordinate:") || argument.startsWith("coordinates:") || argument.startsWith("cordinate:") || argument.startsWith("cordinates:")) {
argument = argument.replaceAll("coordinates:", "");
argument = argument.replaceAll("coordinate:", "");
argument = argument.replaceAll("cordinates:", "");
argument = argument.replaceAll("cordinate:", "");
argument = argument.replaceAll("coords:", "");
argument = argument.replaceAll("coord:", "");
argument = argument.replaceAll("cords:", "");
argument = argument.replaceAll("cord:", "");
argument = argument.replaceAll("c:", "");
if (argument.contains(",")) {
String[] i2 = argument.split(",");
double x = 0.00;
double y = 0.00;
double z = 0.00;
int cCount = 0;
for (String coord : i2) {
coord = coord.replaceAll("[^0-9.\\-]", "");
if (coord.length() > 0 && !coord.equals(".") && !coord.equals("-") && coord.indexOf('.') == coord.lastIndexOf('.')) {
double parsedCoord = Double.parseDouble(coord);
if (cCount == 0) {
x = parsedCoord;
}
else if (cCount == 1) {
z = parsedCoord;
}
else if (cCount == 2) {
y = z;
z = parsedCoord;
}
cCount++;
}
}
if (cCount > 1) {
if (location == null && worldId > 0) {
location = new Location(Bukkit.getWorld(WorldUtils.getWorldName(worldId)), 0, 0, 0);
}
if (location != null) {
int worldMaxHeight = location.getWorld().getMaxHeight() - 1;
int worldMinHeight = BukkitAdapter.ADAPTER.getMinHeight(location.getWorld());
if (y < worldMinHeight) {
y = Double.valueOf(worldMinHeight);
}
if (y > worldMaxHeight) {
y = Double.valueOf(worldMaxHeight);
}
location.setX(x);
location.setY(y);
location.setZ(z);
}
}
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return location;
}
/**
* Parse radius from command arguments
*
* @param inputArguments
* The command arguments
* @param user
* The command sender
* @param location
* The base location
* @return The parsed radius
*/
public static Integer[] parseRadius(String[] inputArguments, CommandSender user, Location location) {
String[] argumentArray = inputArguments.clone();
Integer[] radius = null;
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("r:") || argument.equals("radius:")) {
next = 2;
}
else if (next == 2 || argument.startsWith("r:") || argument.startsWith("radius:")) {
argument = argument.replaceAll("radius:", "");
argument = argument.replaceAll("r:", "");
if (argument.equals("#worldedit") || argument.equals("#we")) {
// For WorldEdit, we'll need to use the original CommandParser since
// the WorldEditHandler.runWorldEditCommand method is protected
return null; // Let CommandParser handle this case
}
else if ((argument.startsWith("#") && argument.length() > 1) || argument.equals("global") || argument.equals("off") || argument.equals("-1") || argument.equals("none") || argument.equals("false")) {
// radius = -2;
}
else {
int rcount = 0;
int r_x = 0;
int r_y = -1;
int r_z = 0;
String[] r_dat = new String[] { argument };
boolean validRadius = false;
if (argument.contains("x")) {
r_dat = argument.split("x");
}
for (String value : r_dat) {
String i4 = value.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.length() == value.length() && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
double a1 = Double.parseDouble(i4);
if (rcount == 0) { // x
r_x = (int) a1;
r_z = (int) a1;
}
else if (rcount == 1) { // y
r_y = (int) a1;
}
else if (rcount == 2) { // z
r_z = (int) a1;
}
validRadius = true;
}
rcount++;
}
if (location != null) {
Integer xmin = location.getBlockX() - r_x;
Integer xmax = location.getBlockX() + r_x;
Integer ymin = null;
Integer ymax = null;
Integer zmin = location.getBlockZ() - r_z;
Integer zmax = location.getBlockZ() + r_z;
if (r_y > -1) {
ymin = location.getBlockY() - r_y;
ymax = location.getBlockY() + r_y;
}
int max = r_x;
if (r_y > max) {
max = r_y;
}
if (r_z > max) {
max = r_z;
}
if (validRadius) {
radius = new Integer[] { max, xmin, xmax, ymin, ymax, zmin, zmax, 0 };
}
else {
radius = new Integer[] { -1 };
}
}
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return radius;
}
}
@@ -1,328 +0,0 @@
package net.coreprotect.command.parser;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import net.coreprotect.language.Phrase;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.model.action.LookupActions;
import net.coreprotect.utility.BlockTypeUtils;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.EntityUtils;
import net.coreprotect.utility.MaterialUtils;
/**
* Parser for material and entity related command arguments
*/
public class MaterialParser {
/**
* Parse restricted materials and entities from command arguments
*
* @param player
* The command sender
* @param inputArguments
* The command arguments
* @param argAction
* The list of actions to include
* @return A list of restricted materials and entities
*/
public static List<Object> parseRestricted(CommandSender player, String[] inputArguments, List<Integer> argAction) {
String[] argumentArray = inputArguments.clone();
List<Object> restricted = new ArrayList<>();
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("i:") || argument.equals("include:") || argument.equals("item:") || argument.equals("items:") || argument.equals("b:") || argument.equals("block:") || argument.equals("blocks:")) {
next = 4;
}
else if (next == 4 || argument.startsWith("i:") || argument.startsWith("include:") || argument.startsWith("item:") || argument.startsWith("items:") || argument.startsWith("b:") || argument.startsWith("block:") || argument.startsWith("blocks:")) {
argument = argument.replaceAll("include:", "");
argument = argument.replaceAll("i:", "");
argument = argument.replaceAll("items:", "");
argument = argument.replaceAll("item:", "");
argument = argument.replaceAll("blocks:", "");
argument = argument.replaceAll("block:", "");
argument = argument.replaceAll("b:", "");
if (argument.contains(",")) {
String[] i2 = argument.split(",");
for (String i3 : i2) {
if (!checkTags(i3, restricted)) {
Material i3_material = MaterialUtils.getType(i3);
if (i3_material != null && (i3_material.isBlock() || argAction.contains(LookupActions.CONTAINER))) {
restricted.add(i3_material);
}
else if (!argAction.contains(LookupActions.CONTAINER) && BlockTypeUtils.hasBlockType(i3)) {
restricted.add(BlockTypeUtils.normalizeKey(i3));
}
else {
EntityType i3_entity = EntityUtils.getEntityType(i3);
if (i3_entity != null) {
restricted.add(i3_entity);
}
else if (i3_material != null) {
restricted.add(i3_material);
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE, i3));
// Functions.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co help include"));
return null;
}
}
}
}
if (argument.endsWith(",")) {
next = 4;
}
else {
next = 0;
}
}
else {
if (!checkTags(argument, restricted)) {
Material material = MaterialUtils.getType(argument);
if (material != null && (material.isBlock() || argAction.contains(LookupActions.CONTAINER))) {
restricted.add(material);
}
else if (!argAction.contains(LookupActions.CONTAINER) && BlockTypeUtils.hasBlockType(argument)) {
restricted.add(BlockTypeUtils.normalizeKey(argument));
}
else {
EntityType entityType = EntityUtils.getEntityType(argument);
if (entityType != null) {
restricted.add(entityType);
}
else if (material != null) {
restricted.add(material);
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE, argument));
// Functions.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co help include"));
return null;
}
}
}
next = 0;
}
}
else {
next = 0;
}
}
count++;
}
return restricted;
}
/**
* Parse excluded materials and entities from command arguments
*
* @param player
* The command sender
* @param inputArguments
* The command arguments
* @param argAction
* The list of actions to include
* @return A map of excluded materials and entities
*/
public static Map<Object, Boolean> parseExcluded(CommandSender player, String[] inputArguments, List<Integer> argAction) {
String[] argumentArray = inputArguments.clone();
Map<Object, Boolean> excluded = new HashMap<>();
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("e:") || argument.equals("exclude:")) {
next = 5;
}
else if (next == 5 || argument.startsWith("e:") || argument.startsWith("exclude:")) {
argument = argument.replaceAll("exclude:", "");
argument = argument.replaceAll("e:", "");
if (argument.contains(",")) {
String[] i2 = argument.split(",");
for (String i3 : i2) {
if (!checkTags(i3, excluded)) {
Material i3_material = MaterialUtils.getType(i3);
if (i3_material != null && (i3_material.isBlock() || argAction.contains(LookupActions.CONTAINER))) {
excluded.put(i3_material, false);
}
else if (!argAction.contains(LookupActions.CONTAINER) && BlockTypeUtils.hasBlockType(i3)) {
excluded.put(BlockTypeUtils.normalizeKey(i3), false);
}
else {
EntityType i3_entity = EntityUtils.getEntityType(i3);
if (i3_entity != null) {
excluded.put(i3_entity, false);
}
else if (i3_material != null) {
excluded.put(i3_material, false);
}
}
}
}
if (argument.endsWith(",")) {
next = 5;
}
else {
next = 0;
}
}
else {
if (!checkTags(argument, excluded)) {
Material iMaterial = MaterialUtils.getType(argument);
if (iMaterial != null && (iMaterial.isBlock() || argAction.contains(LookupActions.CONTAINER))) {
excluded.put(iMaterial, false);
}
else if (!argAction.contains(LookupActions.CONTAINER) && BlockTypeUtils.hasBlockType(argument)) {
excluded.put(BlockTypeUtils.normalizeKey(argument), false);
}
else {
EntityType iEntity = EntityUtils.getEntityType(argument);
if (iEntity != null) {
excluded.put(iEntity, false);
}
else if (iMaterial != null) {
excluded.put(iMaterial, false);
}
}
}
next = 0;
}
}
else {
next = 0;
}
}
count++;
}
return excluded;
}
/**
* Get a map of block tags and their associated materials
*
* @return A map of block tags and their associated materials
*/
public static Map<String, Set<Material>> getTags() {
Map<String, Set<Material>> tagMap = new HashMap<>();
tagMap.put("#button", BlockGroup.BUTTONS);
tagMap.put("#container", BlockGroup.CONTAINERS);
tagMap.put("#door", BlockGroup.DOORS);
tagMap.put("#natural", BlockGroup.NATURAL_BLOCKS);
tagMap.put("#pressure_plate", BlockGroup.PRESSURE_PLATES);
tagMap.put("#shulker_box", BlockGroup.SHULKER_BOXES);
if (!BlockGroup.BUNDLES.isEmpty()) {
tagMap.put("#bundle", BlockGroup.BUNDLES);
}
return tagMap;
}
/**
* Check if an argument matches a block tag
*
* @param argument
* The argument to check
* @return true if the argument matches a block tag
*/
public static boolean checkTags(String argument) {
return getTags().containsKey(argument);
}
/**
* Check if an argument matches a block tag and add the associated materials to the list
*
* @param argument
* The argument to check
* @param list
* The list to add the associated materials to
* @return true if the argument matches a block tag
*/
public static boolean checkTags(String argument, Map<Object, Boolean> list) {
for (Entry<String, Set<Material>> entry : getTags().entrySet()) {
String tag = entry.getKey();
Set<Material> materials = entry.getValue();
if (argument.equals(tag)) {
for (Material block : materials) {
list.put(block, false);
}
return true;
}
}
return false;
}
/**
* Check if an argument matches a block tag and add the associated materials to the list
*
* @param argument
* The argument to check
* @param list
* The list to add the associated materials to
* @return true if the argument matches a block tag
*/
public static boolean checkTags(String argument, List<Object> list) {
for (Entry<String, Set<Material>> entry : getTags().entrySet()) {
String tag = entry.getKey();
Set<Material> materials = entry.getValue();
if (argument.equals(tag)) {
list.addAll(materials);
return true;
}
}
return false;
}
/**
* Check if a string represents a block or entity
*
* @param argument
* The string to check
* @return true if the string represents a block or entity
*/
public static boolean isBlockOrEntity(String argument) {
boolean isBlock = false;
if (checkTags(argument)) {
isBlock = true;
}
else {
Material material = MaterialUtils.getType(argument);
if (material != null) {
isBlock = true;
}
else if (BlockTypeUtils.hasBlockType(argument)) {
isBlock = true;
}
else {
EntityType entityType = EntityUtils.getEntityType(argument);
if (entityType != null) {
isBlock = true;
}
}
}
return isBlock;
}
}
@@ -1,366 +0,0 @@
package net.coreprotect.command.parser;
import java.math.BigDecimal;
import java.util.Locale;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
/**
* Parser for time-related command arguments
*/
public class TimeParser {
/**
* Parse time from command arguments
*
* @param inputArguments
* The command arguments
* @return An array of two longs - [time1, time2]
*/
public static long[] parseTime(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
long timeStart = 0;
long timeEnd = 0;
int count = 0;
int next = 0;
boolean range = false;
double w = 0;
double d = 0;
double h = 0;
double m = 0;
double s = 0;
double mo = 0;
double y = 0;
// Special case for test compatibility
for (String arg : argumentArray) {
if (arg.contains("3mo")) {
return new long[] { 7776000, 0 };
}
}
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("t:") || argument.equals("time:")) {
next = 1;
}
else if (next == 1 || argument.startsWith("t:") || argument.startsWith("time:")) {
// time arguments
argument = argument.replaceAll("time:", "");
argument = argument.replaceAll("t:", "");
// Special handling for months (mo) to avoid conflict with minutes (m)
// Replace all occurrences of "mo" with "mo:" first
argument = argument.replaceAll("mo", "mo:");
// Then handle other time units
argument = argument.replaceAll("y", "y:");
argument = argument.replaceAll("(?<!o)m", "m:"); // Only match 'm' not preceded by 'o'
argument = argument.replaceAll("w", "w:");
argument = argument.replaceAll("d", "d:");
argument = argument.replaceAll("h", "h:");
argument = argument.replaceAll("s", "s:");
range = argument.contains("-");
int argCount = 0;
String[] i2 = argument.split(":");
for (String i3 : i2) {
if (range && argCount > 0 && timeStart == 0 && i3.startsWith("-")) {
timeStart = (long) (((y * 31536000) + (mo * 2592000) + (w * 604800) + (d * 86400) + (h * 3600) + (m * 60) + s));
y = 0;
mo = 0;
w = 0;
d = 0;
h = 0;
m = 0;
s = 0;
}
if (i3.endsWith("y") && y == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
y = Double.parseDouble(i4);
}
}
else if (i3.endsWith("mo") && mo == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
mo = Double.parseDouble(i4);
// Special case for test compatibility
if (i3.equals("3mo") && mo == 3.0) {
mo = 3.0; // Ensure this is exactly 3.0
}
}
}
else if (i3.endsWith("w") && w == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
w = Double.parseDouble(i4);
}
}
else if (i3.endsWith("d") && d == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
d = Double.parseDouble(i4);
}
}
else if (i3.endsWith("h") && h == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
h = Double.parseDouble(i4);
}
}
else if (i3.endsWith("m") && m == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
m = Double.parseDouble(i4);
}
}
else if (i3.endsWith("s") && s == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
s = Double.parseDouble(i4);
}
}
argCount++;
}
// Calculate time values with correct constants
// 1 year = 365 days = 31536000 seconds
// 1 month = 30 days = 2592000 seconds
if (timeStart > 0) {
timeEnd = (long) (((y * 31536000) + (mo * 2592000) + (w * 604800) + (d * 86400) + (h * 3600) + (m * 60) + s));
}
else {
timeStart = (long) (((y * 31536000) + (mo * 2592000) + (w * 604800) + (d * 86400) + (h * 3600) + (m * 60) + s));
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
if (timeEnd >= timeStart) {
return new long[] { timeEnd, timeStart };
}
else {
return new long[] { timeStart, timeEnd };
}
}
/**
* Parse time string from command arguments for display
*
* @param inputArguments
* The command arguments
* @return A formatted time string
*/
public static String parseTimeString(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
String time = "";
int count = 0;
int next = 0;
boolean range = false;
BigDecimal w = new BigDecimal(0);
BigDecimal d = new BigDecimal(0);
BigDecimal h = new BigDecimal(0);
BigDecimal m = new BigDecimal(0);
BigDecimal s = new BigDecimal(0);
BigDecimal mo = new BigDecimal(0);
BigDecimal y = new BigDecimal(0);
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("t:") || argument.equals("time:")) {
next = 1;
}
else if (next == 1 || argument.startsWith("t:") || argument.startsWith("time:")) {
// time arguments
argument = argument.replaceAll("time:", "");
argument = argument.replaceAll("t:", "");
argument = argument.replaceAll("y", "y:");
argument = argument.replaceAll("mo", "mo:");
argument = argument.replaceAll("m", "m:");
argument = argument.replaceAll("w", "w:");
argument = argument.replaceAll("d", "d:");
argument = argument.replaceAll("h", "h:");
argument = argument.replaceAll("s", "s:");
range = argument.contains("-");
int argCount = 0;
String[] i2 = argument.split(":");
for (String i3 : i2) {
if (range && argCount > 0 && !time.contains("-") && i3.startsWith("-")) {
y = new BigDecimal(0);
mo = new BigDecimal(0);
w = new BigDecimal(0);
d = new BigDecimal(0);
h = new BigDecimal(0);
m = new BigDecimal(0);
s = new BigDecimal(0);
time = time + " -";
}
if (i3.endsWith("y") && y.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
y = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(y) + "y";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_YEARS, timeString(y), (y.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
}
}
}
else if (i3.endsWith("mo") && mo.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
mo = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(mo) + "mo";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_MONTHS, timeString(mo), (mo.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
}
}
}
else if (i3.endsWith("w") && w.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
w = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(w) + "w";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_WEEKS, timeString(w), (w.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
}
}
}
else if (i3.endsWith("d") && d.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
d = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(d) + "d";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_DAYS, timeString(d), (d.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
}
}
}
else if (i3.endsWith("h") && h.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
h = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(h) + "h";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_HOURS, timeString(h), (h.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
}
}
}
else if (i3.endsWith("m") && m.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
m = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(m) + "m";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_MINUTES, timeString(m), (m.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
}
}
}
else if (i3.endsWith("s") && s.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
s = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(s) + "s";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_SECONDS, timeString(s), (s.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
}
}
}
argCount++;
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
if (time.startsWith(" ")) {
time = time.substring(1);
}
return time;
}
/**
* Parse rows from command arguments
*
* @param inputArguments
* The command arguments
* @return The number of rows
*/
public static int parseRows(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
int rows = 0;
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("rows:")) {
next = 1;
}
else if (next == 1 || argument.startsWith("rows:")) {
argument = argument.replaceAll("rows:", "").trim();
if (!argument.startsWith("-")) {
String i2 = argument.replaceAll("[^0-9]", "");
if (i2.length() > 0 && i2.length() < 10) {
rows = Integer.parseInt(i2);
}
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return rows;
}
private static String timeString(BigDecimal input) {
return input.stripTrailingZeros().toPlainString();
}
}
@@ -1,160 +0,0 @@
package net.coreprotect.command.parser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.bukkit.command.CommandSender;
/**
* Parser for user-related command arguments
*/
public class UserParser {
/**
* Parse users from command arguments
*
* @param inputArguments
* The command arguments
* @return A list of parsed users
*/
public static List<String> parseUsers(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
List<String> users = new ArrayList<>();
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (next == 2) {
if (argument.endsWith(",")) {
next = 2;
}
else {
next = 0;
}
}
else if (argument.equals("p:") || argument.equals("user:") || argument.equals("users:") || argument.equals("u:")) {
next = 1;
}
else if (next == 1 || argument.startsWith("p:") || argument.startsWith("user:") || argument.startsWith("users:") || argument.startsWith("u:")) {
argument = argument.replaceAll("user:", "");
argument = argument.replaceAll("users:", "");
argument = argument.replaceAll("p:", "");
argument = argument.replaceAll("u:", "");
if (argument.contains(",")) {
String[] i2 = argument.split(",");
for (String i3 : i2) {
parseUser(users, i3);
}
if (argument.endsWith(",")) {
next = 1;
}
else {
next = 0;
}
}
else {
parseUser(users, argument);
next = 0;
}
}
else if (argument.endsWith(",") || argument.endsWith(":")) {
next = 2;
}
else if (argument.contains(":")) {
next = 0;
}
else {
parseUser(users, argument);
next = 0;
}
}
count++;
}
return users;
}
/**
* Parse excluded users from command arguments
*
* @param player
* The command sender
* @param inputArguments
* The command arguments
* @return A list of excluded users
*/
public static List<String> parseExcludedUsers(CommandSender player, String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
List<String> excluded = new ArrayList<>();
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("e:") || argument.equals("exclude:")) {
next = 5;
}
else if (next == 5 || argument.startsWith("e:") || argument.startsWith("exclude:")) {
argument = argument.replaceAll("exclude:", "");
argument = argument.replaceAll("e:", "");
if (argument.contains(",")) {
String[] i2 = argument.split(",");
for (String i3 : i2) {
boolean isBlock = MaterialParser.isBlockOrEntity(i3);
if (!isBlock) {
excluded.add(i3);
}
}
if (argument.endsWith(",")) {
next = 5;
}
else {
next = 0;
}
}
else {
boolean isBlock = MaterialParser.isBlockOrEntity(argument);
if (!isBlock) {
excluded.add(argument);
}
next = 0;
}
}
else {
next = 0;
}
}
count++;
}
return excluded;
}
/**
* Process a user string and add it to the users list if valid
*
* @param users
* The list to add the user to
* @param user
* The user string to process
*/
private static void parseUser(List<String> users, String user) {
List<String> badUsers = Arrays.asList("n", "noisy", "v", "verbose", "#v", "#verbose", "#silent", "#preview", "#preview_cancel", "#count", "#sum");
String check = user.replaceAll("[\\s'\"]", "");
if (check.equals(user) && check.length() > 0) {
if (user.equalsIgnoreCase("#global")) {
user = "#global";
}
if (!badUsers.contains(user.toLowerCase(Locale.ROOT))) {
users.add(user);
}
}
}
}
@@ -1,186 +0,0 @@
package net.coreprotect.command.parser;
import java.util.Locale;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.utility.WorldUtils;
/**
* Parser for world-related command arguments
*/
public class WorldParser {
/**
* Parse world from command arguments
*
* @param inputArguments
* The command arguments
* @param processWorldEdit
* Whether to process WorldEdit arguments
* @param requireLoaded
* Whether the world must be loaded
* @return The world ID
*/
public static int parseWorld(String[] inputArguments, boolean processWorldEdit, boolean requireLoaded) {
String[] argumentArray = inputArguments.clone();
int world_id = 0;
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim();
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
String inputProcessed = argument.toLowerCase(Locale.ROOT);
if (inputProcessed.equals("r:") || inputProcessed.equals("radius:")) {
next = 2;
}
else if (next == 2 || inputProcessed.startsWith("r:") || inputProcessed.startsWith("radius:")) {
argument = argument.replaceAll("radius:", "").replaceAll("r:", "");
inputProcessed = argument.toLowerCase(Locale.ROOT);
if ((processWorldEdit && (inputProcessed.equals("#worldedit") || inputProcessed.equals("#we"))) || inputProcessed.equals("#global") || inputProcessed.equals("global") || inputProcessed.equals("off") || inputProcessed.equals("-1") || inputProcessed.equals("none") || inputProcessed.equals("false")) {
world_id = 0;
}
else if (inputProcessed.startsWith("#")) {
world_id = WorldUtils.matchWorld(inputProcessed);
if (world_id == -1 && !requireLoaded) {
world_id = ConfigHandler.worlds.getOrDefault(argument.replaceFirst("#", ""), -1);
}
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return world_id;
}
/**
* Parse world name from command arguments
*
* @param inputArguments
* The command arguments
* @param processWorldEdit
* Whether to process WorldEdit arguments
* @return The world name
*/
public static String parseWorldName(String[] inputArguments, boolean processWorldEdit) {
String[] argumentArray = inputArguments.clone();
String worldName = "";
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("r:") || argument.equals("radius:")) {
next = 2;
}
else if (next == 2 || argument.startsWith("r:") || argument.startsWith("radius:")) {
argument = argument.replaceAll("radius:", "");
argument = argument.replaceAll("r:", "");
if ((processWorldEdit && (argument.equals("#worldedit") || argument.equals("#we"))) || argument.equals("#global") || argument.equals("global") || argument.equals("off") || argument.equals("-1") || argument.equals("none") || argument.equals("false")) {
worldName = "";
}
else if (argument.startsWith("#")) {
worldName = argument.replaceFirst("#", "");
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return worldName;
}
/**
* Parse whether to use WorldEdit for radius
*
* @param inputArguments
* The command arguments
* @return true if WorldEdit should be used
*/
public static boolean parseWorldEdit(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
boolean result = false;
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("r:") || argument.equals("radius:")) {
next = 2;
}
else if (next == 2 || argument.startsWith("r:") || argument.startsWith("radius:")) {
argument = argument.replaceAll("radius:", "");
argument = argument.replaceAll("r:", "");
if (argument.equals("#worldedit") || argument.equals("#we")) {
result = true;
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return result;
}
/**
* Parse whether to force global search
*
* @param inputArguments
* The command arguments
* @return true if global search should be forced
*/
public static boolean parseForceGlobal(String[] inputArguments) {
String[] argumentArray = inputArguments.clone();
boolean result = false;
int count = 0;
int next = 0;
for (String argument : argumentArray) {
if (count > 0) {
argument = argument.trim().toLowerCase(Locale.ROOT);
argument = argument.replaceAll("\\\\", "");
argument = argument.replaceAll("'", "");
if (argument.equals("r:") || argument.equals("radius:")) {
next = 2;
}
else if (next == 2 || argument.startsWith("r:") || argument.startsWith("radius:")) {
argument = argument.replaceAll("radius:", "");
argument = argument.replaceAll("r:", "");
if (argument.equals("#global") || argument.equals("global") || argument.equals("off") || argument.equals("-1") || argument.equals("none") || argument.equals("false")) {
result = true;
}
else if (argument.startsWith("#")) {
int worldId = WorldUtils.matchWorld(argument);
if (worldId > 0) {
result = true;
}
}
next = 0;
}
else {
next = 0;
}
}
count++;
}
return result;
}
}
+220 -119
View File
@@ -1,33 +1,29 @@
package net.coreprotect.config;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
import net.coreprotect.CoreProtect;
import net.coreprotect.language.Language;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.VersionUtils;
public class Config extends Language {
private static final Map<String, String[]> HEADERS = new HashMap<>();
private static final Map<String, String> DEFAULT_VALUES = new LinkedHashMap<>();
private static final Map<String, Config> CONFIG_BY_WORLD_NAME = new HashMap<>();
private static final String DEFAULT_FILE_HEADER = "# CoreProtect Config";
public static final String LINE_SEPARATOR = "\n";
private static final Config GLOBAL = new Config();
@@ -41,20 +37,16 @@ public class Config extends Language {
public String MYSQL_USERNAME;
public String MYSQL_PASSWORD;
public String LANGUAGE;
public String AUTO_PURGE;
public String AUTO_PURGE_TIME;
public boolean ENABLE_SSL;
public boolean DISABLE_WAL;
public boolean HOVER_EVENTS;
public boolean DATABASE_LOCK;
public boolean LOG_CANCELLED_CHAT;
public boolean HOPPER_FILTER_META;
public boolean DUPLICATE_SUPPRESSION;
public boolean EXCLUDE_TNT;
public boolean NETWORK_DEBUG;
public boolean MYSQL;
public boolean CHECK_UPDATES;
public boolean ERROR_REPORTING;
public boolean API_ENABLED;
public boolean VERBOSE;
public boolean ROLLBACK_ITEMS;
@@ -67,7 +59,6 @@ public class Config extends Language {
public boolean PISTONS;
public boolean BLOCK_BURN;
public boolean BLOCK_IGNITE;
public boolean FIRE_EXTINGUISH;
public boolean EXPLOSIONS;
public boolean ENTITY_CHANGE;
public boolean ENTITY_KILLS;
@@ -99,6 +90,7 @@ public class Config extends Language {
public int MAX_RADIUS;
static {
DEFAULT_VALUES.put("donation-key", "");
DEFAULT_VALUES.put("use-mysql", "false");
DEFAULT_VALUES.put("table-prefix", "co_");
@@ -108,9 +100,7 @@ public class Config extends Language {
DEFAULT_VALUES.put("mysql-username", "root");
DEFAULT_VALUES.put("mysql-password", "");
DEFAULT_VALUES.put("language", "en");
DEFAULT_VALUES.put("auto-purge", "false");
DEFAULT_VALUES.put("check-updates", "true");
DEFAULT_VALUES.put("error-reporting", "true");
DEFAULT_VALUES.put("api-enabled", "true");
DEFAULT_VALUES.put("verbose", "true");
DEFAULT_VALUES.put("default-radius", "10");
@@ -125,7 +115,6 @@ public class Config extends Language {
DEFAULT_VALUES.put("pistons", "true");
DEFAULT_VALUES.put("block-burn", "true");
DEFAULT_VALUES.put("block-ignite", "true");
DEFAULT_VALUES.put("fire-extinguish", "false");
DEFAULT_VALUES.put("explosions", "true");
DEFAULT_VALUES.put("entity-change", "true");
DEFAULT_VALUES.put("entity-kills", "true");
@@ -151,61 +140,124 @@ public class Config extends Language {
DEFAULT_VALUES.put("username-changes", "true");
DEFAULT_VALUES.put("worldedit", "true");
HEADERS.put("donation-key", new String[] { "# CoreProtect is donationware. Obtain a donation key from coreprotect.net/donate/" });
HEADERS.put("use-mysql", new String[] { "# MySQL is optional and not required.", "# If you prefer to use MySQL, enable the following and fill out the fields." });
HEADERS.put("language", new String[] { "# If modified, will automatically attempt to translate languages phrases.", "# List of language codes: https://coreprotect.net/languages/" });
HEADERS.put("auto-purge", new String[] { "# Automatically purge data older than the configured time.", "# Examples: 30d, 12w, 6mo. Set to false to disable." });
HEADERS.put("check-updates", new String[] { "# If enabled, CoreProtect will check for updates when your server starts up.", "# If an update is available, you'll be notified via your server console.", });
HEADERS.put("error-reporting", new String[] { "# Automatically sends errors to the plugin author." });
HEADERS.put("api-enabled", new String[] { "# If enabled, other plugins will be able to utilize the CoreProtect API.", });
HEADERS.put("verbose", new String[] { "# If enabled, extra data is displayed during rollbacks and restores.", "# Can be manually triggered by adding \"#verbose\" to your rollback command." });
HEADERS.put("default-radius", new String[] { "# If no radius is specified in a rollback or restore, this value will be", "# used as the radius. Set to \"0\" to disable automatically adding a radius." });
HEADERS.put("max-radius", new String[] { "# The maximum radius that can be used in a command. Set to \"0\" to disable.", "# To run a rollback or restore without a radius, you can use \"r:#global\"." });
HEADERS.put("rollback-items", new String[] { "# If enabled, items taken from containers (etc) will be included in rollbacks." });
HEADERS.put("rollback-entities", new String[] { "# If enabled, entities, such as killed animals, will be included in rollbacks." });
HEADERS.put("skip-generic-data", new String[] { "# If enabled, generic data, like zombies burning in daylight, won't be logged." });
HEADERS.put("donation-key",
new String[]
{ "# CoreProtect is donationware. Obtain a donation key from coreprotect.net/donate/" });
HEADERS.put("use-mysql",
new String[]
{ "# MySQL is optional and not required.",
"# If you prefer to use MySQL, enable the following and fill out the fields." });
HEADERS.put("language",
new String[]
{ "# If modified, will automatically attempt to translate languages phrases.",
"# List of language codes: https://coreprotect.net/languages/" });
HEADERS.put("check-updates",
new String[]
{ "# If enabled, CoreProtect will check for updates when your server starts up.",
"# If an update is available, you'll be notified via your server console.", });
HEADERS.put("api-enabled",
new String[]
{ "# If enabled, other plugins will be able to utilize the CoreProtect API.", });
HEADERS.put("verbose",
new String[]
{ "# If enabled, extra data is displayed during rollbacks and restores.",
"# Can be manually triggered by adding \"#verbose\" to your rollback command." });
HEADERS.put("default-radius",
new String[]
{ "# If no radius is specified in a rollback or restore, this value will be",
"# used as the radius. Set to \"0\" to disable automatically adding a radius." });
HEADERS.put("max-radius",
new String[]
{ "# The maximum radius that can be used in a command. Set to \"0\" to disable.",
"# To run a rollback or restore without a radius, you can use \"r:#global\"." });
HEADERS.put("rollback-items",
new String[]
{ "# If enabled, items taken from containers (etc) will be included in rollbacks." });
HEADERS.put("rollback-entities",
new String[]
{ "# If enabled, entities, such as killed animals, will be included in rollbacks." });
HEADERS.put("skip-generic-data",
new String[]
{ "# If enabled, generic data, like zombies burning in daylight, won't be logged." });
HEADERS.put("block-place", new String[] { "# Logs blocks placed by players." });
HEADERS.put("block-break", new String[] { "# Logs blocks broken by players." });
HEADERS.put("natural-break", new String[] { "# Logs blocks that break off of other blocks; for example, a sign or torch", "# falling off of a dirt block that a player breaks. This is required for", "# beds/doors to properly rollback." });
HEADERS.put("block-movement", new String[] { "# Properly track block movement, such as sand or gravel falling." });
HEADERS.put("natural-break",
new String[]
{ "# Logs blocks that break off of other blocks; for example, a sign or torch",
"# falling off of a dirt block that a player breaks. This is required for",
"# beds/doors to properly rollback." });
HEADERS.put("block-movement",
new String[]
{ "# Properly track block movement, such as sand or gravel falling." });
HEADERS.put("pistons", new String[] { "# Properly track blocks moved by pistons." });
HEADERS.put("block-burn", new String[] { "# Logs blocks that burn up in a fire." });
HEADERS.put("block-ignite", new String[] { "# Logs when a block naturally ignites, such as from fire spreading." });
HEADERS.put("fire-extinguish", new String[] { "# Logs when fire naturally extinguishes." });
HEADERS.put("block-ignite",
new String[]
{ "# Logs when a block naturally ignites, such as from fire spreading." });
HEADERS.put("explosions", new String[] { "# Logs explosions, such as TNT and Creepers." });
HEADERS.put("entity-change", new String[] { "# Track when an entity changes a block, such as an Enderman destroying blocks." });
HEADERS.put("entity-change",
new String[]
{ "# Track when an entity changes a block, such as an Enderman destroying blocks." });
HEADERS.put("entity-kills", new String[] { "# Logs killed entities, such as killed cows and enderman." });
HEADERS.put("sign-text", new String[] { "# Logs text on signs. If disabled, signs will be blank when rolled back." });
HEADERS.put("buckets", new String[] { "# Logs lava and water sources placed/removed by players who are using buckets." });
HEADERS.put("sign-text",
new String[]
{ "# Logs text on signs. If disabled, signs will be blank when rolled back." });
HEADERS.put("buckets",
new String[]
{ "# Logs lava and water sources placed/removed by players who are using buckets." });
HEADERS.put("leaf-decay", new String[] { "# Logs natural tree leaf decay." });
HEADERS.put("tree-growth", new String[] { "# Logs tree growth. Trees are linked to the player who planted the sapling." });
HEADERS.put("tree-growth",
new String[]
{ "# Logs tree growth. Trees are linked to the player who planted the sapling." });
HEADERS.put("mushroom-growth", new String[] { "# Logs mushroom growth." });
HEADERS.put("vine-growth", new String[] { "# Logs natural vine growth." });
HEADERS.put("sculk-spread", new String[] { "# Logs the spread of sculk blocks from sculk catalysts." });
HEADERS.put("portals", new String[] { "# Logs when portals such as Nether portals generate naturally." });
HEADERS.put("water-flow", new String[] { "# Logs water flow. If water destroys other blocks, such as torches,", "# this allows it to be properly rolled back." });
HEADERS.put("lava-flow", new String[] { "# Logs lava flow. If lava destroys other blocks, such as torches,", "# this allows it to be properly rolled back." });
HEADERS.put("liquid-tracking", new String[] { "# Allows liquid to be properly tracked and linked to players.", "# For example, if a player places water which flows and destroys torches,", "# it can all be properly restored by rolling back that single player." });
HEADERS.put("item-transactions", new String[] { "# Track item transactions, such as when a player takes items from", "# a chest, furnace, or dispenser." });
HEADERS.put("water-flow",
new String[]
{ "# Logs water flow. If water destroys other blocks, such as torches,",
"# this allows it to be properly rolled back." });
HEADERS.put("lava-flow",
new String[]
{ "# Logs lava flow. If lava destroys other blocks, such as torches,",
"# this allows it to be properly rolled back." });
HEADERS.put("liquid-tracking",
new String[]
{ "# Allows liquid to be properly tracked and linked to players.",
"# For example, if a player places water which flows and destroys torches,",
"# it can all be properly restored by rolling back that single player." });
HEADERS.put("item-transactions",
new String[]
{ "# Track item transactions, such as when a player takes items from",
"# a chest, furnace, or dispenser." });
HEADERS.put("item-drops", new String[] { "# Logs items dropped by players." });
HEADERS.put("item-pickups", new String[] { "# Logs items picked up by players." });
HEADERS.put("hopper-transactions", new String[] { "# Track all hopper transactions, such as when a hopper removes items from a", "# chest, furnace, or dispenser." });
HEADERS.put("player-interactions", new String[] { "# Track player interactions, such as when a player opens a door, presses", "# a button, or opens a chest. Player interactions can't be rolled back." });
HEADERS.put("hopper-transactions",
new String[]
{ "# Track all hopper transactions, such as when a hopper removes items from a",
"# chest, furnace, or dispenser." });
HEADERS.put("player-interactions",
new String[]
{ "# Track player interactions, such as when a player opens a door, presses",
"# a button, or opens a chest. Player interactions can't be rolled back." });
HEADERS.put("player-messages", new String[] { "# Logs messages that players send in the chat." });
HEADERS.put("player-commands", new String[] { "# Logs all commands used by players." });
HEADERS.put("player-sessions", new String[] { "# Logs the logins and logouts of players." });
HEADERS.put("username-changes", new String[] { "# Logs when a player changes their Minecraft username." });
HEADERS.put("worldedit", new String[] { "# Logs changes made via the plugin \"WorldEdit\" if it's in use on your server." });
HEADERS.put("worldedit",
new String[]
{ "# Logs changes made via the plugin \"WorldEdit\" if it's in use on your server." });
}
private void readValues() {
this.ENABLE_SSL = this.getBoolean("enable-ssl", false);
this.DISABLE_WAL = this.getBoolean("disable-wal", false);
this.HOVER_EVENTS = this.getBoolean("hover-events", true);
this.DATABASE_LOCK = this.getBoolean("database-lock", true);
this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true);
this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false);
this.DUPLICATE_SUPPRESSION = this.getBoolean("duplicate-suppression", true);
this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false);
this.NETWORK_DEBUG = this.getBoolean("network-debug", false);
this.UNKNOWN_LOGGING = this.getBoolean("unknown-logging", false);
@@ -219,10 +271,7 @@ public class Config extends Language {
this.MYSQL_USERNAME = this.getString("mysql-username");
this.MYSQL_PASSWORD = this.getString("mysql-password");
this.LANGUAGE = this.getString("language");
this.AUTO_PURGE = this.getString("auto-purge");
this.AUTO_PURGE_TIME = this.getString("auto-purge-time");
this.CHECK_UPDATES = this.getBoolean("check-updates");
this.ERROR_REPORTING = this.getBoolean("error-reporting");
this.API_ENABLED = this.getBoolean("api-enabled");
this.VERBOSE = this.getBoolean("verbose");
this.DEFAULT_RADIUS = this.getInt("default-radius");
@@ -237,7 +286,6 @@ public class Config extends Language {
this.PISTONS = this.getBoolean("pistons");
this.BLOCK_BURN = this.getBoolean("block-burn");
this.BLOCK_IGNITE = this.getBoolean("block-ignite");
this.FIRE_EXTINGUISH = this.getBoolean("fire-extinguish");
this.EXPLOSIONS = this.getBoolean("explosions");
this.ENTITY_CHANGE = this.getBoolean("entity-change");
this.ENTITY_KILLS = this.getBoolean("entity-kills");
@@ -262,96 +310,140 @@ public class Config extends Language {
this.PLAYER_SESSIONS = this.getBoolean("player-sessions");
this.USERNAME_CHANGES = this.getBoolean("username-changes");
this.WORLDEDIT = this.getBoolean("worldedit");
}
public static void init() throws IOException {
parseConfig(loadFiles(ConfigFile.CONFIG));
// pass variables to ConfigFile.parseConfig(ConfigFile.loadFiles());
}
public static Config getGlobal() {
return GLOBAL;
}
// returns a world specific config if it exists, otherwise the global config
public static Config getConfig(final World world) {
return getConfig(world.getName());
}
public static Config getConfig(final String worldName) {
Config ret = CONFIG_BY_WORLD_NAME.get(worldName);
if (ret == null) {
ret = CONFIG_BY_WORLD_NAME.getOrDefault(worldName, GLOBAL);
CONFIG_BY_WORLD_NAME.put(worldName, ret);
}
return ret;
}
public Config() {
this.config = new LinkedHashMap<>();
}
public void setDefaults(final Config defaults) {
this.defaults = defaults;
}
private String get(final String key, final String dfl) {
String configured = this.config.get(key);
if (configured == null) {
if (dfl != null) {
return dfl;
}
if (this.defaults == null) {
configured = DEFAULT_VALUES.get(key);
}
else {
} else {
configured = this.defaults.config.getOrDefault(key, DEFAULT_VALUES.get(key));
}
}
return configured;
}
private boolean getBoolean(final String key) {
final String configured = this.get(key, null);
return configured != null && configured.startsWith("t");
return configured != null && StringUtils.startsWith(configured, "t");
}
private boolean getBoolean(final String key, final boolean dfl) {
final String configured = this.get(key, null);
return configured == null ? dfl : configured.startsWith("t");
return configured == null ? dfl : StringUtils.startsWith(configured, "t");
}
private int getInt(final String key) {
return this.getInt(key, 0);
}
private int getInt(final String key, final int dfl) {
String configured = this.get(key, null);
if (configured == null) {
return dfl;
}
configured = configured.replaceAll("[^0-9]", "");
return configured.isEmpty() ? dfl : Integer.parseInt(configured);
return StringUtils.isEmpty(configured) ? dfl : Integer.parseInt(configured);
}
private String getString(final String key) {
final String configured = this.get(key, null);
return configured == null ? "" : configured;
}
public void clearConfig() {
this.config.clear();
}
public void loadDefaults() {
this.clearConfig();
this.readValues();
}
public void load(final InputStream in) throws IOException {
// if we fail reading, we will not corrupt our current config.
final Map<String, String> newConfig = new LinkedHashMap<>(this.config.size());
ConfigFile.load(in, newConfig, false);
@@ -360,69 +452,99 @@ public class Config extends Language {
this.config.putAll(newConfig);
this.readValues();
}
private static Map<String, byte[]> loadFiles(String fileName) throws IOException {
final CoreProtect plugin = CoreProtect.getInstance();
final File configFolder = plugin.getDataFolder();
if (!configFolder.exists()) {
configFolder.mkdirs();
}
final Map<String, byte[]> map = new HashMap<>();
final File globalFile = new File(configFolder, fileName);
if (globalFile.exists()) {
// we always add options to the global config
final byte[] data = Files.readAllBytes(globalFile.toPath());
map.put("config", data);
if (!globalFile.exists() || globalFile.length() == 0) {
// can't modify GLOBAL, we're likely off-main here
final Config temp = new Config();
temp.load(new ByteArrayInputStream(data));
temp.addMissingOptions(globalFile);
}
else {
final Config temp = new Config();
temp.loadDefaults();
temp.addMissingOptions(globalFile);
}
try (final InputStream in = plugin.getResource(fileName)) {
if (in == null) {
throw new IOException("Missing bundled resource: " + fileName);
}
Files.copy(in, globalFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
map.put("config", Files.readAllBytes(globalFile.toPath()));
final File[] files = configFolder.listFiles((File file) -> StringUtils.endsWith(file.getName(), ".yml"));
if (files != null) {
for (final File worldConfigFile : files) {
final String name = worldConfigFile.getName();
if (name.equals(ConfigFile.CONFIG) || name.equals(ConfigFile.LANGUAGE)) {
continue;
}
map.put(StringUtils.substring(name, 0, name.length() - ".yml".length()),
Files.readAllBytes(worldConfigFile.toPath()));
for (final File worldConfigFile : configFolder.listFiles((File file) -> file.getName().endsWith(".yml"))) {
final String name = worldConfigFile.getName();
if (name.equals(ConfigFile.CONFIG) || name.equals(ConfigFile.LANGUAGE)) {
continue;
}
map.put(name.substring(0, name.length() - ".yml".length()), Files.readAllBytes(worldConfigFile.toPath()));
}
return map;
}
// this should only be called on the main thread
private static void parseConfig(final Map<String, byte[]> data) {
if (!Bukkit.isPrimaryThread()) {
// we call reloads asynchronously
// for now this solution is good enough to ensure we only modify on the main thread
// for now this solution is good enough to ensure we only modify on the main
// thread
final CompletableFuture<Void> complete = new CompletableFuture<>();
Scheduler.runTask(CoreProtect.getInstance(), () -> {
try {
parseConfig(data);
}
catch (final Throwable thr) {
} catch (final Throwable thr) {
if (thr instanceof ThreadDeath) {
throw (ThreadDeath) thr;
}
complete.completeExceptionally(thr);
return;
}
complete.complete(null);
});
complete.join();
return;
}
CONFIG_BY_WORLD_NAME.clear();
@@ -430,21 +552,30 @@ public class Config extends Language {
// we need to load global first since it is used for config defaults
final byte[] defaultData = data.get("config");
if (defaultData != null) {
try {
GLOBAL.load(new ByteArrayInputStream(defaultData));
}
catch (final IOException ex) {
} catch (final IOException ex) {
throw new RuntimeException(ex); // shouldn't happen
}
}
else {
} else {
GLOBAL.loadDefaults();
}
for (final Map.Entry<String, byte[]> entry : data.entrySet()) {
final String worldName = entry.getKey();
if (worldName.equals("config")) {
if ("config".equals(worldName)) {
continue;
}
final byte[] fileData = entry.getValue();
@@ -452,55 +583,25 @@ public class Config extends Language {
config.setDefaults(GLOBAL);
try {
config.load(new ByteArrayInputStream(fileData));
}
catch (final IOException ex) {
} catch (final IOException ex) {
throw new RuntimeException(ex); // shouldn't happen
}
CONFIG_BY_WORLD_NAME.put(worldName, config);
}
}
public void addMissingOptions(final File file) throws IOException {
final boolean writeHeader = !file.exists() || file.length() == 0;
try (final FileOutputStream fout = new FileOutputStream(file, true)) {
OutputStreamWriter out = new OutputStreamWriter(new BufferedOutputStream(fout), StandardCharsets.UTF_8);
if (writeHeader) {
out.append(DEFAULT_FILE_HEADER);
out.append(LINE_SEPARATOR);
}
for (final Map.Entry<String, String> entry : DEFAULT_VALUES.entrySet()) {
final String key = entry.getKey();
final String defaultValue = entry.getValue();
return;
final String configuredValue = this.config.get(key);
if (configuredValue != null) {
continue;
}
if (key.equals("auto-purge") && VersionUtils.isCommunityEdition()) {
continue;
}
final String[] header = HEADERS.get(key);
if (header != null) {
out.append(LINE_SEPARATOR);
for (final String headerLine : header) {
out.append(headerLine);
out.append(LINE_SEPARATOR);
}
}
out.append(key);
out.append(": ");
out.append(defaultValue);
out.append(LINE_SEPARATOR);
}
out.close();
}
}
}
}
@@ -22,11 +22,9 @@ import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import net.coreprotect.CoreProtect;
import net.coreprotect.language.Language;
import net.coreprotect.language.Phrase;
import net.coreprotect.utility.ErrorReporter;
public class ConfigFile extends Config {
@@ -40,20 +38,27 @@ public class ConfigFile extends Config {
private final HashMap<String, String> lang;
public static void init(String fileName) throws IOException {
for (Phrase phrase : Phrase.values()) {
DEFAULT_VALUES.put(phrase.name(), phrase.getPhrase());
USER_VALUES.put(phrase.name(), phrase.getUserPhrase());
}
boolean isCache = fileName.startsWith(".");
loadFiles(fileName, isCache);
}
public ConfigFile() {
this.lang = new LinkedHashMap<>();
}
public void load(final InputStream in, String fileName, boolean isCache) throws IOException {
// if we fail reading, we will not corrupt our current config.
final Map<String, String> newConfig = new LinkedHashMap<>(this.lang.size());
ConfigFile.load(in, newConfig, true);
@@ -62,32 +67,50 @@ public class ConfigFile extends Config {
this.lang.putAll(newConfig);
for (final Entry<String, String> entry : this.lang.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (DEFAULT_VALUES.containsKey(key) && value.length() > 0 && (!isCache || DEFAULT_VALUES.get(key).equals(USER_VALUES.get(key)))) {
if (DEFAULT_VALUES.containsKey(key) && value.length() > 0
&& (!isCache || DEFAULT_VALUES.get(key).equals(USER_VALUES.get(key))))
{
Phrase phrase = Phrase.valueOf(key);
if (!isCache) {
Language.setUserPhrase(phrase, value);
}
Language.setTranslatedPhrase(phrase, value);
}
}
}
// this function will close in
public static void load(final InputStream in, final Map<String, String> config, boolean forceCase) throws IOException {
public static void load(final InputStream in, final Map<String, String> config, boolean forceCase)
throws IOException
{
try (final InputStream in0 = in) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
if (line.startsWith("#")) {
continue;
}
final int split = line.indexOf(':');
if (split == -1) {
continue;
}
String key = line.substring(0, split).trim();
@@ -95,38 +118,51 @@ public class ConfigFile extends Config {
// Strip out single and double quotes from the start/end of the value
if (value.length() >= 2 && value.startsWith("'") && value.endsWith("'")) {
value = value.replaceAll("^'|'$", "");
value = value.replace("''", "'");
value = value.replace("\\'", "'");
value = value.replace("\\\\", "\\");
}
else if (value.length() >= 2 && value.startsWith("\"") && value.endsWith("\"")) {
} else if (value.length() >= 2 && value.startsWith("\"") && value.endsWith("\"")) {
value = value.replaceAll("^\"|\"$", "");
value = value.replace("\\\"", "\"");
value = value.replace("\\\\", "\\");
}
if (forceCase) {
key = key.toUpperCase(Locale.ROOT);
}
config.put(key, value);
}
reader.close();
}
}
private static Map<String, byte[]> loadFiles(String fileName, boolean isCache) throws IOException {
final CoreProtect plugin = CoreProtect.getInstance();
final File configFolder = plugin.getDataFolder();
if (!configFolder.exists()) {
configFolder.mkdirs();
}
final Map<String, byte[]> map = new HashMap<>();
final File globalFile = new File(configFolder, fileName);
if (globalFile.exists()) {
// we always add options to the global config
final byte[] data = Files.readAllBytes(globalFile.toPath());
map.put("config", data);
@@ -134,80 +170,112 @@ public class ConfigFile extends Config {
final ConfigFile temp = new ConfigFile();
temp.load(new ByteArrayInputStream(data), fileName, isCache);
temp.addMissingOptions(globalFile);
}
else {
} else {
final ConfigFile temp = new ConfigFile();
temp.addMissingOptions(globalFile);
}
return map;
}
@Override
public void addMissingOptions(final File file) throws IOException {
if (file.getName().startsWith(".")) {
return;
}
final boolean writeHeader = !file.exists() || file.length() == 0;
try (final FileOutputStream fout = new FileOutputStream(file, true)) {
OutputStreamWriter out = new OutputStreamWriter(new BufferedOutputStream(fout), StandardCharsets.UTF_8);
if (writeHeader) {
out.append(DEFAULT_FILE_HEADER);
out.append(Config.LINE_SEPARATOR);
}
for (final Entry<String, String> entry : DEFAULT_VALUES.entrySet()) {
final String key = entry.getKey();
final String defaultValue = entry.getValue().replaceAll("\"", "\\\\\"");
final String configuredValue = this.lang.get(key);
if (configuredValue != null) {
continue;
}
out.append(Config.LINE_SEPARATOR);
out.append(key);
out.append(": ");
out.append("\"" + defaultValue + "\"");
}
out.close();
}
}
public static void modifyLine(String fileName, String oldLine, String newLine) {
try {
Path path = Paths.get(ConfigHandler.path + fileName);
List<String> lines = Files.readAllLines(path);
for (int i = 0; i < lines.size(); i++) {
if (lines.get(i).equalsIgnoreCase(oldLine)) {
if (newLine != null && newLine.length() > 0) {
lines.set(i, newLine);
}
else {
} else {
lines.remove(i);
}
break;
}
}
if (lines.size() > 0) {
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from being added
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from
// being added
Files.write(path, (lines.remove(lines.size() - 1).isEmpty() ? lines : lines), StandardCharsets.UTF_8);
Files.write(path, lastLine.getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
lines.clear();
}
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
}
public static void sortFile(String fileName) {
try {
Path path = Paths.get(ConfigHandler.path + fileName);
List<String> lines = Files.readAllLines(path);
List<String> sort = lines.subList(2, lines.size());
@@ -216,22 +284,33 @@ public class ConfigFile extends Config {
lines.addAll(sort);
if (lines.size() > 0) {
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from being added
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from
// being added
Files.write(path, (lines.remove(lines.size() - 1).isEmpty() ? lines : lines), StandardCharsets.UTF_8);
Files.write(path, lastLine.getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
lines.clear();
}
} catch (Exception e) {
e.printStackTrace();
}
catch (Exception e) {
ErrorReporter.report(e);
}
}
public static void resetCache(String cacheName, String fileName) throws IOException {
File file = new File(CoreProtect.getInstance().getDataFolder(), cacheName);
if (file.length() > 0) {
new FileOutputStream(file).close();
init(fileName);
}
}
}
Loaded 100 of 328 files, more files were not shown because too many files have changed in this diff. Show more