Update gradle to 8.14.3, add formatting

This commit is contained in:
NotAlexNoyle committed 2025-08-17 21:52:27 -04:00
1 parent 0a18ab3c82
commit 24882ca79b
38 files changed
+3152 -2374

No files matched your search

+3 -3
View File
@@ -1,9 +1,9 @@
[submodule "libs/Utilities-OG"]
path = libs/Utilities-OG
url = https://github.com/true-og/Utilities-OG
[submodule "libs/DiamondBank-OG"]
path = libs/DiamondBank-OG
url = https://github.com/true-og/DiamondBank-OG
[submodule "libs/GxUI-OG"]
path = libs/GxUI-OG
url = https://github.com/true-og/GxUI-OG
[submodule "libs/DiamondBank-OG"]
path = libs/DiamondBank-OG
url = https://github.com/NotAlexNoyle/DiamondBank-OG
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/bash
# Fetch all submodule content.
git submodule update --force --recursive --init --remote
git submodule update --force --recursive --init
+88 -57
View File
@@ -1,99 +1,130 @@
/* ------------------------------ Plugins ------------------------------ */
plugins {
id("com.gradleup.shadow") version "8.3.6" // Import shadow API.
java // Tell gradle this is a java project.
eclipse // Import eclipse plugin for IDE integration.
kotlin("jvm") version "2.1.21" // Import kotlin jvm plugin for kotlin/java integration.
id("java") // Import Java plugin.
id("java-library") // Import Java Library plugin.
id("com.diffplug.spotless") version "7.0.4" // Import Spotless plugin.
id("com.gradleup.shadow") version "8.3.6" // Import Shadow plugin.
id("checkstyle") // Import Checkstyle plugin.
eclipse // Import Eclipse plugin.
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
}
extra["kotlinAttribute"] = Attribute.of("kotlin-tag", Boolean::class.javaObjectType)
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
/* --------------------------- JDK / Kotlin ---------------------------- */
java {
// Declare java version.
sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
toolchain { // Select Java toolchain.
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
}
}
kotlin { jvmToolchain(17) }
/* ----------------------------- Metadata ------------------------------ */
group = "net.trueog.splegg-og" // Declare bundle identifier.
version = "0.7" // Declare plugin version (will be in .jar).
val apiVersion = "1.19" // Declare minecraft server target version.
/* ----------------------------- Resources ----------------------------- */
tasks.named<ProcessResources>("processResources") {
val props = mapOf(
"version" to version,
"apiVersion" to apiVersion
)
val props = mapOf("version" to version, "apiVersion" to apiVersion)
inputs.properties(props) // Indicates to rerun if version changes.
filesMatching("plugin.yml") {
expand(props)
}
from("LICENSE") { // Bundle license into .jars.
into("/")
}
filesMatching("plugin.yml") { expand(props) }
from("LICENSE") { into("/") } // Bundle licenses into jarfiles.
}
/* ---------------------------- Repos ---------------------------------- */
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url = uri("https://repo.purpurmc.org/snapshots")
}
maven {
url = uri("https://jitpack.io") // Jitpack for Vault API.
}
maven {
url = uri("https://papermc.io/repo/repository/maven-public/") // Paper repository for EssentialsX API.
}
maven {
url = uri("https://repo.essentialsx.net/releases/") // EssentialsX API repository.
}
maven {
url = uri("https://maven.enginehub.org/repo") // WorldEdit API repository.
}
mavenCentral() // Import the Maven Central Maven Repository.
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
maven { url = uri("https://jitpack.io") } // Import the Jitpack Maven Repository.
maven { url = uri("https://papermc.io/repo/repository/maven-public/") } // Import the Paper Maven Repository.
maven { url = uri("https://repo.essentialsx.net/releases/") } // Import the EssentialsX Maven Repository.
maven { url = uri("https://maven.enginehub.org/repo") } // Import the WorldEdit Maven Repository.
}
/* ---------------------- Java project deps ---------------------------- */
dependencies {
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare purpur API version to be packaged.
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur API version to be packaged.
compileOnly("io.github.miniplaceholders:miniplaceholders-api:2.2.3") // Import MiniPlaceholders API.
compileOnly("com.github.MilkBowl:VaultAPI:1.7") // Import Vault API.
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT") // Import WorldEdit API.
implementation("net.essentialsx:EssentialsX:2.20.1") // Import EssentialsX API.
compileOnly(project(":libs:Utilities-OG"))
compileOnly(project(":libs:GxUI-OG"))
compileOnly(project(":libs:DiamondBank-OG"))
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
compileOnlyApi(project(":libs:GxUI-OG")) // Import TrueOG Network GxUI-OG Java API (from source).
compileOnlyApi(project(":libs:DiamondBank-OG")) {
attributes { attribute(kotlinAttribute, true) }
} // Import TrueOG network DiamondBank-OG Kotlin API (from source).
}
apply(from = "eclipse.gradle.kts") // Import eclipse classpath support script.
/* ---------------------- Reproducible jars ---------------------------- */
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
/* ----------------------------- Shadow -------------------------------- */
tasks.shadowJar {
exclude("io.github.miniplaceholders.*") // Exclude the MiniPlaceholders package from being shadowed.
archiveClassifier.set("") // Use empty string instead of null.
minimize()
}
tasks.build {
dependsOn(tasks.shadowJar)
}
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
tasks.jar {
archiveClassifier.set("part")
}
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar) } // Build depends on spotless and shadow.
/* --------------------------- Javac opts ------------------------------- */
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters")
options.compilerArgs.add("-Xlint:deprecation") // Triggers deprecation warning messages.
options.encoding = "UTF-8"
options.isFork = true
options.compilerArgs.add("-parameters") // Enable reflection for java code.
options.isFork = true // Run javac in its own process.
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
options.encoding = "UTF-8" // Use UTF-8 file encoding.
}
kotlin {
jvmToolchain(17)
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.GRAAL_VM
/* ----------------------------- Auto Formatting ------------------------ */
spotless {
java {
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
removeUnusedImports() // Remove imports that aren't being called.
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
}
}
checkstyle {
toolVersion = "10.18.1" // Declare checkstyle version to use.
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
}
tasks.named("compileJava") {
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
}
tasks.named("spotlessCheck") {
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
}
/* ------------------------------ Eclipse SHIM ------------------------- */
// This can't be put in eclipse.gradle.kts because Gradle is weird.
subprojects {
apply(plugin = "java-library")
apply(plugin = "eclipse")
eclipse.project.name = "${project.name}-${rootProject.name}"
tasks.withType<Jar>().configureEach { archiveBaseName.set("${project.name}-${rootProject.name}") }
}
+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>
+151
View File
@@ -0,0 +1,151 @@
/* This is free and unencumbered software released into the public domain */
import org.gradle.plugins.ide.eclipse.model.EclipseModel
import java.nio.file.Files
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.transform.OutputKeys
import javax.xml.transform.TransformerFactory
import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
val kotlinPluginProjects = configurations
.getByName("compileClasspath")
.allDependencies
.filterIsInstance<ProjectDependency>()
.filter { it -> it.attributes.getAttribute(kotlinAttribute) != null }
.map { it.path }
kotlinPluginProjects.forEach { evaluationDependsOn(it) }
val ideLibs: Configuration by
configurations.creating {
isCanBeResolved = true
isCanBeConsumed = false
}
configure<EclipseModel> {
project {
name = "Splegg-OG-Plugin"
}
classpath {
plusConfigurations.add(ideLibs)
}
}
val ideLibDir = layout.buildDirectory.dir("ide-libs")
val hashRegex = Regex("-[0-9a-fA-F]{10}(?=\\.jar$)") // Black magic.
val copyTasks = mutableListOf<TaskProvider<Copy>>()
kotlinPluginProjects.forEach { path ->
val sub = project(path)
val shadowJarProv = sub.tasks.named("shadowJar")
val copyTask =
tasks.register<Copy>("ideCopy${sub.name.replaceFirstChar(Char::titlecase)}") {
dependsOn(shadowJarProv)
from(shadowJarProv)
into(ideLibDir)
rename { it.replace(hashRegex, "") } // Remove git commit hash from jarfile.
}
copyTasks += copyTask
}
/* Ensure the jars exist before .classpath is generated */
tasks.named("eclipseClasspath").configure { dependsOn(copyTasks) }
/* Supply those jars to the ideLibs configuration (after evaluation) */
afterEvaluate { dependencies { add("ideLibs", fileTree(ideLibDir) { include("*.jar") }) } }
val injectIdeLibs =
tasks.register("injectIdeLibs") {
dependsOn("eclipse") // run after all eclipse files are generated
doLast {
val cpFile = file(".classpath")
if (!cpFile.exists()) return@doLast
val jars = fileTree(ideLibDir.get()) { include("*.jar") }.files.sortedBy { it.name }
if (jars.isEmpty()) return@doLast
// Parse DOM
val dbf = DocumentBuilderFactory.newInstance()
val doc = dbf.newDocumentBuilder().parse(cpFile)
val root = doc.documentElement
// Helper to see if an entry already exists
fun exists(path: String): Boolean =
root.getElementsByTagName("classpathentry").let { list ->
(0 until list.length).any { i ->
val n = list.item(i)
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
val p = n.attributes?.getNamedItem("path")?.nodeValue
kind == "lib" && p == path
}
}
// Remove any entry that points to ide-libs dir (folder or jars) to avoid dupes
val toRemove = mutableListOf<org.w3c.dom.Node>()
val list = root.getElementsByTagName("classpathentry")
val dirPath = ideLibDir.get().asFile.absolutePath
for (i in 0 until list.length) {
val n = list.item(i)
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
val p = n.attributes?.getNamedItem("path")?.nodeValue ?: ""
if (kind == "lib" && (p == dirPath || p.startsWith("$dirPath/"))) {
toRemove += n
}
}
toRemove.forEach { root.removeChild(it) }
// Append our jar entries LAST
jars.forEach { f ->
val abs = f.absolutePath
if (!exists(abs)) {
val entry = doc.createElement("classpathentry")
entry.setAttribute("kind", "lib")
entry.setAttribute("path", abs)
root.appendChild(entry)
}
}
// Write back pretty
val tf =
TransformerFactory.newInstance().newTransformer().apply {
setOutputProperty(OutputKeys.INDENT, "yes")
setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1")
setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no")
setOutputProperty(OutputKeys.ENCODING, "UTF-8")
}
Files.newBufferedWriter(cpFile.toPath()).use { w -> tf.transform(DOMSource(doc), StreamResult(w)) }
}
}
tasks.named("eclipse").configure { finalizedBy(injectIdeLibs) }
val eclipseModel = extensions.getByType<EclipseModel>()
fun Project.addResolvableEclipseConfigs() {
val jarAttr =
objects.named(org.gradle.api.attributes.LibraryElements::class, org.gradle.api.attributes.LibraryElements.JAR)
val apiAttr = objects.named(org.gradle.api.attributes.Usage::class, org.gradle.api.attributes.Usage.JAVA_API)
val compileOnlyRes =
configurations.create("eclipseCompileOnly") {
extendsFrom(configurations.getByName("compileOnly"))
isCanBeResolved = true
isCanBeConsumed = false
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
}
val compileOnlyApiRes =
configurations.create("eclipseCompileOnlyApi") {
extendsFrom(configurations.getByName("compileOnlyApi"))
isCanBeResolved = true
isCanBeConsumed = false
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
}
eclipseModel.classpath.plusConfigurations.addAll(listOf(compileOnlyRes, compileOnlyApiRes))
}
addResolvableEclipseConfigs()
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+6 -4
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -84,7 +86,7 @@ done
# 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
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
@@ -112,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -203,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * 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.
@@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+4 -2
View File
@@ -13,6 +13,8 @@
@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 ##########################################################################
@@ -68,11 +70,11 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%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
+9 -11
View File
@@ -1,15 +1,13 @@
rootProject.name = "Splegg-OG"
// Run the bootstrap at configuration time.
val process = ProcessBuilder("sh", "bootstrap.sh")
.directory(rootDir)
.start()
val exitValue = process.waitFor()
if (exitValue != 0) {
throw GradleException("bootstrap.sh failed with exit code $exitValue")
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
}
include("libs:Utilities-OG")
include("libs:GxUI-OG")
include("libs:DiamondBank-OG")
file("libs")
.listFiles()
?.filter { it.isDirectory && !it.name.startsWith(".") }
?.forEach { dir ->
include(":libs:${dir.name}")
project(":libs:${dir.name}").projectDir = dir
}
+302 -323
View File
@@ -20,558 +20,537 @@ import utils.Utils;
public class SpleggCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String tag, String[] args) {
public boolean onCommand(CommandSender sender, Command cmd, String tag, String[] args) {
if (sender instanceof Player) {
if (sender instanceof Player) {
Player player = (Player) sender;
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Player player = (Player) sender;
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (args.length == 0) {
if (args.length == 0) {
Utils.spleggOGMessage(player, "&aPlugin created by MrLuangamer, updated by Hraponssi, now maintained by NotAlexNoyle for true-og.net. &6For more information: /splegg help");
Utils.spleggOGMessage(player,
"&aPlugin created by MrLuangamer, updated by Hraponssi, now maintained by NotAlexNoyle for true-og.net. &6For more information: /splegg help");
}
else if (args.length == 1) {
} else if (args.length == 1) {
if (args[0].equalsIgnoreCase("join")) {
if (args[0].equalsIgnoreCase("join")) {
if (player.hasPermission("splegg.join")) {
if (player.hasPermission("splegg.join")) {
if (u.getGame() != null && u.isAlive() && u.getGame().getLobbyCount() > 0) {
if (u.getGame() != null && u.isAlive() && u.getGame().getLobbyCount() > 0) {
player.teleport(u.getGame().getMap().getLobby());
player.teleport(u.getGame().getMap().getLobby());
}
else {
} else {
// Test to see if the user entered any text or not. If they didn't, an ArrayIndexOutOfBoundsException is thrown.
try {
// Test to see if the user entered any text or not. If they didn't, an
// ArrayIndexOutOfBoundsException is thrown.
try {
String gameThatWasNotFound = args[1];
String gameThatWasNotFound = args[1];
Utils.spleggOGMessage(player, "&cERROR: Failed to start game: &6" + gameThatWasNotFound + "&c! &eSyntax: /splegg join &6mapname.");
Utils.spleggOGMessage(player, "&cERROR: Failed to start game: &6" + gameThatWasNotFound
+ "&c! &eSyntax: /splegg join &6mapname.");
}
catch(ArrayIndexOutOfBoundsException error) {
} catch (ArrayIndexOutOfBoundsException error) {
Utils.spleggOGMessage(player, "&cERROR: The game to join was unspecified! &6Syntax: &e/splegg join mapname.");
Utils.spleggOGMessage(player,
"&cERROR: The game to join was unspecified! &6Syntax: &e/splegg join mapname.");
}
}
}
}
} else {
}
else {
permissionMessage(player);
permissionMessage(player);
}
}
} else if (args[0].equalsIgnoreCase("leave")) {
}
else if (args[0].equalsIgnoreCase("leave")) {
if (u.getGame() != null && u.isAlive()) {
if (u.getGame() != null && u.isAlive()) {
Game game = u.getGame();
game.leaveGame(u);
Game game = u.getGame();
game.leaveGame(u);
} else {
}
else {
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
}
}
} else if (args[0].equalsIgnoreCase("start")) {
}
else if (args[0].equalsIgnoreCase("start")) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
if (u.getGame() == null) {
if (u.getGame() == null) {
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
}
else if (u.getGame().getStatus() == Status.LOBBY) {
} else if (u.getGame().getStatus() == Status.LOBBY) {
if(u.getGame().getPlayers().size() >= 2) {
if (u.getGame().getPlayers().size() >= 2) {
SpleggOG.getPlugin().game.startGame(u.getGame());
SpleggOG.getPlugin().game.startGame(u.getGame());
Utils.spleggOGMessage(player, "&aGame started!");
Utils.spleggOGMessage(player, "&aGame started!");
}
else {
} else {
Utils.spleggOGMessage(player, "&CERROR: There are not enough players in the lobby to start the game. &6Players required: &e" + u.getGame().getMap().getSpawnCount() + "&6.");
Utils.spleggOGMessage(player,
"&CERROR: There are not enough players in the lobby to start the game. &6Players required: &e"
+ u.getGame().getMap().getSpawnCount() + "&6.");
}
}
}
else if (u.getGame().getStatus() == Status.INGAME) {
} else if (u.getGame().getStatus() == Status.INGAME) {
Utils.spleggOGMessage(player, "&cERROR: The game has already begun!");
Utils.spleggOGMessage(player, "&cERROR: The game has already begun!");
}
}
}
else {
} else {
permissionMessage(player);
permissionMessage(player);
}
}
}
else if (args[0].equalsIgnoreCase("stop")) {
} else if (args[0].equalsIgnoreCase("stop")) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
if (u.getGame() == null) {
if (u.getGame() == null) {
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
}
else if (u.getGame().getStatus() == Status.LOBBY) {
} else if (u.getGame().getStatus() == Status.LOBBY) {
Utils.spleggOGMessage(player, "&cERROR: The game has not begun yet!");
Utils.spleggOGMessage(player, "&cERROR: The game has not begun yet!");
}
else if (u.getGame().getStatus() == Status.INGAME) {
} else if (u.getGame().getStatus() == Status.INGAME) {
SpleggOG.getPlugin().chat.bc("&5" + player.getName() + "&6 has stopped the game.", u.getGame());
SpleggOG.getPlugin().chat.bc("&5" + player.getName() + "&6 has stopped the game.",
u.getGame());
SpleggOG.getPlugin().game.stopGame(u.getGame(), u.getGame().players.size());
SpleggOG.getPlugin().game.stopGame(u.getGame(), u.getGame().players.size());
Utils.spleggOGMessage(player, "&6You have stopped the game.");
Utils.spleggOGMessage(player, "&6You have stopped the game.");
}
}
}
else {
} else {
permissionMessage(player);
permissionMessage(player);
}
}
}
else if (args[0].equalsIgnoreCase("setlobby")) {
} else if (args[0].equalsIgnoreCase("setlobby")) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
SpleggOG.getPlugin().config.setLobby(player.getLocation());
SpleggOG.getPlugin().config.setLobby(player.getLocation());
Utils.spleggOGMessage(player, "&aThe lobby has been set.");
Utils.spleggOGMessage(player, "&aThe lobby has been set.");
}
else {
} else {
permissionMessage(player);
permissionMessage(player);
}
}
}
else if (!args[0].equalsIgnoreCase("")) {
} else if (!args[0].equalsIgnoreCase("")) {
Utils.spleggOGMessage(player, "&cIncorrect Usage! &6Applicable commands are: &e/" + tag + " &6<&ejoin&6, &eleave&6, &ehelp&6>");
Utils.spleggOGMessage(player, "&cIncorrect Usage! &6Applicable commands are: &e/" + tag
+ " &6<&ejoin&6, &eleave&6, &ehelp&6>");
}
}
}
else {
} else {
Map map;
String firstUserCommandArgument;
Game game;
if (args.length == 2 || args.length == 3) {
Map map;
String firstUserCommandArgument;
Game game;
if (args.length == 2 || args.length == 3) {
if (args[0].equalsIgnoreCase("setspawn")) {
if (args[0].equalsIgnoreCase("setspawn")) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
map = SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument);
String secondUserCommandArgumentIsText;
try {
map = SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument);
String secondUserCommandArgumentIsText;
try {
secondUserCommandArgumentIsText = args[2];
if (secondUserCommandArgumentIsText.equalsIgnoreCase("next")) {
secondUserCommandArgumentIsText = args[2];
if (secondUserCommandArgumentIsText.equalsIgnoreCase("next")) {
map.addSpawn(player.getLocation(), SpleggOG.getPlugin().games.getGame(map.getName()));
Utils.spleggOGMessage(player, "&aSpawn &6" + map.getSpawnCount() + " &aset for map: &e" + map.getName() + "&a.");
map.addSpawn(player.getLocation(),
SpleggOG.getPlugin().games.getGame(map.getName()));
Utils.spleggOGMessage(player, "&aSpawn &6" + map.getSpawnCount()
+ " &aset for map: &e" + map.getName() + "&a.");
}
else {
} else {
int secondUserCommandArgumentIsInteger;
try {
int secondUserCommandArgumentIsInteger;
try {
secondUserCommandArgumentIsInteger = Integer.parseInt(args[2]);
if (this.spawnset(secondUserCommandArgumentIsInteger, map)) {
secondUserCommandArgumentIsInteger = Integer.parseInt(args[2]);
if (this.spawnset(secondUserCommandArgumentIsInteger, map)) {
map.setSpawn(map, secondUserCommandArgumentIsInteger, player.getLocation());
map.setSpawn(map, secondUserCommandArgumentIsInteger,
player.getLocation());
Utils.spleggOGMessage(player, "&aThe spawn point &6" + secondUserCommandArgumentIsInteger + " &afor map: &e" + firstUserCommandArgument + "&a has been re-set.");
Utils.spleggOGMessage(player,
"&aThe spawn point &6" + secondUserCommandArgumentIsInteger
+ " &afor map: &e" + firstUserCommandArgument
+ "&a has been re-set.");
}
else {
} else {
Utils.spleggOGMessage(player, "&ERROR: The spawn point: &6" + secondUserCommandArgumentIsInteger + " &cdoes not yet exist for map: &e" + map.getName() + "&c.");
usageMessage(player, tag);
Utils.spleggOGMessage(player, "&ERROR: The spawn point: &6"
+ secondUserCommandArgumentIsInteger
+ " &cdoes not yet exist for map: &e" + map.getName() + "&c.");
usageMessage(player, tag);
}
}
}
catch(Exception error) {
} catch (Exception error) {
usageMessage(player, tag);
usageMessage(player, tag);
}
}
}
}
}
catch(ArrayIndexOutOfBoundsException error) {
} catch (ArrayIndexOutOfBoundsException error) {
map.addSpawn(player.getLocation(), SpleggOG.getPlugin().games.getGame(map.getName()));
Utils.spleggOGMessage(player, "&aThe spawn: &6" + map.getSpawnCount() + " &ahas been set for the map: &e" + map.getName() + "&a.");
map.addSpawn(player.getLocation(),
SpleggOG.getPlugin().games.getGame(map.getName()));
Utils.spleggOGMessage(player, "&aThe spawn: &6" + map.getSpawnCount()
+ " &ahas been set for the map: &e" + map.getName() + "&a.");
}
}
}
else {
} else {
noMapMessage(player, firstUserCommandArgument);
noMapMessage(player, firstUserCommandArgument);
}
}
}
else {
} else {
permissionMessage(player);
permissionMessage(player);
}
}
}
else if (args[0].equalsIgnoreCase("create")) {
} else if (args[0].equalsIgnoreCase("create")) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
Utils.spleggOGMessage(player, "&cERROR: The map: &e" + firstUserCommandArgument + " &calready exists.");
Utils.spleggOGMessage(player,
"&cERROR: The map: &e" + firstUserCommandArgument + " &calready exists.");
}
else {
} else {
SpleggOG.getPlugin().maps.c.addMap(firstUserCommandArgument);
SpleggOG.getPlugin().maps.addMap(firstUserCommandArgument);
SpleggOG.getPlugin().maps.c.addMap(firstUserCommandArgument);
SpleggOG.getPlugin().maps.addMap(firstUserCommandArgument);
map = SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument);
game = new Game(SpleggOG.getPlugin(), map);
game.setStatus(Status.DISABLED);
SpleggOG.getPlugin().games.addGame(map.getName(), game);
map = SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument);
game = new Game(SpleggOG.getPlugin(), map);
game.setStatus(Status.DISABLED);
SpleggOG.getPlugin().games.addGame(map.getName(), game);
Utils.spleggOGMessage(player, "&aThe map: &e" + firstUserCommandArgument + " &ahas been created. It will be &cDISABLED &auntil at least one spawn point and one floor have been added.");
Utils.spleggOGMessage(player, "&aThe map: &e" + firstUserCommandArgument
+ " &ahas been created. It will be &cDISABLED &auntil at least one spawn point and one floor have been added.");
}
}
}
else {
} else {
permissionMessage(player);
permissionMessage(player);
}
}
}
else if (args[0].equalsIgnoreCase("delete")) {
} else if (args[0].equalsIgnoreCase("delete")) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
SpleggOG.getPlugin().maps.deleteMap(firstUserCommandArgument);
SpleggOG.getPlugin().maps.deleteMap(firstUserCommandArgument);
Utils.spleggOGMessage(player, "&aThe map: &e" + firstUserCommandArgument + " &ahas been deleted.");
Utils.spleggOGMessage(player,
"&aThe map: &e" + firstUserCommandArgument + " &ahas been deleted.");
}
else {
} else {
noMapMessage(player, firstUserCommandArgument);
noMapMessage(player, firstUserCommandArgument);
}
}
}
else {
} else {
permissionMessage(player);
permissionMessage(player);
}
}
}
else if(args[0].equalsIgnoreCase("start")) {
} else if (args[0].equalsIgnoreCase("start")) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
game = SpleggOG.getPlugin().games.getGame(firstUserCommandArgument);
if (game == null) {
game = SpleggOG.getPlugin().games.getGame(firstUserCommandArgument);
if (game == null) {
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
}
else if (game.getStatus() == Status.LOBBY) {
} else if (game.getStatus() == Status.LOBBY) {
if(u.getGame().getPlayers().size() >= 2) {
if (u.getGame().getPlayers().size() >= 2) {
Utils.spleggOGMessage(player, "&eStarting Game " + firstUserCommandArgument + "...");
Utils.spleggOGMessage(player,
"&eStarting Game " + firstUserCommandArgument + "...");
SpleggOG.getPlugin().game.startGame(game);
SpleggOG.getPlugin().game.startGame(game);
}
}
}
else if (game.getStatus() == Status.INGAME) {
} else if (game.getStatus() == Status.INGAME) {
// TODO: Change this for spectator mode when it is implemented.
Utils.spleggOGMessage(player, "&cERROR: The game has already begun.");
// TODO: Change this for spectator mode when it is implemented.
Utils.spleggOGMessage(player, "&cERROR: The game has already begun.");
}
}
}
else {
} else {
noMapMessage(player, firstUserCommandArgument);
noMapMessage(player, firstUserCommandArgument);
}
}
}
else {
} else {
permissionMessage(player);
permissionMessage(player);
}
}
else if (args[0].equalsIgnoreCase("stop")) {
}
if (player.hasPermission("splegg.admin")) {
} else if (args[0].equalsIgnoreCase("stop")) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
if (player.hasPermission("splegg.admin")) {
game = SpleggOG.getPlugin().games.getGame(firstUserCommandArgument);
if (game == null) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
game = SpleggOG.getPlugin().games.getGame(firstUserCommandArgument);
if (game == null) {
}
else if (game.getStatus() == Status.LOBBY) {
Utils.spleggOGMessage(player, "&cERROR: You are not in a game!");
Utils.spleggOGMessage(player, "&cERROR: The game has not begun yet!");
} else if (game.getStatus() == Status.LOBBY) {
}
else if (game.getStatus() == Status.INGAME) {
Utils.spleggOGMessage(player, "&cERROR: The game has not begun yet!");
SpleggOG.getPlugin().chat.bc("&5" + player.getName() + "&6 has stopped the game.", game);
} else if (game.getStatus() == Status.INGAME) {
SpleggOG.getPlugin().game.stopGame(game, u.getGame().players.size());
SpleggOG.getPlugin().chat.bc("&5" + player.getName() + "&6 has stopped the game.",
game);
Utils.spleggOGMessage(player, "&6You have stopped the game.");
SpleggOG.getPlugin().game.stopGame(game, u.getGame().players.size());
}
Utils.spleggOGMessage(player, "&6You have stopped the game.");
}
else {
}
noMapMessage(player, firstUserCommandArgument);
} else {
}
noMapMessage(player, firstUserCommandArgument);
}
else {
}
permissionMessage(player);
} else {
}
permissionMessage(player);
}
else if (args[0].equalsIgnoreCase("setlobby")) {
}
if (player.hasPermission("splegg.admin")) {
} else if (args[0].equalsIgnoreCase("setlobby")) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
if (player.hasPermission("splegg.admin")) {
SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument).setLobby(player.getLocation());
Utils.spleggOGMessage(player, "&aThe lobby for map: &e" + firstUserCommandArgument + "&a has been set to: &2" + player.getLocation() + "&a.");
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
}
else {
SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument)
.setLobby(player.getLocation());
Utils.spleggOGMessage(player, "&aThe lobby for map: &e" + firstUserCommandArgument
+ "&a has been set to: &2" + player.getLocation() + "&a.");
noMapMessage(player, firstUserCommandArgument);
} else {
}
noMapMessage(player, firstUserCommandArgument);
}
else {
}
permissionMessage(player);
} else {
}
permissionMessage(player);
}
else if (args[0].equalsIgnoreCase("addfloor")) {
}
if (player.hasPermission("splegg.admin")) {
} else if (args[0].equalsIgnoreCase("addfloor")) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
if (player.hasPermission("splegg.admin")) {
map = SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument);
WorldEditPlugin we = SpleggOG.getPlugin().getWorldEdit();
Region sel = null;
try {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
sel = we.getSession(player).getSelection(new BukkitWorld(player.getWorld()));
map = SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument);
WorldEditPlugin we = SpleggOG.getPlugin().getWorldEdit();
Region sel = null;
try {
}
catch (IncompleteRegionException error) {
sel = we.getSession(player).getSelection(new BukkitWorld(player.getWorld()));
Utils.spleggOGMessage(player, "&cERROR: The area you have selected is incomplete.");
} catch (IncompleteRegionException error) {
}
Utils.spleggOGMessage(player, "&cERROR: The area you have selected is incomplete.");
if (sel == null) {
}
Utils.spleggOGMessage(player, "&4Please select an area with worldedit.");
if (sel == null) {
}
else {
Utils.spleggOGMessage(player, "&4Please select an area with worldedit.");
map.addFloor(new Location(player.getWorld(), sel.getMinimumPoint().x(), sel.getMinimumPoint().y(), sel.getMinimumPoint().z()), new Location(player.getWorld(), sel.getMaximumPoint().x(), sel.getMaximumPoint().y(), sel.getMaximumPoint().z()), SpleggOG.getPlugin().games.getGame(map.getName()));
} else {
Utils.spleggOGMessage(player, "&aFloor &6" + map.getFloors() + " &aadded to map: &e" + map.getName() + "&a.");
map.addFloor(
new Location(player.getWorld(), sel.getMinimumPoint().x(),
sel.getMinimumPoint().y(), sel.getMinimumPoint().z()),
new Location(player.getWorld(), sel.getMaximumPoint().x(),
sel.getMaximumPoint().y(), sel.getMaximumPoint().z()),
SpleggOG.getPlugin().games.getGame(map.getName()));
}
Utils.spleggOGMessage(player, "&aFloor &6" + map.getFloors() + " &aadded to map: &e"
+ map.getName() + "&a.");
}
else {
}
noMapMessage(player, firstUserCommandArgument);
} else {
}
noMapMessage(player, firstUserCommandArgument);
}
else {
}
permissionMessage(player);
} else {
}
permissionMessage(player);
}
else if (args[0].equalsIgnoreCase("join")) {
}
if (player.hasPermission("splegg.join")) {
} else if (args[0].equalsIgnoreCase("join")) {
if (u.getGame() != null) {
if (player.hasPermission("splegg.join")) {
Utils.spleggOGMessage(player, "&cERROR: You are already playing.");
if (u.getGame() != null) {
}
else {
Utils.spleggOGMessage(player, "&cERROR: You are already playing.");
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
} else {
game = SpleggOG.getPlugin().games.getGame(firstUserCommandArgument);
if (game != null && SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument).isUsable(game.getMap())) {
firstUserCommandArgument = args[1];
if (SpleggOG.getPlugin().maps.mapExists(firstUserCommandArgument)) {
game.joinGame(u);
game = SpleggOG.getPlugin().games.getGame(firstUserCommandArgument);
if (game != null && SpleggOG.getPlugin().maps.getMap(firstUserCommandArgument)
.isUsable(game.getMap()))
{
}
else {
game.joinGame(u);
Utils.spleggOGMessage(player, "&cERROR: The map: &e" + firstUserCommandArgument + " &cis incorrectly set up. &6Please read the README.md file for instructions.");
} else {
}
Utils.spleggOGMessage(player, "&cERROR: The map: &e" + firstUserCommandArgument
+ " &cis incorrectly set up. &6Please read the README.md file for instructions.");
}
else {
}
noMapMessage(player, firstUserCommandArgument);
} else {
}
noMapMessage(player, firstUserCommandArgument);
}
}
}
else {
}
permissionMessage(player);
} else {
}
permissionMessage(player);
}
else if (args[0].equalsIgnoreCase("leave")) {
}
Utils.spleggOGMessage(player, "&4Please use &e/" + tag + " leave");
} else if (args[0].equalsIgnoreCase("leave")) {
}
else {
Utils.spleggOGMessage(player, "&4Please use &e/" + tag + " leave");
usageMessage(player, tag);
} else {
}
usageMessage(player, tag);
}
else {
}
usageMessage(player, tag);
} else {
}
usageMessage(player, tag);
}
}
}
}
return false;
}
}
return false;
void permissionMessage(Player player) {
}
Utils.spleggOGMessage(player, "&cERROR: You do not have permission to do that.");
void permissionMessage(Player player) {
}
Utils.spleggOGMessage(player, "&cERROR: You do not have permission to do that.");
void usageMessage(Player player, String tag) {
}
Utils.spleggOGMessage(player, "&cERROR: Incorrect syntax. &6Use the command: &e/splegg setspawn [MAPNAME] &6to create spawn points.");
void usageMessage(Player player, String tag) {
}
Utils.spleggOGMessage(player,
"&cERROR: Incorrect syntax. &6Use the command: &e/splegg setspawn [MAPNAME] &6to create spawn points.");
void noMapMessage(Player player, String mapUserTriedToReferTo) {
}
Utils.spleggOGMessage(player, "&cERROR: The map: &e" + mapUserTriedToReferTo + " &cdoes not exist.");
void noMapMessage(Player player, String mapUserTriedToReferTo) {
}
Utils.spleggOGMessage(player, "&cERROR: The map: &e" + mapUserTriedToReferTo + " &cdoes not exist.");
boolean spawnset(int i, Map map) {
}
return map.getConfig().isString("Spawns." + i + ".world");
boolean spawnset(int i, Map map) {
}
return map.getConfig().isString("Spawns." + i + ".world");
public void sendUsage(Player player, String tag, String usage, String def) {
}
Utils.spleggOGMessage(player, "&c/" + tag + " &d" + usage + " &5- &b" + def);
public void sendUsage(Player player, String tag, String usage, String def) {
}
Utils.spleggOGMessage(player, "&c/" + tag + " &d" + usage + " &5- &b" + def);
}
}
+183 -185
View File
@@ -15,310 +15,308 @@ import managers.Status;
public class Map {
SpleggOG splegg;
String name;
File file;
int spawncount;
int floorcount;
boolean usable;
SpleggOG splegg;
String name;
File file;
int spawncount;
int floorcount;
boolean usable;
// Enable the conversion of text from config.yml to objects.
public FileConfiguration config = SpleggOG.getPlugin().getConfig();
// Enable the conversion of text from config.yml to objects.
public FileConfiguration config = SpleggOG.getPlugin().getConfig();
public Map(SpleggOG splegg, String name) {
public Map(SpleggOG splegg, String name) {
this.splegg = splegg;
this.name = name;
this.floorcount = 0;
this.spawncount = 0;
this.splegg = splegg;
this.name = name;
this.floorcount = 0;
this.spawncount = 0;
}
}
public void load() {
public void load() {
SpleggOG.getPlugin().getLogger().info("Loading map " + this.name + "...");
SpleggOG.getPlugin().getLogger().info("Loading map " + this.name + "...");
this.file = new File(SpleggOG.getPlugin().getDataFolder(), this.name + ".yml");
try {
this.file = new File(SpleggOG.getPlugin().getDataFolder(), this.name + ".yml");
try {
if (! this.file.exists()) {
if (!this.file.exists()) {
this.file.createNewFile();
this.file.createNewFile();
}
}
}
catch (IOException error) {
} catch (IOException error) {
SpleggOG.getPlugin().getLogger().severe("ERROR: Issue creating " + this.name + ".yml: " + error.getMessage());
SpleggOG.getPlugin().getLogger()
.severe("ERROR: Issue creating " + this.name + ".yml: " + error.getMessage());
}
}
this.setConfig(YamlConfiguration.loadConfiguration(this.file));
this.save();
this.setConfig(YamlConfiguration.loadConfiguration(this.file));
this.save();
this.loadSpawns();
this.loadFloors();
this.loadSpawns();
this.loadFloors();
SpleggOG.getPlugin().getLogger().info("File set: " + this.file.getName() + ".");
SpleggOG.getPlugin().getLogger().info("File set: " + this.file.getName() + ".");
}
}
public void usableDecider(Map map) {
public void usableDecider(Map map) {
if (this.spawncount > 0 && this.floorcount > 0) {
if (this.spawncount > 0 && this.floorcount > 0) {
SpleggOG.getPlugin().getLogger().info("Floor and spawn point(s) detected. The map is ready to go!");
this.usable = true;
SpleggOG.getPlugin().games.getGame(this.getName()).setStatus(Status.LOBBY);
SpleggOG.getPlugin().getLogger().info("Floor and spawn point(s) detected. The map is ready to go!");
this.usable = true;
SpleggOG.getPlugin().games.getGame(this.getName()).setStatus(Status.LOBBY);
}
else {
} else {
this.usable = false;
this.usable = false;
}
}
}
}
public boolean isUsable(Map map) {
public boolean isUsable(Map map) {
usableDecider(map);
return this.usable;
usableDecider(map);
return this.usable;
}
}
public void delete() {
public void delete() {
this.file.delete();
this.file.delete();
}
}
public void savenumbers() {
public void savenumbers() {
config.set("Spawns.count", this.spawncount);
config.set("Floors.count", this.floorcount);
config.set("Spawns.count", this.spawncount);
config.set("Floors.count", this.floorcount);
}
}
public void save() {
public void save() {
try {
try {
config.save(this.file);
config.save(this.file);
}
catch (IOException error) {
} catch (IOException error) {
SpleggOG.getPlugin().getLogger().severe("An error occured while saving " + this.name + ".yml.");
SpleggOG.getPlugin().getLogger().severe("An error occured while saving " + this.name + ".yml.");
}
}
}
}
public void setSpawn(Map map, int id, Location l) {
public void setSpawn(Map map, int id, Location l) {
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
float pitch = l.getPitch();
float yaw = l.getYaw();
float pitch = l.getPitch();
float yaw = l.getYaw();
String worldname = l.getWorld().getName();
String worldname = l.getWorld().getName();
config.set("Spawns." + id + ".world", worldname);
config.set("Spawns." + id + ".x", x);
config.set("Spawns." + id + ".y", y);
config.set("Spawns." + id + ".z", z);
config.set("Spawns." + id + ".pitch", pitch);
config.set("Spawns." + id + ".yaw", yaw);
config.set("Spawns." + id + ".world", worldname);
config.set("Spawns." + id + ".x", x);
config.set("Spawns." + id + ".y", y);
config.set("Spawns." + id + ".z", z);
config.set("Spawns." + id + ".pitch", pitch);
config.set("Spawns." + id + ".yaw", yaw);
this.save();
this.save();
usableDecider(map);
usableDecider(map);
}
}
public Location getSpawn(int id) {
public Location getSpawn(int id) {
int x = config.getInt("Spawns." + id + ".x");
int y = config.getInt("Spawns." + id + ".y");
int z = config.getInt("Spawns." + id + ".z");
int x = config.getInt("Spawns." + id + ".x");
int y = config.getInt("Spawns." + id + ".y");
int z = config.getInt("Spawns." + id + ".z");
float yaw = (float) config.getInt("Spawns." + id + ".yaw");
float pitch = (float) config.getInt("Spawns." + id + ".pitch");
float yaw = (float) config.getInt("Spawns." + id + ".yaw");
float pitch = (float) config.getInt("Spawns." + id + ".pitch");
World world = Bukkit.getWorld(config.getString("Spawns." + id + ".world"));
World world = Bukkit.getWorld(config.getString("Spawns." + id + ".world"));
return new Location(world, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
return new Location(world, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
}
}
public void setSpec(Location l) {
public void setSpec(Location l) {
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
float pitch = l.getPitch();
float yaw = l.getYaw();
float pitch = l.getPitch();
float yaw = l.getYaw();
String worldname = l.getWorld().getName();
String worldname = l.getWorld().getName();
config.set("Spec.world", worldname);
config.set("Spec.x", x);
config.set("Spec.y", y);
config.set("Spec.z", z);
config.set("Spec.pitch", pitch);
config.set("Spec.yaw", yaw);
config.set("Spec.world", worldname);
config.set("Spec.x", x);
config.set("Spec.y", y);
config.set("Spec.z", z);
config.set("Spec.pitch", pitch);
config.set("Spec.yaw", yaw);
}
}
public Location getSpawnSpec() {
public Location getSpawnSpec() {
int x = config.getInt("Spec.x");
int y = config.getInt("Spec.y");
int z = config.getInt("Spec.z");
int x = config.getInt("Spec.x");
int y = config.getInt("Spec.y");
int z = config.getInt("Spec.z");
float yaw = (float) config.getInt("Spec.yaw");
float pitch = (float) config.getInt("Spec.pitch");
float yaw = (float) config.getInt("Spec.yaw");
float pitch = (float) config.getInt("Spec.pitch");
World world = Bukkit.getWorld(config.getString("Spec.world"));
World world = Bukkit.getWorld(config.getString("Spec.world"));
return new Location(world, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
return new Location(world, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
}
}
public String getName() {
public String getName() {
return this.name;
return this.name;
}
}
public void loadSpawns() {
public void loadSpawns() {
this.spawncount = getCount();
this.spawncount = getCount();
}
}
public void loadFloors() {
public void loadFloors() {
this.floorcount = getFloors();
this.floorcount = getFloors();
}
}
public void addSpawn(Location l, Game game) {
public void addSpawn(Location l, Game game) {
this.spawncount++;
this.savenumbers();
this.setSpawn(game.getMap(), this.spawncount, l);
this.spawncount++;
this.savenumbers();
this.setSpawn(game.getMap(), this.spawncount, l);
}
}
public void addFloor(Location p1, Location p2, Game game) {
public void addFloor(Location p1, Location p2, Game game) {
this.floorcount++;
this.savenumbers();
this.floorcount++;
this.savenumbers();
this.config.set("Floors." + this.floorcount + ".p1.x", p1.getBlockX());
this.config.set("Floors." + this.floorcount + ".p1.y", p1.getBlockY());
this.config.set("Floors." + this.floorcount + ".p1.z", p1.getBlockZ());
this.config.set("Floors." + this.floorcount + ".p1.world", p1.getWorld().getName());
this.config.set("Floors." + this.floorcount + ".p2.x", p2.getBlockX());
this.config.set("Floors." + this.floorcount + ".p2.y", p2.getBlockY());
this.config.set("Floors." + this.floorcount + ".p2.z", p2.getBlockZ());
this.config.set("Floors." + this.floorcount + ".p2.world", p2.getWorld().getName());
this.config.set("Floors." + this.floorcount + ".p1.x", p1.getBlockX());
this.config.set("Floors." + this.floorcount + ".p1.y", p1.getBlockY());
this.config.set("Floors." + this.floorcount + ".p1.z", p1.getBlockZ());
this.config.set("Floors." + this.floorcount + ".p1.world", p1.getWorld().getName());
this.config.set("Floors." + this.floorcount + ".p2.x", p2.getBlockX());
this.config.set("Floors." + this.floorcount + ".p2.y", p2.getBlockY());
this.config.set("Floors." + this.floorcount + ".p2.z", p2.getBlockZ());
this.config.set("Floors." + this.floorcount + ".p2.world", p2.getWorld().getName());
this.save();
this.save();
usableDecider(game.getMap());
usableDecider(game.getMap());
}
}
public Location getFloor(int id, String pos) {
public Location getFloor(int id, String pos) {
int x = this.config.getInt("Floors." + id + ".p" + pos + ".x");
int y = this.config.getInt("Floors." + id + ".p" + pos + ".y");
int z = this.config.getInt("Floors." + id + ".p" + pos + ".z");
int x = this.config.getInt("Floors." + id + ".p" + pos + ".x");
int y = this.config.getInt("Floors." + id + ".p" + pos + ".y");
int z = this.config.getInt("Floors." + id + ".p" + pos + ".z");
String world = this.config.getString("Floors." + id + ".p" + pos + ".world");
String world = this.config.getString("Floors." + id + ".p" + pos + ".world");
return new Location(Bukkit.getWorld(world), (double) x, (double) y, (double) z);
return new Location(Bukkit.getWorld(world), (double) x, (double) y, (double) z);
}
}
public int getCount() {
public int getCount() {
return config.getInt("Spawns.count");
return config.getInt("Spawns.count");
}
}
public int getFloors() {
public int getFloors() {
return config.getInt("Floors.count");
return config.getInt("Floors.count");
}
}
public int getSpawnCount() {
public int getSpawnCount() {
return this.spawncount;
return this.spawncount;
}
}
public FileConfiguration getConfig() {
public FileConfiguration getConfig() {
return this.config;
return this.config;
}
}
public void setConfig(FileConfiguration config) {
public void setConfig(FileConfiguration config) {
this.config = config;
this.config = config;
}
}
public boolean lobbySet() {
public boolean lobbySet() {
return config.isString("Spawns.lobby.world");
return config.isString("Spawns.lobby.world");
}
}
public void setLobby(Location l) {
public void setLobby(Location l) {
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
float pitch = l.getPitch();
float yaw = l.getYaw();
float pitch = l.getPitch();
float yaw = l.getYaw();
String worldname = l.getWorld().getName();
String worldname = l.getWorld().getName();
config.set("Spawns.lobby.world", worldname);
config.set("Spawns.lobby.x", x);
config.set("Spawns.lobby.y", y);
config.set("Spawns.lobby.z", z);
config.set("Spawns.lobby.pitch", pitch);
config.set("Spawns.lobby.yaw", yaw);
config.set("Spawns.lobby.world", worldname);
config.set("Spawns.lobby.x", x);
config.set("Spawns.lobby.y", y);
config.set("Spawns.lobby.z", z);
config.set("Spawns.lobby.pitch", pitch);
config.set("Spawns.lobby.yaw", yaw);
this.save();
this.save();
}
}
public Location getLobby() {
public Location getLobby() {
int x = config.getInt("Spawns.lobby.x");
int y = config.getInt("Spawns.lobby.y");
int z = config.getInt("Spawns.lobby.z");
int x = config.getInt("Spawns.lobby.x");
int y = config.getInt("Spawns.lobby.y");
int z = config.getInt("Spawns.lobby.z");
float yaw = (float) config.getInt("Spawns.lobby.yaw");
float pitch = (float) config.getInt("Spawns.lobby.pitch");
float yaw = (float) config.getInt("Spawns.lobby.yaw");
float pitch = (float) config.getInt("Spawns.lobby.pitch");
World world = Bukkit.getWorld(config.getString("Spawns.lobby.world"));
World world = Bukkit.getWorld(config.getString("Spawns.lobby.world"));
return new Location(world, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
return new Location(world, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
}
}
}
+61 -64
View File
@@ -14,114 +14,111 @@ import managers.Status;
public class MapConfig {
public FileConfiguration maps;
public File f;
public FileConfiguration maps;
public File f;
public void setup() {
public void setup() {
this.f = new File(SpleggOG.getPlugin().getDataFolder(), "maps.yml");
try {
this.f = new File(SpleggOG.getPlugin().getDataFolder(), "maps.yml");
try {
this.f.createNewFile();
this.f.createNewFile();
}
catch (IOException error) {
} catch (IOException error) {
SpleggOG.getPlugin().getLogger().severe("An error occured while creating maps.yml.");
SpleggOG.getPlugin().getLogger().severe("An error occured while creating maps.yml.");
}
}
this.loadMaps();
this.saveMaps();
this.loadMaps();
this.saveMaps();
SpleggOG.getPlugin().maps.MAPS.clear();
SpleggOG.getPlugin().maps.MAPS.clear();
Iterator<?> enabledMapIterator = this.getEnabledMaps().iterator();
while(enabledMapIterator.hasNext()) {
Iterator<?> enabledMapIterator = this.getEnabledMaps().iterator();
while (enabledMapIterator.hasNext()) {
String maps = (String) enabledMapIterator.next();
SpleggOG.getPlugin().maps.addMap(maps);
String maps = (String) enabledMapIterator.next();
SpleggOG.getPlugin().maps.addMap(maps);
Map map = SpleggOG.getPlugin().maps.getMap(maps);
Game game = new Game(SpleggOG.getPlugin(), map);
SpleggOG.getPlugin().games.addGame(map.getName(), game);
Map map = SpleggOG.getPlugin().maps.getMap(maps);
Game game = new Game(SpleggOG.getPlugin(), map);
SpleggOG.getPlugin().games.addGame(map.getName(), game);
if (! map.isUsable(map)) {
if (!map.isUsable(map)) {
game.setStatus(Status.DISABLED);
game.setStatus(Status.DISABLED);
}
}
}
}
}
}
private void loadMaps() {
private void loadMaps() {
this.maps = YamlConfiguration.loadConfiguration(this.f);
this.maps = YamlConfiguration.loadConfiguration(this.f);
}
}
public void saveMaps() {
public void saveMaps() {
try {
try {
this.maps.save(this.f);
this.maps.save(this.f);
} catch (IOException error) {
}
catch (IOException error) {
SpleggOG.getPlugin().getLogger().severe("An error occured while saving maps.yml.");
SpleggOG.getPlugin().getLogger().severe("An error occured while saving maps.yml.");
}
}
}
}
public List<String> getEnabledMaps() {
public List<String> getEnabledMaps() {
return this.maps.getStringList("maps");
return this.maps.getStringList("maps");
}
}
public void addSign(String map, String loc) {
public void addSign(String map, String loc) {
List<String> signs = this.maps.getStringList("Signs." + map + ".lobby");
signs.add(loc);
List<String> signs = this.maps.getStringList("Signs." + map + ".lobby");
signs.add(loc);
this.maps.set("Signs." + map + ".lobby", signs);
this.saveMaps();
this.maps.set("Signs." + map + ".lobby", signs);
this.saveMaps();
}
}
public void delSign(String map, String loc) {
public void delSign(String map, String loc) {
List<String> signs = this.maps.getStringList("Signs." + map + ".lobby");
signs.remove(loc);
List<String> signs = this.maps.getStringList("Signs." + map + ".lobby");
signs.remove(loc);
this.maps.set("Signs." + map + ".lobby", signs);
this.saveMaps();
this.maps.set("Signs." + map + ".lobby", signs);
this.saveMaps();
}
}
public void addMap(String name) {
public void addMap(String name) {
List<String> maps = this.maps.getStringList("maps");
maps.add(name);
List<String> maps = this.maps.getStringList("maps");
maps.add(name);
this.maps.set("maps", maps);
this.saveMaps();
this.maps.set("maps", maps);
this.saveMaps();
}
}
public void removeMap(String name) {
public void removeMap(String name) {
List<String> maps = this.maps.getStringList("maps");
maps.remove(name);
List<String> maps = this.maps.getStringList("maps");
maps.remove(name);
this.maps.set("maps", maps);
this.saveMaps();
this.maps.set("maps", maps);
this.saveMaps();
}
}
}
+53 -51
View File
@@ -9,76 +9,78 @@ import managers.Status;
public class MapUtilities {
public MapConfig c = new MapConfig();
public HashMap<String, Map> MAPS = new HashMap<String, Map>();
public MapConfig c = new MapConfig();
public HashMap<String, Map> MAPS = new HashMap<String, Map>();
public void addMap(String name) {
public void addMap(String name) {
Map map = new Map(SpleggOG.getPlugin(), name);
this.MAPS.put(name, map);
map.load();
Map map = new Map(SpleggOG.getPlugin(), name);
this.MAPS.put(name, map);
map.load();
}
}
public void deleteMap(String name) {
public void deleteMap(String name) {
Map m = this.getMap(name);
Game game = SpleggOG.getPlugin().games.getGame(name);
if (game.getStatus() == Status.INGAME) {
Map m = this.getMap(name);
Game game = SpleggOG.getPlugin().games.getGame(name);
if (game.getStatus() == Status.INGAME) {
SpleggOG.getPlugin().game.stopGame(game, 0);
SpleggOG.getPlugin().game.stopGame(game, 0);
}
}
SpleggOG.getPlugin().games.GAMES.remove(m.getName());
SpleggOG.getPlugin().games.GAMES.remove(m.getName());
this.MAPS.remove(name, m);
this.c.removeMap(name);
m.delete();
this.MAPS.remove(name, m);
this.c.removeMap(name);
m.delete();
}
}
public boolean mapExists(String name) {
public boolean mapExists(String name) {
return this.MAPS.containsKey(name);
return this.MAPS.containsKey(name);
}
}
public Collection<Map> getMaps() {
public Collection<Map> getMaps() {
return this.MAPS.values();
return this.MAPS.values();
}
}
public Map getMap(String name) {
public Map getMap(String name) {
return (Map) this.MAPS.get(name);
return (Map) this.MAPS.get(name);
}
}
// TODO: Use getRandomMap in map voting as an option.
/*private Map getRandomMap() {
ArrayList<Map> all = new ArrayList<Map>();
Iterator<?> var3 = this.MAPS.values().iterator();
while(var3.hasNext()) {
Map map = (Map)var3.next();
if (map.isUsable()) {
all.add(map);
}
}
Object[] mapsa = all.toArray();
Map randomMap = (Map) mapsa[(new Random()).nextInt(mapsa.length)];
return randomMap;
}*/
// TODO: Use getRandomMap in map voting as an option.
/*
* private Map getRandomMap() {
*
* ArrayList<Map> all = new ArrayList<Map>(); Iterator<?> var3 =
* this.MAPS.values().iterator();
*
* while(var3.hasNext()) {
*
* Map map = (Map)var3.next();
*
* if (map.isUsable()) {
*
* all.add(map);
*
* }
*
* }
*
* Object[] mapsa = all.toArray(); Map randomMap = (Map) mapsa[(new
* Random()).nextInt(mapsa.length)];
*
* return randomMap;
*
* }
*/
}
+136 -131
View File
@@ -25,218 +25,223 @@ import utils.Utils;
public class Listeners implements Listener {
public static ArrayList<String> manager = new ArrayList<String>();
public static ArrayList<String> moneymanager = new ArrayList<String>();
public static ArrayList<String> shopmanager = new ArrayList<String>();
public static ArrayList<String> diamondspade = new ArrayList<String>();
public static ArrayList<String> goldspade = new ArrayList<String>();
public static ArrayList<String> launchEggs = new ArrayList<String>();
public static ArrayList<String> manager = new ArrayList<String>();
public static ArrayList<String> moneymanager = new ArrayList<String>();
public static ArrayList<String> shopmanager = new ArrayList<String>();
public static ArrayList<String> diamondspade = new ArrayList<String>();
public static ArrayList<String> goldspade = new ArrayList<String>();
public static ArrayList<String> launchEggs = new ArrayList<String>();
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Player player = (Player) event.getWhoClicked();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (shopmanager.contains(player.getName())) {
if (shopmanager.contains(player.getName())) {
EconomyResponse r;
EconomyResponse r;
if (event.getCurrentItem().getType() == Material.GOLDEN_SHOVEL) {
if (event.getCurrentItem().getType() == Material.GOLDEN_SHOVEL) {
player.getInventory().close();
player.getInventory().close();
if (SpleggOG.getPlugin().econ.getBalance(player) >= (double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.GoldShovel.Price")) {
if (SpleggOG.getPlugin().econ.getBalance(
player) >= (double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.GoldShovel.Price"))
{
r = SpleggOG.getPlugin().econ.withdrawPlayer(player, (double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.GoldShovel.Price"));
if (r.transactionSuccess()) {
r = SpleggOG.getPlugin().econ.withdrawPlayer(player,
(double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.GoldShovel.Price"));
if (r.transactionSuccess()) {
goldspade.add(player.getName());
diamondspade.remove(player.getName());
shopmanager.remove(player.getName());
manager.remove(player.getName());
goldspade.add(player.getName());
diamondspade.remove(player.getName());
shopmanager.remove(player.getName());
manager.remove(player.getName());
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.BuyGoldShovel"));
Utils.spleggOGMessage(player,
SpleggOG.getPlugin().getConfig().getString("Messages.BuyGoldShovel"));
}
else {
} else {
player.sendMessage(String.format("An error occured: %s", r.errorMessage));
player.sendMessage(String.format("An error occured: %s", r.errorMessage));
shopmanager.add(player.getName());
manager.add(player.getName());
goldspade.remove(player.getName());
diamondspade.remove(player.getName());
shopmanager.add(player.getName());
manager.add(player.getName());
goldspade.remove(player.getName());
diamondspade.remove(player.getName());
}
}
}
else {
} else {
player.getInventory().close();
player.getInventory().close();
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.NoEnoughMoney"));
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.NoEnoughMoney"));
}
}
}
}
if (event.getCurrentItem().getType() == Material.DIAMOND_SHOVEL) {
if (event.getCurrentItem().getType() == Material.DIAMOND_SHOVEL) {
player.getInventory().close();
player.getInventory().close();
if (SpleggOG.getPlugin().econ.getBalance(player) >= (double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.DiamondShovel.Price")) {
if (SpleggOG.getPlugin().econ.getBalance(
player) >= (double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.DiamondShovel.Price"))
{
r = SpleggOG.getPlugin().econ.withdrawPlayer(player, (double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.DiamondShovel.Price"));
if (r.transactionSuccess()) {
r = SpleggOG.getPlugin().econ.withdrawPlayer(player,
(double) SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.DiamondShovel.Price"));
if (r.transactionSuccess()) {
goldspade.remove(player.getName());
diamondspade.add(player.getName());
shopmanager.remove(player.getName());
manager.remove(player.getName());
goldspade.remove(player.getName());
diamondspade.add(player.getName());
shopmanager.remove(player.getName());
manager.remove(player.getName());
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.BuyDiamondShovel"));
Utils.spleggOGMessage(player,
SpleggOG.getPlugin().getConfig().getString("Messages.BuyDiamondShovel"));
}
else {
} else {
player.sendMessage(String.format("An error occured: %s", r.errorMessage));
player.sendMessage(String.format("An error occured: %s", r.errorMessage));
shopmanager.add(player.getName());
manager.add(player.getName());
goldspade.remove(player.getName());
diamondspade.remove(player.getName());
shopmanager.add(player.getName());
manager.add(player.getName());
goldspade.remove(player.getName());
diamondspade.remove(player.getName());
}
}
}
else {
} else {
player.getInventory().close();
player.getInventory().close();
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.NoEnoughMoney"));
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.NoEnoughMoney"));
}
}
}
}
}
else {
} else {
player.getInventory().close();
player.getInventory().close();
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.Haveyoueverbought"));
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.Haveyoueverbought"));
}
}
if (u.getGame() != null && u.isAlive()) {
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Game game = u.getGame();
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Game game = u.getGame();
if(game != null) {
if (game != null) {
game.leaveGame(u);
game.leaveGame(u);
}
}
}
}
@EventHandler
public void onPlayerPickupItem(EntityPickupItemEvent event) {
@EventHandler
public void onPlayerPickupItem(EntityPickupItemEvent event) {
if(event.getEntityType() == EntityType.PLAYER) {
if (event.getEntityType() == EntityType.PLAYER) {
Player player = (Player) event.getEntity();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
Player player = (Player) event.getEntity();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
}
}
@EventHandler
public void onPlayerAdvancement(PlayerAdvancementCriterionGrantEvent event) {
@EventHandler
public void onPlayerAdvancement(PlayerAdvancementCriterionGrantEvent event) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if(u.getGame() != null && u.isAlive()) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = (Player) event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Game game = u.getGame();
if (game != null && Listeners.launchEggs.contains(u.getName())) {
Player player = (Player) event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Game game = u.getGame();
if (game != null && Listeners.launchEggs.contains(u.getName())) {
EquipmentSlot playerHand = null;
try {
EquipmentSlot playerHand = null;
try {
playerHand = event.getHand();
playerHand = event.getHand();
}
catch(NullPointerException error) {
} catch (NullPointerException error) {
SpleggOG.getPlugin().getLogger().severe("ERROR: Player's hand returned null.");
SpleggOG.getPlugin().getLogger().severe("ERROR: Player's hand returned null.");
}
}
if(playerHand.equals(EquipmentSlot.HAND)) {
if (playerHand.equals(EquipmentSlot.HAND)) {
ItemStack itemInHand = player.getInventory().getItemInMainHand();
switch(itemInHand.getType()) {
ItemStack itemInHand = player.getInventory().getItemInMainHand();
switch (itemInHand.getType()) {
case WOODEN_SHOVEL, STONE_SHOVEL, IRON_SHOVEL, GOLDEN_SHOVEL, DIAMOND_SHOVEL, NETHERITE_SHOVEL:
Utils.fireEgg(event, u, player, itemInHand);
break;
case SLIME_BALL:
case WOODEN_SHOVEL, STONE_SHOVEL, IRON_SHOVEL, GOLDEN_SHOVEL, DIAMOND_SHOVEL, NETHERITE_SHOVEL:
Utils.fireEgg(event, u, player, itemInHand);
break;
case SLIME_BALL:
game.leaveGame(u);
game.leaveGame(u);
break;
default:
break;
default:
if(itemInHand.getType() == Material.getMaterial(SpleggOG.getPlugin().getConfig().getString("Shop.Item"))) {
if (itemInHand.getType() == Material
.getMaterial(SpleggOG.getPlugin().getConfig().getString("Shop.Item")))
{
player.openInventory(Utils.getShopInventory());
player.openInventory(Utils.getShopInventory());
}
}
break;
}
break;
}
}
}
}
}
}
@EventHandler
public void onAsyncPlayerChat(AsyncChatEvent event) {
}
// TODO: Direct chat to world-specific channel here.
@EventHandler
public void onAsyncPlayerChat(AsyncChatEvent event) {
}
// TODO: Direct chat to world-specific channel here.
}
}
+24 -24
View File
@@ -12,43 +12,43 @@ import utils.UtilPlayer;
public class MapListener implements Listener {
@EventHandler
public void blockBreak(BlockBreakEvent event) {
@EventHandler
public void blockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
@EventHandler
public void blockPlace(BlockPlaceEvent event) {
@EventHandler
public void blockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
@EventHandler
public void hangingEntityBreak(HangingBreakByEntityEvent event) {
@EventHandler
public void hangingEntityBreak(HangingBreakByEntityEvent event) {
Player player = (Player) event.getRemover();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
Player player = (Player) event.getRemover();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
}
+61 -61
View File
@@ -20,106 +20,106 @@ import utils.Utils;
public class PlayerListener implements Listener {
String[] cmds = new String[]{""};
String[] cmds = new String[] { "" };
@EventHandler
public void onFood(FoodLevelChangeEvent event) {
@EventHandler
public void onFood(FoodLevelChangeEvent event) {
if (event.getEntity() instanceof Player) {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
UtilPlayer u = new UtilPlayer(player);
if (u.getGame() != null && u.isAlive()) {
Player player = (Player) event.getEntity();
UtilPlayer u = new UtilPlayer(player);
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setFoodLevel(20);
event.setCancelled(true);
event.setFoodLevel(20);
}
}
}
}
}
}
@EventHandler
public void entityDamage(EntityDamageEvent event) {
@EventHandler
public void entityDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player) {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
UtilPlayer u = new UtilPlayer(player);
if (u.getGame() != null && u.isAlive()) {
Player player = (Player) event.getEntity();
UtilPlayer u = new UtilPlayer(player);
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
}
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UtilPlayer u = new UtilPlayer(player);
Player player = event.getPlayer();
UtilPlayer u = new UtilPlayer(player);
SpleggOG.getPlugin().pm.PLAYERS.put(player.getName(), u);
SpleggOG.getPlugin().pm.PLAYERS.put(player.getName(), u);
Essentials ess = (Essentials) SpleggOG.getPlugin().getServer().getPluginManager().getPlugin("Essentials");
User user = new User(player, ess);
Essentials ess = (Essentials) SpleggOG.getPlugin().getServer().getPluginManager().getPlugin("Essentials");
User user = new User(player, ess);
Kits essentialsKitList = new Kits(ess);
Kit playersKitToRestoreAfterMatch = (Kit) essentialsKitList.getKit(player.getName());
if(playersKitToRestoreAfterMatch != null) {
Kits essentialsKitList = new Kits(ess);
Kit playersKitToRestoreAfterMatch = (Kit) essentialsKitList.getKit(player.getName());
if (playersKitToRestoreAfterMatch != null) {
try {
try {
playersKitToRestoreAfterMatch.expandItems(user);
playersKitToRestoreAfterMatch.expandItems(user);
} catch (Exception error) {
}
catch (Exception error) {
SpleggOG.getPlugin().getLogger().severe(error.getMessage());
SpleggOG.getPlugin().getLogger().severe(error.getMessage());
}
}
} else {
}
else {
SpleggOG.getPlugin().getLogger().severe(
"ERROR: Kit for player: " + player.getName() + " was not found during the restore attempt!");
SpleggOG.getPlugin().getLogger().severe("ERROR: Kit for player: " + player.getName() + " was not found during the restore attempt!");
}
}
}
}
@EventHandler
public void dropItem(PlayerDropItemEvent event) {
@EventHandler
public void dropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
UtilPlayer u = new UtilPlayer(player);
Player player = event.getPlayer();
UtilPlayer u = new UtilPlayer(player);
if (u.getGame() != null && u.isAlive()) {
if (u.getGame() != null && u.isAlive()) {
event.setCancelled(true);
event.setCancelled(true);
}
}
}
}
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
UtilPlayer u = new UtilPlayer(player);
if (u.getGame() != null && u.isAlive() && !event.getMessage().startsWith("/splegg")
&& !player.hasPermission("splegg.admin"))
{
Player player = event.getPlayer();
UtilPlayer u = new UtilPlayer(player);
if (u.getGame() != null && u.isAlive() && ! event.getMessage().startsWith("/splegg") && ! player.hasPermission("splegg.admin")) {
event.setCancelled(true);
event.setCancelled(true);
Utils.spleggOGMessage(player, "&6You cannot use that command in &3Splegg&6!");
Utils.spleggOGMessage(player, "&6You cannot use that command in &3Splegg&6!");
}
}
}
}
}
+74 -70
View File
@@ -21,112 +21,116 @@ import utils.Utils;
public class SignListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void signPlace(SignChangeEvent event) {
@EventHandler(priority = EventPriority.HIGHEST)
public void signPlace(SignChangeEvent event) {
Player player = event.getPlayer();
if (event.line(0).toString().equalsIgnoreCase("[splegg]") && event.line(1).toString().equalsIgnoreCase("join") && player.hasPermission("splegg.admin")) {
Player player = event.getPlayer();
if (event.line(0).toString().equalsIgnoreCase("[splegg]") && event.line(1).toString().equalsIgnoreCase("join")
&& player.hasPermission("splegg.admin"))
{
String map = event.line(2).toString();
if (SpleggOG.getPlugin().maps.mapExists(map)) {
String map = event.line(2).toString();
if (SpleggOG.getPlugin().maps.mapExists(map)) {
LobbySign ls = new LobbySign(SpleggOG.getPlugin().maps.getMap(map), SpleggOG.getPlugin());
ls.create(event.getBlock().getLocation(), SpleggOG.getPlugin().maps.getMap(map));
LobbySign ls = new LobbySign(SpleggOG.getPlugin().maps.getMap(map), SpleggOG.getPlugin());
ls.create(event.getBlock().getLocation(), SpleggOG.getPlugin().maps.getMap(map));
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.CreateSign").replaceAll("%map%", map));
Utils.spleggOGMessage(player,
SpleggOG.getPlugin().getConfig().getString("Messages.CreateSign").replaceAll("%map%", map));
}
}
}
}
}
}
private static Collection<Material> signMaterials = new ArrayList<>();
static {
private static Collection<Material> signMaterials = new ArrayList<>();
static {
signMaterials.add(Material.ACACIA_SIGN);
signMaterials.add(Material.DARK_OAK_SIGN);
signMaterials.add(Material.OAK_SIGN);
signMaterials.add(Material.BIRCH_SIGN);
signMaterials.add(Material.SPRUCE_SIGN);
signMaterials.add(Material.JUNGLE_SIGN);
signMaterials.add(Material.CRIMSON_SIGN);
signMaterials.add(Material.WARPED_SIGN);
signMaterials.add(Material.ACACIA_WALL_SIGN);
signMaterials.add(Material.DARK_OAK_WALL_SIGN);
signMaterials.add(Material.OAK_WALL_SIGN);
signMaterials.add(Material.BIRCH_WALL_SIGN);
signMaterials.add(Material.SPRUCE_WALL_SIGN);
signMaterials.add(Material.JUNGLE_WALL_SIGN);
signMaterials.add(Material.CRIMSON_WALL_SIGN);
signMaterials.add(Material.WARPED_WALL_SIGN);
signMaterials.add(Material.ACACIA_SIGN);
signMaterials.add(Material.DARK_OAK_SIGN);
signMaterials.add(Material.OAK_SIGN);
signMaterials.add(Material.BIRCH_SIGN);
signMaterials.add(Material.SPRUCE_SIGN);
signMaterials.add(Material.JUNGLE_SIGN);
signMaterials.add(Material.CRIMSON_SIGN);
signMaterials.add(Material.WARPED_SIGN);
signMaterials.add(Material.ACACIA_WALL_SIGN);
signMaterials.add(Material.DARK_OAK_WALL_SIGN);
signMaterials.add(Material.OAK_WALL_SIGN);
signMaterials.add(Material.BIRCH_WALL_SIGN);
signMaterials.add(Material.SPRUCE_WALL_SIGN);
signMaterials.add(Material.JUNGLE_WALL_SIGN);
signMaterials.add(Material.CRIMSON_WALL_SIGN);
signMaterials.add(Material.WARPED_WALL_SIGN);
}
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (e.hasBlock() && signMaterials.contains(e.getClickedBlock().getType()) && e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (e.hasBlock() && signMaterials.contains(e.getClickedBlock().getType())
&& e.getAction() == Action.RIGHT_CLICK_BLOCK)
{
Sign s = (Sign) e.getClickedBlock().getState();
Player player = e.getPlayer();
if (s.line(0).toString().equalsIgnoreCase(SpleggOG.getPlugin().getConfig().getString("Sings.Format.1"))) {
Sign s = (Sign) e.getClickedBlock().getState();
Player player = e.getPlayer();
if (s.line(0).toString().equalsIgnoreCase(SpleggOG.getPlugin().getConfig().getString("Sings.Format.1"))) {
String map = s.line(2).toString();
String map = s.line(2).toString();
if (SpleggOG.getPlugin().maps.mapExists(map)) {
if (SpleggOG.getPlugin().maps.mapExists(map)) {
player.chat("/splegg join " + map);
player.updateInventory();
player.chat("/splegg join " + map);
player.updateInventory();
e.setCancelled(true);
e.setCancelled(true);
}
else {
} else {
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.Mapnotexist"));
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.Mapnotexist"));
e.setCancelled(true);
e.setCancelled(true);
}
}
}
}
}
}
}
}
@EventHandler
public void signBreak(BlockBreakEvent e) {
@EventHandler
public void signBreak(BlockBreakEvent e) {
Player player = e.getPlayer();
if(signMaterials.contains(e.getBlock().getType())) {
Player player = e.getPlayer();
if (signMaterials.contains(e.getBlock().getType())) {
Sign s = (Sign) e.getBlock().getState();
String[] lines = (String[]) s.lines().toArray();
String map = lines[1];
if (LobbySignUtils.get().isLobbySign(e.getBlock().getLocation(), map)) {
Sign s = (Sign) e.getBlock().getState();
String[] lines = (String[]) s.lines().toArray();
String map = lines[1];
if (LobbySignUtils.get().isLobbySign(e.getBlock().getLocation(), map)) {
if (player.hasPermission("splegg.admin")) {
if (player.hasPermission("splegg.admin")) {
LobbySign sign = new LobbySign(SpleggOG.getPlugin().maps.getMap(map), SpleggOG.getPlugin());
sign.delete(e.getBlock().getLocation());
LobbySign sign = new LobbySign(SpleggOG.getPlugin().maps.getMap(map), SpleggOG.getPlugin());
sign.delete(e.getBlock().getLocation());
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.RemovedSign").replaceAll("%map%", map));
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.RemovedSign")
.replaceAll("%map%", map));
}
else {
} else {
e.setCancelled(true);
e.setCancelled(true);
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.NotBreakSign"));
Utils.spleggOGMessage(player, SpleggOG.getPlugin().getConfig().getString("Messages.NotBreakSign"));
}
}
}
}
}
}
}
}
}
+91 -85
View File
@@ -27,144 +27,150 @@ import utils.UtilPlayer;
public class SpleggEvents implements Listener {
@EventHandler
public void eggLand(ProjectileHitEvent event) {
@EventHandler
public void eggLand(ProjectileHitEvent event) {
ProjectileSource shooter = event.getEntity().getShooter();
if (shooter instanceof Player && event.getEntity() instanceof Egg) {
ProjectileSource shooter = event.getEntity().getShooter();
if (shooter instanceof Player && event.getEntity() instanceof Egg) {
Player player = (Player) shooter;
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Block hitBlock = event.getHitBlock();
if(hitBlock != null) {
Location hitLocation = null;
BlockIterator bi = new BlockIterator(hitBlock.getWorld(), event.getEntity().getLocation().toVector(), event.getEntity().getVelocity().normalize(), 0.0D, 4);
if (u.getGame() != null && u.isAlive()) {
Player player = (Player) shooter;
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Block hitBlock = event.getHitBlock();
if (hitBlock != null) {
Block hit = null;
while(bi.hasNext()) {
Location hitLocation = null;
BlockIterator bi = new BlockIterator(hitBlock.getWorld(), event.getEntity().getLocation().toVector(),
event.getEntity().getVelocity().normalize(), 0.0D, 4);
if (u.getGame() != null && u.isAlive()) {
hit = bi.next();
Block hit = null;
while (bi.hasNext()) {
if (hit.getType() != Material.AIR) {
hit = bi.next();
break;
if (hit.getType() != Material.AIR) {
}
else {
break;
// Get location if it is a block.
hitLocation = hitBlock.getLocation();
} else {
// Cancel the collision.
event.setCancelled(true);
// Get location if it is a block.
hitLocation = hitBlock.getLocation();
// Deletes the egg entity.
event.getEntity().remove();
// Cancel the collision.
event.setCancelled(true);
}
// Deletes the egg entity.
event.getEntity().remove();
}
}
if (hit.getType() == Material.TNT) {
}
hitBlock.getWorld().createExplosion(hitLocation, 3.0F);
if (hit.getType() == Material.TNT) {
Iterator<?> entityIterator = hitBlock.getWorld().getEntities().iterator();
while(entityIterator.hasNext()) {
hitBlock.getWorld().createExplosion(hitLocation, 3.0F);
Entity drop = (Entity) entityIterator.next();
Iterator<?> entityIterator = hitBlock.getWorld().getEntities().iterator();
while (entityIterator.hasNext()) {
if (drop.getType() == EntityType.DROPPED_ITEM) {
Entity drop = (Entity) entityIterator.next();
drop.remove();
if (drop.getType() == EntityType.DROPPED_ITEM) {
}
drop.remove();
}
}
}
}
Game game = u.getGame();
if (game.getFloor().contains(hitLocation)) {
}
// If the game is in-progress, do this.
if (game.getStatus() == Status.INGAME) {
Game game = u.getGame();
if (game.getFloor().contains(hitLocation)) {
// Play chicken egg sound upon block hit for every player nearby the event.
player.getWorld().playSound(hitLocation, Sound.ENTITY_CHICKEN_EGG, 1.0F, 1.0F);
// If the game is in-progress, do this.
if (game.getStatus() == Status.INGAME) {
// Spawn spell particles when a block is destroyed to indicate vaporization.
player.getWorld().spawnParticle(Particle.SPELL, hitLocation, 12);
player.getWorld().spawnParticle(Particle.BLOCK_DUST, hitLocation, 6, hit.getBlockData());
// Play chicken egg sound upon block hit for every player nearby the event.
player.getWorld().playSound(hitLocation, Sound.ENTITY_CHICKEN_EGG, 1.0F, 1.0F);
// Destroy the block that was hit by an egg.
hit.setType(Material.AIR);
// Spawn spell particles when a block is destroyed to indicate vaporization.
player.getWorld().spawnParticle(Particle.SPELL, hitLocation, 12);
player.getWorld().spawnParticle(Particle.BLOCK_DUST, hitLocation, 6, hit.getBlockData());
}
// Destroy the block that was hit by an egg.
hit.setType(Material.AIR);
}
}
}
}
}
}
}
}
}
}
// TODO: Implement spectator compass here.
@EventHandler
public void eggHatch(PlayerEggThrowEvent event) {
}
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
// TODO: Implement spectator compass here.
@EventHandler
public void eggHatch(PlayerEggThrowEvent event) {
if (u.getGame() != null && u.isAlive()) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
event.setHatching(false);
if (u.getGame() != null && u.isAlive()) {
}
event.setHatching(false);
}
}
@EventHandler
public void onFall(EntityDamageEvent event) {
}
if (event.getEntity() instanceof Player) {
@EventHandler
public void onFall(EntityDamageEvent event) {
Player player = (Player) event.getEntity();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
if (event.getEntity() instanceof Player) {
if (u.getGame() != null && u.isAlive()) {
Player player = (Player) event.getEntity();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
event.setCancelled(true);
if (u.getGame() != null && u.isAlive()) {
}
event.setCancelled(true);
}
}
}
}
}
@EventHandler
public void onKnockout(PlayerMoveEvent event) {
@EventHandler
public void onKnockout(PlayerMoveEvent event) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Game game = u.getGame();
if (game != null && u.isAlive() && ((double) player.getLocation().getBlockY() < -5.0D || player.getLocation().getBlockY() < game.getLowestPossible()) && game.getStatus() == Status.INGAME) {
Player player = event.getPlayer();
UtilPlayer u = SpleggOG.getPlugin().pm.getPlayer(player);
Game game = u.getGame();
if (game != null && u.isAlive()
&& ((double) player.getLocation().getBlockY() < -5.0D
|| player.getLocation().getBlockY() < game.getLowestPossible())
&& game.getStatus() == Status.INGAME)
{
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.KnockoutPlayer").replaceAll("%player%", player.getName()));
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.PlayersRemaining").replaceAll("%count%", String.valueOf(game.getPlayers().size() - 1)), game);
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.KnockoutPlayer")
.replaceAll("%player%", player.getName()));
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.PlayersRemaining")
.replaceAll("%count%", String.valueOf(game.getPlayers().size() - 1)), game);
player.setFallDistance(0.0F);
game.leaveGame(u);
player.setFallDistance(0.0F);
game.leaveGame(u);
SpleggOG.getPlugin().games.checkWinner(game);
SpleggOG.getPlugin().games.checkWinner(game);
}
}
}
}
}
+105 -100
View File
@@ -23,165 +23,170 @@ import managers.GameManager;
import managers.GameUtilities;
import managers.Status;
import net.milkbowl.vault.economy.Economy;
import net.trueog.diamondbankog.DiamondBankAPIJava;
import utils.UtilPlayer;
import utils.Utils;
public class SpleggOG extends JavaPlugin {
private static SpleggOG plugin;
public Economy econ = null;
public Utils chat;
public MapUtilities maps;
public GameUtilities games;
public GameManager game;
public Utils pm;
public Utils utils;
public Utils config;
public boolean updateOut = false;
public String newVer = "";
public boolean disabling = false;
boolean economy = true;
DiamondBankAPIJava dbog;
// TODO: If a shovel in the Splegg shop is too expensive, close the inventory and tell the user about it.
private boolean setupEconomy() {
private static SpleggOG plugin;
public Economy econ = null;
public Utils chat;
public MapUtilities maps;
public GameUtilities games;
public GameManager game;
public Utils pm;
public Utils utils;
public Utils config;
public boolean updateOut = false;
public String newVer = "";
public boolean disabling = false;
boolean economy = true;
if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
// TODO: If a shovel in the Splegg shop is too expensive, close the inventory
// and tell the user about it.
private boolean setupEconomy() {
return false;
if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
}
else {
// ondBankAPI dbog;
RegisteredServiceProvider<Economy> rsp = this.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
return false;
} else {
}
else {
RegisteredServiceProvider<Economy> rsp = this.getServer().getServicesManager()
.getRegistration(Economy.class);
if (rsp == null) {
this.econ = (Economy) rsp.getProvider();
return false;
return this.econ != null;
} else {
}
this.econ = (Economy) rsp.getProvider();
}
return this.econ != null;
}
}
public void onEnable() {
}
plugin = this;
this.chat = new Utils();
if (this.getServer().getPluginManager().getPlugin("WorldEdit") == null) {
}
String noWorldEditError = "\"ERROR: WorldEdit not found! Without WorldEdit, Splegg-OG will not function. Please download it from http://dev.bukkit.org/bukkit-plugins/worldedit\"";
this.getLogger().severe(noWorldEditError);
this.getLogger().info(noWorldEditError);
public void onEnable() {
Bukkit.getPluginManager().disablePlugin(this);
plugin = this;
this.chat = new Utils();
if (this.getServer().getPluginManager().getPlugin("WorldEdit") == null) {
}
else {
String noWorldEditError = "\"ERROR: WorldEdit not found! Without WorldEdit, Splegg-OG will not function. Please download it from http://dev.bukkit.org/bukkit-plugins/worldedit\"";
this.getLogger().severe(noWorldEditError);
this.getLogger().info(noWorldEditError);
this.maps = new MapUtilities();
this.games = new GameUtilities();
this.game = new GameManager();
this.pm = new Utils();
this.utils = new Utils();
this.config = new Utils();
Bukkit.getPluginManager().disablePlugin(this);
this.maps.c.setup();
this.config.setup();
} else {
this.getConfig().options().copyDefaults(true);
this.saveConfig();
this.maps = new MapUtilities();
this.games = new GameUtilities();
this.game = new GameManager();
this.pm = new Utils();
this.utils = new Utils();
this.config = new Utils();
this.getServer().getPluginManager().registerEvents(new MapListener(), this);
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
this.getServer().getPluginManager().registerEvents(new SpleggEvents(), this);
this.getServer().getPluginManager().registerEvents(new SignListener(), this);
this.getServer().getPluginManager().registerEvents(new Listeners(), this);
this.maps.c.setup();
this.config.setup();
this.getCommand("splegg").setExecutor(new SpleggCommand());
this.getConfig().options().copyDefaults(true);
this.saveConfig();
if (! this.setupEconomy()) {
this.getServer().getPluginManager().registerEvents(new MapListener(), this);
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
this.getServer().getPluginManager().registerEvents(new SpleggEvents(), this);
this.getServer().getPluginManager().registerEvents(new SignListener(), this);
this.getServer().getPluginManager().registerEvents(new Listeners(), this);
// Inform the user that the plugin will not work due to a missing vault dependency.
this.getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", this.getPluginMeta().getName()));
this.getCommand("splegg").setExecutor(new SpleggCommand());
// Disable Splegg-OG for this instance because Vault (a crucial dependency) was not found.
this.getServer().getPluginManager().disablePlugin(this);
if (!this.setupEconomy()) {
}
else {
// Inform the user that the plugin will not work due to a missing vault
// dependency.
this.getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!",
this.getPluginMeta().getName()));
for(Player p : Bukkit.getOnlinePlayers()) {
// Disable Splegg-OG for this instance because Vault (a crucial dependency) was
// not found.
this.getServer().getPluginManager().disablePlugin(this);
UtilPlayer u = new UtilPlayer(p);
} else {
this.pm.PLAYERS.put(p.getName(), u);
for (Player p : Bukkit.getOnlinePlayers()) {
}
UtilPlayer u = new UtilPlayer(p);
}
this.pm.PLAYERS.put(p.getName(), u);
}
}
}
}
public void onDisable() {
}
this.disabling = true;
}
HandlerList.unregisterAll(new MapListener());
HandlerList.unregisterAll(new PlayerListener());
HandlerList.unregisterAll(new SpleggEvents());
HandlerList.unregisterAll(new SignListener());
HandlerList.unregisterAll(new Listeners());
public void onDisable() {
int gameCounter = 0;
try {
this.disabling = true;
Iterator<?> gameIterator = this.games.GAMES.values().iterator();
while(gameIterator.hasNext()) {
HandlerList.unregisterAll(new MapListener());
HandlerList.unregisterAll(new PlayerListener());
HandlerList.unregisterAll(new SpleggEvents());
HandlerList.unregisterAll(new SignListener());
HandlerList.unregisterAll(new Listeners());
Game game = (Game) gameIterator.next();
if (game.getStatus() == Status.INGAME) {
int gameCounter = 0;
try {
gameCounter++;
Iterator<?> gameIterator = this.games.GAMES.values().iterator();
while (gameIterator.hasNext()) {
this.game.stopGame(game, 1);
Game game = (Game) gameIterator.next();
if (game.getStatus() == Status.INGAME) {
}
gameCounter++;
}
this.game.stopGame(game, 1);
this.getLogger().info("Splegg-OG Shut Down with " + gameCounter + " games running.");
}
}
catch (NullPointerException error) {
}
this.getLogger().info("Splegg-OG Shut Down with 0 games running.");
this.getLogger().info("Splegg-OG Shut Down with " + gameCounter + " games running.");
}
} catch (NullPointerException error) {
}
this.getLogger().info("Splegg-OG Shut Down with 0 games running.");
public WorldEditPlugin getWorldEdit() {
}
Plugin worldEdit = this.getServer().getPluginManager().getPlugin("WorldEdit");
}
return worldEdit instanceof WorldEditPlugin ? (WorldEditPlugin) worldEdit : null;
public WorldEditPlugin getWorldEdit() {
}
Plugin worldEdit = this.getServer().getPluginManager().getPlugin("WorldEdit");
public static SpleggOG getPlugin() {
return worldEdit instanceof WorldEditPlugin ? (WorldEditPlugin) worldEdit : null;
// Pass instance of main to other classes.
return plugin;
}
}
public static SpleggOG getPlugin() {
// Pass instance of main to other classes.
return plugin;
}
}
File diff suppressed because it is too large. Load diff
+70 -70
View File
@@ -14,113 +14,113 @@ import utils.Utils;
public class GameManager {
SpleggOG splegg;
SpleggOG splegg;
public GameManager() {
public GameManager() {
splegg = SpleggOG.getPlugin();
splegg = SpleggOG.getPlugin();
}
}
public void startGame(Game game) {
public void startGame(Game game) {
Map map = game.getMap();
SpleggOG.getPlugin().getLogger().info("New game commencing in map: " + map);
game.startGameTimer();
Bukkit.getScheduler().cancelTask(game.counter);
game.status = Status.INGAME;
game.time = 901;
game.setLobbyCount(31);
int c = 1;
game.loadFloors();
Map map = game.getMap();
SpleggOG.getPlugin().getLogger().info("New game commencing in map: " + map);
game.startGameTimer();
Bukkit.getScheduler().cancelTask(game.counter);
game.status = Status.INGAME;
game.time = 901;
game.setLobbyCount(31);
int c = 1;
game.loadFloors();
Iterator<?> playersInGame = game.players.values().iterator();
SpleggPlayer sp;
while(playersInGame.hasNext()) {
Iterator<?> playersInGame = game.players.values().iterator();
SpleggPlayer sp;
while (playersInGame.hasNext()) {
sp = (SpleggPlayer) playersInGame.next();
sp = (SpleggPlayer) playersInGame.next();
sp.getPlayer().setLevel(0);
sp.getUtilPlayer().setAlive(true);
sp.getPlayer().setLevel(0);
sp.getUtilPlayer().setAlive(true);
if (c > map.getSpawnCount()) {
if (c > map.getSpawnCount()) {
c = 1;
c = 1;
}
}
sp.getPlayer().teleport(map.getSpawn(c));
c++;
sp.getPlayer().setLevel(0);
sp.getPlayer().setExp(0.0F);
sp.getPlayer().setGameMode(GameMode.ADVENTURE);
sp.getPlayer().getInventory().clear();
sp.getPlayer().teleport(map.getSpawn(c));
c++;
sp.getPlayer().setLevel(0);
sp.getPlayer().setExp(0.0F);
sp.getPlayer().setGameMode(GameMode.ADVENTURE);
sp.getPlayer().getInventory().clear();
}
}
game.getSign().update(map, false);
game.getSign().update(map, false);
splegg.chat.bc(splegg.getConfig().getString("Messages.InstructionsGame"), game);
splegg.chat.bc(splegg.getConfig().getString("Messages.InstructionsGame"), game);
}
}
public void stopGame(Game game, int r) {
public void stopGame(Game game, int r) {
SpleggOG.getPlugin().getLogger().info("Commencing shutdown of: " + game.getMap().getName() + ".");
SpleggOG.getPlugin().getLogger().info("Commencing shutdown of: " + game.getMap().getName() + ".");
game.status = Status.ENDING;
game.stopGameTimer();
game.time = 601;
game.setStatus(Status.LOBBY);
game.resetArena();
game.data.clear();
game.floor.clear();
game.setStarting(false);
game.status = Status.ENDING;
game.stopGameTimer();
game.time = 601;
game.setStatus(Status.LOBBY);
game.resetArena();
game.data.clear();
game.floor.clear();
game.setStarting(false);
Iterator<?> playersInGame = game.players.values().iterator();
while(playersInGame.hasNext()) {
Iterator<?> playersInGame = game.players.values().iterator();
while (playersInGame.hasNext()) {
SpleggPlayer sp = (SpleggPlayer) playersInGame.next();
UtilPlayer u = sp.getUtilPlayer();
game.leaveGame(u);
SpleggPlayer sp = (SpleggPlayer) playersInGame.next();
UtilPlayer u = sp.getUtilPlayer();
game.leaveGame(u);
}
}
if (! splegg.disabling) {
if (!splegg.disabling) {
game.getSign().update(game.map, true);
game.getSign().update(game.map, true);
}
}
game.players.clear();
game.players.clear();
SpleggOG.getPlugin().getLogger().info("Map " + game.map.getName() + " was reset.");
SpleggOG.getPlugin().getLogger().info("Map " + game.map.getName() + " was reset.");
}
}
public String getDigitTime(int count) {
public String getDigitTime(int count) {
int minutes = count / 60;
int seconds = count % 60;
int minutes = count / 60;
int seconds = count % 60;
String disMinu = (minutes < 10 ? "0" : "") + minutes;
String disSec = (seconds < 10 ? "0" : "") + seconds;
String formattedTime = disMinu + ":" + disSec;
String disMinu = (minutes < 10 ? "0" : "") + minutes;
String disSec = (seconds < 10 ? "0" : "") + seconds;
String formattedTime = disMinu + ":" + disSec;
return formattedTime;
return formattedTime;
}
}
public void ingameTimer(int count, HashMap<String, SpleggPlayer> players) {
public void ingameTimer(int count, HashMap<String, SpleggPlayer> players) {
Iterator<?> playersInGame = players.values().iterator();
while(playersInGame.hasNext()) {
Iterator<?> playersInGame = players.values().iterator();
while (playersInGame.hasNext()) {
SpleggPlayer sp = (SpleggPlayer) playersInGame.next();
Utils.spleggOGMessage(sp.getPlayer(), ("&6Splegg is ending in... " + splegg.game.getDigitTime(count)));
SpleggPlayer sp = (SpleggPlayer) playersInGame.next();
Utils.spleggOGMessage(sp.getPlayer(), ("&6Splegg is ending in... " + splegg.game.getDigitTime(count)));
}
}
}
}
}
+67 -67
View File
@@ -11,124 +11,124 @@ import utils.SpleggPlayer;
public class GameUtilities {
public HashMap<String, Game> GAMES = new HashMap<String, Game>();
public HashMap<String, Game> GAMES = new HashMap<String, Game>();
public Game getGame(String map) {
public Game getGame(String map) {
return (Game) this.GAMES.get(map);
return (Game) this.GAMES.get(map);
}
}
public void addGame(String map, Game game) {
public void addGame(String map, Game game) {
this.GAMES.put(map, game);
this.GAMES.put(map, game);
}
}
public SpleggPlayer getPlayer(Player player) {
public SpleggPlayer getPlayer(Player player) {
if (player == null) {
if (player == null) {
return null;
return null;
}
else {
} else {
SpleggPlayer sp = null;
Iterator<?> var4 = this.GAMES.values().iterator();
while(var4.hasNext()) {
SpleggPlayer sp = null;
Iterator<?> var4 = this.GAMES.values().iterator();
while (var4.hasNext()) {
Game games = (Game) var4.next();
Game games = (Game) var4.next();
Iterator<?> var6 = games.players.values().iterator();
while(var6.hasNext()) {
Iterator<?> var6 = games.players.values().iterator();
while (var6.hasNext()) {
SpleggPlayer sps = (SpleggPlayer) var6.next();
SpleggPlayer sps = (SpleggPlayer) var6.next();
if (sps.getPlayer().getName().equalsIgnoreCase(player.getName())) {
if (sps.getPlayer().getName().equalsIgnoreCase(player.getName())) {
sp = sps;
sp = sps;
}
}
}
}
}
}
return sp;
return sp;
}
}
}
}
public Game getMatchedGame(Player player) {
public Game getMatchedGame(Player player) {
Game game = null;
Iterator<?> var4 = this.GAMES.values().iterator();
Game game = null;
Iterator<?> var4 = this.GAMES.values().iterator();
while(var4.hasNext()) {
while (var4.hasNext()) {
Game g = (Game) var4.next();
if (g.players.containsKey(player.getName())) {
Game g = (Game) var4.next();
if (g.players.containsKey(player.getName())) {
game = g;
game = g;
}
}
}
}
return game;
return game;
}
}
public int howManyOpenGames() {
public int howManyOpenGames() {
ArrayList<Game> all = new ArrayList<Game>();
Iterator<?> var3 = this.GAMES.values().iterator();
while(var3.hasNext()) {
ArrayList<Game> all = new ArrayList<Game>();
Iterator<?> var3 = this.GAMES.values().iterator();
while (var3.hasNext()) {
Game games = (Game) var3.next();
if (games.getStatus() == Status.LOBBY) {
Game games = (Game) var3.next();
if (games.getStatus() == Status.LOBBY) {
all.add(games);
}
all.add(games);
}
}
return all.size();
}
}
return all.size();
public void checkWinner(Game game) {
}
int amountOfPlayersInGame = game.players.size();
if (amountOfPlayersInGame <= 1) {
public void checkWinner(Game game) {
if (amountOfPlayersInGame == 0) {
int amountOfPlayersInGame = game.players.size();
if (amountOfPlayersInGame <= 1) {
game.splegg.game.stopGame(game, 0);
if (amountOfPlayersInGame == 0) {
}
else {
game.splegg.game.stopGame(game, 0);
Iterator<?> playersLeft = game.players.values().iterator();
while(playersLeft.hasNext()) {
} else {
SpleggPlayer sp = (SpleggPlayer) playersLeft.next();
Iterator<?> playersLeft = game.players.values().iterator();
while (playersLeft.hasNext()) {
SpleggOG.getPlugin().getLogger().info("Winner who should be removed from the game: " + sp.getPlayer().getName());
SpleggPlayer sp = (SpleggPlayer) playersLeft.next();
game.leaveGame(sp.getUtilPlayer());
game.players.clear();
SpleggOG.getPlugin().getLogger()
.info("Winner who should be removed from the game: " + sp.getPlayer().getName());
}
game.leaveGame(sp.getUtilPlayer());
game.players.clear();
game.splegg.game.stopGame(game, 5);
}
}
game.splegg.game.stopGame(game, 5);
}
}
}
}
}
}
+42 -42
View File
@@ -5,74 +5,74 @@ import org.bukkit.block.data.BlockData;
public class Rollback {
private String world;
private Material previd;
private Material newid;
private BlockData prevdata;
private BlockData newdata;
private int x;
private int y;
private int z;
private String world;
private Material previd;
private Material newid;
private BlockData prevdata;
private BlockData newdata;
private int x;
private int y;
private int z;
public Rollback(String world, Material previd, BlockData prevdata, int x, int y, int z) {
public Rollback(String world, Material previd, BlockData prevdata, int x, int y, int z) {
this.world = world;
this.previd = previd;
this.prevdata = prevdata;
this.newid = Material.AIR;
this.newdata = null;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.previd = previd;
this.prevdata = prevdata;
this.newid = Material.AIR;
this.newdata = null;
this.x = x;
this.y = y;
this.z = z;
}
}
public String getWorld() {
public String getWorld() {
return this.world;
return this.world;
}
}
public BlockData getPrevdata() {
public BlockData getPrevdata() {
return this.prevdata;
return this.prevdata;
}
}
public BlockData getNewdata() {
public BlockData getNewdata() {
return this.newdata;
return this.newdata;
}
}
public Material getPrevid() {
public Material getPrevid() {
return this.previd;
return this.previd;
}
}
public Material getNewid() {
public Material getNewid() {
return this.newid;
return this.newid;
}
}
public int getX() {
public int getX() {
return this.x;
return this.x;
}
}
public int getY() {
public int getY() {
return this.y;
return this.y;
}
}
public int getZ() {
public int getZ() {
return this.z;
return this.z;
}
}
}
+1 -4
View File
@@ -2,9 +2,6 @@ package managers;
public enum Status {
DISABLED,
LOBBY,
INGAME,
ENDING;
DISABLED, LOBBY, INGAME, ENDING;
}
+23 -22
View File
@@ -5,46 +5,47 @@ import managers.Game;
public class GameTime implements Runnable {
SpleggOG splegg;
Game game;
SpleggOG splegg;
Game game;
public GameTime(SpleggOG splegg, Game game) {
public GameTime(SpleggOG splegg, Game game) {
this.splegg = splegg;
this.game = game;
this.splegg = splegg;
this.game = game;
}
}
public void run() {
public void run() {
if (game.getCount() > 0) {
if (game.getCount() > 0) {
splegg.games.checkWinner(game);
splegg.games.checkWinner(game);
if (game.getCount() % 300 == 0) {
if (game.getCount() % 300 == 0) {
splegg.game.ingameTimer(game.getCount(), game.getPlayers());
splegg.game.ingameTimer(game.getCount(), game.getPlayers());
}
}
if (game.getCount() % 30 == 0 && game.getCount() < 60) {
if (game.getCount() % 30 == 0 && game.getCount() < 60) {
splegg.game.ingameTimer(game.getCount(), game.getPlayers());
splegg.game.ingameTimer(game.getCount(), game.getPlayers());
}
}
if (game.getCount() <= 5 && game.getCount() >= 1) {
if (game.getCount() <= 5 && game.getCount() >= 1) {
splegg.chat.bc(splegg.getConfig().getString("Messages.EndingTimer").replaceAll("%timer%", String.valueOf(game.getCount())), game);
splegg.chat.bc(splegg.getConfig().getString("Messages.EndingTimer").replaceAll("%timer%",
String.valueOf(game.getCount())), game);
}
}
game.stopGameTimer();
game.stopGameTimer();
splegg.chat.bc(splegg.getConfig().getString("Messages.Timelimitreached"), game);
splegg.chat.bc(splegg.getConfig().getString("Messages.Timelimitreached"), game);
}
}
}
}
}
+50 -48
View File
@@ -11,84 +11,86 @@ import utils.SpleggPlayer;
public class LobbyCountdown implements Runnable {
int lobbycount;
Game game;
int lobbycount;
Game game;
public LobbyCountdown(SpleggOG splegg, Game game, int lobbycount) {
public LobbyCountdown(SpleggOG splegg, Game game, int lobbycount) {
this.game = game;
this.lobbycount = lobbycount;
this.game = game;
this.lobbycount = lobbycount;
}
}
public void run() {
public void run() {
if (this.lobbycount >= 1) {
if (this.lobbycount >= 1) {
this.lobbycount--;
this.game.setLobbyCount(this.lobbycount);
this.lobbycount--;
this.game.setLobbyCount(this.lobbycount);
SpleggPlayer sp;
Iterator<?> playersInGameIterator = this.game.getPlayers().values().iterator();
while(playersInGameIterator.hasNext()) {
SpleggPlayer sp;
Iterator<?> playersInGameIterator = this.game.getPlayers().values().iterator();
while (playersInGameIterator.hasNext()) {
sp = (SpleggPlayer) playersInGameIterator.next();
sp.getPlayer().setLevel(this.lobbycount);
sp.getPlayer().setExp((float) ((double) this.game.getLobbyCount() * 0.008D));
sp = (SpleggPlayer) playersInGameIterator.next();
sp.getPlayer().setLevel(this.lobbycount);
sp.getPlayer().setExp((float) ((double) this.game.getLobbyCount() * 0.008D));
}
}
this.game.getSign().update(this.game.getMap(), false);
this.game.getSign().update(this.game.getMap(), false);
if (this.lobbycount % 25 == 0) {
if (this.lobbycount % 25 == 0) {
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.LobbyTimer").replaceAll("%timer%", String.valueOf(this.lobbycount)), this.game);
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.LobbyTimer")
.replaceAll("%timer%", String.valueOf(this.lobbycount)), this.game);
}
}
if (this.lobbycount <= 10 && this.lobbycount >= 1) {
if (this.lobbycount <= 10 && this.lobbycount >= 1) {
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.LobbyTimer").replaceAll("%timer%", String.valueOf(this.lobbycount)), this.game);
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.LobbyTimer")
.replaceAll("%timer%", String.valueOf(this.lobbycount)), this.game);
playersInGameIterator = this.game.getPlayers().values().iterator();
while(playersInGameIterator.hasNext()) {
playersInGameIterator = this.game.getPlayers().values().iterator();
while (playersInGameIterator.hasNext()) {
sp = (SpleggPlayer) playersInGameIterator.next();
sp.getPlayer().playSound(sp.getPlayer().getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1.0F, 1.0F);
sp = (SpleggPlayer) playersInGameIterator.next();
sp.getPlayer().playSound(sp.getPlayer().getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1.0F,
1.0F);
}
}
}
}
if (this.lobbycount <= 0) {
if (this.lobbycount <= 0) {
playersInGameIterator = this.game.getPlayers().values().iterator();
while(playersInGameIterator.hasNext()) {
playersInGameIterator = this.game.getPlayers().values().iterator();
while (playersInGameIterator.hasNext()) {
sp = (SpleggPlayer) playersInGameIterator.next();
sp = (SpleggPlayer) playersInGameIterator.next();
}
}
}
}
}
else if ((this.game.getPlayers().size()) >= 2) {
} else if ((this.game.getPlayers().size()) >= 2) {
Bukkit.getScheduler().cancelTask(this.game.getCounterID());
SpleggOG.getPlugin().game.startGame(this.game);
Bukkit.getScheduler().cancelTask(this.game.getCounterID());
SpleggOG.getPlugin().game.startGame(this.game);
}
else {
} else {
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.NoEnoughPlayers"), this.game);
Bukkit.getScheduler().cancelTask(this.game.getCounterID());
SpleggOG.getPlugin().chat.bc(SpleggOG.getPlugin().getConfig().getString("Messages.NoEnoughPlayers"),
this.game);
Bukkit.getScheduler().cancelTask(this.game.getCounterID());
this.game.setStarting(false);
this.game.getSign().update(this.game.getMap(), false);
this.game.startCountdown();
this.game.setStarting(false);
this.game.getSign().update(this.game.getMap(), false);
this.game.startCountdown();
}
}
}
}
}
+136 -121
View File
@@ -18,196 +18,211 @@ import net.kyori.adventure.text.TextComponent;
public class LobbySign {
SpleggOG splegg;
Map map;
SpleggOG splegg;
Map map;
public LobbySign(Map map, SpleggOG s) {
public LobbySign(Map map, SpleggOG s) {
this.splegg = s;
this.map = map;
this.splegg = s;
this.map = map;
}
}
private static Collection<Material> signMaterials = new ArrayList<>();
static {
private static Collection<Material> signMaterials = new ArrayList<>();
static {
signMaterials.add(Material.ACACIA_SIGN);
signMaterials.add(Material.DARK_OAK_SIGN);
signMaterials.add(Material.OAK_SIGN);
signMaterials.add(Material.BIRCH_SIGN);
signMaterials.add(Material.SPRUCE_SIGN);
signMaterials.add(Material.JUNGLE_SIGN);
signMaterials.add(Material.CRIMSON_SIGN);
signMaterials.add(Material.WARPED_SIGN);
signMaterials.add(Material.ACACIA_WALL_SIGN);
signMaterials.add(Material.DARK_OAK_WALL_SIGN);
signMaterials.add(Material.OAK_WALL_SIGN);
signMaterials.add(Material.BIRCH_WALL_SIGN);
signMaterials.add(Material.SPRUCE_WALL_SIGN);
signMaterials.add(Material.JUNGLE_WALL_SIGN);
signMaterials.add(Material.CRIMSON_WALL_SIGN);
signMaterials.add(Material.WARPED_WALL_SIGN);
signMaterials.add(Material.ACACIA_SIGN);
signMaterials.add(Material.DARK_OAK_SIGN);
signMaterials.add(Material.OAK_SIGN);
signMaterials.add(Material.BIRCH_SIGN);
signMaterials.add(Material.SPRUCE_SIGN);
signMaterials.add(Material.JUNGLE_SIGN);
signMaterials.add(Material.CRIMSON_SIGN);
signMaterials.add(Material.WARPED_SIGN);
signMaterials.add(Material.ACACIA_WALL_SIGN);
signMaterials.add(Material.DARK_OAK_WALL_SIGN);
signMaterials.add(Material.OAK_WALL_SIGN);
signMaterials.add(Material.BIRCH_WALL_SIGN);
signMaterials.add(Material.SPRUCE_WALL_SIGN);
signMaterials.add(Material.JUNGLE_WALL_SIGN);
signMaterials.add(Material.CRIMSON_WALL_SIGN);
signMaterials.add(Material.WARPED_WALL_SIGN);
}
}
public void create(Location location, final Map map) {
public void create(Location location, final Map map) {
String loc = LobbySignUtils.get().locationToString(location);
this.splegg.maps.c.addSign(map.getName(), loc);
String loc = LobbySignUtils.get().locationToString(location);
this.splegg.maps.c.addSign(map.getName(), loc);
if (this.map == null) {
if (this.map == null) {
this.map = map;
this.map = map;
}
}
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.splegg, new Runnable() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.splegg, new Runnable() {
public void run() {
public void run() {
LobbySign.this.update(map, true);
LobbySign.this.update(map, true);
}
}
}, 5L);
}, 5L);
}
}
public void delete(Location location) {
public void delete(Location location) {
String loc = LobbySignUtils.get().locationToString(location);
this.splegg.maps.c.delSign(this.map.getName(), loc);
String loc = LobbySignUtils.get().locationToString(location);
this.splegg.maps.c.delSign(this.map.getName(), loc);
this.splegg.maps.c.saveMaps();
this.map = null;
this.splegg.maps.c.saveMaps();
this.map = null;
}
}
public void update(Map map, boolean force) {
public void update(Map map, boolean force) {
Iterator<?> var4 = this.splegg.maps.c.maps.getStringList("Signs." + map.getName() + ".lobby").iterator();
while(var4.hasNext()) {
Iterator<?> var4 = this.splegg.maps.c.maps.getStringList("Signs." + map.getName() + ".lobby").iterator();
while (var4.hasNext()) {
String loc = (String)var4.next();
Location location = LobbySignUtils.get().stringToLocation(loc);
if (! signMaterials.contains(location.getBlock().getType())) {
String loc = (String) var4.next();
Location location = LobbySignUtils.get().stringToLocation(loc);
if (!signMaterials.contains(location.getBlock().getType())) {
location.getBlock().setType(Material.OAK_WALL_SIGN);
location.getBlock().setType(Material.OAK_WALL_SIGN);
}
}
Sign s = (Sign) location.getBlock().getState();
String[] sign;
if (force) {
Sign s = (Sign) location.getBlock().getState();
String[] sign;
if (force) {
String[] array = new String[]{splegg.getConfig().getString("Sings.Restarting.1"), splegg.getConfig().getString("Sings.Restarting.2"), splegg.getConfig().getString("Sings.Restarting.3").replaceAll("%map%", map.getName()), splegg.getConfig().getString("Sings.Restarting.4")};
this.setSign(array, s);
sign = new String[4];
Game game = this.splegg.games.getGame(map.getName());
if (game == null) {
String[] array = new String[] { splegg.getConfig().getString("Sings.Restarting.1"),
splegg.getConfig().getString("Sings.Restarting.2"),
splegg.getConfig().getString("Sings.Restarting.3").replaceAll("%map%", map.getName()),
splegg.getConfig().getString("Sings.Restarting.4") };
this.setSign(array, s);
sign = new String[4];
Game game = this.splegg.games.getGame(map.getName());
if (game == null) {
sign[0] = "";
sign[1] = "&cPlease remove";
sign[2] = "&4this sign";
sign[3] = "";
sign[0] = "";
sign[1] = "&cPlease remove";
sign[2] = "&4this sign";
sign[3] = "";
}
else {
} else {
sign[0] = splegg.getConfig().getString("Sings.Format.1").replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName()).replaceAll("%count%/%maxcount%", this.getPlayers(game));
sign[1] = splegg.getConfig().getString("Sings.Format.2").replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName()).replaceAll("%count%/%maxcount%", this.getPlayers(game));
sign[2] = splegg.getConfig().getString("Sings.Format.3").replaceAll("%map%", map.getName()).replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%count%/%maxcount%", this.getPlayers(game));
sign[3] = splegg.getConfig().getString("Sings.Format.4").replaceAll("%count%/%maxcount%", this.getPlayers(game)).replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName());
sign[0] = splegg.getConfig().getString("Sings.Format.1")
.replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName())
.replaceAll("%count%/%maxcount%", this.getPlayers(game));
sign[1] = splegg.getConfig().getString("Sings.Format.2")
.replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName())
.replaceAll("%count%/%maxcount%", this.getPlayers(game));
sign[2] = splegg.getConfig().getString("Sings.Format.3").replaceAll("%map%", map.getName())
.replaceAll("%status%", this.getFancyStatus(game))
.replaceAll("%count%/%maxcount%", this.getPlayers(game));
sign[3] = splegg.getConfig().getString("Sings.Format.4")
.replaceAll("%count%/%maxcount%", this.getPlayers(game))
.replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName());
}
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this.splegg, new SignDelay(sign, s), 40L);
Bukkit.getScheduler().scheduleSyncDelayedTask(this.splegg, new SignDelay(sign, s), 40L);
}
else {
} else {
Game game = this.splegg.games.getGame(map.getName());
sign = new String[]{splegg.getConfig().getString("Sings.Format.1").replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName()).replaceAll("%count%/%maxcount%", this.getPlayers(game)), splegg.getConfig().getString("Sings.Format.2").replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName()).replaceAll("%count%/%maxcount%", this.getPlayers(game)), splegg.getConfig().getString("Sings.Format.3").replaceAll("%map%", map.getName()).replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%count%/%maxcount%", this.getPlayers(game)), splegg.getConfig().getString("Sings.Format.4").replaceAll("%count%/%maxcount%", this.getPlayers(game)).replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName())};
this.setSign(sign, s);
Game game = this.splegg.games.getGame(map.getName());
sign = new String[] {
splegg.getConfig().getString("Sings.Format.1").replaceAll("%status%", this.getFancyStatus(game))
.replaceAll("%map%", map.getName())
.replaceAll("%count%/%maxcount%", this.getPlayers(game)),
splegg.getConfig().getString("Sings.Format.2").replaceAll("%status%", this.getFancyStatus(game))
.replaceAll("%map%", map.getName())
.replaceAll("%count%/%maxcount%", this.getPlayers(game)),
splegg.getConfig().getString("Sings.Format.3").replaceAll("%map%", map.getName())
.replaceAll("%status%", this.getFancyStatus(game))
.replaceAll("%count%/%maxcount%", this.getPlayers(game)),
splegg.getConfig().getString("Sings.Format.4")
.replaceAll("%count%/%maxcount%", this.getPlayers(game))
.replaceAll("%status%", this.getFancyStatus(game)).replaceAll("%map%", map.getName()) };
this.setSign(sign, s);
}
}
}
}
}
}
private String getPlayers(Game game) {
private String getPlayers(Game game) {
String players = "";
if (game.getStatus() == Status.DISABLED) {
String players = "";
if (game.getStatus() == Status.DISABLED) {
players = "";
players = "";
}
else if (game.getMap().getSpawnCount() <= 1) {
} else if (game.getMap().getSpawnCount() <= 1) {
players = "Players: " + game.getPlayers().size();
players = "Players: " + game.getPlayers().size();
}
else {
} else {
players = game.getPlayers().size() + "/" + game.getMap().getSpawnCount();
players = game.getPlayers().size() + "/" + game.getMap().getSpawnCount();
}
}
return players;
return players;
}
}
private void setSign(String[] lines, Sign s) {
private void setSign(String[] lines, Sign s) {
for(int i = 0; i < lines.length; ++i) {
for (int i = 0; i < lines.length; ++i) {
TextComponent signLineContainer = Component.text(lines[i]);
s.line(i, signLineContainer);
TextComponent signLineContainer = Component.text(lines[i]);
s.line(i, signLineContainer);
}
}
s.update();
s.update();
}
}
private String getFancyStatus(Game game) {
private String getFancyStatus(Game game) {
String status = new String();
Status st = game.getStatus();
if (st == Status.LOBBY) {
String status = new String();
Status st = game.getStatus();
if (st == Status.LOBBY) {
if (game.isStarting()) {
if (game.isStarting()) {
status = splegg.getConfig().getString("Sings.Status.Join");
status = splegg.getConfig().getString("Sings.Status.Join");
}
else {
} else {
status = splegg.getConfig().getString("Sings.Status.Join");
status = splegg.getConfig().getString("Sings.Status.Join");
}
}
}
else if (st == Status.DISABLED) {
} else if (st == Status.DISABLED) {
status = splegg.getConfig().getString("Sings.Status.Disabled");
status = splegg.getConfig().getString("Sings.Status.Disabled");
}
else if (st == Status.INGAME) {
} else if (st == Status.INGAME) {
status = splegg.getConfig().getString("Sings.Status.Started");
status = splegg.getConfig().getString("Sings.Status.Started");
}
else {
} else {
status = "&2" + st.toString().toLowerCase();
status = "&2" + st.toString().toLowerCase();
}
}
return status;
return status;
}
}
}
+35 -35
View File
@@ -10,65 +10,65 @@ import main.SpleggOG;
public class LobbySignUtils {
public static LobbySignUtils lsu = new LobbySignUtils();
public static LobbySignUtils lsu = new LobbySignUtils();
public static LobbySignUtils get() {
public static LobbySignUtils get() {
return lsu;
return lsu;
}
}
public boolean isLobbySign(Location location, String name) {
public boolean isLobbySign(Location location, String name) {
String locString = this.locationToString(location);
List<String> signLocs = SpleggOG.getPlugin().maps.c.maps.getStringList("Signs." + name + ".lobby");
String locString = this.locationToString(location);
List<String> signLocs = SpleggOG.getPlugin().maps.c.maps.getStringList("Signs." + name + ".lobby");
return signLocs.contains(locString);
return signLocs.contains(locString);
}
}
public String locationToString(Location l) {
public String locationToString(Location l) {
String w = l.getWorld().getName();
String w = l.getWorld().getName();
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
return w + "." + x + "." + y + "." + z;
return w + "." + x + "." + y + "." + z;
}
}
public Location stringToLocation(String s) {
public Location stringToLocation(String s) {
String[] str = s.split("\\.");
String[] str = s.split("\\.");
World w = Bukkit.getServer().getWorld(str[0]);
World w = Bukkit.getServer().getWorld(str[0]);
int x = Integer.parseInt(str[1]);
int y = Integer.parseInt(str[2]);
int z = Integer.parseInt(str[3]);
int x = Integer.parseInt(str[1]);
int y = Integer.parseInt(str[2]);
int z = Integer.parseInt(str[3]);
return new Location(w, (double) x, (double) y, (double) z);
return new Location(w, (double) x, (double) y, (double) z);
}
}
public boolean compareLocations(Location one, Location two) {
public boolean compareLocations(Location one, Location two) {
String w = one.getWorld().getName();
String w = one.getWorld().getName();
int x = one.getBlockX();
int y = one.getBlockY();
int z = one.getBlockZ();
int x = one.getBlockX();
int y = one.getBlockY();
int z = one.getBlockZ();
String checkw = two.getWorld().getName();
String checkw = two.getWorld().getName();
int checkx = two.getBlockX();
int checky = two.getBlockY();
int checkz = two.getBlockZ();
int checkx = two.getBlockX();
int checky = two.getBlockY();
int checkz = two.getBlockZ();
return w.equalsIgnoreCase(checkw) && x == checkx && y == checky && z == checkz;
return w.equalsIgnoreCase(checkw) && x == checkx && y == checky && z == checkz;
}
}
}
+13 -13
View File
@@ -7,27 +7,27 @@ import net.kyori.adventure.text.TextComponent;
public class SignDelay implements Runnable {
String[] data;
Sign sign;
String[] data;
Sign sign;
public SignDelay(String[] data, Sign sign) {
public SignDelay(String[] data, Sign sign) {
this.data = data;
this.sign = sign;
this.data = data;
this.sign = sign;
}
}
public void run() {
public void run() {
for(int i = 0; i < this.data.length; i++) {
for (int i = 0; i < this.data.length; i++) {
TextComponent signData = Component.text(this.data[i]);
this.sign.line(i, signData);
TextComponent signData = Component.text(this.data[i]);
this.sign.line(i, signData);
}
}
this.sign.update();
this.sign.update();
}
}
}
+52 -52
View File
@@ -7,69 +7,69 @@ import org.bukkit.inventory.ItemStack;
public class InvStore {
public Player player;
public ItemStack[] inv;
public ItemStack[] armour;
public double health;
public int fire;
public int food;
public int level;
public float exp;
public GameMode gamemode;
public Player player;
public ItemStack[] inv;
public ItemStack[] armour;
public double health;
public int fire;
public int food;
public int level;
public float exp;
public GameMode gamemode;
public InvStore(Player player) {
public InvStore(Player player) {
this.player = player;
this.exp = 0.0F;
this.level = 0;
this.health = 0.0D;
this.food = 0;
this.fire = 0;
this.armour = null;
this.inv = null;
this.player = player;
this.exp = 0.0F;
this.level = 0;
this.health = 0.0D;
this.food = 0;
this.fire = 0;
this.armour = null;
this.inv = null;
}
}
public void load() {
public void load() {
this.player.getInventory().setContents(this.inv);
this.player.getInventory().setArmorContents(this.armour);
this.player.setExp(this.exp);
this.player.setLevel(this.level);
this.player.setHealthScale(this.health);
this.player.setFoodLevel(this.food);
this.player.setFireTicks(this.fire);
this.player.setGameMode(this.gamemode);
this.player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
this.player.updateInventory();
this.player.getInventory().setContents(this.inv);
this.player.getInventory().setArmorContents(this.armour);
this.player.setExp(this.exp);
this.player.setLevel(this.level);
this.player.setHealthScale(this.health);
this.player.setFoodLevel(this.food);
this.player.setFireTicks(this.fire);
this.player.setGameMode(this.gamemode);
this.player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
this.player.updateInventory();
}
}
public void save() {
public void save() {
this.inv = this.player.getInventory().getContents();
this.armour = this.player.getInventory().getArmorContents();
this.exp = this.player.getExp();
this.level = this.player.getLevel();
this.food = this.player.getFoodLevel();
this.fire = this.player.getFireTicks();
this.health = this.player.getHealthScale();
this.gamemode = this.player.getGameMode();
this.player.updateInventory();
this.inv = this.player.getInventory().getContents();
this.armour = this.player.getInventory().getArmorContents();
this.exp = this.player.getExp();
this.level = this.player.getLevel();
this.food = this.player.getFoodLevel();
this.fire = this.player.getFireTicks();
this.health = this.player.getHealthScale();
this.gamemode = this.player.getGameMode();
this.player.updateInventory();
}
}
public void reset() {
public void reset() {
this.exp = 0.0F;
this.level = 0;
this.health = 0.0D;
this.food = 0;
this.fire = 0;
this.gamemode = null;
this.armour = null;
this.inv = null;
this.exp = 0.0F;
this.level = 0;
this.health = 0.0D;
this.food = 0;
this.fire = 0;
this.gamemode = null;
this.armour = null;
this.inv = null;
}
}
}
+23 -23
View File
@@ -4,46 +4,46 @@ import org.bukkit.entity.Player;
public class SpleggPlayer {
UtilPlayer u;
int kills;
int broken;
UtilPlayer u;
int kills;
int broken;
public SpleggPlayer(UtilPlayer u) {
public SpleggPlayer(UtilPlayer u) {
this.u = u;
this.kills = 0;
this.broken = 0;
this.u = u;
this.kills = 0;
this.broken = 0;
}
}
public UtilPlayer getUtilPlayer() {
public UtilPlayer getUtilPlayer() {
return this.u;
return this.u;
}
}
public Player getPlayer() {
public Player getPlayer() {
return this.u.getPlayer();
return this.u.getPlayer();
}
}
public int getKills() {
public int getKills() {
return this.kills;
return this.kills;
}
}
public void setKills(int i) {
public void setKills(int i) {
this.kills = i;
this.kills = i;
}
}
public int getBroken() {
public int getBroken() {
return this.broken;
return this.broken;
}
}
}
+33 -33
View File
@@ -6,62 +6,62 @@ import managers.Game;
public class UtilPlayer {
Player player;
String name;
boolean alive;
Game game;
InvStore store;
Player player;
String name;
boolean alive;
Game game;
InvStore store;
public UtilPlayer(Player player) {
public UtilPlayer(Player player) {
this.player = player;
this.game = null;
this.name = player.getName();
this.alive = false;
this.store = new InvStore(player);
this.player = player;
this.game = null;
this.name = player.getName();
this.alive = false;
this.store = new InvStore(player);
}
}
public InvStore getStore() {
public InvStore getStore() {
return this.store;
return this.store;
}
}
public Player getPlayer() {
public Player getPlayer() {
return this.player;
return this.player;
}
}
public String getName() {
public String getName() {
return this.name;
return this.name;
}
}
public boolean isAlive() {
public boolean isAlive() {
return this.alive;
return this.alive;
}
}
public void setAlive(boolean a) {
public void setAlive(boolean a) {
this.alive = a;
this.alive = a;
}
}
public Game getGame() {
public Game getGame() {
return this.game;
return this.game;
}
}
public void setGame(Game game) {
public void setGame(Game game) {
this.game = game;
this.game = game;
}
}
}
+204 -203
View File
@@ -31,326 +31,327 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class Utils {
// Enable the conversion of text from config.yml to objects.
public FileConfiguration config = SpleggOG.getPlugin().getConfig();
public HashMap<String, UtilPlayer> PLAYERS = new HashMap<String, UtilPlayer>();
private File f;
public static String prefix = "&7[&eSplegg&f-&4OG&7] ";
// Enable the conversion of text from config.yml to objects.
public FileConfiguration config = SpleggOG.getPlugin().getConfig();
public HashMap<String, UtilPlayer> PLAYERS = new HashMap<String, UtilPlayer>();
private File f;
public static String prefix = "&7[&eSplegg&f-&4OG&7] ";
public void bc(String s) {
public void bc(String s) {
TextComponent prefixContainer = legacySerializerAnyCase(prefix + s);
Bukkit.broadcast(prefixContainer);
TextComponent prefixContainer = legacySerializerAnyCase(prefix + s);
Bukkit.broadcast(prefixContainer);
}
}
public void bc(String string, Game game) {
public void bc(String string, Game game) {
Iterator<?> playerIterator = SpleggOG.getPlugin().pm.PLAYERS.values().iterator();
while(playerIterator.hasNext()) {
Iterator<?> playerIterator = SpleggOG.getPlugin().pm.PLAYERS.values().iterator();
while (playerIterator.hasNext()) {
UtilPlayer u = (UtilPlayer) playerIterator.next();
if (u.getGame() == game && u.isAlive()) {
UtilPlayer u = (UtilPlayer) playerIterator.next();
if (u.getGame() == game && u.isAlive()) {
spleggOGMessage(u.getPlayer(), string);
spleggOGMessage(u.getPlayer(), string);
}
}
}
}
}
}
public void setup() {
public void setup() {
this.f = new File(SpleggOG.getPlugin().getDataFolder(), "spawns.yml");
this.f = new File(SpleggOG.getPlugin().getDataFolder(), "spawns.yml");
try {
try {
if (! this.f.exists()) {
if (!this.f.exists()) {
this.f.createNewFile();
this.f.createNewFile();
}
}
}
catch (IOException error) {
} catch (IOException error) {
SpleggOG.getPlugin().getLogger().severe("An error occured while creating spawns.yml.");
SpleggOG.getPlugin().getLogger().severe("An error occured while creating spawns.yml.");
}
}
reloadSpawns();
saveSpawns();
reloadSpawns();
reloadSpawns();
saveSpawns();
reloadSpawns();
}
}
private void reloadSpawns() {
private void reloadSpawns() {
this.config = YamlConfiguration.loadConfiguration(f);
this.config = YamlConfiguration.loadConfiguration(f);
}
}
private void saveSpawns() {
private void saveSpawns() {
try {
try {
this.config.save(f);
this.config.save(f);
}
catch (IOException error) {
} catch (IOException error) {
SpleggOG.getPlugin().getLogger().severe("An error occured while saving spawns.yml.");
SpleggOG.getPlugin().getLogger().severe("An error occured while saving spawns.yml.");
}
}
}
}
public void setLobby(Location l) {
public void setLobby(Location l) {
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
float yaw = l.getYaw();
float pitch = l.getPitch();
String worldName = l.getWorld().getName();
int x = l.getBlockX();
int y = l.getBlockY();
int z = l.getBlockZ();
float yaw = l.getYaw();
float pitch = l.getPitch();
String worldName = l.getWorld().getName();
this.config.set("Spawns.lobby.world", worldName);
this.config.set("Spawns.lobby.x", x);
this.config.set("Spawns.lobby.y", y);
this.config.set("Spawns.lobby.z", z);
this.config.set("Spawns.lobby.pitch", pitch);
this.config.set("Spawns.lobby.yaw", yaw);
this.config.set("Spawns.lobby.world", worldName);
this.config.set("Spawns.lobby.x", x);
this.config.set("Spawns.lobby.y", y);
this.config.set("Spawns.lobby.z", z);
this.config.set("Spawns.lobby.pitch", pitch);
this.config.set("Spawns.lobby.yaw", yaw);
saveSpawns();
saveSpawns();
}
}
public Location getLobby(Player player) {
public Location getLobby(Player player) {
int x = this.config.getInt("Spawns.lobby.x");
int y = this.config.getInt("Spawns.lobby.y");
int z = this.config.getInt("Spawns.lobby.z");
int x = this.config.getInt("Spawns.lobby.x");
int y = this.config.getInt("Spawns.lobby.y");
int z = this.config.getInt("Spawns.lobby.z");
float yaw = (float) this.config.getInt("Spawns.lobby.yaw");
float pitch = (float) this.config.getInt("Spawns.lobby.pitch");
float yaw = (float) this.config.getInt("Spawns.lobby.yaw");
float pitch = (float) this.config.getInt("Spawns.lobby.pitch");
World worldName = player.getWorld();
World worldName = player.getWorld();
return new Location(worldName, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
return new Location(worldName, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
}
}
public UtilPlayer getPlayer(String name) {
public UtilPlayer getPlayer(String name) {
return (UtilPlayer) this.PLAYERS.get(name);
return (UtilPlayer) this.PLAYERS.get(name);
}
}
public UtilPlayer getPlayer(Player player) {
public UtilPlayer getPlayer(Player player) {
return (UtilPlayer) this.PLAYERS.get(player.getName());
return (UtilPlayer) this.PLAYERS.get(player.getName());
}
}
// Sends a formatted message to the player (including name replacement).
public static void spleggOGMessage(Player p, String message) {
// Sends a formatted message to the player (including name replacement).
public static void spleggOGMessage(Player p, String message) {
p.sendMessage(legacySerializerAnyCase(prefix + message));
p.sendMessage(legacySerializerAnyCase(prefix + message));
}
}
public static TextComponent legacySerializerAnyCase(String subject) {
public static TextComponent legacySerializerAnyCase(String subject) {
int count = 0;
// Count the number of '&' characters to determine the size of the array
for (char c : subject.toCharArray()) {
int count = 0;
// Count the number of '&' characters to determine the size of the array
for (char c : subject.toCharArray()) {
if (c == '&') {
if (c == '&') {
count++;
count++;
}
}
}
}
// Create an array to store the positions of '&' characters
int[] positions = new int[count];
int index = 0;
// Find the positions of '&' characters and store in the array
for (int i = 0; i < subject.length(); i++) {
// Create an array to store the positions of '&' characters
int[] positions = new int[count];
int index = 0;
// Find the positions of '&' characters and store in the array
for (int i = 0; i < subject.length(); i++) {
if (subject.charAt(i) == '&') {
if (subject.charAt(i) == '&') {
if (isUpperBukkitCode(subject.charAt(i + 1))) {
if (isUpperBukkitCode(subject.charAt(i + 1))) {
subject = replaceCharAtIndex(subject, (i + 1), Character.toLowerCase(subject.charAt(i + 1)));
subject = replaceCharAtIndex(subject, (i + 1), Character.toLowerCase(subject.charAt(i + 1)));
}
}
positions[index++] = i;
positions[index++] = i;
}
}
}
}
return LegacyComponentSerializer.legacyAmpersand().deserialize(subject);
return LegacyComponentSerializer.legacyAmpersand().deserialize(subject);
}
}
private static boolean isUpperBukkitCode(char input) {
private static boolean isUpperBukkitCode(char input) {
char[] bukkitColorCodes = {'A', 'B', 'C', 'D', 'E', 'F', 'K', 'L', 'M', 'N', 'O', 'R'};
boolean match = false;
char[] bukkitColorCodes = { 'A', 'B', 'C', 'D', 'E', 'F', 'K', 'L', 'M', 'N', 'O', 'R' };
boolean match = false;
// Loop through each character in the array.
for (char c : bukkitColorCodes) {
// Check if the current character in the array is equal to the input character.
if (c == input) {
// Loop through each character in the array.
for (char c : bukkitColorCodes) {
match = true;
// Check if the current character in the array is equal to the input character.
if (c == input) {
}
match = true;
}
}
return match;
}
}
return match;
private static String replaceCharAtIndex(String original, int index, char newChar) {
}
// Check if the index is valid
if (index >= 0 && index < original.length()) {
private static String replaceCharAtIndex(String original, int index, char newChar) {
// Create a new string with the replaced character
return original.substring(0, index) + newChar + original.substring(index + 1);
// Check if the index is valid
if (index >= 0 && index < original.length()) {
}
// Create a new string with the replaced character
return original.substring(0, index) + newChar + original.substring(index + 1);
// If the index is invalid, return the original string
return original;
}
}
// If the index is invalid, return the original string
return original;
public static ItemStack getItem(Material material, String name, String lore) {
}
ItemStack stack = new ItemStack(material, 1);
ItemMeta meta = stack.getItemMeta();
TextComponent nameContainer = null;
TextComponent loreContainer = null;
try {
public static ItemStack getItem(Material material, String name, String lore) {
nameContainer = Component.text(name);
loreContainer = Component.text(lore);
ItemStack stack = new ItemStack(material, 1);
ItemMeta meta = stack.getItemMeta();
TextComponent nameContainer = null;
TextComponent loreContainer = null;
try {
}
catch(NullPointerException error) {
nameContainer = Component.text(name);
loreContainer = Component.text(lore);
SpleggOG.getPlugin().getLogger().severe("Failed to get Item information for: " + material + ".");
} catch (NullPointerException error) {
}
SpleggOG.getPlugin().getLogger().severe("Failed to get Item information for: " + material + ".");
meta.displayName(nameContainer);
meta.lore(Arrays.asList(loreContainer));
stack.setItemMeta(meta);
}
return stack;
meta.displayName(nameContainer);
meta.lore(Arrays.asList(loreContainer));
stack.setItemMeta(meta);
}
return stack;
public static void fireEgg(PlayerInteractEvent event, UtilPlayer u, Player player, ItemStack itemInHand) {
}
if(u.getGame() != null) {
public static void fireEgg(PlayerInteractEvent event, UtilPlayer u, Player player, ItemStack itemInHand) {
if(u.getGame().getStatus().equals(Status.INGAME) && u.isAlive()) {
if (u.getGame() != null) {
if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
if (u.getGame().getStatus().equals(Status.INGAME) && u.isAlive()) {
switch(itemInHand.getType()) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
case WOODEN_SHOVEL, STONE_SHOVEL, IRON_SHOVEL, GOLDEN_SHOVEL:
player.launchProjectile(Egg.class);
eggSound(player);
break;
case DIAMOND_SHOVEL:
for(int i = 0; i < 2; i = i + 1) {
switch (itemInHand.getType()) {
player.launchProjectile(Egg.class);
case WOODEN_SHOVEL, STONE_SHOVEL, IRON_SHOVEL, GOLDEN_SHOVEL:
player.launchProjectile(Egg.class);
eggSound(player);
break;
case DIAMOND_SHOVEL:
for (int i = 0; i < 2; i = i + 1) {
}
eggSound(player);
break;
case NETHERITE_SHOVEL:
for(int i = 0; i < 3; i = i + 1) {
player.launchProjectile(Egg.class);
player.launchProjectile(Egg.class);
}
eggSound(player);
break;
case NETHERITE_SHOVEL:
for (int i = 0; i < 3; i = i + 1) {
}
eggSound(player);
break;
default:
break;
player.launchProjectile(Egg.class);
}
}
eggSound(player);
break;
default:
break;
}
}
}
}
}
}
}
}
private static void eggSound(Player player) {
}
player.playSound(player.getLocation(), Sound.ENTITY_GHAST_SHOOT, 0.10F, 2.0F);
private static void eggSound(Player player) {
}
player.playSound(player.getLocation(), Sound.ENTITY_GHAST_SHOOT, 0.10F, 2.0F);
public static Inventory getShopInventory() {
}
// Create the GUI title.
TextComponent shopTitleComponent = legacySerializerAnyCase(SpleggOG.getPlugin().getConfig().getString("GUI.Shop.Title"));
String shopTitle = LegacyComponentSerializer.legacyAmpersand().serialize(shopTitleComponent);
public static Inventory getShopInventory() {
// Create the inventory.
Inventory shop = Bukkit.createInventory((InventoryHolder) null, 9, Component.text(shopTitle));
// Create the GUI title.
TextComponent shopTitleComponent = legacySerializerAnyCase(
SpleggOG.getPlugin().getConfig().getString("GUI.Shop.Title"));
String shopTitle = LegacyComponentSerializer.legacyAmpersand().serialize(shopTitleComponent);
// Get the item names and descriptions, then serialize them back to Strings.
String goldShovelNameComponent = LegacyComponentSerializer.legacyAmpersand().serialize(
legacySerializerAnyCase(SpleggOG.getPlugin().getConfig().getString("GUI.Shop.GoldShovel.Name"))
);
String goldShovelDescriptionComponent = LegacyComponentSerializer.legacyAmpersand().serialize(
legacySerializerAnyCase(SpleggOG.getPlugin().getConfig().getString("GUI.Shop.GoldShovel.Description")
.replaceAll("%price%", "&B" + String.valueOf(SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.GoldShovel.Price"))))
);
// Create the inventory.
Inventory shop = Bukkit.createInventory((InventoryHolder) null, 9, Component.text(shopTitle));
String diamondShovelNameComponent = LegacyComponentSerializer.legacyAmpersand().serialize(
legacySerializerAnyCase(SpleggOG.getPlugin().getConfig().getString("GUI.Shop.DiamondShovel.Name"))
);
String diamondShovelDescriptionComponent = LegacyComponentSerializer.legacyAmpersand().serialize(
legacySerializerAnyCase(SpleggOG.getPlugin().getConfig().getString("GUI.Shop.DiamondShovel.Description")
.replaceAll("%price%", "&B" + String.valueOf(SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.DiamondShovel.Price"))))
);
// Get the item names and descriptions, then serialize them back to Strings.
String goldShovelNameComponent = LegacyComponentSerializer.legacyAmpersand().serialize(
legacySerializerAnyCase(SpleggOG.getPlugin().getConfig().getString("GUI.Shop.GoldShovel.Name")));
String goldShovelDescriptionComponent = LegacyComponentSerializer.legacyAmpersand()
.serialize(legacySerializerAnyCase(SpleggOG.getPlugin().getConfig()
.getString("GUI.Shop.GoldShovel.Description").replaceAll("%price%", "&B" + String
.valueOf(SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.GoldShovel.Price")))));
// Present the serialized Strings to the user on the items.
shop.setItem(0, Utils.getItem(Material.GOLDEN_SHOVEL, goldShovelNameComponent, goldShovelDescriptionComponent));
shop.setItem(1, Utils.getItem(Material.DIAMOND_SHOVEL, diamondShovelNameComponent, diamondShovelDescriptionComponent));
String diamondShovelNameComponent = LegacyComponentSerializer.legacyAmpersand().serialize(
legacySerializerAnyCase(SpleggOG.getPlugin().getConfig().getString("GUI.Shop.DiamondShovel.Name")));
String diamondShovelDescriptionComponent = LegacyComponentSerializer.legacyAmpersand()
.serialize(legacySerializerAnyCase(SpleggOG.getPlugin().getConfig()
.getString("GUI.Shop.DiamondShovel.Description").replaceAll("%price%", "&B" + String
.valueOf(SpleggOG.getPlugin().getConfig().getInt("GUI.Shop.DiamondShovel.Price")))));
// Pass the shop to the player.
return shop;
// Present the serialized Strings to the user on the items.
shop.setItem(0, Utils.getItem(Material.GOLDEN_SHOVEL, goldShovelNameComponent, goldShovelDescriptionComponent));
shop.setItem(1,
Utils.getItem(Material.DIAMOND_SHOVEL, diamondShovelNameComponent, diamondShovelDescriptionComponent));
}
// Pass the shop to the player.
return shop;
// TODO: Spectator mode in listener.
/*private static Inventory getSpecInventory() {
}
TextComponent spectatorTitle = Component.text("Splegg - Spectators");
Inventory spec = Bukkit.createInventory((InventoryHolder) null, InventoryType.CHEST, spectatorTitle);
return spec;
}*/
// TODO: Spectator mode in listener.
/*
* private static Inventory getSpecInventory() {
*
* TextComponent spectatorTitle = Component.text("Splegg - Spectators");
* Inventory spec = Bukkit.createInventory((InventoryHolder) null,
* InventoryType.CHEST, spectatorTitle);
*
* return spec;
*
* }
*/
}