26 Commits
Author SHA1 Message Date
NotAlexNoyle 537701eeb4 Exclude CODEOWNERS from language statistics 2026-10-28 08:31:45 -04:00
NotAlexNoyle 05cc6d7038 Add CODEOWNERS (one staff approval) 2026-10-28 08:31:45 -04:00
NotAlexNoyle 6d92e5e5d9 Remove update checking 2026-07-22 08:10:13 -04:00
NotAlexNoyle 2ee91697fd Use live TrueOG Network config files 2026-04-01 07:05:25 -04:00
NotAlexNoyle 1a87501e75 Update shadow 2025-09-25 03:24:33 -04:00
NotAlexNoyle f1ecbddcdc Fix gradle build 2025-09-02 11:10:05 -04:00
NotAlexNoyle 72bb096f85 Maven -> Gradle 2025-09-02 11:05:24 -04:00
Nassim Jahnke 018e0c1265 1.7.4 Release 2024-07-19 14:48:36 +02:00
Nassim Jahnke 383e7752de Change particle defaults to work across versions 2024-07-19 14:48:15 +02:00
Nassim Jahnke 7cc3c4c5d2 Use root locale in string case changes 2024-07-01 11:54:53 +02:00
Nassim Jahnke ecf7b2cb1c Clear vectors cache via reference change to avoid cme
Fixes #17
2024-07-01 11:47:04 +02:00
Nassim Jahnke 39272c3e3f Bump version to 1.7.4-SNAPSHOT 2024-07-01 11:43:02 +02:00
Nassim Jahnke 3fe95d7c36 1.7.3 Release 2024-05-17 16:25:04 +02:00
Nassim Jahnke 4283964e0b Small refactors 2023-10-01 21:56:15 +10:00
Nassim JahnkeandPhillip Glanz 23f9ca8350 Add Folia support
Co-authored-by: Phillip Glanz <p.glanz@madfix.me>
2023-04-03 12:24:20 +02:00
Nassim Jahnke 423a552e5b Update bstats 2023-01-01 17:56:50 +01:00
Nassim Jahnke b5dc9d45e0 Update dependencies 2023-01-01 17:53:12 +01:00
Nassim Jahnke 55a1857392 Bump version to 7.1.3-SNAPSHOT 2023-01-01 17:45:15 +01:00
Nassim Jahnke 24b97184cc 1.7.2 Release 2021-11-06 21:57:51 +01:00
Nassim Jahnke 8e10485e89 Add ability to set per-particle radius, speed, and offset 2021-11-06 21:53:12 +01:00
Nassim Jahnke 95a766d250 Update copyright header and name 2021-11-06 21:33:16 +01:00
KennyTV 75db35d027 Add sanity check when uncaching players 2020-04-23 18:38:05 +02:00
KennyTV b698132801 Replace domain redirection with proper discord link 2020-04-13 23:48:39 +02:00
KennyTV a7085b1bc0 1.7.1 Release
* Add max selection size option
* Limit the maximum advanced grid size to make them more beautiful
* Fix send to all particles not working (Fixes #7)
2020-04-12 13:59:25 +02:00
KennyTV 6385374151 1.7 Release
* Show WorldGuard regions on command
* Option to only send particles to players with a low ping
* Properly use Bukkit permission for the command
* Update bStats metrics
* Update copyright header
* Some cleanup
2020-04-11 11:31:03 +02:00
KennyTV 6865a71828 Check server version before WE version, update dependencies 2019-12-11 12:59:34 +01:00
59 changed files with 2167 additions and 1104 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
+3 -1
View File
@@ -91,4 +91,6 @@ $RECYCLE.BIN/
*.msi
*.msm
*.msp
*.lnk
*.lnk
/.gradle/
/build/
+3 -6
View File
@@ -1,20 +1,17 @@
# WorldEditSUI
[![Discord](https://img.shields.io/discord/489135856284729384.svg?label=Discord&logo=discord&logoColor=fff)](https://discord.gg/vGCUzHq)
[![Twitter](https://img.shields.io/twitter/follow/KennyTVN.svg?label=Twitter)](https://twitter.com/KennyTVN)
Sassy Minecraft plugin to show your current WorldEdit selection by displaying particles (which can be greatly customized in the plugin's config).
It aims at a higher performance and lesser memory impact by having a quite simplistic approach to calculating vectors.
Compared to other server plugins with similar functionality, it aims at a higher performance and lesser memory impact by having a quite simplistic approach to calculating vectors.
You can read up on everything else and see examples on the [**Spigot page**](https://www.spigotmc.org/resources/worldeditsui.60726/).
## Legacy support
This branch supports Minecraft versions from 1.9 upwards.
If you want a jar that supports 1.8.4-1.8.9 as well (everything below 1.8.4 still unsupported), see the `1.8-support` branch / the [**releases download page**](https://github.com/KennyTV/WorldEditSUI/releases).
The default master branch does not contain 1.8 support, since that version seems to be used by only a very small fraction of WESUI users and requires some extra encapsulation and small additions for every new Minecraft release.
If you want a jar that supports 1.8.4-1.8.9 as well, see the `1.8-support` branch / the [**last release to contain a 1.8 build**](https://github.com/kennytv/WorldEditSUI/releases/tag/1.6.1).
## Compiling
Use Maven to compile the project (`mvn clean package`).
Use Maven to compile the project (`mvn package`).
## Licence
This project is licensed under the [GNU General Public License](http://www.gnu.org/licenses/gpl-3.0).
+173
View File
@@ -0,0 +1,173 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.kotlin.dsl.provideDelegate
plugins {
id("java")
id("java-library")
id("com.diffplug.spotless") version "7.0.4"
id("com.gradleup.shadow") version "8.3.8"
id("checkstyle")
eclipse
}
java {
sourceCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.GRAAL_VM)
}
}
group = "eu.kennytv.worldeditsui"
version = "1.7.4"
val apiVersion = "1.19"
repositories {
mavenCentral()
gradlePluginPortal()
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
maven { url = uri("https://maven.enginehub.org/repo/") }
maven { url = uri("https://repo.purpurmc.org/snapshots") }
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let {
val dir = file(it)
if (dir.isDirectory) {
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
maven { url = uri("file://${dir.absolutePath}") }
} else {
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
mavenLocal()
}
} ?: logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
}
subprojects {
apply(plugin = "java")
apply(plugin = "java-library")
apply(plugin = "eclipse")
repositories {
mavenCentral()
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
maven { url = uri("https://maven.enginehub.org/repo/") }
maven { url = uri("https://repo.purpurmc.org/snapshots") }
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let {
val dir = file(it)
if (dir.isDirectory) {
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
maven { url = uri("file://${dir.absolutePath}") }
} else {
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
mavenLocal()
}
}
}
}
project(":worldedit-sui") {
apply(plugin = "com.gradleup.shadow")
dependencies {
implementation(project(":we-compat:we-compat-common"))
implementation(project(":we-compat:we6-compat"))
implementation(project(":we-compat:we7-compat"))
implementation("org.bstats:bstats-bukkit:3.0.2")
compileOnly("dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
}
tasks.named<ProcessResources>("processResources") {
val props = mapOf("version" to rootProject.version, "apiVersion" to apiVersion)
inputs.properties(props)
filesMatching("plugin.yml") { expand(props) }
from(rootProject.file("LICENSE")) { into("/") }
}
tasks.named<ShadowJar>("shadowJar") {
relocate("org.bstats", "eu.kennytv.worldeditsui.lib.bstats")
archiveBaseName.set("WorldEditSUI")
archiveClassifier.set("")
destinationDirectory.set(rootProject.layout.buildDirectory.dir("libs"))
minimize()
manifest { attributes(mapOf("paperweight-mappings-namespace" to "mojang")) }
}
tasks.named<Jar>("jar") { manifest { attributes(mapOf("paperweight-mappings-namespace" to "mojang")) } }
}
project(":we-compat") {
// aggregator
}
project(":we-compat:we-compat-common") {
dependencies {
compileOnly("com.sk89q.worldedit:worldedit-bukkit:6.1.4-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
}
}
project(":we-compat:we6-compat") {
dependencies {
compileOnly(project(":we-compat:we-compat-common"))
compileOnly("com.sk89q.worldedit:worldedit-bukkit:6.1.4-SNAPSHOT")
compileOnly("com.sk89q:worldguard:6.1.1-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
}
}
project(":we-compat:we7-compat") {
dependencies {
compileOnly(project(":we-compat:we-compat-common"))
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9") { exclude(group = "com.sk89q.worldedit") }
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
}
}
subprojects {
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
}
tasks.jar { archiveClassifier.set("part") }
tasks.build { dependsOn(tasks.spotlessApply, ":worldedit-sui:shadowJar") }
subprojects {
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters")
options.isFork = true
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:-removal")
}
}
spotless {
java {
eclipse().configFile("config/formatter/eclipse-java-formatter.xml")
leadingTabsToSpaces()
removeUnusedImports()
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) }
target("build.gradle.kts", "settings.gradle.kts")
}
}
checkstyle {
toolVersion = "10.18.1"
configFile = file("config/checkstyle/checkstyle.xml")
isIgnoreFailures = true
isShowViolations = true
}
tasks.named("compileJava") { dependsOn("spotlessApply") }
tasks.named("spotlessCheck") { dependsOn("spotlessApply") }
+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>
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
-69
View File
@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>worldedit-sui-parent</artifactId>
<packaging>pom</packaging>
<version>1.6.1</version>
<modules>
<module>worldedit-sui</module>
<module>we-compat</module>
</modules>
<properties>
<plugin.java>1.8</plugin.java>
<maven.compiler.target>${plugin.java}</maven.compiler.target>
<maven.compiler.source>${plugin.java}</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>enginehub-repo</id>
<url>https://maven.sk89q.com/artifactory/repo/</url>
</repository>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>${project.name}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
+11
View File
@@ -0,0 +1,11 @@
rootProject.name = "WorldEditSUI"
include(":worldedit-sui")
include(":we-compat")
include(":we-compat:we-compat-common")
include(":we-compat:we6-compat")
include(":we-compat:we7-compat")
-20
View File
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>worldedit-sui-parent</artifactId>
<version>1.6.1</version>
</parent>
<packaging>pom</packaging>
<artifactId>we-compat</artifactId>
<modules>
<module>we-compat-common</module>
<module>we6-compat</module>
<module>we7-compat</module>
</modules>
</project>
+1
View File
@@ -0,0 +1 @@
/build/
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat</artifactId>
<version>1.6.1</version>
</parent>
<artifactId>we-compat-common</artifactId>
<dependencies>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>6.1.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,32 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.compat;
import org.bukkit.World;
import org.jetbrains.annotations.Nullable;
import java.util.Set;
public interface ProtectedRegionHelper {
@Nullable
ProtectedRegionWrapper getRegion(World world, String regionName);
Set<String> getRegionNames(World world);
}
@@ -0,0 +1,40 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.compat;
import com.sk89q.worldedit.regions.Region;
public final class ProtectedRegionWrapper {
private final Region region;
private final SelectionType selectionType;
public ProtectedRegionWrapper(final Region region, final SelectionType selectionType) {
this.region = region;
this.selectionType = selectionType;
}
public Region getRegion() {
return region;
}
public SelectionType getSelectionType() {
return selectionType;
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.ClipboardHolder;
import org.bukkit.Material;
public interface IRegionHelper {
public interface RegionHelper {
SimpleVector getRadius(EllipsoidRegion region);
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.util;
package eu.kennytv.worldeditsui.compat;
import java.util.HashMap;
import java.util.Map;
@@ -31,7 +31,7 @@ public enum SelectionType {
NONE(null);
private static final Map<String, SelectionType> TYPES = new HashMap<>();
private final String key;
private final String key; // WE key, hence the inconsistent naming
SelectionType(final String key) {
this.key = key;
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1
View File
@@ -0,0 +1 @@
/build/
-28
View File
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat</artifactId>
<version>1.6.1</version>
</parent>
<artifactId>we6-compat</artifactId>
<dependencies>
<dependency>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat-common</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>6.1.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,74 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.compat.we6;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldguard.bukkit.RegionContainer;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionType;
import eu.kennytv.worldeditsui.compat.ProtectedRegionHelper;
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
import eu.kennytv.worldeditsui.compat.SelectionType;
import org.bukkit.World;
import java.util.Collections;
import java.util.Set;
public final class ProtectedRegionHelper6 implements ProtectedRegionHelper {
private final RegionContainer regionContainer = WorldGuardPlugin.inst().getRegionContainer();
@Override
public ProtectedRegionWrapper getRegion(final World world, final String regionName) {
final RegionManager regionManager = regionContainer.get(world);
if (regionManager == null) {
return null;
}
final ProtectedRegion region = regionManager.getRegion(regionName);
if (region == null) {
return null;
}
final RegionType type = region.getType();
final com.sk89q.worldedit.world.World worldWrapper = new BukkitWorld(world);
switch (type) {
case CUBOID:
return new ProtectedRegionWrapper(new CuboidRegion(worldWrapper, region.getMinimumPoint(), region.getMaximumPoint()), SelectionType.CUBOID);
case POLYGON:
return new ProtectedRegionWrapper(new Polygonal2DRegion(worldWrapper, region.getPoints(),
(int) region.getMinimumPoint().getY(), (int) region.getMaximumPoint().getY()), SelectionType.POLYGON);
case GLOBAL:
default:
return null;
}
}
@Override
public Set<String> getRegionNames(final World world) {
final RegionManager regionManager = regionContainer.get(world);
if (regionManager == null) return Collections.emptySet();
return regionManager.getRegions().keySet();
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,9 +24,14 @@ import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.*;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CylinderRegion;
import com.sk89q.worldedit.regions.EllipsoidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.session.ClipboardHolder;
import eu.kennytv.worldeditsui.compat.IRegionHelper;
import eu.kennytv.worldeditsui.compat.RegionHelper;
import eu.kennytv.worldeditsui.compat.Simple2DVector;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import org.bukkit.Material;
@@ -34,7 +39,7 @@ import org.bukkit.inventory.ItemStack;
import java.util.List;
public final class RegionHelper implements IRegionHelper {
public final class RegionHelper6 implements RegionHelper {
@Override
public SimpleVector getRadius(final EllipsoidRegion region) {
+1
View File
@@ -0,0 +1 @@
/build/
-28
View File
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat</artifactId>
<version>1.6.1</version>
</parent>
<artifactId>we7-compat</artifactId>
<dependencies>
<dependency>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat-common</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,74 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.compat.we7;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionType;
import eu.kennytv.worldeditsui.compat.ProtectedRegionHelper;
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
import eu.kennytv.worldeditsui.compat.SelectionType;
import org.bukkit.World;
import java.util.Collections;
import java.util.Set;
public final class ProtectedRegionHelper7 implements ProtectedRegionHelper {
private final RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer();
@Override
public ProtectedRegionWrapper getRegion(final World world, final String regionName) {
final BukkitWorld worldWrapper = new BukkitWorld(world);
final RegionManager regionManager = regionContainer.get(worldWrapper);
if (regionManager == null) {
return null;
}
final ProtectedRegion region = regionManager.getRegion(regionName);
if (region == null) {
return null;
}
final RegionType type = region.getType();
switch (type) {
case CUBOID:
return new ProtectedRegionWrapper(new CuboidRegion(worldWrapper, region.getMinimumPoint(), region.getMaximumPoint()), SelectionType.CUBOID);
case POLYGON:
return new ProtectedRegionWrapper(new Polygonal2DRegion(worldWrapper, region.getPoints(),
region.getMinimumPoint().getY(), region.getMaximumPoint().getY()), SelectionType.POLYGON);
case GLOBAL:
default:
return null;
}
}
@Override
public Set<String> getRegionNames(final World world) {
final RegionManager regionManager = regionContainer.get(new BukkitWorld(world));
if (regionManager == null) return Collections.emptySet();
return regionManager.getRegions().keySet();
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,16 +25,22 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector2;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.*;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CylinderRegion;
import com.sk89q.worldedit.regions.EllipsoidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.session.ClipboardHolder;
import eu.kennytv.worldeditsui.compat.IRegionHelper;
import eu.kennytv.worldeditsui.compat.RegionHelper;
import eu.kennytv.worldeditsui.compat.Simple2DVector;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import java.util.Locale;
import org.bukkit.Material;
import java.util.List;
public final class RegionHelper implements IRegionHelper {
public final class RegionHelper7 implements RegionHelper {
@Override
public SimpleVector getRadius(final EllipsoidRegion region) {
@@ -108,7 +114,7 @@ public final class RegionHelper implements IRegionHelper {
@Override
public Material getWand(final WorldEditPlugin plugin) {
return Material.getMaterial(plugin.getLocalConfiguration().wandItem.toUpperCase().replace("MINECRAFT:", ""));
return Material.getMaterial(plugin.getLocalConfiguration().wandItem.toUpperCase(Locale.ROOT).replace("MINECRAFT:", ""));
}
@Override
+1
View File
@@ -0,0 +1 @@
/build/
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>worldedit-sui-parent</artifactId>
<version>1.6.1</version>
</parent>
<artifactId>worldedit-sui</artifactId>
<name>WorldEditSUI</name>
<dependencies>
<dependency>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we-compat-common</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we6-compat</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>eu.kennytv.worldeditsui</groupId>
<artifactId>we7-compat</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,13 +18,22 @@
package eu.kennytv.worldeditsui;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import eu.kennytv.worldeditsui.util.ParticleData;
import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Particle;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -44,10 +53,12 @@ public final class Settings {
private int particleSendInterval;
private int particleViewDistance;
private long expiresAfterMillis;
private long maxSelectionSizeToDisplay;
private int maxPing;
private boolean useMaxSelectionSizeBypassPerm;
private boolean cacheLocations;
private boolean expiryEnabled;
private boolean expireMessage;
private boolean updateChecks;
private boolean sendParticlesToAll;
private boolean persistentToggles;
private boolean showByDefault;
@@ -56,8 +67,10 @@ public final class Settings {
private ParticleData clipboardParticle;
private ParticleData othersParticle;
private ParticleData othersClipboardParticle;
private ParticleData wgRegionParticle;
private GridSettings advancedGrid;
private GridSettings advancedClipboardGrid;
private GridSettings advancedWGRegionGrid;
Settings(final WorldEditSUIPlugin plugin) {
this.plugin = plugin;
@@ -69,10 +82,34 @@ public final class Settings {
public void loadSettings() {
final YamlConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "config.yml"));
wandItem = config.getString("wand", "").toUpperCase().replace("MINECRAFT:", "");
wandItem = config.getString("wand", "").toUpperCase(Locale.ROOT).replace("MINECRAFT:", "");
particleViewDistance = config.getInt("particle-viewdistance", 99);
if (particleViewDistance < 1 || particleViewDistance > 500) {
plugin.getLogger().warning("To punish you for your deeds of setting the particle viewdistance to an astonishing "
+ particleViewDistance + ", it has been set to 2 blocks.");
plugin.getLogger().warning("Also, this puppy just died.\n"
+ " __\n" +
" (___()'`;\n" +
" /, /`\n" +
" \\\\\"--\\\\");
plugin.getLogger().warning("Is this what you wanted?");
particleViewDistance = 2;
}
particle = loadParticle(config, "particle", Particle.FLAME);
clipboardParticle = loadParticle(config, "clipboard-particle", Particle.VILLAGER_HAPPY);
clipboardParticle = loadParticle(config, "clipboard-particle", Particle.END_ROD);
wgRegionParticle = loadParticle(config, "wg-region-particle", Particle.END_ROD);
maxPing = Math.max(config.getInt("max-ping"), 0);
try {
Player.Spigot.class.getDeclaredMethod("getPing");
} catch (final NoSuchMethodException ignored) {
if (maxPing != 0) {
plugin.getLogger().warning("The max-ping option only works on servers running Paper!");
maxPing = 0;
}
}
final ConfigurationSection sendToAllSection = config.getConfigurationSection("send-particles-to-all");
sendParticlesToAll = sendToAllSection.getBoolean("enabled");
@@ -80,9 +117,9 @@ public final class Settings {
if (otherParticlesPermission.isEmpty() || otherParticlesPermission.equalsIgnoreCase("none")) {
otherParticlesPermission = null;
}
plugin.getParticleHelper().setPermission(otherParticlesPermission);
othersParticle = loadParticle(sendToAllSection, "others-particle", Particle.FLAME);
othersClipboardParticle = loadParticle(sendToAllSection, "others-clipboard-particle", Particle.VILLAGER_HAPPY);
othersClipboardParticle = loadParticle(sendToAllSection, "others-clipboard-particle", Particle.END_ROD);
particlesPerBlock = config.getInt("particles-per-block", 4);
if (particlesPerBlock < 0.5 || particlesPerBlock > 5) {
@@ -101,6 +138,10 @@ public final class Settings {
advancedClipboardGrid = clipboardGridSection != null && clipboardGridSection.getBoolean("enabled", false) ?
new GridSettings(plugin, clipboardGridSection) : null;
final ConfigurationSection wgRegionGridSection = config.getConfigurationSection("advanced-wg-region-grid");
advancedWGRegionGrid = wgRegionGridSection != null && wgRegionGridSection.getBoolean("enabled", false) ?
new GridSettings(plugin, wgRegionGridSection) : null;
particleSendInterval = config.getInt("particle-send-interval", 12);
if (particleSendInterval < 5 || particleSendInterval > 200) {
plugin.getLogger().warning("The particle-send-interval has to be set between 5 and 200!");
@@ -114,24 +155,10 @@ public final class Settings {
}
cacheLocations = config.getBoolean("cache-calculated-positions", true);
updateChecks = config.getBoolean("update-checks", true);
persistentToggles = config.getBoolean("persistent-toggles");
showByDefault = config.getBoolean("show-selection-by-default", true);
showClipboardByDefault = config.getBoolean("show-clipboard-by-default");
particleViewDistance = config.getInt("particle-viewdistance", 99);
if (particleViewDistance < 1 || particleViewDistance > 500) {
plugin.getLogger().warning("To punish you for your deeds of setting the particle viewdistance to an astonishing "
+ particleViewDistance + ", it has been set to 2 blocks.");
plugin.getLogger().warning("Also, this puppy just died.\n"
+ " __\n" +
" (___()'`;\n" +
" /, /`\n" +
" \\\\\"--\\\\");
plugin.getLogger().warning("Is this what you wanted?");
particleViewDistance = 2;
}
expiryEnabled = config.getBoolean("particle-expiry.enabled", false);
if (expiryEnabled) {
expireMessage = config.getBoolean("particle-expiry.expire-message", true);
@@ -145,6 +172,9 @@ public final class Settings {
}
}
maxSelectionSizeToDisplay = Math.max(config.getLong("max-selection-size-to-display"), 0);
useMaxSelectionSizeBypassPerm = config.getBoolean("enable-max-selection-bypass-perm", true);
if (persistentToggles) {
final File file = new File(plugin.getDataFolder(), "userdata.yml");
if (!file.exists()) {
@@ -175,24 +205,36 @@ public final class Settings {
}
private ParticleData loadParticle(final ConfigurationSection section, final String s, final Particle defaultParticle) {
final String particleName = section.getString(s, defaultParticle.name()).toUpperCase().replace("MINECRAFT:", "");
final String particleName = section.getString(s, defaultParticle.name()).toUpperCase(Locale.ROOT).replace("MINECRAFT:", "");
final Particle particle;
try {
particle = Particle.valueOf(particleName);
} catch (final Exception e) {
plugin.getLogger().warning("Unknown particle for " + s + ": " + particleName.toUpperCase());
plugin.getLogger().warning("Switched to default particle: " + defaultParticle);
return new ParticleData(defaultParticle, null);
return new ParticleData(defaultParticle, particleViewDistance);
}
double speed = 0;
double offX = 0;
double offY = 0;
double offZ = 0;
int radius = particleViewDistance;
final ConfigurationSection particleSection = section.getConfigurationSection(s + "-data");
if (particleSection != null) {
speed = Math.max(0, particleSection.getDouble("speed"));
offX = particleSection.getDouble("offX");
offY = particleSection.getDouble("offY");
offZ = particleSection.getDouble("offZ");
radius = Math.min(500, Math.max(1, particleSection.getInt("radius", radius))); // TODO warn if radius is too high
}
try {
final Object data = ParticleData.getExtraData(particle, section.getConfigurationSection(s + "-data"));
return new ParticleData(particle, data);
return new ParticleData(particle, radius, speed, offX, offY, offZ, ParticleData.getExtraData(particle, particleSection));
} catch (final Exception e) {
plugin.getLogger().warning("Error loading particle data of " + particleName + " - Missing data? You may read up on how to correctly set its data at the bottom of the plugin's Spigot page.");
plugin.getLogger().warning("Falling back to default particle: " + defaultParticle);
e.printStackTrace();
return new ParticleData(particle, null);
return new ParticleData(particle, particleViewDistance);
}
}
@@ -218,8 +260,10 @@ public final class Settings {
plugin.getLogger().warning("The language file is missing the following string: " + path);
return "empty";
}
if (s.contains("%prefix%"))
if (s.contains("%prefix%")) {
s = s.replace("%prefix%", language.getString("prefix", ""));
}
return ChatColor.translateAlternateColorCodes('&', s);
}
@@ -227,45 +271,40 @@ public final class Settings {
return permission;
}
// getter is unused since the perm is directly given to the particle helper class
public String getOtherParticlesPermission() {
return otherParticlesPermission;
}
public boolean hasAdvancedGrid() {
return advancedGrid != null;
@Nullable
public GridSettings getGridSettings(final DrawedType drawedType) {
switch (drawedType) {
case SELECTED:
return advancedGrid;
case CLIPBOARD:
return advancedClipboardGrid;
case WG_REGION:
return advancedWGRegionGrid;
default:
throw new IllegalArgumentException();
}
}
public boolean hasAdvancedGrid(final boolean clipboardSelection) {
return clipboardSelection ? advancedClipboardGrid != null : advancedGrid != null;
public boolean hasAdvancedGrid(final DrawedType drawedType) {
return getGridSettings(drawedType) != null;
}
/**
* @see #hasAdvancedGrid()
* @see #hasAdvancedGrid(DrawedType)
*/
public double getParticleGridSpace() {
return advancedGrid.getParticleGridSpace();
public double getParticleGridSpace(final DrawedType drawedType) {
return getGridSettings(drawedType).getParticleGridSpace();
}
/**
* @see #hasAdvancedGrid(boolean)
* @see #hasAdvancedGrid(DrawedType)
*/
public double getParticleGridSpace(final boolean clipboardSelection) {
return clipboardSelection ? advancedClipboardGrid.getParticleGridSpace() : advancedGrid.getParticleGridSpace();
}
/**
* @see #hasAdvancedGrid()
*/
public int getParticlesPerGridBlock() {
return advancedGrid.getParticlesPerGridBlock();
}
/**
* @see #hasAdvancedGrid(boolean)
*/
public int getParticlesPerGridBlock(final boolean clipboardSelection) {
return clipboardSelection ? advancedClipboardGrid.getParticlesPerGridBlock() : advancedGrid.getParticlesPerGridBlock();
public int getParticlesPerGridBlock(final DrawedType drawedType) {
return getGridSettings(drawedType).getParticlesPerGridBlock();
}
public double getParticleSpace() {
@@ -288,6 +327,18 @@ public final class Settings {
return expiresAfterMillis;
}
public int getMaxPing() {
return maxPing;
}
public long getMaxSelectionSizeToDisplay() {
return maxSelectionSizeToDisplay;
}
public boolean useMaxSelectionSizeBypassPerm() {
return useMaxSelectionSizeBypassPerm;
}
public boolean isExpiryEnabled() {
return expiryEnabled;
}
@@ -296,12 +347,8 @@ public final class Settings {
return expireMessage;
}
public boolean hasUpdateChecks() {
return updateChecks;
}
public boolean sendParticlesToAll() {
return sendParticlesToAll;
public boolean sendParticlesToAll(final DrawedType drawedType) {
return sendParticlesToAll && (drawedType == DrawedType.SELECTED || drawedType == DrawedType.CLIPBOARD);
}
public boolean hasPersistentToggles() {
@@ -320,20 +367,27 @@ public final class Settings {
return cacheLocations;
}
public ParticleData getParticle() {
return particle;
public ParticleData getParticle(final DrawedType drawedType) {
switch (drawedType) {
default:
case SELECTED:
return particle;
case CLIPBOARD:
return clipboardParticle;
case WG_REGION:
return wgRegionParticle;
}
}
public ParticleData getClipboardParticle() {
return clipboardParticle;
}
public ParticleData getOthersParticle() {
return othersParticle;
}
public ParticleData getOthersClipboardParticle() {
return othersClipboardParticle;
public ParticleData getOthersParticle(final DrawedType drawedType) {
switch (drawedType) {
case SELECTED:
return othersParticle;
case CLIPBOARD:
return othersClipboardParticle;
default:
throw new IllegalArgumentException();
}
}
public String getWandItem() {
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,253 +29,281 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.session.ClipboardHolder;
import eu.kennytv.worldeditsui.command.WESUICommand;
import eu.kennytv.worldeditsui.compat.IRegionHelper;
import eu.kennytv.worldeditsui.compat.ProtectedRegionHelper;
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
import eu.kennytv.worldeditsui.compat.RegionHelper;
import eu.kennytv.worldeditsui.compat.SelectionType;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import eu.kennytv.worldeditsui.compat.we6.RegionHelper;
import eu.kennytv.worldeditsui.compat.we6.ProtectedRegionHelper6;
import eu.kennytv.worldeditsui.compat.we6.RegionHelper6;
import eu.kennytv.worldeditsui.compat.we7.ProtectedRegionHelper7;
import eu.kennytv.worldeditsui.compat.we7.RegionHelper7;
import eu.kennytv.worldeditsui.drawer.DrawManager;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import eu.kennytv.worldeditsui.listener.PlayerJoinListener;
import eu.kennytv.worldeditsui.listener.PlayerQuitListener;
import eu.kennytv.worldeditsui.listener.WESelectionListener;
import eu.kennytv.worldeditsui.metrics.MetricsLite;
import eu.kennytv.worldeditsui.user.SelectionCache;
import eu.kennytv.worldeditsui.user.User;
import eu.kennytv.worldeditsui.user.UserManager;
import eu.kennytv.worldeditsui.util.Cancellable;
import eu.kennytv.worldeditsui.util.CancellableBukkitTask;
import eu.kennytv.worldeditsui.util.CancellableScheduledTask;
import eu.kennytv.worldeditsui.util.ParticleHelper;
import eu.kennytv.worldeditsui.util.SelectionType;
import eu.kennytv.worldeditsui.util.Version;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.bstats.bukkit.Metrics;
import org.bukkit.Location;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* @author KennyTV
*/
public final class WorldEditSUIPlugin extends JavaPlugin {
private static final String PREFIX = "§8[§eWorldEditSUI§8] ";
private IRegionHelper regionHelper;
private static final boolean FOLIA = hasClass("io.papermc.paper.threadedregions.scheduler.EntityScheduler");
private RegionHelper regionHelper;
private ProtectedRegionHelper protectedRegionHelper;
private ParticleHelper particleHelper;
private UserManager userManager;
private Settings settings;
private DrawManager drawManager;
private WorldEditPlugin worldEditPlugin;
private Version version;
private Version newestVersion;
private int expiryTask = -1;
private int persistentTogglesTask = -1;
private Cancellable expiryTask;
private Cancellable persistentTogglesTask;
private boolean worldGuardEnabled;
@Override
public void onEnable() {
version = new Version(getDescription().getVersion());
printEnableMessage();
try {
Class.forName("com.sk89q.worldedit.math.Vector2");
regionHelper = new eu.kennytv.worldeditsui.compat.we7.RegionHelper();
} catch (final ClassNotFoundException e) {
regionHelper = new RegionHelper();
}
try {
Class.forName("org.bukkit.Particle");
} catch (final ClassNotFoundException e) {
// See the master branch for 1.8 support
getLogger().severe("Sorry - this plugin only supports Minecraft versions from 1.9 upwards.");
getLogger().severe("This plugin only supports Minecraft versions from 1.9 upwards.");
getServer().getPluginManager().disablePlugin(this);
return;
}
particleHelper = new ParticleHelper();
boolean isWorldEdit7 = true;
try {
Class.forName("com.sk89q.worldedit.math.Vector2");
} catch (final ClassNotFoundException e) {
isWorldEdit7 = false;
}
regionHelper = isWorldEdit7 ? new RegionHelper7() : new RegionHelper6();
settings = new Settings(this);
particleHelper = new ParticleHelper(settings);
userManager = new UserManager(settings);
drawManager = new DrawManager(this);
final PluginManager pm = getServer().getPluginManager();
worldEditPlugin = ((WorldEditPlugin) pm.getPlugin("WorldEdit"));
worldGuardEnabled = pm.isPluginEnabled("WorldGuard");
if (worldGuardEnabled) {
protectedRegionHelper = isWorldEdit7 ? new ProtectedRegionHelper7() : new ProtectedRegionHelper6();
}
// Imagine someone using the server reload command 👀
getServer().getOnlinePlayers().forEach(p -> userManager.createUser(p));
pm.registerEvents(new PlayerJoinListener(this), this);
pm.registerEvents(new PlayerJoinListener(userManager), this);
pm.registerEvents(new PlayerQuitListener(userManager), this);
pm.registerEvents(new WESelectionListener(this), this);
getCommand("worldeditsui").setExecutor(new WESUICommand(this));
final PluginCommand command = getCommand("worldeditsui");
command.setExecutor(new WESUICommand(this));
command.setPermissionMessage(settings.getMessage("noPermission"));
// Start tasks
getServer().getScheduler().runTaskTimerAsynchronously(this, this::updateSelections, settings.getParticleSendInterval(), settings.getParticleSendInterval());
checkTasks();
runRepeatedAsync(this::updateSelections, settings.getParticleSendInterval(), settings.getParticleSendInterval());
reloadTasks();
new MetricsLite(this);
new Metrics(this, 5444);
}
@Override
public void onDisable() {
if (settings == null) return; // if instantly disabled
settings.saveData();
getServer().getOnlinePlayers().forEach(player -> userManager.deleteUser(player));
}
private void printEnableMessage() {
getLogger().info("Plugin by KennyTV");
getServer().getScheduler().runTaskAsynchronously(this, () -> {
updateAvailable();
final int compare = version.compareTo(newestVersion);
if (compare == -1) {
getLogger().info("§cNewest version available: §aVersion " + newestVersion + "§c, you're on §a" + version);
} else if (compare == 1) {
if (version.getTag().equalsIgnoreCase("snapshot")) {
getLogger().info("§cYou're running a development version, please report bugs on the Discord server (https://kennytv.eu/discord).");
} else {
getLogger().info("§cYou're running a version, that doesn't exist! §cN§ai§dc§ee§5!");
}
}
});
}
public boolean updateAvailable() {
try {
final HttpURLConnection c = (HttpURLConnection) new URL("https://api.spigotmc.org/legacy/update.php?resource=60726").openConnection();
final String newVersionString = new BufferedReader(new InputStreamReader(c.getInputStream())).readLine().replaceAll("[a-zA-Z -]", "");
final Version newVersion = new Version(newVersionString);
if (newVersion.equals(version)) return false;
newestVersion = newVersion;
return version.compareTo(newVersion) == -1;
} catch (final Exception ignored) {
return false;
public Cancellable runRepeatedAsync(final Runnable runnable, final long delay, final long period) {
if (FOLIA) {
return new CancellableScheduledTask(getServer().getAsyncScheduler().runAtFixedRate(this, scheduledTask -> runnable.run(), delay * 50, period * 50, TimeUnit.MILLISECONDS));
} else {
return new CancellableBukkitTask(getServer().getScheduler().runTaskTimerAsynchronously(this, runnable, delay, period));
}
}
public void checkTasks() {
public Cancellable runRepeated(final Runnable runnable, final long delay, final long period) {
if (FOLIA) {
return new CancellableScheduledTask(getServer().getGlobalRegionScheduler().runAtFixedRate(this, task -> runnable.run(), delay, period));
} else {
return new CancellableBukkitTask(getServer().getScheduler().runTaskTimer(this, runnable, delay, period));
}
}
public void reloadTasks() {
// Start tasks if not already running, or cancel them if one is running but now disabled in the config
if (expiryTask == -1 && settings.isExpiryEnabled()) {
expiryTask = getServer().getScheduler().runTaskTimer(this, () -> {
userManager.getExpireTimestamps().entrySet().removeIf(entry -> {
final boolean remove = entry.getValue() < System.currentTimeMillis();
if (remove && settings.hasExpireMessage()) {
getServer().getPlayer(entry.getKey()).sendMessage(settings.getMessage("idled"));
}
return remove;
});
}, 20, 20).getTaskId();
} else if (expiryTask != -1 && !settings.isExpiryEnabled()) {
getServer().getScheduler().cancelTask(expiryTask);
expiryTask = -1;
if (expiryTask == null && settings.isExpiryEnabled()) {
expiryTask = runRepeated(this::expiryTask, 20, 20);
} else if (expiryTask != null && !settings.isExpiryEnabled()) {
expiryTask.cancel();
expiryTask = null;
for (final User user : userManager.getUsers().values()) {
user.setExpireTimestamp(-1);
}
}
if (persistentTogglesTask == -1 && settings.hasPersistentToggles()) {
if (persistentTogglesTask == null && settings.hasPersistentToggles()) {
// Check every 15 minutes
persistentTogglesTask = getServer().getScheduler().runTaskTimerAsynchronously(this, () -> settings.saveData(), 18000, 18000).getTaskId();
} else if (persistentTogglesTask != -1 && !settings.hasPersistentToggles()) {
getServer().getScheduler().cancelTask(persistentTogglesTask);
persistentTogglesTask = -1;
persistentTogglesTask = runRepeatedAsync(() -> settings.saveData(), 18000, 18000);
} else if (persistentTogglesTask != null && !settings.hasPersistentToggles()) {
persistentTogglesTask.cancel();
persistentTogglesTask = null;
}
}
private void expiryTask() {
for (final User user : userManager.getUsers().values()) {
if (user.getExpireTimestamp() == 0) continue;
if (user.getExpireTimestamp() > System.currentTimeMillis()) continue;
user.setExpireTimestamp(0);
if (settings.hasExpireMessage()) {
getServer().getPlayer(user.getUuid()).sendMessage(settings.getMessage("idled"));
}
}
}
private void updateSelections() {
for (final Player player : getServer().getOnlinePlayers()) {
if (!player.isOnline()) continue;
if (!player.isOnline()) {
continue;
}
final User user = userManager.getUser(player);
if (user == null) continue;
if (!user.isSelectionShown() && !user.isClipboardShown()) continue;
if (settings.isExpiryEnabled() && !userManager.getExpireTimestamps().containsKey(player.getUniqueId()))
if (user == null) {
continue;
if (settings.getPermission() != null && !player.hasPermission(settings.getPermission())) continue;
}
// Check for sending restrictions
if (!user.isSelectionShown() && !user.isClipboardShown()
|| settings.isExpiryEnabled() && user.getExpireTimestamp() == 0
|| settings.getPermission() != null && !player.hasPermission(settings.getPermission())
|| settings.getMaxPing() != 0 && player.spigot().getPing() > settings.getMaxPing()) {
continue;
}
final LocalSession session = worldEditPlugin.getSession(player);
final RegionSelector selector = session.getRegionSelector(new BukkitWorld(player.getWorld()));
// Selected WorldGuard region
final ProtectedRegionWrapper selectedWGRegion = user.getSelectedWGRegion();
if (selectedWGRegion != null) {
drawSelection(player, user, selectedWGRegion.getRegion(), selectedWGRegion.getSelectionType(), DrawedType.WG_REGION);
}
// Clipboard
if (user.isClipboardShown()) {
try {
final ClipboardHolder holder = session.getClipboard();
final Clipboard clipboard = holder.getClipboard();
final Location location = player.getLocation();
final SimpleVector origin = regionHelper.getOrigin(clipboard);
// Transform the clipboard if necessary
final Transform transform = holder.getTransform();
final Region region = transform.isIdentity() ? clipboard.getRegion() : regionHelper.transformAndReShift(holder, clipboard.getRegion());
// Shift the transformed region relative to the player
final Region shiftedRegion = regionHelper.shift(region,
location.getBlockX() - origin.getX(), location.getBlockY() - origin.getY(), location.getBlockZ() - origin.getZ());
drawManager.getDrawer(SelectionType.CUBOID).draw(player, shiftedRegion, true);
} catch (final EmptyClipboardException ignored) {
// Ignore if there's no clipboard
}
drawClipboard(player, session);
}
// Selection
if (user.isSelectionShown()) {
final Region region;
try {
region = selector.getRegion();
} catch (final IncompleteRegionException ignored) {
// Clear cache if present
if (settings.cacheLocations()) {
final SelectionCache cache = user.getSelectionCache();
if (cache != null) {
cache.getVectors().clear();
user.setSelectionCache(null);
}
}
continue;
}
final SelectionType selectionType = SelectionType.fromKey(selector.getTypeName());
if (selectionType != null)
drawSelection(player, user, region, selectionType);
drawSelection(selector, player, user);
}
}
}
private void drawSelection(final Player player, final User user, final Region region, final SelectionType selectionType) {
private void drawClipboard(final Player player, final LocalSession session) {
try {
final ClipboardHolder holder = session.getClipboard();
final Clipboard clipboard = holder.getClipboard();
final Location location = player.getLocation();
final SimpleVector origin = regionHelper.getOrigin(clipboard);
// Transform the clipboard if necessary
final Transform transform = holder.getTransform();
final Region region = transform.isIdentity() ? clipboard.getRegion() : regionHelper.transformAndReShift(holder, clipboard.getRegion());
// Shift the transformed region relative to the player
final Region shiftedRegion = regionHelper.shift(region,
location.getBlockX() - origin.getX(), location.getBlockY() - origin.getY(), location.getBlockZ() - origin.getZ());
drawManager.getDrawer(SelectionType.CUBOID).draw(player, shiftedRegion, DrawedType.CLIPBOARD);
} catch (final EmptyClipboardException ignored) {
// Ignore if there's no clipboard
}
}
private void drawSelection(final RegionSelector selector, final Player player, final User user) {
try {
final Region region = selector.getRegion();
final SelectionType selectionType = SelectionType.fromKey(selector.getTypeName());
if (selectionType != null) {
drawSelection(player, user, region, selectionType, DrawedType.SELECTED);
}
} catch (final IncompleteRegionException ignored) {
// Clear cache if present
if (settings.cacheLocations()) {
user.clearCache(DrawedType.SELECTED);
}
}
}
private void drawSelection(final Player player, final User user, final Region region, final SelectionType selectionType, final DrawedType drawedType) {
if (settings.cacheLocations()) {
final SimpleVector minimumPoint = regionHelper.getMinimumPoint(region);
final SimpleVector maximumPoint = regionHelper.getMaximumPoint(region);
SelectionCache cache = user.getSelectionCache();
SelectionCache cache = user.getSelectionCache(drawedType);
if (cache != null) {
if (selectionType == cache.getSelectionType()
&& cache.getMinimum().equals(minimumPoint) && cache.getMaximum().equals(maximumPoint)) {
final Location location = new Location(player.getWorld(), 0, 0, 0);
for (final SimpleVector vector : cache.getVectors()) {
final List<SimpleVector> vectors = cache.getVectors();
for (final SimpleVector vector : vectors) {
location.setX(vector.getX());
location.setY(vector.getY());
location.setZ(vector.getZ());
if (settings.sendParticlesToAll()) {
particleHelper.playEffectToAll(settings.getParticle(), settings.getOthersParticle(), location, 0, 1, settings.getParticleViewDistance(), player);
if (settings.sendParticlesToAll(drawedType)) {
particleHelper.playEffectToAll(settings.getParticle(drawedType), settings.getOthersParticle(drawedType), location, player);
} else {
particleHelper.playEffect(settings.getParticle(), location, 0, 1, settings.getParticleViewDistance(), player);
particleHelper.playEffect(settings.getParticle(drawedType), location, player);
}
}
return;
}
} else {
cache = new SelectionCache();
user.setSelectionCache(cache);
user.setSelectionCache(drawedType, cache);
}
// If there's a new region, reset the cache and recalculate vectors
cache.clear();
cache.setMinimum(minimumPoint);
cache.setMaximum(maximumPoint);
cache.setSelectionType(selectionType);
cache.getVectors().clear();
}
drawManager.getDrawer(selectionType).draw(player, region);
// Current selection
drawManager.getDrawer(selectionType).draw(player, region, drawedType);
}
public WorldEditPlugin getWorldEditPlugin() {
return worldEditPlugin;
}
public DrawManager getDrawManager() {
return drawManager;
}
public UserManager getUserManager() {
return userManager;
}
@@ -284,23 +312,29 @@ public final class WorldEditSUIPlugin extends JavaPlugin {
return settings;
}
public String getPrefix() {
return PREFIX;
}
public Version getVersion() {
return version;
}
public Version getNewestVersion() {
return newestVersion;
}
public IRegionHelper getRegionHelper() {
public RegionHelper getRegionHelper() {
return regionHelper;
}
@MonotonicNonNull
public ProtectedRegionHelper getProtectedRegionHelper() {
return protectedRegionHelper;
}
public ParticleHelper getParticleHelper() {
return particleHelper;
}
public boolean isWorldGuardEnabled() {
return worldGuardEnabled;
}
private static boolean hasClass(final String className) {
try {
Class.forName(className);
return true;
} catch (final ClassNotFoundException e) {
return false;
}
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,17 +20,22 @@ package eu.kennytv.worldeditsui.command;
import eu.kennytv.worldeditsui.Settings;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.user.SelectionCache;
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import eu.kennytv.worldeditsui.user.User;
import java.util.Locale;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
public final class WESUICommand implements CommandExecutor, TabCompleter {
@@ -43,55 +48,95 @@ public final class WESUICommand implements CommandExecutor, TabCompleter {
}
@Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String s, final String[] args) {
if (checkPermission(sender, "command")) return true;
public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command cmd, @NotNull final String s, @NotNull final String[] args) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("toggle")) {
if (!(sender instanceof Player)) return true;
if (checkPermission(sender, "command.toggle")) return true;
final String arg = args[0].toLowerCase(Locale.ROOT);
switch (arg) {
case "toggle": {
if (!(sender instanceof Player)) return true;
if (checkPermission(sender, "command.toggle")) return true;
final Player player = (Player) sender;
final User user = plugin.getUserManager().getUser(player);
if (user.isSelectionShown()) {
player.sendMessage(getMessage("particlesHidden"));
user.setSelectionShown(false);
final SelectionCache cache = user.getSelectionCache();
if (cache != null) {
cache.getVectors().clear();
user.setSelectionCache(null);
final Player player = (Player) sender;
final User user = plugin.getUserManager().getUser(player);
if (user.isSelectionShown()) {
player.sendMessage(getMessage("particlesHidden"));
user.setSelectionShown(false);
user.clearCaches();
} else {
player.sendMessage(getMessage("particlesShown"));
user.setSelectionShown(true);
}
} else {
player.sendMessage(getMessage("particlesShown"));
user.setSelectionShown(true);
}
if (settings.hasPersistentToggles()) {
settings.setUserData("selection." + player.getUniqueId(), user.isSelectionShown());
if (settings.hasPersistentToggles()) {
settings.setUserData("selection." + player.getUniqueId(), user.isSelectionShown());
}
break;
}
} else if (args[0].equalsIgnoreCase("toggleclipboard")) {
if (!(sender instanceof Player)) return true;
if (checkPermission(sender, "command.toggleclipboard")) return true;
case "toggleclipboard": {
if (!(sender instanceof Player)) return true;
if (checkPermission(sender, "command.toggleclipboard")) return true;
final Player player = (Player) sender;
final User user = plugin.getUserManager().getUser(player);
player.sendMessage(user.isClipboardShown() ? getMessage("clipboardHidden") : getMessage("clipboardShown"));
user.setClipboardShown(!user.isClipboardShown());
if (settings.hasPersistentToggles()) {
settings.setUserData("clipboard." + player.getUniqueId(), user.isClipboardShown());
final Player player = (Player) sender;
final User user = plugin.getUserManager().getUser(player);
player.sendMessage(user.isClipboardShown() ? getMessage("clipboardHidden") : getMessage("clipboardShown"));
user.setClipboardShown(!user.isClipboardShown());
if (settings.hasPersistentToggles()) {
settings.setUserData("clipboard." + player.getUniqueId(), user.isClipboardShown());
}
break;
}
} else if (args[0].equalsIgnoreCase("reload")) {
if (checkPermission(sender, "command.reload")) return true;
case "reload":
if (checkPermission(sender, "command.reload")) return true;
final boolean cache = settings.cacheLocations();
settings.loadSettings();
settings.loadLanguageFile();
// Empty cache to recalculate positions
plugin.getUserManager().getUsers().values().forEach(user -> user.setSelectionCache(null));
plugin.checkTasks();
sender.sendMessage(getMessage("reload"));
} else
sendHelp(sender);
settings.loadSettings();
settings.loadLanguageFile();
// Empty cache to recalculate positions
plugin.getUserManager().getUsers().values().forEach(User::clearCaches);
plugin.reloadTasks();
sender.sendMessage(getMessage("reload"));
// Reset Bukkit's no perm message for the command
plugin.getCommand("worldeditsui").setPermissionMessage(settings.getMessage("noPermission"));
break;
case "showregion": {
if (!(sender instanceof Player)) return true;
if (checkPermission(sender, "command.showregion")) return true;
final Player player = (Player) sender;
final User user = plugin.getUserManager().getUser(player);
if (user.getSelectedWGRegion() == null) {
sendHelp(sender);
return true;
}
user.setSelectedWGRegion(null);
user.clearCache(DrawedType.WG_REGION);
user.setExpireTimestamp(System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
sender.sendMessage(getMessage("regionCleared"));
break;
}
default:
sendHelp(sender);
break;
}
} else if (args.length == 2 && args[0].equalsIgnoreCase("showregion")) {
if (!(sender instanceof Player)) return true;
if (checkPermission(sender, "command.showregion")) return true;
if (!plugin.isWorldGuardEnabled()) {
sender.sendMessage(getMessage("WGNotEnabled"));
return true;
}
final Player player = (Player) sender;
final ProtectedRegionWrapper region = plugin.getProtectedRegionHelper().getRegion(player.getWorld(), args[1]);
if (region == null) {
sender.sendMessage(getMessage("regionNotFound"));
return true;
}
final User user = plugin.getUserManager().getUser(player);
user.clearCache(DrawedType.WG_REGION);
user.setSelectedWGRegion(region);
player.sendMessage(getMessage("regionDisplayed"));
} else
sendHelp(sender);
return true;
@@ -106,7 +151,9 @@ public final class WESUICommand implements CommandExecutor, TabCompleter {
sender.sendMessage(getMessage("helpToggle"));
if (sender.hasPermission("wesui.command.toggleclipboard"))
sender.sendMessage(getMessage("helpToggleClipboard"));
sender.sendMessage("§8× §eVersion " + plugin.getVersion() + " §7by §bKennyTV");
if (plugin.isWorldGuardEnabled() && sender.hasPermission("wesui.command.showregion"))
sender.sendMessage(getMessage("helpShowRegion"));
sender.sendMessage("§8× §eVersion " + plugin.getDescription().getVersion() + " §7by §bkennytv");
sender.sendMessage(getMessage("helpHeader"));
sender.sendMessage("");
}
@@ -120,21 +167,33 @@ public final class WESUICommand implements CommandExecutor, TabCompleter {
}
@Override
public List<String> onTabComplete(final CommandSender sender, final Command cmd, final String s, final String[] args) {
if (args.length != 1 || !sender.hasPermission("wesui.command")) return Collections.emptyList();
final String arg = args[0].toLowerCase();
final List<String> list = new ArrayList<>();
checkString(sender, arg, "reload", list);
checkString(sender, arg, "toggle", list);
checkString(sender, arg, "toggleclipboard", list);
return list;
public List<String> onTabComplete(@NotNull final CommandSender sender, @NotNull final Command cmd, @NotNull final String s, @NotNull final String[] args) {
if (!sender.hasPermission("wesui.command")) return Collections.emptyList();
if (args.length == 1) {
final String arg = args[0].toLowerCase(Locale.ROOT);
final List<String> list = new ArrayList<>();
checkString(sender, arg, "reload", list);
checkString(sender, arg, "toggle", list);
checkString(sender, arg, "toggleclipboard", list);
if (plugin.isWorldGuardEnabled()) {
checkString(sender, arg, "showregion", list);
}
return list;
} else if (args.length == 2) {
if (sender instanceof Player && plugin.isWorldGuardEnabled()
&& args[0].equalsIgnoreCase("showregion") && sender.hasPermission("wesui.showregion")) {
final Set<String> regionNames = plugin.getProtectedRegionHelper().getRegionNames(((Player) sender).getWorld());
return StringUtil.copyPartialMatches(args[1], regionNames, new ArrayList<>());
}
}
return Collections.emptyList();
}
private void checkString(final CommandSender sender, final String s, final String command, final List<String> list) {
if (!s.isEmpty() && !command.startsWith(s)) return;
if (sender.hasPermission("wesui.command." + command))
if (sender.hasPermission("wesui.command." + command)) {
list.add(command);
}
}
private String getMessage(final String path) {
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@ package eu.kennytv.worldeditsui.drawer;
import com.sk89q.worldedit.regions.Region;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -33,12 +34,9 @@ public final class CuboidDrawer extends DrawerBase {
}
@Override
public void draw(final Player player, final Region region) {
this.draw(player, region, false);
}
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
@Override
public void draw(final Player player, final Region region, final boolean copySelection) {
final double width = region.getWidth();
final double length = region.getLength();
final double height = region.getHeight();
@@ -53,49 +51,50 @@ public final class CuboidDrawer extends DrawerBase {
int gridSpaceX = 0;
int gridSpaceZ = 0;
int topGridSpace = 0;
if (settings.hasAdvancedGrid(copySelection)) {
gridSpaceX = settings.getParticlesPerBlock() * ((int) ((width * height) / AREA_FACTOR) + 1);
gridSpaceZ = settings.getParticlesPerBlock() * ((int) ((length * height) / AREA_FACTOR) + 1);
topGridSpace = settings.getParticlesPerBlock() * ((int) ((width * length) / AREA_FACTOR) + 1);
maxGridTicks = height * settings.getParticlesPerGridBlock(copySelection) - 1;
maxTopGridTicksX = length * settings.getParticlesPerGridBlock(copySelection) - 1;
maxTopGridTicksZ = width * settings.getParticlesPerGridBlock(copySelection) - 1;
if (settings.hasAdvancedGrid(drawedType)) {
gridSpaceX = settings.getParticlesPerBlock() * checkSpace(((int) ((width * height) / AREA_FACTOR) + 1));
gridSpaceZ = settings.getParticlesPerBlock() * checkSpace(((int) ((length * height) / AREA_FACTOR) + 1));
topGridSpace = settings.getParticlesPerBlock() * checkSpace(((int) ((width * length) / AREA_FACTOR) + 1));
maxGridTicks = height * settings.getParticlesPerGridBlock(drawedType) - 1;
maxTopGridTicksX = length * settings.getParticlesPerGridBlock(drawedType) - 1;
maxTopGridTicksZ = width * settings.getParticlesPerGridBlock(drawedType) - 1;
}
drawLines(player, minimumPoint.clone(), gridSpaceX, topGridSpace, maxTicksX, maxGridTicks, maxTopGridTicksX, height, true, copySelection);
drawLines(player, minimumPoint.clone().add(0, 0, length), gridSpaceX, 0, maxTicksX, maxGridTicks, 0, height, true, copySelection);
drawLines(player, minimumPoint.clone(), gridSpaceZ, topGridSpace, maxTicksZ, maxGridTicks, maxTopGridTicksZ, height, false, copySelection);
drawLines(player, minimumPoint.clone().add(width, 0, 0), gridSpaceZ, 0, maxTicksZ, maxGridTicks, 0, height, false, copySelection);
drawPillarsAndGrid(player, minimumPoint, gridSpaceX, gridSpaceZ, height, width, length, copySelection);
drawLines(player, minimumPoint.clone(), gridSpaceX, topGridSpace, maxTicksX, maxGridTicks, maxTopGridTicksX, height, true, drawedType);
drawLines(player, minimumPoint.clone().add(0, 0, length), gridSpaceX, 0, maxTicksX, maxGridTicks, 0, height, true, drawedType);
drawLines(player, minimumPoint.clone(), gridSpaceZ, topGridSpace, maxTicksZ, maxGridTicks, maxTopGridTicksZ, height, false, drawedType);
drawLines(player, minimumPoint.clone().add(width, 0, 0), gridSpaceZ, 0, maxTicksZ, maxGridTicks, 0, height, false, drawedType);
drawPillarsAndGrid(player, minimumPoint, gridSpaceX, gridSpaceZ, height, width, length, drawedType);
}
private void drawLines(final Player player, final Location location, final int gridSpace, final int topGridSpace,
final double maxTicks, final double maxGridTicks, final double maxTopGridTicks,
final double height, final boolean x, final boolean copySelection) {
final double height, final boolean x, final DrawedType drawedType) {
// Lower row (with vertical grid)
final double oldX = location.getX();
final double oldZ = location.getZ();
int blocks = 0;
for (int i = 0; i < maxTicks; i++) {
if (settings.hasAdvancedGrid(copySelection)) {
if (settings.hasAdvancedGrid(drawedType)) {
if (blocks % gridSpace == 0 && i != 0) {
final Location clone = location.clone();
for (double j = 0; j < maxGridTicks; j++) {
clone.add(0, settings.getParticleGridSpace(copySelection), 0);
playEffect(clone, player, copySelection);
clone.add(0, settings.getParticleGridSpace(drawedType), 0);
playEffect(clone, player, drawedType);
}
}
if (topGridSpace != 0 && blocks % topGridSpace == 0 && i != 0) {
tickGrid(player, location, maxTopGridTicks, x, copySelection);
tickGrid(player, location, maxTopGridTicks, x, drawedType);
}
blocks++;
}
if (x)
if (x) {
location.add(settings.getParticleSpace(), 0, 0);
else
} else {
location.add(0, 0, settings.getParticleSpace());
playEffect(location, player, copySelection);
}
playEffect(location, player, drawedType);
}
// Upper row
@@ -104,70 +103,72 @@ public final class CuboidDrawer extends DrawerBase {
location.setY(location.getY() + height);
blocks = 0;
for (double i = 0; i < maxTicks; i++) {
if (settings.hasAdvancedGrid(copySelection) && topGridSpace != 0 && blocks++ % topGridSpace == 0 && i != 0) {
tickGrid(player, location, maxTopGridTicks, x, copySelection);
if (settings.hasAdvancedGrid(drawedType) && topGridSpace != 0 && blocks++ % topGridSpace == 0 && i != 0) {
tickGrid(player, location, maxTopGridTicks, x, drawedType);
}
if (x)
if (x) {
location.add(settings.getParticleSpace(), 0, 0);
else
} else {
location.add(0, 0, settings.getParticleSpace());
playEffect(location, player, copySelection);
}
playEffect(location, player, drawedType);
}
}
private void tickGrid(final Player player, final Location location, final double maxTopGridTicks, final boolean x, final boolean copySelection) {
private void tickGrid(final Player player, final Location location, final double maxTopGridTicks, final boolean x, final DrawedType drawedType) {
final Location clone = location.clone();
for (double j = 0; j < maxTopGridTicks; j++) {
if (x)
clone.add(0, 0, settings.getParticleGridSpace(copySelection));
clone.add(0, 0, settings.getParticleGridSpace(drawedType));
else
clone.add(settings.getParticleGridSpace(copySelection), 0, 0);
playEffect(clone, player, copySelection);
clone.add(settings.getParticleGridSpace(drawedType), 0, 0);
playEffect(clone, player, drawedType);
}
}
private void drawPillarsAndGrid(final Player player, final Location minimum, final int gridSpaceX, final int gridSpaceZ,
final double height, final double width, final double length, final boolean copySelection) {
final boolean advancedGridEnabled = settings.hasAdvancedGrid(copySelection);
final double height, final double width, final double length, final DrawedType drawedType) {
final boolean advancedGridEnabled = settings.hasAdvancedGrid(drawedType);
final double x = minimum.getX();
final double y = minimum.getY();
final double z = minimum.getZ();
final double gridSpace = advancedGridEnabled ? settings.getParticleGridSpace(copySelection) : 0;
final double gridSpace = advancedGridEnabled ? settings.getParticleGridSpace(drawedType) : 0;
final double maxTicks = height * settings.getParticlesPerBlock();
final double maxGridTicksX = advancedGridEnabled ? width * settings.getParticlesPerGridBlock(copySelection) - 1 : 0;
final double maxGridTicksZ = advancedGridEnabled ? length * settings.getParticlesPerGridBlock(copySelection) - 1 : 0;
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, gridSpace, 0, copySelection);
final double maxGridTicksX = advancedGridEnabled ? width * settings.getParticlesPerGridBlock(drawedType) - 1 : 0;
final double maxGridTicksZ = advancedGridEnabled ? length * settings.getParticlesPerGridBlock(drawedType) - 1 : 0;
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, gridSpace, 0, drawedType);
minimum.setX(x + width);
minimum.setY(y);
minimum.setZ(z + length);
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, -gridSpace, 0, copySelection);
setGrid(player, minimum, gridSpaceX, maxTicks, maxGridTicksX, -gridSpace, 0, drawedType);
minimum.setX(x + width);
minimum.setY(y);
minimum.setZ(z);
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, gridSpace, copySelection);
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, gridSpace, drawedType);
minimum.setX(x);
minimum.setY(y);
minimum.setZ(z + length);
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, -gridSpace, copySelection);
setGrid(player, minimum, gridSpaceZ, maxTicks, maxGridTicksZ, 0, -gridSpace, drawedType);
}
private void setGrid(final Player player, final Location location, final int gridSpace, final double maxTicks, final double maxGridTicks, final double xAddition, final double zAddition, final boolean copySelection) {
private void setGrid(final Player player, final Location location, final int gridSpace, final double maxTicks, final double maxGridTicks,
final double xAddition, final double zAddition, final DrawedType drawedType) {
int blocks = 0;
for (int i = 0; i < maxTicks; i++) {
// Horizontal grid
if (settings.hasAdvancedGrid(copySelection) && blocks++ % gridSpace == 0 && i != 0) {
if (settings.hasAdvancedGrid(drawedType) && blocks++ % gridSpace == 0 && i != 0) {
final Location clone = location.clone();
for (double j = 0; j < maxGridTicks; j++) {
clone.add(xAddition, 0, zAddition);
playEffect(clone, player, copySelection);
playEffect(clone, player, drawedType);
}
}
// Pillar
location.add(0, settings.getParticleSpace(), 0);
playEffect(location, player, copySelection);
playEffect(location, player, drawedType);
}
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.regions.FlatRegion;
import com.sk89q.worldedit.regions.Region;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -34,7 +35,9 @@ public final class CylinderDrawer extends DrawerBase {
}
@Override
public void draw(final Player player, final Region region) {
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
final SimpleVector radius = plugin.getRegionHelper().getRadius((CylinderRegion) region, 1.3, 1.3);
final int width = (int) radius.getX();
final int length = (int) radius.getZ();
@@ -51,46 +54,68 @@ public final class CylinderDrawer extends DrawerBase {
location.setY(top);
drawCurves(player, width, length, 1, location, wideGrid, heightSpace == 0 ? 1 : heightSpace);
if (settings.hasAdvancedGrid()) {
if (settings.hasAdvancedGrid(drawedType)) {
location.setY(bottom);
final double wideInterval = Math.PI / (settings.getParticlesPerGridBlock() * max / 10D);
drawCurves(player, width, length, height * settings.getParticlesPerGridBlock(), location, wideInterval, settings.getParticleGridSpace());
drawGrid(player, width, length, top, location, true);
drawGrid(player, length, width, top, location, false);
final double wideInterval = Math.PI / (settings.getParticlesPerGridBlock(drawedType) * max / 10D);
drawCurves(player, width, length, height * settings.getParticlesPerGridBlock(drawedType), location, wideInterval, settings.getParticleGridSpace(drawedType));
drawGrid(player, drawedType, width, length, top, location, true);
drawGrid(player, drawedType, length, width, top, location, false);
}
}
private void drawGrid(final Player player, final int width, final int length, final int top, final Location location, final boolean xAxis) {
private void drawGrid(final Player player, final DrawedType drawedType, final int width, final int length, final int top, final Location location, final boolean xAxis) {
final double x = location.getX();
final double z = location.getZ();
final double bottom = location.getY();
final int gap = settings.getParticlesPerBlock() * (((width * length) / AREA_FACTOR) + 1);
final int gap = checkSpace(settings.getParticlesPerBlock() * (((width * length) / AREA_FACTOR) + 1));
final int ticks = 2 * (width - 1) / gap;
if (xAxis) location.setX(location.getX() - width);
else location.setZ(location.getZ() - width);
if (xAxis) {
location.setX(location.getX() - width);
} else {
location.setZ(location.getZ() - width);
}
for (int i = 0; i < ticks; i++) {
if (xAxis) location.setX(location.getX() + gap);
else location.setZ(location.getZ() + gap);
if (xAxis) {
location.setX(location.getX() + gap);
} else {
location.setZ(location.getZ() + gap);
}
final double delta = Math.abs(xAxis ? location.getX() - x : location.getZ() - z);
// Thanks to a beautiful buddy of mine that took an our of his life to come up with this formula by himself, even though it's on Wikipedia 👀
final double radius = ((double) length / width) * Math.sqrt((width * width) - (delta * delta));
final int gridTicks = (int) (radius * settings.getParticlesPerGridBlock() * 2);
if (xAxis) location.setZ(location.getZ() - radius);
else location.setX(location.getX() - radius);
final int gridTicks = (int) (radius * settings.getParticlesPerGridBlock(drawedType) * 2);
if (xAxis) {
location.setZ(location.getZ() - radius);
} else {
location.setX(location.getX() - radius);
}
for (int j = 0; j < gridTicks; j++) {
if (xAxis) location.setZ(location.getZ() + settings.getParticleGridSpace());
else location.setX(location.getX() + settings.getParticleGridSpace());
if (xAxis) {
location.setZ(location.getZ() + settings.getParticleGridSpace(drawedType));
} else {
location.setX(location.getX() + settings.getParticleGridSpace(drawedType));
}
playEffect(location, player);
location.setY(top);
playEffect(location, player);
location.setY(bottom);
}
if (xAxis) location.setZ(z);
else location.setX(x);
if (xAxis) {
location.setZ(z);
} else {
location.setX(x);
}
}
if (xAxis) {
location.setX(x);
} else {
location.setZ(z);
}
if (xAxis) location.setX(x);
else location.setZ(z);
}
private void drawCurves(final Player player, final int width, final int length, final int ticks, final Location location, final double wideGrid, final double heightSpace) {
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,14 +18,15 @@
package eu.kennytv.worldeditsui.drawer;
import eu.kennytv.worldeditsui.util.SelectionType;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.SelectionType;
import eu.kennytv.worldeditsui.drawer.base.Drawer;
import java.util.HashMap;
import java.util.Map;
public final class DrawManager {
private final Map<SelectionType, Drawer> drawers = new HashMap<>();
public DrawManager(final WorldEditSUIPlugin plugin) {
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@ import com.sk89q.worldedit.regions.EllipsoidRegion;
import com.sk89q.worldedit.regions.Region;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -33,7 +34,9 @@ public final class EllipsoidDrawer extends DrawerBase {
}
@Override
public void draw(final Player player, final Region region) {
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
final SimpleVector radius = plugin.getRegionHelper().getRadius((EllipsoidRegion) region, 1.5, 1.4, 1.5);
final int width = (int) radius.getX();
final int length = (int) radius.getZ();
@@ -46,9 +49,9 @@ public final class EllipsoidDrawer extends DrawerBase {
final double wideInterval = Math.PI / (settings.getParticlesPerBlock() * max / 10D);
showGrid(player, width, length, height, location, wideInterval, heightInterval);
if (settings.hasAdvancedGrid()) {
final double heightGrid = Math.PI / (settings.getParticlesPerGridBlock() * height);
final double wideGrid = Math.PI / (settings.getParticlesPerGridBlock() * max / 5D);
if (settings.hasAdvancedGrid(drawedType)) {
final double heightGrid = Math.PI / (settings.getParticlesPerGridBlock(drawedType) * height);
final double wideGrid = Math.PI / (settings.getParticlesPerGridBlock(drawedType) * max / 5D);
showGrid(player, width, length, height, location, heightGrid, wideGrid);
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.Simple2DVector;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import eu.kennytv.worldeditsui.drawer.base.DrawerBase;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -34,7 +35,9 @@ public final class PolygonalDrawer extends DrawerBase {
}
@Override
public void draw(final Player player, final Region region) {
public void draw(final Player player, final Region region, final DrawedType drawedType) {
if (!hasValidSize(player, region)) return;
final Polygonal2DRegion polyRegion = (Polygonal2DRegion) region;
final Simple2DVector[] points = plugin.getRegionHelper().getPoints(polyRegion);
Simple2DVector last = points[0];
@@ -0,0 +1,26 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.drawer.base;
public enum DrawedType {
SELECTED,
CLIPBOARD,
WG_REGION
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,10 +21,19 @@ package eu.kennytv.worldeditsui.drawer.base;
import com.sk89q.worldedit.regions.Region;
import org.bukkit.entity.Player;
import javax.annotation.Nullable;
public interface Drawer {
/**
* Recreates the given with particles.
* If the given player object is null, the particles
* will be sent to all players nearby.
*
* @param player player to send the particles to, may be null when sent to all players
* @param region region to be displayed with particles
* @param drawedType drawed type
*/
void draw(Player player, Region region, DrawedType drawedType);
/**
* Recreates the given with particles.
* If the given player object is null, the particles
@@ -33,21 +42,7 @@ public interface Drawer {
* @param player player to send the particles to, may be null when sent to all players
* @param region region to be displayed with particles
*/
void draw(@Nullable Player player, Region region);
/**
* Recreates the given with particles.
* If the given player object is null, the particles
* will be sent to all players nearby.
*
* @param player player to send the particles to, may be null when sent to all players
* @param region region to be displayed with particles
* @param copySelection if the region is a copied region
* @see #draw(Player, Region)
* @deprecated only implemented by the CuboidDrawer
*/
@Deprecated
default void draw(@Nullable final Player player, final Region region, final boolean copySelection) {
this.draw(player, region);
default void draw(final Player player, final Region region) {
draw(player, region, DrawedType.SELECTED);
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,9 +18,11 @@
package eu.kennytv.worldeditsui.drawer.base;
import com.sk89q.worldedit.regions.Region;
import eu.kennytv.worldeditsui.Settings;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import eu.kennytv.worldeditsui.user.SelectionCache;
import eu.kennytv.worldeditsui.user.User;
import eu.kennytv.worldeditsui.util.ParticleData;
import org.bukkit.Location;
@@ -28,6 +30,7 @@ import org.bukkit.entity.Player;
public abstract class DrawerBase implements Drawer {
protected static final int MAX_GAP = 30;
protected static final int AREA_FACTOR = 256;
protected final WorldEditSUIPlugin plugin;
protected final Settings settings;
@@ -37,23 +40,35 @@ public abstract class DrawerBase implements Drawer {
this.settings = plugin.getSettings();
}
protected void playEffect(final Location location, final Player player) {
playEffect(location, player, false);
protected boolean hasValidSize(final Player player, final Region region) {
if (settings.getMaxSelectionSizeToDisplay() == 0) return true;
return region.getArea() <= settings.getMaxSelectionSizeToDisplay()
|| (settings.useMaxSelectionSizeBypassPerm() && player.hasPermission("wesui.maxselectionsize.bypass"));
}
protected void playEffect(final Location location, final Player player, final boolean copySelection) {
if (settings.cacheLocations() && !copySelection) {
protected void playEffect(final Location location, final Player player) {
playEffect(location, player, DrawedType.SELECTED);
}
protected void playEffect(final Location location, final Player player, final DrawedType drawedType) {
if (settings.cacheLocations() && drawedType != DrawedType.CLIPBOARD) {
final User user = plugin.getUserManager().getUser(player);
if (user == null) return;
user.getSelectionCache().getVectors().add(new SimpleVector(location.getX(), location.getY(), location.getZ()));
final SelectionCache cache = user.getSelectionCache(drawedType);
cache.getVectors().add(new SimpleVector(location.getX(), location.getY(), location.getZ()));
}
final ParticleData particle = copySelection ? settings.getClipboardParticle() : settings.getParticle();
if (settings.sendParticlesToAll()) {
final ParticleData othersParticle = copySelection ? settings.getOthersClipboardParticle() : settings.getOthersParticle();
plugin.getParticleHelper().playEffectToAll(particle, othersParticle, location, 0, 1, settings.getParticleViewDistance(), player);
final ParticleData particle = settings.getParticle(drawedType);
if (settings.sendParticlesToAll(drawedType)) {
final ParticleData othersParticle = settings.getOthersParticle(drawedType);
plugin.getParticleHelper().playEffectToAll(particle, othersParticle, location, player);
} else {
plugin.getParticleHelper().playEffect(particle, location, 0, 1, settings.getParticleViewDistance(), player);
plugin.getParticleHelper().playEffect(particle, location, player);
}
}
protected int checkSpace(final int gap) {
return Math.min(gap, MAX_GAP);
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,58 +18,21 @@
package eu.kennytv.worldeditsui.listener;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import eu.kennytv.worldeditsui.user.UserManager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public final class PlayerJoinListener implements Listener {
private final Set<UUID> notified = new HashSet<>();
private final WorldEditSUIPlugin plugin;
private final UserManager userManager;
public PlayerJoinListener(final WorldEditSUIPlugin plugin) {
this.plugin = plugin;
public PlayerJoinListener(final UserManager userManager) {
this.userManager = userManager;
}
@EventHandler
public void playerJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer();
plugin.getUserManager().createUser(player);
if (!plugin.getSettings().hasUpdateChecks()) return;
if (!player.hasPermission("worldeditsui.admin")) return;
if (notified.contains(player.getUniqueId())) return;
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
if (!plugin.updateAvailable()) return;
if (!player.isOnline()) return;
player.sendMessage(plugin.getPrefix() + "§cThere is a newer version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getDescription().getVersion());
notified.add(player.getUniqueId());
try {
final TextComponent tc1 = new TextComponent(TextComponent.fromLegacyText(plugin.getPrefix()));
final TextComponent tc2 = new TextComponent(TextComponent.fromLegacyText("§cDownload it at: §6https://www.spigotmc.org/resources/worldeditsui.60726/"));
final TextComponent click = new TextComponent(TextComponent.fromLegacyText(" §7§l§o(CLICK ME)"));
click.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org/resources/worldeditsui.60726/"));
click.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aDownload the latest version").create()));
tc1.addExtra(tc2);
tc1.addExtra(click);
player.spigot().sendMessage(tc1);
} catch (final Exception e) {
player.sendMessage(plugin.getPrefix() + "§cDownload it at: §6https://www.spigotmc.org/resources/worldeditsui.60726/");
}
});
userManager.createUser(event.getPlayer());
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@ import com.google.common.collect.Sets;
import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.util.eventbus.Subscribe;
import eu.kennytv.worldeditsui.WorldEditSUIPlugin;
import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -31,6 +32,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.Set;
import java.util.UUID;
public final class WESelectionListener implements Listener {
@@ -78,7 +80,8 @@ public final class WESelectionListener implements Listener {
final String type = item.getType().name();
if (!type.endsWith("_AXE") || !type.contains("WOOD")) return;
}
plugin.getUserManager().getExpireTimestamps().put(player.getUniqueId(), System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
plugin.getUserManager().getUser(player).setExpireTimestamp(System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
}
@Subscribe
@@ -89,10 +92,13 @@ public final class WESelectionListener implements Listener {
while (!arguments.isEmpty() && arguments.charAt(0) == '/') {
arguments = arguments.substring(1);
}
if (arguments.isEmpty()) return;
final String command = arguments.split(" ", 2)[0].toLowerCase();
final String command = arguments.split(" ", 2)[0].toLowerCase(Locale.ROOT);
if (weCommands.stream().noneMatch(command::equals)) return;
plugin.getUserManager().getExpireTimestamps().put(event.getActor().getUniqueId(), System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
final UUID uuid = event.getActor().getUniqueId();
plugin.getUserManager().getUser(uuid).setExpireTimestamp(System.currentTimeMillis() + plugin.getSettings().getExpiresAfterMillis());
}
}
@@ -1,255 +0,0 @@
package eu.kennytv.worldeditsui.metrics;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.ServicePriority;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
/**
* bStats collects some data for plugin authors.
* <p>
* Check out https://bStats.org/ to learn more about bStats!
*/
public final class MetricsLite {
public static final int B_STATS_VERSION = 1;
private static final String URL = "https://bStats.org/submitData/bukkit";
private final boolean enabled;
private static boolean logFailedRequests;
private static boolean logSentData;
private static boolean logResponseStatusText;
private static String serverUUID;
private final Plugin plugin;
public MetricsLite(final Plugin plugin) {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null!");
}
this.plugin = plugin;
final File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
final File configFile = new File(bStatsFolder, "config.yml");
final YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
if (!config.isSet("serverUuid")) {
config.addDefault("enabled", true);
config.addDefault("serverUuid", UUID.randomUUID().toString());
config.addDefault("logFailedRequests", false);
config.addDefault("logSentData", false);
config.addDefault("logResponseStatusText", false);
config.options().header(
"bStats collects some data for plugin authors like how many servers are using their plugins.\n" +
"To honor their work, you should not disable it.\n" +
"This has nearly no effect on the server performance!\n" +
"Check out https://bStats.org/ to learn more :)"
).copyDefaults(true);
try {
config.save(configFile);
} catch (final IOException ignored) {
}
}
serverUUID = config.getString("serverUuid");
logFailedRequests = config.getBoolean("logFailedRequests", false);
enabled = config.getBoolean("enabled", true);
logSentData = config.getBoolean("logSentData", false);
logResponseStatusText = config.getBoolean("logResponseStatusText", false);
if (enabled) {
boolean found = false;
for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION");
found = true;
break;
} catch (final NoSuchFieldException ignored) {
}
}
Bukkit.getServicesManager().register(MetricsLite.class, this, plugin, ServicePriority.Normal);
if (!found) {
startSubmitting();
}
}
}
public boolean isEnabled() {
return enabled;
}
private void startSubmitting() {
final Timer timer = new Timer(true);
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if (!plugin.isEnabled()) { // Plugin was disabled
timer.cancel();
return;
}
Bukkit.getScheduler().runTask(plugin, () -> submitData());
}
}, 1000 * 60 * 5, 1000 * 60 * 30);
}
public JsonObject getPluginData() {
final JsonObject data = new JsonObject();
final String pluginName = plugin.getDescription().getName();
final String pluginVersion = plugin.getDescription().getVersion();
data.addProperty("pluginName", pluginName);
data.addProperty("pluginVersion", pluginVersion);
data.add("customCharts", new JsonArray());
return data;
}
private JsonObject getServerData() {
final int playerAmount = Bukkit.getOnlinePlayers().size();
final int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
final String bukkitVersion = Bukkit.getVersion();
final String bukkitName = Bukkit.getName();
final String javaVersion = System.getProperty("java.version");
final String osName = System.getProperty("os.name");
final String osArch = System.getProperty("os.arch");
final String osVersion = System.getProperty("os.version");
final int coreCount = Runtime.getRuntime().availableProcessors();
final JsonObject data = new JsonObject();
data.addProperty("serverUUID", serverUUID);
data.addProperty("playerAmount", playerAmount);
data.addProperty("onlineMode", onlineMode);
data.addProperty("bukkitVersion", bukkitVersion);
data.addProperty("bukkitName", bukkitName);
data.addProperty("javaVersion", javaVersion);
data.addProperty("osName", osName);
data.addProperty("osArch", osArch);
data.addProperty("osVersion", osVersion);
data.addProperty("coreCount", coreCount);
return data;
}
private void submitData() {
final JsonObject data = getServerData();
final JsonArray pluginData = new JsonArray();
for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION");
for (final RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) {
try {
final Object plugin = provider.getService().getMethod("getPluginData").invoke(provider.getProvider());
if (plugin instanceof JsonObject) {
pluginData.add((JsonObject) plugin);
} else {
try {
final Class<?> jsonObjectJsonSimple = Class.forName("org.json.simple.JSONObject");
if (plugin.getClass().isAssignableFrom(jsonObjectJsonSimple)) {
final Method jsonStringGetter = jsonObjectJsonSimple.getDeclaredMethod("toJSONString");
jsonStringGetter.setAccessible(true);
final String jsonString = (String) jsonStringGetter.invoke(plugin);
final JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject();
pluginData.add(object);
}
} catch (final ClassNotFoundException e) {
if (logFailedRequests) {
this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception ", e);
}
}
}
} catch (final NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
}
}
} catch (final NoSuchFieldException ignored) {
}
}
data.add("plugins", pluginData);
new Thread(() -> {
try {
sendData(plugin, data);
} catch (final Exception e) {
if (logFailedRequests) {
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
}
}
}).start();
}
private static void sendData(final Plugin plugin, final JsonObject data) throws Exception {
if (data == null) {
throw new IllegalArgumentException("Data cannot be null!");
}
if (Bukkit.isPrimaryThread()) {
throw new IllegalAccessException("This method must not be called from the main thread!");
}
if (logSentData) {
plugin.getLogger().info("Sending data to bStats: " + data);
}
final HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
final byte[] compressedData = compress(data.toString());
connection.setRequestMethod("POST");
connection.addRequestProperty("Accept", "application/json");
connection.addRequestProperty("Connection", "close");
connection.addRequestProperty("Content-Encoding", "gzip");
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
connection.setDoOutput(true);
final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.write(compressedData);
outputStream.flush();
outputStream.close();
if (logResponseStatusText) {
final InputStream inputStream = connection.getInputStream();
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
final StringBuilder builder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
builder.append(line);
}
bufferedReader.close();
plugin.getLogger().info("Sent data to bStats and received response: " + builder);
} else {
connection.getInputStream().close();
}
}
private static byte[] compress(final String str) throws IOException {
if (str == null) {
return null;
}
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
gzip.write(str.getBytes(StandardCharsets.UTF_8));
gzip.close();
return outputStream.toByteArray();
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,15 +18,15 @@
package eu.kennytv.worldeditsui.user;
import eu.kennytv.worldeditsui.compat.SelectionType;
import eu.kennytv.worldeditsui.compat.SimpleVector;
import eu.kennytv.worldeditsui.util.SelectionType;
import java.util.ArrayList;
import java.util.List;
public final class SelectionCache {
private final List<SimpleVector> vectors = new ArrayList<>();
private List<SimpleVector> vectors = new ArrayList<>();
private SelectionType selectionType = SelectionType.NONE;
private SimpleVector minimum;
private SimpleVector maximum;
@@ -35,6 +35,10 @@ public final class SelectionCache {
return vectors;
}
public void clear() {
vectors = new ArrayList<>();
}
public SelectionType getSelectionType() {
return selectionType;
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,17 +18,32 @@
package eu.kennytv.worldeditsui.user;
import eu.kennytv.worldeditsui.compat.ProtectedRegionWrapper;
import eu.kennytv.worldeditsui.drawer.base.DrawedType;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public final class User {
private final UUID uuid;
private SelectionCache selectionCache;
private SelectionCache selectedWGRegionCache;
private ProtectedRegionWrapper selectedWGRegion;
private boolean selectionShown;
private boolean clipboardShown;
private long expireTimestamp = -1;
User(final boolean selectionShown, final boolean clipboardShown) {
User(final UUID uuid, final boolean selectionShown, final boolean clipboardShown) {
this.uuid = uuid;
this.selectionShown = selectionShown;
this.clipboardShown = clipboardShown;
}
public UUID getUuid() {
return uuid;
}
public boolean isSelectionShown() {
return selectionShown;
}
@@ -45,11 +60,72 @@ public final class User {
this.clipboardShown = clipboardShown;
}
/**
* @return time at which the selection will expire, 0 if no longer shown, -1 if disabled
*/
public long getExpireTimestamp() {
return expireTimestamp;
}
public void setExpireTimestamp(final long expireTimestamp) {
this.expireTimestamp = expireTimestamp;
}
@Nullable
public SelectionCache getSelectionCache() {
return selectionCache;
}
public void setSelectionCache(final SelectionCache selectionCache) {
this.selectionCache = selectionCache;
@Nullable
public SelectionCache getSelectionCache(final DrawedType drawedType) {
switch (drawedType) {
case SELECTED:
return selectionCache;
case WG_REGION:
return selectedWGRegionCache;
default:
throw new IllegalArgumentException("Only allowed types are SELECTED and WG_REGION");
}
}
public void setSelectionCache(final DrawedType drawedType, @Nullable final SelectionCache selectionCache) {
switch (drawedType) {
case SELECTED:
this.selectionCache = selectionCache;
break;
case WG_REGION:
this.selectedWGRegionCache = selectionCache;
break;
default:
throw new IllegalArgumentException("Only allowed types are SELECTED and WG_REGION");
}
}
@Nullable
public ProtectedRegionWrapper getSelectedWGRegion() {
return selectedWGRegion;
}
public void setSelectedWGRegion(@Nullable final ProtectedRegionWrapper selectedWGRegion) {
this.selectedWGRegion = selectedWGRegion;
}
public void clearCaches() {
if (selectionCache != null) {
selectionCache.clear();
selectionCache = null;
}
if (selectedWGRegionCache != null) {
selectedWGRegionCache.clear();
selectedWGRegionCache = null;
}
}
public void clearCache(final DrawedType drawedType) {
final SelectionCache oldCache = getSelectionCache(drawedType);
if (oldCache != null) {
oldCache.clear();
setSelectionCache(drawedType, null);
}
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,13 +28,16 @@ import java.util.UUID;
public final class UserManager {
private final Map<UUID, User> users = new HashMap<>();
private final Map<UUID, Long> expireTimestamps = new HashMap<>();
private final Settings settings;
public UserManager(final Settings settings) {
this.settings = settings;
}
public User getUser(final UUID uuid) {
return users.get(uuid);
}
public User getUser(final Player player) {
return users.get(player.getUniqueId());
}
@@ -50,22 +53,17 @@ public final class UserManager {
selection = settings.showByDefault();
clipboard = settings.showClipboardByDefault();
}
users.put(player.getUniqueId(), new User(selection, clipboard));
users.put(player.getUniqueId(), new User(player.getUniqueId(), selection, clipboard));
}
public void deleteUser(final Player player) {
expireTimestamps.remove(player.getUniqueId());
final User remove = users.remove(player.getUniqueId());
final SelectionCache cache = remove.getSelectionCache();
if (cache != null)
cache.getVectors().clear();
final User removedUser = users.remove(player.getUniqueId());
if (removedUser != null) {
removedUser.clearCaches();
}
}
public Map<UUID, User> getUsers() {
return users;
}
public Map<UUID, Long> getExpireTimestamps() {
return expireTimestamps;
}
}
@@ -0,0 +1,24 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.util;
public interface Cancellable {
void cancel();
}
@@ -0,0 +1,34 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.util;
import org.bukkit.scheduler.BukkitTask;
public final class CancellableBukkitTask implements Cancellable {
private final BukkitTask task;
public CancellableBukkitTask(final BukkitTask task) {
this.task = task;
}
@Override
public void cancel() {
task.cancel();
}
}
@@ -0,0 +1,34 @@
/*
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.util;
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
public final class CancellableScheduledTask implements Cancellable {
private final ScheduledTask task;
public CancellableScheduledTask(final ScheduledTask task) {
this.task = task;
}
@Override
public void cancel() {
task.cancel();
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditCUI - https://git.io/wecui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,27 +25,35 @@ import org.bukkit.Particle;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.Nullable;
public final class ParticleData {
private final Particle particle;
private final int radiusSquared;
private final double speed;
private final double offX;
private final double offY;
private final double offZ;
private final Object data;
public ParticleData(final Particle particle, final Object data) {
public ParticleData(final Particle particle, final int radius) {
this(particle, radius, 0, 0, 0, 0, null);
}
public ParticleData(final Particle particle, final int radius, final double speed,
final double offX, final double offY, final double offZ, @Nullable final Object data) {
this.particle = particle;
this.radiusSquared = radius * radius;
this.data = data;
}
public Particle getParticle() {
return particle;
}
public Object getData() {
return data;
this.speed = speed;
this.offX = offX;
this.offY = offY;
this.offZ = offZ;
}
//TODO proper error handling/warnings
public static Object getExtraData(final Particle particle, final ConfigurationSection section) throws Exception {
public static Object getExtraData(final Particle particle, final ConfigurationSection section) {
final Class<?> dataType = particle.getDataType();
if (dataType == null || dataType == Void.class) return null;
@@ -53,7 +61,7 @@ public final class ParticleData {
final String name = dataType.getSimpleName();
// they might exist, they might not ¯\_(ツ)_/¯
// also it's only executed when (re)loading the config, so I think I might just get away with this method (prolly not worth doing extra modules for this)
// also it's only executed when (re)loading the config, so I might just get away with this method (not worth doing extra modules for this)
if (name.equals("DustOptions")) {
final float size = (float) section.getDouble("size");
final Color color = section.contains("rgb") ? Color.fromRGB(section.getInt("rgb"))
@@ -74,4 +82,33 @@ public final class ParticleData {
throw new IllegalArgumentException("The datatype " + name + " is not yet supported by the plugin - please report this error!");
}
public Particle getParticle() {
return particle;
}
public int radiusSquared() {
return radiusSquared;
}
public double speed() {
return speed;
}
public double offX() {
return offX;
}
public double offY() {
return offY;
}
public double offZ() {
return offZ;
}
@Nullable
public Object getData() {
return data;
}
}
@@ -1,6 +1,6 @@
/*
* WorldEditCUI - https://git.io/wecui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
* This file is part of WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018-2021 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,53 +18,43 @@
package eu.kennytv.worldeditsui.util;
import eu.kennytv.worldeditsui.Settings;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public final class ParticleHelper {
/**
* Only players with this permission can see another player's particles.
*/
private String permission;
private final Settings settings;
public void playEffect(final ParticleData particle, final Location location, final float speed, final int amount, final int radius, final Player player) {
playEffect(particle, location, 0, 0, 0, speed, amount, radius, player);
public ParticleHelper(final Settings settings) {
this.settings = settings;
}
public void playEffect(final ParticleData particle, final Location location, final float offX, final float offY, final float offZ, final float speed, final int amount, final int radius, final Player player) {
public void playEffect(final ParticleData particle, final Location location, final Player player) {
if (!location.getWorld().equals(player.getWorld())) return;
final int radiusSquared = radius * radius;
if (player.getLocation().distanceSquared(location) > radiusSquared) return;
if (player.getLocation().distanceSquared(location) > particle.radiusSquared()) return;
player.spawnParticle(particle.getParticle(), location, amount, offX, offY, offZ, speed, particle.getData());
player.spawnParticle(particle.getParticle(), location, 1,
particle.offX(), particle.offY(), particle.offZ(), particle.speed(), particle.getData());
}
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final float speed, final int amount, final int radius, final Player origin) {
playEffectToAll(particle, othersParticle, location, 0, 0, 0, speed, amount, radius, origin);
}
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final float offX, final float offY, final float offZ, final float speed, final int amount, final int radius, final Player origin) {
final int radiusSquared = radius * radius;
public void playEffectToAll(final ParticleData particle, final ParticleData othersParticle, final Location location, final Player origin) {
for (final Player player : Bukkit.getOnlinePlayers()) {
if (!location.getWorld().equals(player.getWorld())
|| player.getLocation().distanceSquared(location) > radiusSquared) continue;
|| player.getLocation().distanceSquared(location) > particle.radiusSquared()) continue;
final boolean originalPlayer = player.getUniqueId().equals(origin.getUniqueId());
if (!originalPlayer && !canSeeOtherParticles(player)) continue;
final ParticleData toSend = originalPlayer ? particle : othersParticle;
player.spawnParticle(toSend.getParticle(), location, amount, offX, offY, offZ, speed, toSend.getData());
player.spawnParticle(toSend.getParticle(), location, 1,
particle.offX(), particle.offY(), particle.offZ(), particle.speed(), toSend.getData());
}
}
public void setPermission(final String permission) {
this.permission = permission;
}
private boolean canSeeOtherParticles(final Player player) {
return permission == null || player.hasPermission(permission);
return settings.getOtherParticlesPermission() == null || player.hasPermission(settings.getOtherParticlesPermission());
}
}
@@ -1,87 +0,0 @@
/*
* WorldEditSUI - https://git.io/wesui
* Copyright (C) 2018 KennyTV (https://github.com/KennyTV)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.worldeditsui.util;
public final class Version implements Comparable<Version> {
private final int[] parts;
private final String version;
private final String tag;
public Version(final String version) {
if (version == null || version.isEmpty()) {
this.version = "";
tag = "";
parts = new int[0];
return;
}
final String[] split = version.split("-", 2)[0].split("\\.");
parts = new int[split.length];
for (int i = 0; i < split.length; i++) {
if (!split[i].matches("[0-9]+")) {
this.version = "";
tag = "";
return;
}
parts[i] = Integer.parseInt(split[i]);
}
this.version = version;
tag = version.contains("-") ? version.split("-", 2)[1] : "";
}
/**
* Compare two versions.
*
* @param version version to compare to
* @return 0 if they are the same, 1 if this instance is newer, -1 if older
*/
@Override
public int compareTo(final Version version) {
if (version == null || version.toString() == null) return 0;
final int max = Math.max(this.parts.length, version.parts.length);
for (int i = 0; i < max; i++) {
final int partA = i < this.parts.length ? this.parts[i] : 0;
final int partB = i < version.parts.length ? version.parts[i] : 0;
if (partA < partB) return -1;
if (partA > partB) return 1;
}
if (this.tag.isEmpty() && !version.tag.isEmpty())
return 1;
if (!this.tag.isEmpty() && version.tag.isEmpty())
return -1;
return 0;
}
public String getTag() {
return tag;
}
@Override
public String toString() {
return version;
}
@Override
public boolean equals(final Object o) {
if (o == null) return false;
return o instanceof Version && o == this || version.equals(o.toString());
}
}
+31 -14
View File
@@ -1,4 +1,4 @@
# WorldEditSUI Plugin by KennyTV
# WorldEditSUI Plugin by kennytv
# If enabled, the positions for particles will only be calculated once per selection and then cached.
# This essentially entirely removes the higher CPU usage of the calculations, but results in some caching if many/big selections are being made.
@@ -12,25 +12,39 @@ cache-calculated-positions: true
#
# If you want to use a particle that requires extra data (REDSTONE, FALLING_DUST, BLOCK_DUST, BLOCK_CRACK, ITEM_CRACK),
# you can read up on how to do that at the bottom of the plugin's Spigot page.
# The same applies to per-particle view-distance, speed, and offsets.
particle: FLAME
# Shown for the clipboard (after using WorldEdit's //copy command).
# Can be enabled with the '/wesui toggleclipboard' command.
clipboard-particle: VILLAGER_HAPPY
clipboard-particle: END_ROD
# Shown for the WG region view (when using '/wesui showregion <region>').
wg-region-particle: END_ROD
# How many particles should be displayed for every block of length.
# The recommended amount is between 2 and 4. Can be set from 1 to 5.
particles-per-block: 3
particles-per-block: 2
# This number determines how many ticks should be between every sending of particles.
# Can be set from 5 to 200.
# For reference: 20 Minecraft ticks are equivalent to 1 second -> 10 ticks are 0.5 seconds -> 1 tick is 0.05 seconds.
particle-send-interval: 12
# Max ping a player can have before particles are no longer sent - this option only works on Paper servers.
# Set this to -1 to disable.
max-ping: 250
# Selecting giant areas may result in a high cpu usage or server lag.
# This limits the maximum number of blocks that can be displayed (default is 10 million, ~250*150*250 blocks).
# You could still go even higher if they can only be used by trusted people.
max-selection-size-to-display: 10_000_000
# If set to true, players with the 'wesui.maxselectionsize.bypass' permission ignore the limit from above.
enable-max-selection-bypass-perm: false
advanced-grid:
# If enabled, the selection will not only be displayed by the outline,
# but also with a grid between the outlines (the bigger the selection, the bigger the grid).
# Requires more or less 2 to 3 times the amount of calculations, but looks amazing!
enabled: false
enabled: true
# How many particles should be displayed for every block of length.
# The recommended amount is between 2 and 3. Can be set from 2 to 5.
particles-per-block: 2
@@ -38,15 +52,21 @@ advanced-grid:
advanced-clipboard-grid:
# You can also enable the grid for the clipboard view.
# Same as advanced-grid settings, but for the clipboard.
enabled: false
enabled: true
particles-per-block: 2
advanced-wg-region-grid:
# You can also enable the grid for the WG region view by using the '/wesui showregion <region>' command.
# Same as advanced-grid settings, but for the WorldGuard regions.
enabled: true
particles-per-block: 2
particle-expiry:
# If enabled and a selection isn't changed for the given amount of seconds, particles will stop being sent for it
enabled: false
expires-after-seconds: 180
enabled: true
expires-after-seconds: 250
# If enabled, players are notified if their particles disappear after the expiry.
expire-message: true
expire-message: false
# If set to 'none', every player will have their selection displayed.
# Else, only players with the set permission will have particles for their selection.
@@ -61,7 +81,7 @@ send-particles-to-all:
view-others-particles-perm: "none"
# If you want people to see different particles for another player's selections, you can set them here.
others-particle: FLAME
others-clipboard-particle: VILLAGER_HAPPY
others-clipboard-particle: END_ROD
# If set to false, players will have to use '/wesui toggle' first to be able to see the particles.
show-selection-by-default: true
@@ -70,11 +90,8 @@ show-clipboard-by-default: false
# Saves toggles to a file, so that they stay changed after player quits and server restarts.
# This also includes the clipboard toggle.
persistent-toggles: false
persistent-toggles: true
# Changes the distance from which particles can be seen, can be set from 1 to 500 (if you for some reason want to see them 500 blocks away).
# This does NOT affect server performance in any way.
particle-viewdistance: 99
# Recommended to have this enabled, as you'd else miss out on new features and overall improvements.
update-checks: true
particle-viewdistance: 250
@@ -1,4 +1,4 @@
prefix: "&8[&eWorldEditSUI&8]"
prefix: "&7[&eWorldEditSUI&7]"
noPermission: "%prefix% &cYou don't have the permission to use this command."
particlesShown: "%prefix% &aParticles of your selection are now shown!"
@@ -7,8 +7,13 @@ clipboardShown: "%prefix% &aParticles of your clipboard are now shown!"
clipboardHidden: "%prefix% &cParticles of your clipboard are now hidden!"
reload: "%prefix% &aReloaded config and language file!"
idled: "%prefix% &7The selection particles are no longer displayed. Update your selection to display them again."
WGNotEnabled: "%prefix% &cThis command requires WorldGuard to be present."
regionNotFound: "%prefix% &cThere is no region with that name!"
regionDisplayed: "%prefix% &aThe selected region will now be displayed. Use &e/wesui showregion &ato turn it off again."
regionCleared: "%prefix% &7The WG region is no longer displayed."
helpHeader: "&8===========[ &eWorldEditSUI &8]==========="
helpReload: "&6/wesui reload &7(Reloads the config file)"
helpToggle: "&6/wesui toggle &7(Toggles the visibility of your selection-particles)"
helpToggleClipboard: "&6/wesui toggleclipboard &7(Toggles the visibility of your clipboard-particles)"
helpShowRegion: "&6/wesui showgregion <WG region> §7(Outlines the given WorldGuard region)"
+7 -4
View File
@@ -1,12 +1,15 @@
name: ${project.name}
version: ${project.version}
name: WorldEditSUI
version: '${version}'
main: eu.kennytv.worldeditsui.WorldEditSUIPlugin
authors: [KennyTV]
authors: [kennytv]
depend: [WorldEdit]
softdepend: [WorldGuard]
website: https://www.spigotmc.org/resources/worldeditsui.60726/
api-version: 1.13
folia-supported: false
commands:
worldeditsui:
description: WorldEditSUI main command.
aliases: [wesui, wecui] # keep wecui alias for legacy reasons
aliases: [wesui]
permission: wesui.command