├── .gitignore
├── LICENSE
├── README.md
├── build.gradle.kts
├── buildSrc
├── build.gradle.kts
├── settings.gradle.kts
└── src
│ └── main
│ └── kotlin
│ ├── paper-plugin.gradle.kts
│ └── root-plugin.gradle.kts
├── changelog.md
├── contributing.md
├── description.md
├── gradle.properties
├── gradle
├── libs.versions.toml
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── paper
├── build.gradle.kts
├── run
│ ├── bukkit.yml
│ ├── config
│ │ ├── paper-global.yml
│ │ └── paper-world-defaults.yml
│ ├── eula.txt
│ ├── server.properties
│ └── spigot.yml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── badbones69
│ │ └── crazyenvoys
│ │ ├── CrazyEnvoys.java
│ │ ├── Methods.java
│ │ ├── api
│ │ ├── CrazyManager.java
│ │ ├── builders
│ │ │ ├── InventoryBuilder.java
│ │ │ └── types
│ │ │ │ └── PrizeGui.java
│ │ ├── enums
│ │ │ ├── Files.java
│ │ │ ├── Messages.java
│ │ │ ├── PersistentKeys.java
│ │ │ └── Properties.java
│ │ ├── events
│ │ │ ├── EnvoyEndEvent.java
│ │ │ ├── EnvoyOpenEvent.java
│ │ │ ├── EnvoyStartEvent.java
│ │ │ ├── FlareUseEvent.java
│ │ │ └── NewDropLocationEvent.java
│ │ └── objects
│ │ │ ├── CoolDownSettings.java
│ │ │ ├── EditorSettings.java
│ │ │ ├── FlareSettings.java
│ │ │ ├── ItemBuilder.java
│ │ │ ├── LocationSettings.java
│ │ │ └── misc
│ │ │ ├── Prize.java
│ │ │ └── Tier.java
│ │ ├── commands
│ │ ├── EnvoyCommand.java
│ │ └── EnvoyTab.java
│ │ ├── config
│ │ ├── ConfigManager.java
│ │ ├── beans
│ │ │ ├── ButtonProperty.java
│ │ │ └── GuiProperty.java
│ │ ├── migrate
│ │ │ ├── ConfigMigration.java
│ │ │ └── LocaleMigration.java
│ │ └── types
│ │ │ ├── ConfigKeys.java
│ │ │ └── MessageKeys.java
│ │ ├── listeners
│ │ ├── EnvoyClickListener.java
│ │ ├── EnvoyEditListener.java
│ │ ├── FireworkDamageListener.java
│ │ ├── FlareClickListener.java
│ │ └── timer
│ │ │ └── CountdownTimer.java
│ │ ├── support
│ │ ├── MetricsWrapper.java
│ │ ├── claims
│ │ │ └── WorldGuardSupport.java
│ │ ├── holograms
│ │ │ ├── HologramManager.java
│ │ │ └── types
│ │ │ │ ├── CMIHologramsSupport.java
│ │ │ │ ├── DecentHologramsSupport.java
│ │ │ │ └── FancyHologramsSupport.java
│ │ ├── interfaces
│ │ │ └── WorldGuardVersion.java
│ │ └── placeholders
│ │ │ └── PlaceholderAPISupport.java
│ │ └── util
│ │ ├── MiscUtils.java
│ │ └── MsgUtils.java
│ └── resources
│ ├── locale
│ ├── en-US.yml
│ └── pl-PL.yml
│ ├── plugin.yml
│ ├── tiers
│ ├── Basic.yml
│ ├── Lucky.yml
│ └── Titan.yml
│ └── users.yml
├── publish
└── build.gradle.kts
└── settings.gradle.kts
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Intellij
2 | .kotlin/
3 | .idea/
4 | !.idea/icon.png
5 |
6 | ### Gradle
7 | .gradle
8 | build/
9 |
10 | ### Servers
11 | run/
12 | !paper/run/config
13 | !paper/run/bukkit.yml
14 | !paper/run/eula.txt
15 | !paper/run/server.properties
16 | !paper/run/spigot.yml
17 |
18 | ### Output
19 | jars/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016-2023 CrazyCrew
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | 
4 |
5 | [![Contributors][contributors-shield]][contributors-url]
6 | [![Forks][forks-shield]][forks-url]
7 | [![Stargazers][stars-shield]][stars-url]
8 | [![Issues][issues-shield]][issues-url]
9 | [![MIT License][license-shield]][license-url]
10 | [](https://www.codefactor.io/repository/github/crazy-crew/crazyenvoys)
11 |
12 | **Drop custom crates with any prize you want all over spawn for players to fight over.**
13 |
14 | **Quick Links**
15 | [Request Features](https://github.com/Crazy-Crew/CrazyEnvoys/issues)
16 | [Documentation](https://docs.crazycrew.us/docs/category/crazyenvoys)
17 | [Developer API](https://docs.crazycrew.us/docs/plugins/crazyenvoys/guides/api/intro)
18 | [Report Bugs](https://github.com/Crazy-Crew/CrazyEnvoys/issues)
19 | [Trello Board](https://trello.com/b/BGDNUdaj/crazyenvoys)
20 |
21 | **Supported Platforms**
22 | [](https://papermc.io/)
23 | [](https://purpurmc.org/)
24 |
25 | [](https://billing.apexminecrafthosting.com/aff.php?aff=5511)
26 |
27 | **Initial Plugin Setup**
28 | CrazyEnvoys as first install will come with a set of default files such as `config.yml`, `messages.yml`, and files in the `tiers` folder.
29 | You can simply edit these files, and configure the looks and settings then do `/crazyenvoys reload`
30 |
31 | 
32 | **In-game location editing with multi user support.**
33 | **Unlimited locations & prizes.**
34 | **Configurable warning times.**
35 | **Configure the falling block & crate block.**
36 | **Ability to configure the firework colors.**
37 | **Customize almost every message.**
38 | **Signal Flares, Flares, Multiple tiers.**
39 | **Ability to have envoy claim cooldowns.**
40 | **Ability to have a grace period for envoys to prevent people rushing it.**
41 | **and so much more!**
42 |
43 | 
44 | Are you confused about something? Hop by the Discord and you might just get an answer!
45 | Please head to [crazy-envoys](https://discord.com/channels/182615261403283459/255937811428016130) with your question and do not cross post.
46 |
47 |
48 | Support Checklist
49 |
50 | Please check to make sure that your question wasn't asked before, You can use `Ctrl+F` on Discord to look for past conversations.
51 | Describe your issue in detail, Don't just make it a bread crumb trail that has to be questioned out of you.
52 | Plugin Version i.e. `CrazyEnvoys 3.3` **LATEST DOES NOT COUNT**
53 | Server Version & Server Type i.e. `Paper 1.21.1` or `Purpur 1.21.1` **LATEST DOES NOT COUNT**
54 | Send any console errors or files you have through https://mclo.gs/ - (We don't own the website, You have to copy the link and send it.)
55 |
56 |
57 |
58 |
59 | [](https://discord.gg/badbones-s-live-chat-182615261403283459)
60 |
61 |
62 | 
63 |
64 |
65 | [contributors-shield]: https://img.shields.io/github/contributors/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
66 | [contributors-url]: https://github.com/Crazy-Crew/CrazyEnvoys/graphs/contributors
67 | [forks-shield]: https://img.shields.io/github/forks/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
68 | [forks-url]: https://github.com/Crazy-Crew/CrazyEnvoys/network/members
69 | [stars-shield]: https://img.shields.io/github/stars/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
70 | [stars-url]: https://github.com/Crazy-Crew/CrazyEnvoys/stargazers
71 | [issues-shield]: https://img.shields.io/github/issues/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
72 | [issues-url]: https://github.com/Crazy-Crew/CrazyEnvoys/issues
73 | [license-shield]: https://img.shields.io/github/license/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
74 | [license-url]: https://github.com/Crazy-Crew/CrazyEnvoys/blob/main/LICENSE
75 |
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("root-plugin")
3 | }
4 |
5 | rootProject.group = "com.badbones69.crazyenvoys"
6 |
7 | val buildNumber: String? = System.getenv("BUILD_NUMBER")
8 | val isPublishing: String? = System.getenv("IS_PUBLISHING")
9 |
10 | rootProject.version = if (buildNumber != null && isPublishing == null) "${libs.versions.minecraft.get()}-$buildNumber" else rootProject.properties["version"].toString()
--------------------------------------------------------------------------------
/buildSrc/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | `kotlin-dsl`
3 | }
4 |
5 | dependencies {
6 | implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
7 | }
--------------------------------------------------------------------------------
/buildSrc/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | dependencyResolutionManagement {
2 | repositories {
3 | gradlePluginPortal()
4 | mavenCentral()
5 | }
6 |
7 | versionCatalogs {
8 | create("libs") {
9 | from(files("../gradle/libs.versions.toml"))
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/kotlin/paper-plugin.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.gradle.accessors.dm.LibrariesForLibs
2 |
3 | // Hack which exposes `libs` to this convention plugin
4 | val libs = the()
5 |
6 | plugins {
7 | id("root-plugin")
8 | }
9 |
10 | repositories {
11 | maven("https://repo.papermc.io/repository/maven-public/")
12 | }
13 |
14 | dependencies {
15 | compileOnly(libs.paper)
16 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/kotlin/root-plugin.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.gradle.accessors.dm.LibrariesForLibs
2 |
3 | // Hack which exposes `libs` to this convention plugin
4 | val libs = the()
5 |
6 | plugins {
7 | `java-library`
8 | }
9 |
10 | repositories {
11 | maven("https://repo.codemc.io/repository/maven-public/")
12 |
13 | maven("https://repo.crazycrew.us/libraries/")
14 | maven("https://repo.crazycrew.us/releases/")
15 |
16 | maven("https://jitpack.io/")
17 |
18 | mavenCentral()
19 | }
20 |
21 | java {
22 | toolchain.languageVersion.set(JavaLanguageVersion.of(21))
23 |
24 | withSourcesJar()
25 | withJavadocJar()
26 | }
27 |
28 | tasks {
29 | compileJava {
30 | options.encoding = Charsets.UTF_8.name()
31 | options.release.set(21)
32 | }
33 |
34 | javadoc {
35 | options.encoding = Charsets.UTF_8.name()
36 | }
37 |
38 | processResources {
39 | filteringCharset = Charsets.UTF_8.name()
40 | }
41 | }
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | - Add support for lists with left/ended in messages.yml. (it should automatically migrate)
2 | ```yml
3 | ended:
4 | - 'line 1'
5 | - 'line 2'
6 | ```
7 | - Converted `time-till-event` into a list in messages.yml. (it should automatically migrate)
--------------------------------------------------------------------------------
/contributing.md:
--------------------------------------------------------------------------------
1 | # Contributing to CrazyEnvoys
2 | Contributions to the project are always welcome, Pull Requests do have some guidelines before being approved.
3 |
4 | ## You should always create the fork as a personal repository not in an organization.
5 | Any pull request made by a fork in an organization prevents modifications. Everyone has their own way of doing things and rather asking you to change that. A personal fork lets us change the things
6 | that we have a tick about.
7 |
8 | If you do not use a personal fork, We have to manually merge your pull request which means it's marked as closed instead of merged.
9 |
10 | ## Requirements
11 | * `git`
12 | * Java 21 ( Adoptium or Corretto is recommended )
13 |
14 | Pull Requests must be labeled properly according to if it's a bug fix, a new feature or enhancements to the code base.
15 | * `git checkout -b fix/your_fix`
16 | * `git checkout -b feature/your_feature`
17 | * `git checkout -b quality/your_enhancement`
18 | * Commit your changes using `git commit -m 'your commit'`
19 | * Push to your branch using `git push`
20 | * Open a pull request to the `main` branch on our repository to add your change.
21 |
22 | You must explain what your pull request is changing and if needed, Supply a video of your change as Pull Requests are a way to get feedback.
--------------------------------------------------------------------------------
/description.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | 
4 |
5 | [![Contributors][contributors-shield]][contributors-url]
6 | [![Forks][forks-shield]][forks-url]
7 | [![Stargazers][stars-shield]][stars-url]
8 | [![Issues][issues-shield]][issues-url]
9 | [![MIT License][license-shield]][license-url]
10 | [](https://www.codefactor.io/repository/github/crazy-crew/crazyenvoys)
11 |
12 | **Drop custom crates with any prize you want all over spawn for players to fight over.**
13 |
14 | **Quick Links**
15 | [Request Features](https://github.com/Crazy-Crew/CrazyEnvoys/issues)
16 | [Documentation](https://docs.crazycrew.us/docs/category/crazyenvoys)
17 | [Developer API](https://docs.crazycrew.us/docs/plugins/crazyenvoys/guides/api/intro)
18 | [Report Bugs](https://github.com/Crazy-Crew/CrazyEnvoys/issues)
19 | [Trello Board](https://trello.com/b/BGDNUdaj/crazyenvoys)
20 |
21 | **Supported Platforms**
22 | [](https://papermc.io/)
23 | [](https://purpurmc.org/)
24 |
25 | [](https://billing.apexminecrafthosting.com/aff.php?aff=5511)
26 |
27 | **Initial Plugin Setup**
28 | CrazyEnvoys as first install will come with a set of default files such as `config.yml`, `messages.yml`, and files in the `tiers` folder.
29 | You can simply edit these files, and configure the looks and settings then do `/crazyenvoys reload`
30 |
31 | 
32 | **In-game location editing with multi user support.**
33 | **Unlimited locations & prizes.**
34 | **Configurable warning times.**
35 | **Configure the falling block & crate block.**
36 | **Ability to configure the firework colors.**
37 | **Customize almost every message.**
38 | **Signal Flares, Flares, Multiple tiers.**
39 | **Ability to have envoy claim cooldowns.**
40 | **Ability to have a grace period for envoys to prevent people rushing it.**
41 | **and so much more!**
42 |
43 | 
44 | Are you confused about something? Hop by the Discord and you might just get an answer!
45 | Please head to [crazy-envoys](https://discord.com/channels/182615261403283459/255937811428016130) with your question and do not cross post.
46 |
47 |
48 | Support Checklist
49 |
50 | Please check to make sure that your question wasn't asked before, You can use `Ctrl+F` on Discord to look for past conversations.
51 | Describe your issue in detail, Don't just make it a bread crumb trail that has to be questioned out of you.
52 | Plugin Version i.e. `CrazyEnvoys 3.3` **LATEST DOES NOT COUNT**
53 | Server Version & Server Type i.e. `Paper 1.21.1` or `Purpur 1.21.1` **LATEST DOES NOT COUNT**
54 | Send any console errors or files you have through https://mclo.gs/ - (We don't own the website, You have to copy the link and send it.)
55 |
56 |
57 |
58 |
59 | [](https://discord.gg/badbones-s-live-chat-182615261403283459)
60 |
61 |
62 | 
63 |
64 |
65 | [contributors-shield]: https://img.shields.io/github/contributors/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
66 | [contributors-url]: https://github.com/Crazy-Crew/CrazyEnvoys/graphs/contributors
67 | [forks-shield]: https://img.shields.io/github/forks/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
68 | [forks-url]: https://github.com/Crazy-Crew/CrazyEnvoys/network/members
69 | [stars-shield]: https://img.shields.io/github/stars/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
70 | [stars-url]: https://github.com/Crazy-Crew/CrazyEnvoys/stargazers
71 | [issues-shield]: https://img.shields.io/github/issues/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
72 | [issues-url]: https://github.com/Crazy-Crew/CrazyEnvoys/issues
73 | [license-shield]: https://img.shields.io/github/license/Crazy-Crew/CrazyEnvoys.svg?style=flat&logo=appveyor
74 | [license-url]: https://github.com/Crazy-Crew/CrazyEnvoys/blob/main/LICENSE
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | website=https://github.com/Crazy-Crew/CrazyCrates
2 | authors = ["ryderbelserion", "BadBones69", "TDL"]
3 | version=1.14.0
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [plugins]
2 | hangar = { id = "io.papermc.hangar-publish-plugin", version.ref = "hangar" }
3 | runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" }
4 | minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" }
5 | shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
6 |
7 | [versions]
8 | # Paper API
9 | paper = "1.21.4-R0.1-SNAPSHOT"
10 | velocity = "3.3.0-SNAPSHOT"
11 | minecraft = "1.21.4"
12 |
13 | # Gradle Plugins
14 | shadow = "9.0.0-beta12"
15 | runPaper = "2.3.1"
16 | minotaur = "2.8.7"
17 | hangar = "0.1.2"
18 |
19 | # Bukkit Plugins
20 | itemsadder = "3.6.3-beta-14"
21 | headdatabaseapi = "1.3.1"
22 | placeholderapi = "2.11.6"
23 | decentholograms = "2.8.8"
24 | fancyholograms = "2.4.1"
25 | worldguard = "7.0.10"
26 | oraxen = "1.171.0"
27 | vault = "1.7.1"
28 |
29 | # Libraries
30 | jetbrains = "24.1.0"
31 | adventure = "4.17.0"
32 | bStats = "3.1.0"
33 | vital = "2.0.1"
34 |
35 | [libraries]
36 | velocity = { module = "com.velocitypowered:velocity-api", version.ref = "velocity" }
37 | paper = { module = "io.papermc.paper:paper-api", version.ref = "paper" }
38 |
39 | # Kyori
40 | kyori-logger = { module = "net.kyori:adventure-text-logger-slf4j", version.ref = "adventure" }
41 | kyori-text = { module = "net.kyori:adventure-text-minimessage", version.ref = "adventure" }
42 | kyori-api = { module = "net.kyori:adventure-api", version.ref = "adventure" }
43 |
44 | # Plugins
45 | decent-holograms = { module = "com.github.decentsoftware-eu:decentholograms", version.ref = "decentholograms" }
46 | fancy-holograms = { module = "de.oliver:FancyHolograms", version.ref = "fancyholograms" }
47 | headdatabaseapi = { module = "com.arcaniax:HeadDatabase-API", version.ref = "headdatabaseapi" }
48 | placeholderapi = { module = "me.clip:placeholderapi", version.ref = "placeholderapi" }
49 | vault = { module = "com.github.MilkBowl:VaultAPI", version.ref = "vault" }
50 | itemsadder = { module = "com.github.LoneDev6:api-itemsadder", version.ref = "itemsadder" }
51 | oraxen = { module = "io.th0rgal:oraxen", version.ref = "oraxen" }
52 | worldguard = { module = "com.sk89q.worldguard:worldguard-bukkit", version.ref = "worldguard" }
53 | cmi-api = { module = "CMI-API:CMI-API", version = "9.7.4.1" }
54 | cmi-lib = { module = "CMILib:CMILib", version = "1.5.1.4" }
55 |
56 | # Libraries
57 | jetbrains = { module = "org.jetbrains:annotations", version.ref = "jetbrains" }
58 | metrics = { module = "org.bstats:bstats-bukkit", version.ref = "bStats" }
59 |
60 | vital-paper = { module = "com.ryderbelserion.vital:paper", version.ref = "vital" }
61 | vital-core = { module = "com.ryderbelserion.vital:core", version.ref = "vital" }
62 |
63 | [bundles]
64 | # Soft Depends
65 | dependencies = ["fancy-holograms", "decent-holograms", "cmi-lib", "cmi-api", "worldguard"]
66 |
67 | # Shared with the git submodules
68 | shared = ["headdatabaseapi", "placeholderapi", "oraxen"]
69 |
70 | # Adventure API
71 | adventure = ["kyori-api", "kyori-text", "kyori-logger"]
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Crazy-Crew/CrazyEnvoys/38300e1db7b89405e98cdf3fec5c08ddb718f6c3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90 | ' "$PWD" ) || exit
91 |
92 | # Use the maximum available, or set MAX_FD != -1 to use that value.
93 | MAX_FD=maximum
94 |
95 | warn () {
96 | echo "$*"
97 | } >&2
98 |
99 | die () {
100 | echo
101 | echo "$*"
102 | echo
103 | exit 1
104 | } >&2
105 |
106 | # OS specific support (must be 'true' or 'false').
107 | cygwin=false
108 | msys=false
109 | darwin=false
110 | nonstop=false
111 | case "$( uname )" in #(
112 | CYGWIN* ) cygwin=true ;; #(
113 | Darwin* ) darwin=true ;; #(
114 | MSYS* | MINGW* ) msys=true ;; #(
115 | NONSTOP* ) nonstop=true ;;
116 | esac
117 |
118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
119 |
120 |
121 | # Determine the Java command to use to start the JVM.
122 | if [ -n "$JAVA_HOME" ] ; then
123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
124 | # IBM's JDK on AIX uses strange locations for the executables
125 | JAVACMD=$JAVA_HOME/jre/sh/java
126 | else
127 | JAVACMD=$JAVA_HOME/bin/java
128 | fi
129 | if [ ! -x "$JAVACMD" ] ; then
130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
131 |
132 | Please set the JAVA_HOME variable in your environment to match the
133 | location of your Java installation."
134 | fi
135 | else
136 | JAVACMD=java
137 | if ! command -v java >/dev/null 2>&1
138 | then
139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
140 |
141 | Please set the JAVA_HOME variable in your environment to match the
142 | location of your Java installation."
143 | fi
144 | fi
145 |
146 | # Increase the maximum file descriptors if we can.
147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
148 | case $MAX_FD in #(
149 | max*)
150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151 | # shellcheck disable=SC2039,SC3045
152 | MAX_FD=$( ulimit -H -n ) ||
153 | warn "Could not query maximum file descriptor limit"
154 | esac
155 | case $MAX_FD in #(
156 | '' | soft) :;; #(
157 | *)
158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159 | # shellcheck disable=SC2039,SC3045
160 | ulimit -n "$MAX_FD" ||
161 | warn "Could not set maximum file descriptor limit to $MAX_FD"
162 | esac
163 | fi
164 |
165 | # Collect all arguments for the java command, stacking in reverse order:
166 | # * args from the command line
167 | # * the main class name
168 | # * -classpath
169 | # * -D...appname settings
170 | # * --module-path (only if needed)
171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
172 |
173 | # For Cygwin or MSYS, switch paths to Windows format before running java
174 | if "$cygwin" || "$msys" ; then
175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
177 |
178 | JAVACMD=$( cygpath --unix "$JAVACMD" )
179 |
180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
181 | for arg do
182 | if
183 | case $arg in #(
184 | -*) false ;; # don't mess with options #(
185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
186 | [ -e "$t" ] ;; #(
187 | *) false ;;
188 | esac
189 | then
190 | arg=$( cygpath --path --ignore --mixed "$arg" )
191 | fi
192 | # Roll the args list around exactly as many times as the number of
193 | # args, so each arg winds up back in the position where it started, but
194 | # possibly modified.
195 | #
196 | # NB: a `for` loop captures its iteration list before it begins, so
197 | # changing the positional parameters here affects neither the number of
198 | # iterations, nor the values presented in `arg`.
199 | shift # remove old arg
200 | set -- "$@" "$arg" # push replacement arg
201 | done
202 | fi
203 |
204 |
205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207 |
208 | # Collect all arguments for the java command:
209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210 | # and any embedded shellness will be escaped.
211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212 | # treated as '${Hostname}' itself on the command line.
213 |
214 | set -- \
215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
216 | -classpath "$CLASSPATH" \
217 | org.gradle.wrapper.GradleWrapperMain \
218 | "$@"
219 |
220 | # Stop when "xargs" is not available.
221 | if ! command -v xargs >/dev/null 2>&1
222 | then
223 | die "xargs is not available"
224 | fi
225 |
226 | # Use "xargs" to parse quoted args.
227 | #
228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
229 | #
230 | # In Bash we could simply go:
231 | #
232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
233 | # set -- "${ARGS[@]}" "$@"
234 | #
235 | # but POSIX shell has neither arrays nor command substitution, so instead we
236 | # post-process each arg (as a line of input to sed) to backslash-escape any
237 | # character that might be a shell metacharacter, then use eval to reverse
238 | # that process (while maintaining the separation between arguments), and wrap
239 | # the whole thing up as a single "set" statement.
240 | #
241 | # This will of course break if any of these variables contains a newline or
242 | # an unmatched quote.
243 | #
244 |
245 | eval "set -- $(
246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
247 | xargs -n1 |
248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
249 | tr '\n' ' '
250 | )" '"$@"'
251 |
252 | exec "$JAVACMD" "$@"
253 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/paper/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("paper-plugin")
3 |
4 | alias(libs.plugins.runPaper)
5 | alias(libs.plugins.shadow)
6 | }
7 |
8 | project.group = "${rootProject.group}"
9 | project.version = rootProject.version
10 | project.description = "Drop custom envoys with any prize you want all over spawn for players to fight over."
11 |
12 | repositories {
13 | maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
14 |
15 | maven("https://repo.fancyinnovations.com/releases/")
16 |
17 | maven("https://repo.oraxen.com/releases/")
18 |
19 | maven("https://maven.enginehub.org/repo/")
20 | }
21 |
22 | dependencies {
23 | implementation(libs.vital.paper)
24 |
25 | implementation(libs.metrics)
26 |
27 | compileOnly(libs.bundles.dependencies)
28 | compileOnly(libs.bundles.shared)
29 |
30 | compileOnly(libs.paper)
31 | }
32 |
33 | tasks {
34 | shadowJar {
35 | archiveBaseName.set(rootProject.name)
36 | archiveClassifier.set("")
37 |
38 | listOf(
39 | "com.ryderbelserion.vital",
40 | "org.bstats"
41 | ).forEach {
42 | relocate(it, "libs.$it")
43 | }
44 | }
45 |
46 | assemble {
47 | dependsOn(shadowJar)
48 |
49 | doLast {
50 | copy {
51 | from(shadowJar.get())
52 | into(rootProject.projectDir.resolve("jars"))
53 | }
54 | }
55 | }
56 |
57 | processResources {
58 | inputs.properties("name" to rootProject.name)
59 | inputs.properties("version" to project.version)
60 | inputs.properties("group" to project.group)
61 | inputs.properties("apiVersion" to libs.versions.minecraft.get())
62 | inputs.properties("description" to project.description)
63 | inputs.properties("authors" to rootProject.properties["authors"].toString())
64 | inputs.properties("website" to rootProject.properties["website"].toString())
65 |
66 | filesMatching("plugin.yml") {
67 | expand(inputs.properties)
68 | }
69 | }
70 |
71 | runPaper.folia.registerTask()
72 |
73 | runServer {
74 | jvmArgs("-Dnet.kyori.ansi.colorLevel=truecolor")
75 |
76 | defaultCharacterEncoding = Charsets.UTF_8.name()
77 |
78 | minecraftVersion(libs.versions.minecraft.get())
79 | }
80 | }
--------------------------------------------------------------------------------
/paper/run/bukkit.yml:
--------------------------------------------------------------------------------
1 | # This is the Bukkit configuration file in Paper.
2 | # As you can see, there's actually not that much to configure without any plugins.
3 | #
4 | # If you need help with the configuration or have any questions related to Paper,
5 | # join us in our Discord or check the docs page.
6 | #
7 | # File Reference: https://docs.papermc.io/paper/reference/bukkit-configuration/
8 | # Docs: https://docs.papermc.io/
9 | # Discord: https://discord.gg/papermc
10 | # Website: https://papermc.io/
11 |
12 | settings:
13 | allow-end: false
14 | warn-on-overload: false
15 | permissions-file: permissions.yml
16 | update-folder: update
17 | plugin-profiling: false
18 | connection-throttle: 4000
19 | query-plugins: true
20 | deprecated-verbose: default
21 | shutdown-message: Server closed
22 | minimum-api: none
23 | use-map-color-cache: true
24 | spawn-limits:
25 | monsters: 70
26 | animals: 10
27 | water-animals: 5
28 | water-ambient: 20
29 | water-underground-creature: 5
30 | axolotls: 5
31 | ambient: 15
32 | chunk-gc:
33 | period-in-ticks: 600
34 | ticks-per:
35 | animal-spawns: 400
36 | monster-spawns: 1
37 | water-spawns: 1
38 | water-ambient-spawns: 1
39 | water-underground-creature-spawns: 1
40 | axolotl-spawns: 1
41 | ambient-spawns: 1
42 | autosave: 6000
43 | aliases: now-in-commands.yml
44 |
--------------------------------------------------------------------------------
/paper/run/config/paper-global.yml:
--------------------------------------------------------------------------------
1 | # This is the global configuration file for Paper.
2 | # As you can see, there's a lot to configure. Some options may impact gameplay, so use
3 | # with caution, and make sure you know what each option does before configuring.
4 | #
5 | # If you need help with the configuration or have any questions related to Paper,
6 | # join us in our Discord or check the docs page.
7 | #
8 | # The world configuration options have been moved inside
9 | # their respective world folder. The files are named paper-world.yml
10 | #
11 | # File Reference: https://docs.papermc.io/paper/reference/global-configuration/
12 | # Docs: https://docs.papermc.io/
13 | # Discord: https://discord.gg/papermc
14 | # Website: https://papermc.io/
15 |
16 | _version: 29
17 | anticheat:
18 | obfuscation:
19 | items:
20 | all-models:
21 | also-obfuscate: []
22 | dont-obfuscate:
23 | - minecraft:lodestone_tracker
24 | sanitize-count: true
25 | enable-item-obfuscation: false
26 | model-overrides:
27 | minecraft:elytra:
28 | also-obfuscate: []
29 | dont-obfuscate:
30 | - minecraft:damage
31 | sanitize-count: true
32 | block-updates:
33 | disable-chorus-plant-updates: false
34 | disable-mushroom-block-updates: false
35 | disable-noteblock-updates: false
36 | disable-tripwire-updates: false
37 | chunk-loading-advanced:
38 | auto-config-send-distance: true
39 | player-max-concurrent-chunk-generates: 0
40 | player-max-concurrent-chunk-loads: 0
41 | chunk-loading-basic:
42 | player-max-chunk-generate-rate: -1.0
43 | player-max-chunk-load-rate: 100.0
44 | player-max-chunk-send-rate: 75.0
45 | chunk-system:
46 | gen-parallelism: default
47 | io-threads: -1
48 | worker-threads: -1
49 | collisions:
50 | enable-player-collisions: true
51 | send-full-pos-for-hard-colliding-entities: true
52 | commands:
53 | ride-command-allow-player-as-vehicle: false
54 | suggest-player-names-when-null-tab-completions: true
55 | time-command-affects-all-worlds: false
56 | console:
57 | enable-brigadier-completions: true
58 | enable-brigadier-highlighting: true
59 | has-all-permissions: false
60 | item-validation:
61 | book:
62 | author: 8192
63 | page: 16384
64 | title: 8192
65 | book-size:
66 | page-max: 2560
67 | total-multiplier: 0.98
68 | display-name: 8192
69 | lore-line: 8192
70 | resolve-selectors-in-books: false
71 | logging:
72 | deobfuscate-stacktraces: true
73 | messages:
74 | kick:
75 | authentication-servers-down:
76 | connection-throttle: Connection throttled! Please wait before reconnecting.
77 | flying-player:
78 | flying-vehicle:
79 | no-permission: I'm sorry, but you do not have permission to perform this command.
80 | Please contact the server administrators if you believe that this is in error.
81 | use-display-name-in-quit-message: false
82 | misc:
83 | chat-threads:
84 | chat-executor-core-size: -1
85 | chat-executor-max-size: -1
86 | client-interaction-leniency-distance: default
87 | compression-level: default
88 | fix-entity-position-desync: true
89 | load-permissions-yml-before-plugins: true
90 | max-joins-per-tick: 5
91 | region-file-cache-size: 256
92 | strict-advancement-dimension-check: false
93 | use-alternative-luck-formula: false
94 | use-dimension-type-for-custom-spawners: false
95 | packet-limiter:
96 | all-packets:
97 | action: KICK
98 | interval: 7.0
99 | max-packet-rate: 500.0
100 | kick-message:
101 | overrides:
102 | ServerboundPlaceRecipePacket:
103 | action: DROP
104 | interval: 4.0
105 | max-packet-rate: 5.0
106 | player-auto-save:
107 | max-per-tick: -1
108 | rate: -1
109 | proxies:
110 | bungee-cord:
111 | online-mode: true
112 | proxy-protocol: false
113 | velocity:
114 | enabled: false
115 | online-mode: true
116 | secret: ''
117 | scoreboards:
118 | save-empty-scoreboard-teams: true
119 | track-plugin-scoreboards: false
120 | spam-limiter:
121 | incoming-packet-threshold: 300
122 | recipe-spam-increment: 1
123 | recipe-spam-limit: 20
124 | tab-spam-increment: 1
125 | tab-spam-limit: 500
126 | spark:
127 | enable-immediately: false
128 | enabled: true
129 | unsupported-settings:
130 | allow-headless-pistons: false
131 | allow-permanent-block-break-exploits: false
132 | allow-piston-duplication: false
133 | allow-unsafe-end-portal-teleportation: false
134 | compression-format: ZLIB
135 | perform-username-validation: true
136 | simplify-remote-item-matching: false
137 | skip-tripwire-hook-placement-validation: false
138 | skip-vanilla-damage-tick-when-shield-blocked: false
139 | update-equipment-on-player-actions: true
140 | watchdog:
141 | early-warning-delay: 10000
142 | early-warning-every: 5000
143 |
--------------------------------------------------------------------------------
/paper/run/config/paper-world-defaults.yml:
--------------------------------------------------------------------------------
1 | # This is the world defaults configuration file for Paper.
2 | # As you can see, there's a lot to configure. Some options may impact gameplay, so use
3 | # with caution, and make sure you know what each option does before configuring.
4 | #
5 | # If you need help with the configuration or have any questions related to Paper,
6 | # join us in our Discord or check the docs page.
7 | #
8 | # Configuration options here apply to all worlds, unless you specify overrides inside
9 | # the world-specific config file inside each world folder.
10 | #
11 | # File Reference: https://docs.papermc.io/paper/reference/world-configuration/
12 | # Docs: https://docs.papermc.io/
13 | # Discord: https://discord.gg/papermc
14 | # Website: https://papermc.io/
15 |
16 | _version: 31
17 | anticheat:
18 | anti-xray:
19 | enabled: false
20 | engine-mode: 1
21 | hidden-blocks:
22 | - copper_ore
23 | - deepslate_copper_ore
24 | - raw_copper_block
25 | - gold_ore
26 | - deepslate_gold_ore
27 | - iron_ore
28 | - deepslate_iron_ore
29 | - raw_iron_block
30 | - coal_ore
31 | - deepslate_coal_ore
32 | - lapis_ore
33 | - deepslate_lapis_ore
34 | - mossy_cobblestone
35 | - obsidian
36 | - chest
37 | - diamond_ore
38 | - deepslate_diamond_ore
39 | - redstone_ore
40 | - deepslate_redstone_ore
41 | - clay
42 | - emerald_ore
43 | - deepslate_emerald_ore
44 | - ender_chest
45 | lava-obscures: false
46 | max-block-height: 64
47 | replacement-blocks:
48 | - stone
49 | - oak_planks
50 | - deepslate
51 | update-radius: 2
52 | use-permission: false
53 | chunks:
54 | auto-save-interval: default
55 | delay-chunk-unloads-by: 10s
56 | entity-per-chunk-save-limit:
57 | arrow: -1
58 | ender_pearl: -1
59 | experience_orb: -1
60 | fireball: -1
61 | small_fireball: -1
62 | snowball: -1
63 | fixed-chunk-inhabited-time: -1
64 | flush-regions-on-save: false
65 | max-auto-save-chunks-per-tick: 24
66 | prevent-moving-into-unloaded-chunks: false
67 | collisions:
68 | allow-player-cramming-damage: false
69 | allow-vehicle-collisions: true
70 | fix-climbing-bypassing-cramming-rule: false
71 | max-entity-collisions: 8
72 | only-players-collide: false
73 | command-blocks:
74 | force-follow-perm-level: true
75 | permissions-level: 2
76 | entities:
77 | armor-stands:
78 | do-collision-entity-lookups: true
79 | tick: true
80 | behavior:
81 | allow-spider-world-border-climbing: true
82 | baby-zombie-movement-modifier: 0.5
83 | cooldown-failed-beehive-releases: true
84 | disable-chest-cat-detection: false
85 | disable-creeper-lingering-effect: false
86 | disable-player-crits: false
87 | door-breaking-difficulty:
88 | husk:
89 | - HARD
90 | vindicator:
91 | - NORMAL
92 | - HARD
93 | zombie:
94 | - HARD
95 | zombie_villager:
96 | - HARD
97 | zombified_piglin:
98 | - HARD
99 | ender-dragons-death-always-places-dragon-egg: false
100 | experience-merge-max-value: -1
101 | mobs-can-always-pick-up-loot:
102 | skeletons: false
103 | zombies: false
104 | nerf-pigmen-from-nether-portals: false
105 | only-merge-items-horizontally: false
106 | parrots-are-unaffected-by-player-movement: false
107 | phantoms-do-not-spawn-on-creative-players: true
108 | phantoms-only-attack-insomniacs: true
109 | phantoms-spawn-attempt-max-seconds: 119
110 | phantoms-spawn-attempt-min-seconds: 60
111 | piglins-guard-chests: true
112 | pillager-patrols:
113 | disable: false
114 | spawn-chance: 0.2
115 | spawn-delay:
116 | per-player: false
117 | ticks: 12000
118 | start:
119 | day: 5
120 | per-player: false
121 | player-insomnia-start-ticks: 72000
122 | should-remove-dragon: false
123 | spawner-nerfed-mobs-should-jump: false
124 | zombie-villager-infection-chance: default
125 | zombies-target-turtle-eggs: true
126 | markers:
127 | tick: true
128 | mob-effects:
129 | immune-to-wither-effect:
130 | wither: true
131 | wither-skeleton: true
132 | spiders-immune-to-poison-effect: true
133 | sniffer:
134 | boosted-hatch-time: default
135 | hatch-time: default
136 | spawning:
137 | all-chunks-are-slime-chunks: false
138 | alt-item-despawn-rate:
139 | enabled: false
140 | items:
141 | cobblestone: 300
142 | count-all-mobs-for-spawning: false
143 | creative-arrow-despawn-rate: default
144 | despawn-range-shape: ELLIPSOID
145 | despawn-ranges:
146 | ambient:
147 | hard: default
148 | soft: default
149 | axolotls:
150 | hard: default
151 | soft: default
152 | creature:
153 | hard: default
154 | soft: default
155 | misc:
156 | hard: default
157 | soft: default
158 | monster:
159 | hard: default
160 | soft: default
161 | underground_water_creature:
162 | hard: default
163 | soft: default
164 | water_ambient:
165 | hard: default
166 | soft: default
167 | water_creature:
168 | hard: default
169 | soft: default
170 | despawn-time:
171 | llama_spit: disabled
172 | snowball: disabled
173 | disable-mob-spawner-spawn-egg-transformation: false
174 | duplicate-uuid:
175 | mode: SAFE_REGEN
176 | safe-regen-delete-range: 32
177 | filter-bad-tile-entity-nbt-from-falling-blocks: true
178 | filtered-entity-tag-nbt-paths:
179 | - Pos
180 | - Motion
181 | - sleeping_pos
182 | iron-golems-can-spawn-in-air: false
183 | monster-spawn-max-light-level: default
184 | non-player-arrow-despawn-rate: default
185 | per-player-mob-spawns: true
186 | scan-for-legacy-ender-dragon: true
187 | skeleton-horse-thunder-spawn-chance: default
188 | slime-spawn-height:
189 | slime-chunk:
190 | maximum: 40.0
191 | surface-biome:
192 | maximum: 70.0
193 | minimum: 50.0
194 | spawn-limits:
195 | ambient: -1
196 | axolotls: -1
197 | creature: -1
198 | monster: -1
199 | underground_water_creature: -1
200 | water_ambient: -1
201 | water_creature: -1
202 | ticks-per-spawn:
203 | ambient: -1
204 | axolotls: -1
205 | creature: -1
206 | monster: -1
207 | underground_water_creature: -1
208 | water_ambient: -1
209 | water_creature: -1
210 | wandering-trader:
211 | spawn-chance-failure-increment: 25
212 | spawn-chance-max: 75
213 | spawn-chance-min: 25
214 | spawn-day-length: 24000
215 | spawn-minute-length: 1200
216 | wateranimal-spawn-height:
217 | maximum: default
218 | minimum: default
219 | tracking-range-y:
220 | animal: default
221 | display: default
222 | enabled: false
223 | misc: default
224 | monster: default
225 | other: default
226 | player: default
227 | environment:
228 | disable-explosion-knockback: false
229 | disable-ice-and-snow: false
230 | disable-thunder: false
231 | fire-tick-delay: 30
232 | frosted-ice:
233 | delay:
234 | max: 40
235 | min: 20
236 | enabled: true
237 | generate-flat-bedrock: false
238 | locate-structures-outside-world-border: false
239 | max-block-ticks: 65536
240 | max-fluid-ticks: 65536
241 | nether-ceiling-void-damage-height: disabled
242 | optimize-explosions: false
243 | portal-create-radius: 16
244 | portal-search-radius: 128
245 | portal-search-vanilla-dimension-scaling: true
246 | treasure-maps:
247 | enabled: true
248 | find-already-discovered:
249 | loot-tables: default
250 | villager-trade: false
251 | void-damage-amount: 4.0
252 | void-damage-min-build-height-offset: -64.0
253 | water-over-lava-flow-speed: 5
254 | feature-seeds:
255 | generate-random-seeds-for-all: false
256 | fishing-time-range:
257 | maximum: 600
258 | minimum: 100
259 | fixes:
260 | disable-unloaded-chunk-enderpearl-exploit: false
261 | falling-block-height-nerf: disabled
262 | fix-items-merging-through-walls: false
263 | prevent-tnt-from-moving-in-water: false
264 | split-overstacked-loot: true
265 | tnt-entity-height-nerf: disabled
266 | hopper:
267 | cooldown-when-full: true
268 | disable-move-event: false
269 | ignore-occluding-blocks: false
270 | lootables:
271 | auto-replenish: false
272 | max-refills: -1
273 | refresh-max: 2d
274 | refresh-min: 12h
275 | reset-seed-on-fill: true
276 | restrict-player-reloot: true
277 | restrict-player-reloot-time: disabled
278 | retain-unlooted-shulker-box-loot-table-on-non-player-break: true
279 | maps:
280 | item-frame-cursor-limit: 128
281 | item-frame-cursor-update-interval: 10
282 | max-growth-height:
283 | bamboo:
284 | max: 16
285 | min: 11
286 | cactus: 3
287 | reeds: 3
288 | misc:
289 | alternate-current-update-order: HORIZONTAL_FIRST_OUTWARD
290 | disable-end-credits: false
291 | disable-relative-projectile-velocity: false
292 | disable-sprint-interruption-on-attack: false
293 | legacy-ender-pearl-behavior: false
294 | max-leash-distance: default
295 | redstone-implementation: VANILLA
296 | shield-blocking-delay: 5
297 | show-sign-click-command-failure-msgs-to-player: false
298 | update-pathfinding-on-block-update: true
299 | scoreboards:
300 | allow-non-player-entities-on-scoreboards: true
301 | use-vanilla-world-scoreboard-name-coloring: false
302 | spawn:
303 | allow-using-signs-inside-spawn-protection: false
304 | tick-rates:
305 | behavior:
306 | villager:
307 | validatenearbypoi: -1
308 | container-update: 1
309 | dry-farmland: 1
310 | grass-spread: 1
311 | mob-spawner: 1
312 | sensor:
313 | villager:
314 | secondarypoisensor: 40
315 | wet-farmland: 1
316 | unsupported-settings:
317 | disable-world-ticking-when-empty: false
318 | fix-invulnerable-end-crystal-exploit: true
319 |
--------------------------------------------------------------------------------
/paper/run/eula.txt:
--------------------------------------------------------------------------------
1 | #By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
2 | #Tue Apr 15 20:52:02 EDT 2025
3 | eula=true
--------------------------------------------------------------------------------
/paper/run/server.properties:
--------------------------------------------------------------------------------
1 | #Minecraft server properties
2 | #Tue Apr 22 01:32:45 EDT 2025
3 | accepts-transfers=false
4 | allow-flight=false
5 | allow-nether=false
6 | broadcast-console-to-ops=false
7 | broadcast-rcon-to-ops=false
8 | bug-report-link=
9 | debug=false
10 | difficulty=peaceful
11 | enable-command-block=false
12 | enable-jmx-monitoring=false
13 | enable-query=false
14 | enable-rcon=false
15 | enable-status=true
16 | enforce-secure-profile=true
17 | enforce-whitelist=false
18 | entity-broadcast-range-percentage=100
19 | force-gamemode=false
20 | function-permission-level=2
21 | gamemode=survival
22 | generate-structures=false
23 | generator-settings={}
24 | hardcore=false
25 | hide-online-players=false
26 | initial-disabled-packs=
27 | initial-enabled-packs=vanilla
28 | level-name=world
29 | level-seed=
30 | level-type=minecraft\:normal
31 | log-ips=false
32 | max-chained-neighbor-updates=1000000
33 | max-players=20
34 | max-tick-time=60000
35 | max-world-size=29999984
36 | motd=A Minecraft Server
37 | network-compression-threshold=256
38 | online-mode=true
39 | op-permission-level=4
40 | pause-when-empty-seconds=-1
41 | player-idle-timeout=0
42 | prevent-proxy-connections=false
43 | pvp=false
44 | query.port=25565
45 | rate-limit=0
46 | rcon.password=
47 | rcon.port=25575
48 | region-file-compression=deflate
49 | require-resource-pack=false
50 | resource-pack=
51 | resource-pack-id=
52 | resource-pack-prompt=
53 | resource-pack-sha1=
54 | server-ip=
55 | server-port=25565
56 | simulation-distance=4
57 | spawn-monsters=false
58 | spawn-protection=0
59 | sync-chunk-writes=false
60 | text-filtering-config=
61 | text-filtering-version=0
62 | use-native-transport=true
63 | view-distance=12
64 | white-list=false
65 |
--------------------------------------------------------------------------------
/paper/run/spigot.yml:
--------------------------------------------------------------------------------
1 | # This is the Spigot configuration file for Paper.
2 | # As you can see, there's tons to configure. Some options may impact gameplay, so use
3 | # with caution, and make sure you know what each option does before configuring.
4 | #
5 | # If you need help with the configuration or have any questions related to Paper,
6 | # join us in our Discord or check the docs page.
7 | #
8 | # File Reference: https://docs.papermc.io/paper/reference/spigot-configuration/
9 | # Docs: https://docs.papermc.io/
10 | # Discord: https://discord.gg/papermc
11 | # Website: https://papermc.io/
12 |
13 | settings:
14 | debug: false
15 | save-user-cache-on-stop-only: false
16 | log-villager-deaths: false
17 | log-named-deaths: false
18 | timeout-time: 60
19 | restart-on-crash: false
20 | restart-script: ./start.sh
21 | moved-wrongly-threshold: 0.0625
22 | moved-too-quickly-multiplier: 10.0
23 | player-shuffle: 0
24 | user-cache-size: 1000
25 | attribute:
26 | maxAbsorption:
27 | max: 2048.0
28 | maxHealth:
29 | max: 1024.0
30 | movementSpeed:
31 | max: 1024.0
32 | attackDamage:
33 | max: 2048.0
34 | netty-threads: 4
35 | bungeecord: false
36 | sample-count: 12
37 | world-settings:
38 | default:
39 | below-zero-generation-in-existing-chunks: true
40 | dragon-death-sound-radius: 0
41 | hanging-tick-frequency: 100
42 | end-portal-sound-radius: 0
43 | wither-spawn-sound-radius: 0
44 | max-tnt-per-tick: 100
45 | max-tick-time:
46 | tile: 50
47 | entity: 50
48 | thunder-chance: 100000
49 | unload-frozen-chunks: false
50 | entity-tracking-range:
51 | players: 128
52 | animals: 96
53 | monsters: 96
54 | misc: 96
55 | display: 128
56 | other: 64
57 | entity-activation-range:
58 | animals: 32
59 | monsters: 32
60 | raiders: 64
61 | misc: 16
62 | water: 16
63 | villagers: 32
64 | flying-monsters: 32
65 | wake-up-inactive:
66 | animals-max-per-tick: 4
67 | animals-every: 1200
68 | animals-for: 100
69 | monsters-max-per-tick: 8
70 | monsters-every: 400
71 | monsters-for: 100
72 | villagers-max-per-tick: 4
73 | villagers-every: 600
74 | villagers-for: 100
75 | flying-monsters-max-per-tick: 8
76 | flying-monsters-every: 200
77 | flying-monsters-for: 100
78 | villagers-work-immunity-after: 100
79 | villagers-work-immunity-for: 20
80 | villagers-active-for-panic: true
81 | tick-inactive-villagers: true
82 | ignore-spectators: false
83 | growth:
84 | cactus-modifier: 100
85 | cane-modifier: 100
86 | melon-modifier: 100
87 | mushroom-modifier: 100
88 | pumpkin-modifier: 100
89 | sapling-modifier: 100
90 | beetroot-modifier: 100
91 | carrot-modifier: 100
92 | potato-modifier: 100
93 | torchflower-modifier: 100
94 | wheat-modifier: 100
95 | netherwart-modifier: 100
96 | vine-modifier: 100
97 | cocoa-modifier: 100
98 | bamboo-modifier: 100
99 | sweetberry-modifier: 100
100 | kelp-modifier: 100
101 | twistingvines-modifier: 100
102 | weepingvines-modifier: 100
103 | cavevines-modifier: 100
104 | glowberry-modifier: 100
105 | pitcherplant-modifier: 100
106 | seed-village: 10387312
107 | seed-desert: 14357617
108 | seed-igloo: 14357618
109 | seed-jungle: 14357619
110 | seed-swamp: 14357620
111 | seed-monument: 10387313
112 | seed-shipwreck: 165745295
113 | seed-ocean: 14357621
114 | seed-outpost: 165745296
115 | seed-endcity: 10387313
116 | seed-slime: 987234911
117 | seed-nether: 30084232
118 | seed-mansion: 10387319
119 | seed-fossil: 14357921
120 | seed-portal: 34222645
121 | seed-ancientcity: 20083232
122 | seed-trailruins: 83469867
123 | seed-trialchambers: 94251327
124 | seed-buriedtreasure: 10387320
125 | seed-mineshaft: default
126 | seed-stronghold: default
127 | zombie-aggressive-towards-villager: true
128 | enable-zombie-pigmen-portal-spawns: true
129 | view-distance: default
130 | simulation-distance: default
131 | hunger:
132 | jump-walk-exhaustion: 0.05
133 | jump-sprint-exhaustion: 0.2
134 | combat-exhaustion: 0.1
135 | regen-exhaustion: 6.0
136 | swim-multiplier: 0.01
137 | sprint-multiplier: 0.1
138 | other-multiplier: 0.0
139 | ticks-per:
140 | hopper-transfer: 8
141 | hopper-check: 1
142 | hopper-amount: 1
143 | hopper-can-load-chunks: false
144 | merge-radius:
145 | item: 0.5
146 | exp: -1.0
147 | mob-spawn-range: 8
148 | item-despawn-rate: 6000
149 | arrow-despawn-rate: 1200
150 | trident-despawn-rate: 1200
151 | nerf-spawner-mobs: false
152 | verbose: false
153 | messages:
154 | restart: Server is restarting
155 | whitelist: You are not whitelisted on this server!
156 | unknown-command: Unknown command. Type "/help" for help.
157 | server-full: The server is full!
158 | outdated-client: Outdated client! Please use {0}
159 | outdated-server: Outdated server! I'm still on {0}
160 | players:
161 | disable-saving: false
162 | advancements:
163 | disable-saving: true
164 | disabled:
165 | - minecraft:story/disabled
166 | config-version: 12
167 | commands:
168 | silent-commandblock-console: false
169 | log: true
170 | spam-exclusions:
171 | - /skill
172 | replace-commands:
173 | - setblock
174 | - summon
175 | - testforblock
176 | - tellraw
177 | tab-complete: 0
178 | send-namespaced: true
179 | enable-spam-exclusions: false
180 | stats:
181 | disable-saving: true
182 | forced-stats: {}
183 |
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/CrazyEnvoys.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys;
2 |
3 | import com.badbones69.crazyenvoys.api.builders.types.PrizeGui;
4 | import com.badbones69.crazyenvoys.commands.EnvoyCommand;
5 | import com.badbones69.crazyenvoys.api.CrazyManager;
6 | import com.badbones69.crazyenvoys.api.events.EnvoyEndEvent;
7 | import com.badbones69.crazyenvoys.api.events.EnvoyEndEvent.EnvoyEndReason;
8 | import com.badbones69.crazyenvoys.api.objects.CoolDownSettings;
9 | import com.badbones69.crazyenvoys.api.objects.EditorSettings;
10 | import com.badbones69.crazyenvoys.api.objects.FlareSettings;
11 | import com.badbones69.crazyenvoys.api.objects.LocationSettings;
12 | import com.badbones69.crazyenvoys.commands.EnvoyTab;
13 | import com.badbones69.crazyenvoys.listeners.EnvoyEditListener;
14 | import com.badbones69.crazyenvoys.listeners.EnvoyClickListener;
15 | import com.badbones69.crazyenvoys.listeners.FireworkDamageListener;
16 | import com.badbones69.crazyenvoys.listeners.FlareClickListener;
17 | import com.badbones69.crazyenvoys.support.placeholders.PlaceholderAPISupport;
18 | import com.ryderbelserion.vital.paper.VitalPaper;
19 | import com.ryderbelserion.vital.paper.api.enums.Support;
20 | import com.ryderbelserion.vital.paper.api.files.FileManager;
21 | import me.arcaniax.hdb.api.HeadDatabaseAPI;
22 | import org.bukkit.command.CommandExecutor;
23 | import org.bukkit.command.PluginCommand;
24 | import org.bukkit.command.TabCompleter;
25 | import org.bukkit.entity.Player;
26 | import org.bukkit.plugin.java.JavaPlugin;
27 | import org.jetbrains.annotations.NotNull;
28 | import org.jetbrains.annotations.Nullable;
29 | import com.badbones69.crazyenvoys.config.ConfigManager;
30 | import com.badbones69.crazyenvoys.support.MetricsWrapper;
31 | import java.util.Locale;
32 |
33 | public class CrazyEnvoys extends JavaPlugin {
34 |
35 | @NotNull
36 | public static CrazyEnvoys get() {
37 | return JavaPlugin.getPlugin(CrazyEnvoys.class);
38 | }
39 |
40 | private final long startTime;
41 |
42 | public CrazyEnvoys() {
43 | this.startTime = System.nanoTime();
44 | }
45 |
46 | private EditorSettings editorSettings;
47 | private FlareSettings flareSettings;
48 | private CoolDownSettings coolDownSettings;
49 | private LocationSettings locationSettings;
50 |
51 | private CrazyManager crazyManager;
52 |
53 | private HeadDatabaseAPI api;
54 |
55 | private FileManager fileManager;
56 |
57 | private VitalPaper paper;
58 |
59 | @Override
60 | public void onEnable() {
61 | this.paper = new VitalPaper(this);
62 |
63 | ConfigManager.load(getDataFolder(), getComponentLogger());
64 |
65 | if (Support.head_database.isEnabled()) {
66 | this.api = new HeadDatabaseAPI();
67 | }
68 |
69 | this.fileManager = new FileManager();
70 | this.fileManager.addFile("users.yml").addFolder("tiers").init();
71 |
72 | new MetricsWrapper(4514);
73 |
74 | this.locationSettings = new LocationSettings();
75 | this.editorSettings = new EditorSettings();
76 | this.coolDownSettings = new CoolDownSettings();
77 | this.flareSettings = new FlareSettings();
78 |
79 | this.crazyManager = new CrazyManager();
80 | this.crazyManager.load();
81 |
82 | getServer().getPluginManager().registerEvents(new EnvoyEditListener(), this);
83 | getServer().getPluginManager().registerEvents(new EnvoyClickListener(), this);
84 | getServer().getPluginManager().registerEvents(new FlareClickListener(), this);
85 | getServer().getPluginManager().registerEvents(new FireworkDamageListener(), this);
86 |
87 | getServer().getPluginManager().registerEvents(new PrizeGui(), this);
88 |
89 | if (Support.placeholder_api.isEnabled()) {
90 | new PlaceholderAPISupport().register();
91 | }
92 |
93 | registerCommand(getCommand("crazyenvoys"), new EnvoyTab(), new EnvoyCommand());
94 |
95 | if (isLogging()) {
96 | getComponentLogger().info("Done ({})!", String.format(Locale.ROOT, "%.3fs", (double) (System.nanoTime() - this.startTime) / 1.0E9D));
97 | }
98 | }
99 |
100 | @Override
101 | public void onDisable() {
102 | for (Player player : getServer().getOnlinePlayers()) {
103 | if (this.editorSettings.isEditor(player)) {
104 | this.editorSettings.removeEditor(player);
105 | this.editorSettings.removeFakeBlocks();
106 | }
107 | }
108 |
109 | if (this.crazyManager.isEnvoyActive()) {
110 | EnvoyEndEvent event = new EnvoyEndEvent(EnvoyEndReason.SHUTDOWN);
111 |
112 | getServer().getPluginManager().callEvent(event);
113 |
114 | this.crazyManager.endEnvoyEvent();
115 | }
116 |
117 | this.crazyManager.reload(true);
118 | }
119 |
120 | public final boolean isLogging() {
121 | return this.paper.isVerbose();
122 | }
123 |
124 | public final VitalPaper getPaper() {
125 | return this.paper;
126 | }
127 |
128 | private void registerCommand(PluginCommand pluginCommand, TabCompleter tabCompleter, CommandExecutor commandExecutor) {
129 | if (pluginCommand != null) {
130 | pluginCommand.setExecutor(commandExecutor);
131 |
132 | if (tabCompleter != null) pluginCommand.setTabCompleter(tabCompleter);
133 | }
134 | }
135 |
136 | public @Nullable final HeadDatabaseAPI getApi() {
137 | if (this.api == null) {
138 | return null;
139 | }
140 |
141 | return this.api;
142 | }
143 |
144 | public final FileManager getFileManager() {
145 | return this.fileManager;
146 | }
147 |
148 | public final EditorSettings getEditorSettings() {
149 | return this.editorSettings;
150 | }
151 |
152 | public final FlareSettings getFlareSettings() {
153 | return this.flareSettings;
154 | }
155 |
156 | public final CoolDownSettings getCoolDownSettings() {
157 | return this.coolDownSettings;
158 | }
159 |
160 | public final LocationSettings getLocationSettings() {
161 | return this.locationSettings;
162 | }
163 |
164 | public final CrazyManager getCrazyManager() {
165 | return this.crazyManager;
166 | }
167 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/Methods.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys;
2 |
3 | import ch.jalu.configme.SettingsManager;
4 | import com.badbones69.crazyenvoys.api.enums.PersistentKeys;
5 | import com.badbones69.crazyenvoys.api.enums.Messages;
6 | import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
7 | import org.bukkit.entity.Marker;
8 | import org.bukkit.event.entity.CreatureSpawnEvent;
9 | import org.bukkit.inventory.Inventory;
10 | import com.badbones69.crazyenvoys.config.types.ConfigKeys;
11 | import com.badbones69.crazyenvoys.util.MsgUtils;
12 | import org.bukkit.Color;
13 | import org.bukkit.FireworkEffect;
14 | import org.bukkit.Location;
15 | import org.bukkit.World;
16 | import org.bukkit.entity.Entity;
17 | import org.bukkit.entity.Firework;
18 | import org.bukkit.entity.Player;
19 | import org.bukkit.inventory.ItemStack;
20 | import org.bukkit.inventory.meta.FireworkMeta;
21 | import org.bukkit.persistence.PersistentDataContainer;
22 | import org.bukkit.persistence.PersistentDataType;
23 | import org.jetbrains.annotations.NotNull;
24 | import com.badbones69.crazyenvoys.config.ConfigManager;
25 |
26 | import java.util.ArrayList;
27 | import java.util.Calendar;
28 | import java.util.List;
29 | import java.util.Map;
30 | import java.util.concurrent.ThreadLocalRandom;
31 |
32 | public class Methods {
33 |
34 | private static final @NotNull CrazyEnvoys plugin = CrazyEnvoys.get();
35 |
36 | private static final @NotNull SettingsManager config = ConfigManager.getConfig();
37 |
38 | public static String getPrefix() {
39 | return MsgUtils.color(config.getProperty(ConfigKeys.command_prefix));
40 | }
41 |
42 | public static void addItem(final Player player, final ItemStack... items) {
43 | final Inventory inventory = player.getInventory();
44 |
45 | inventory.setMaxStackSize(64);
46 | inventory.addItem(items);
47 | }
48 |
49 | public static String getPrefix(String message) {
50 | return MsgUtils.color(config.getProperty(ConfigKeys.command_prefix) + message);
51 | }
52 |
53 | public static ItemStack getItemInHand(Player player) {
54 | return player.getInventory().getItemInMainHand();
55 | }
56 |
57 | public static Calendar getTimeFromString(String time) {
58 | Calendar cal = Calendar.getInstance();
59 |
60 | for (String i : time.split(" ")) {
61 | if (i.contains("D") || i.contains("d")) cal.add(Calendar.DATE, Integer.parseInt(i.replace("D", "").replace("d", "")));
62 |
63 | if (i.contains("H") || i.contains("h")) cal.add(Calendar.HOUR, Integer.parseInt(i.replace("H", "").replace("h", "")));
64 |
65 | if (i.contains("M") || i.contains("m")) cal.add(Calendar.MINUTE, Integer.parseInt(i.replace("M", "").replace("m", "")));
66 |
67 | if (i.contains("S") || i.contains("s")) cal.add(Calendar.SECOND, Integer.parseInt(i.replace("S", "").replace("s", "")));
68 | }
69 |
70 | return cal;
71 | }
72 |
73 | public static boolean isInt(String s) {
74 | try {
75 | Integer.parseInt(s);
76 | } catch (NumberFormatException nfe) {
77 | return false;
78 | }
79 |
80 | return true;
81 | }
82 |
83 | public static boolean isOnline(String name) {
84 | for (Player player : plugin.getServer().getOnlinePlayers()) {
85 | if (player.getName().equalsIgnoreCase(name)) {
86 | return true;
87 | }
88 | }
89 |
90 | return false;
91 | }
92 |
93 | public static Player getPlayer(String name) {
94 | return plugin.getServer().getPlayer(name);
95 | }
96 |
97 | public static boolean isInvFull(Player player) {
98 | return player.getInventory().firstEmpty() == -1;
99 | }
100 |
101 | public static void firework(Location loc, List colors) {
102 | Firework firework = loc.getWorld().spawn(loc, Firework.class);
103 | FireworkMeta fireworkMeta = firework.getFireworkMeta();
104 | fireworkMeta.addEffects(FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(colors).trail(false).flicker(false).build());
105 | fireworkMeta.setPower(0);
106 | firework.setFireworkMeta(fireworkMeta);
107 |
108 | PersistentDataContainer container = firework.getPersistentDataContainer();
109 |
110 | container.set(PersistentKeys.no_firework_damage.getNamespacedKey(), PersistentDataType.BOOLEAN, true);
111 |
112 | detonate(firework);
113 | }
114 |
115 | private static void detonate(Firework firework) {
116 | new FoliaRunnable(plugin.getServer().getRegionScheduler(), firework.getLocation()) {
117 | @Override
118 | public void run() {
119 | firework.detonate();
120 | }
121 | }.runDelayed(plugin, 2);
122 | }
123 |
124 | public static List getPage(List list, Integer page) {
125 | List locations = new ArrayList<>();
126 |
127 | if (page <= 0) page = 1;
128 |
129 | int max = 10;
130 | int index = page * max - max;
131 | int endIndex = index >= list.size() ? list.size() - 1 : index + max;
132 |
133 | for (; index < endIndex; index++) {
134 | if (index < list.size()) locations.add(list.get(index));
135 | }
136 |
137 | for (; locations.isEmpty(); page--) {
138 | if (page <= 0) break;
139 |
140 | index = page * max - max;
141 | endIndex = index >= list.size() ? list.size() - 1 : index + max;
142 |
143 | for (; index < endIndex; index++) {
144 | if (index < list.size()) locations.add(list.get(index));
145 | }
146 | }
147 |
148 | return locations;
149 | }
150 |
151 | public static boolean isSuccessful(final int min, final int max) {
152 | if (max <= min || max <= 0) return true;
153 |
154 | final int chance = 1 + ThreadLocalRandom.current().nextInt(max);
155 |
156 | return chance <= min;
157 | }
158 |
159 | public static List getNearbyEntities(Location loc, double x, double y, double z) {
160 | List out = new ArrayList<>();
161 |
162 | if (loc.getWorld() != null) {
163 | Marker entity = loc.getWorld().spawn(loc.subtract(0, 0, 0), Marker.class, CreatureSpawnEvent.SpawnReason.CUSTOM);
164 |
165 | out = entity.getNearbyEntities(x, y, z);
166 |
167 | entity.remove();
168 | }
169 |
170 | return out;
171 | }
172 |
173 | public static String convertTimeToString(Calendar timeTill) {
174 | Calendar rightNow = Calendar.getInstance();
175 | int total = ((int) (timeTill.getTimeInMillis() / 1000) - (int) (rightNow.getTimeInMillis() / 1000));
176 | int day = 0;
177 | int hour = 0;
178 | int minute = 0;
179 | int second = 0;
180 |
181 | for (; total > 86400; total -= 86400, day++) ;
182 | for (; total > 3600; total -= 3600, hour++) ;
183 | for (; total >= 60; total -= 60, minute++) ;
184 |
185 | second += total;
186 | String message = "";
187 |
188 | if (day > 0) message += day + Messages.day.getMessage() + ", ";
189 | if (day > 0 || hour > 0) message += hour + Messages.hour.getMessage() + ", ";
190 | if (day > 0 || hour > 0 || minute > 0) message += minute + Messages.minute.getMessage() + ", ";
191 | if (day > 0 || hour > 0 || minute > 0 || second > 0) message += second + Messages.second.getMessage() + ", ";
192 |
193 | if (message.length() < 2) {
194 | message = "0" + Messages.second.getMessage();
195 | } else {
196 | message = message.substring(0, message.length() - 2);
197 | }
198 |
199 | return message;
200 | }
201 |
202 | public static String getUnBuiltLocation(Location location) {
203 | return "World:" + location.getWorld().getName() + ", X:" + location.getBlockX() + ", Y:" + location.getBlockY() + ", Z:" + location.getBlockZ();
204 | }
205 |
206 | public static Location getBuiltLocation(String locationString) {
207 | World w = plugin.getServer().getWorlds().getFirst();
208 | int x = 0;
209 | int y = 0;
210 | int z = 0;
211 |
212 | for (String i : locationString.toLowerCase().split(", ")) {
213 | if (i.startsWith("world:")) {
214 | w = plugin.getServer().getWorld(i.replace("world:", ""));
215 | } else if (i.startsWith("x:")) {
216 | x = Integer.parseInt(i.replace("x:", ""));
217 | } else if (i.startsWith("y:")) {
218 | y = Integer.parseInt(i.replace("y:", ""));
219 | } else if (i.startsWith("z:")) {
220 | z = Integer.parseInt(i.replace("z:", ""));
221 | }
222 | }
223 |
224 | return new Location(w, x, y, z);
225 | }
226 |
227 | public static List getPlaceholders(List message, Map lorePlaceholders) {
228 | List lore = new ArrayList<>();
229 |
230 | for (String msg : message) {
231 | for (String placeholder : lorePlaceholders.keySet()) {
232 | msg = msg.replace(placeholder, lorePlaceholders.get(placeholder)).replace(placeholder.toLowerCase(), lorePlaceholders.get(placeholder));
233 | }
234 |
235 | lore.add(msg);
236 | }
237 |
238 | return lore;
239 | }
240 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/builders/InventoryBuilder.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.builders;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import com.badbones69.crazyenvoys.api.objects.misc.Tier;
5 | import com.badbones69.crazyenvoys.util.MsgUtils;
6 | import com.ryderbelserion.vital.paper.api.enums.Support;
7 | import me.clip.placeholderapi.PlaceholderAPI;
8 | import org.bukkit.Server;
9 | import org.bukkit.entity.Player;
10 | import org.bukkit.event.EventHandler;
11 | import org.bukkit.event.Listener;
12 | import org.bukkit.event.inventory.InventoryClickEvent;
13 | import org.bukkit.event.inventory.InventoryDragEvent;
14 | import org.bukkit.inventory.Inventory;
15 | import org.bukkit.inventory.InventoryHolder;
16 | import org.bukkit.inventory.InventoryView;
17 | import org.bukkit.plugin.java.JavaPlugin;
18 | import org.jetbrains.annotations.NotNull;
19 |
20 | public abstract class InventoryBuilder implements InventoryHolder, Listener {
21 |
22 | protected @NotNull final CrazyEnvoys plugin = JavaPlugin.getPlugin(CrazyEnvoys.class);
23 |
24 | protected @NotNull final Server server = this.plugin.getServer();
25 |
26 | private Inventory inventory;
27 | private Player player;
28 | private String title;
29 | private Tier tier;
30 | private int size;
31 | private int page;
32 |
33 | public InventoryBuilder(@NotNull final Player player, @NotNull final String title, final int size) {
34 | this.player = player;
35 | this.title = title;
36 | this.size = size;
37 |
38 | String inventoryTitle = Support.placeholder_api.isEnabled() ? PlaceholderAPI.setPlaceholders(getPlayer(), this.title) : this.title;
39 |
40 | this.inventory = this.server.createInventory(this, this.size, MsgUtils.color(inventoryTitle));
41 | }
42 |
43 | public InventoryBuilder(@NotNull final Player player, @NotNull final String title, final int size, @NotNull final Tier tier) {
44 | this(player, title, size);
45 |
46 | this.tier = tier;
47 | }
48 |
49 | public InventoryBuilder() {}
50 |
51 | public abstract InventoryBuilder build();
52 |
53 | public abstract void run(InventoryClickEvent event);
54 |
55 | public abstract void run(InventoryDragEvent event);
56 |
57 | @EventHandler
58 | public void onPlayerClick(InventoryClickEvent event) {
59 | run(event);
60 | }
61 |
62 | @EventHandler
63 | public void onInventoryDrag(InventoryDragEvent event) {
64 | run(event);
65 | }
66 |
67 | public void size(final int size) {
68 | this.size = size;
69 | }
70 |
71 | public final int getSize() {
72 | return this.size;
73 | }
74 |
75 | public void setPage(final int page) {
76 | this.page = page;
77 | }
78 |
79 | public final int getPage() {
80 | return this.page;
81 | }
82 |
83 | public @NotNull final Tier getTier() {
84 | return this.tier;
85 | }
86 |
87 | public void title(@NotNull final String title) {
88 | this.title = title;
89 | }
90 |
91 | public final boolean contains(@NotNull final String message) {
92 | return this.title.contains(message);
93 | }
94 |
95 | public @NotNull final Player getPlayer() {
96 | return this.player;
97 | }
98 |
99 | public @NotNull final InventoryView getView() {
100 | return getPlayer().getOpenInventory();
101 | }
102 |
103 | @Override
104 | public @NotNull final Inventory getInventory() {
105 | return this.inventory;
106 | }
107 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/builders/types/PrizeGui.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.builders.types;
2 |
3 | import com.badbones69.crazyenvoys.api.builders.InventoryBuilder;
4 | import com.badbones69.crazyenvoys.api.enums.PersistentKeys;
5 | import com.badbones69.crazyenvoys.api.objects.misc.Prize;
6 | import com.badbones69.crazyenvoys.api.objects.misc.Tier;
7 | import org.bukkit.entity.Player;
8 | import org.bukkit.event.inventory.InventoryClickEvent;
9 | import org.bukkit.event.inventory.InventoryDragEvent;
10 | import org.bukkit.event.inventory.InventoryInteractEvent;
11 | import org.bukkit.inventory.Inventory;
12 | import org.bukkit.inventory.ItemStack;
13 | import org.bukkit.inventory.PlayerInventory;
14 | import org.bukkit.inventory.meta.ItemMeta;
15 | import org.bukkit.persistence.PersistentDataContainer;
16 | import org.bukkit.persistence.PersistentDataType;
17 |
18 | public class PrizeGui extends InventoryBuilder {
19 |
20 | private Prize prize;
21 |
22 | public PrizeGui(final Player player, final String title, final int size, final Tier tier, final Prize prize) {
23 | super(player, title, size, tier);
24 |
25 | this.prize = prize;
26 | }
27 |
28 | public PrizeGui() {}
29 |
30 | @Override
31 | public InventoryBuilder build() {
32 | final Inventory inventory = getInventory();
33 |
34 | this.prize.getItems().forEach(item -> {
35 | item.editMeta(itemMeta -> itemMeta.getPersistentDataContainer().set(PersistentKeys.prize_item.getNamespacedKey(), PersistentDataType.STRING, prize.getPrizeID()));
36 |
37 | inventory.setItem(inventory.firstEmpty(), item);
38 | });
39 |
40 | return this;
41 | }
42 |
43 | @Override
44 | public void run(InventoryClickEvent event) {
45 | final Inventory inventory = event.getInventory();
46 |
47 | if (!(inventory.getHolder(false) instanceof PrizeGui holder)) return;
48 |
49 | event.setCancelled(true);
50 |
51 | final Player player = holder.getPlayer();
52 |
53 | if (event.getCurrentItem() == null) return;
54 |
55 | final ItemStack itemStack = event.getCurrentItem();
56 |
57 | if (!itemStack.hasItemMeta()) return;
58 |
59 | final ItemMeta itemMeta = itemStack.getItemMeta();
60 |
61 | final PersistentDataContainer pdc = itemMeta.getPersistentDataContainer();
62 |
63 | if (!pdc.has(PersistentKeys.prize_item.getNamespacedKey())) return;
64 |
65 | final PlayerInventory playerInventory = player.getInventory();
66 |
67 | playerInventory.setMaxStackSize(64);
68 |
69 | itemStack.editMeta(meta -> meta.getPersistentDataContainer().remove(PersistentKeys.prize_item.getNamespacedKey()));
70 |
71 | playerInventory.addItem(itemStack);
72 |
73 | event.setCurrentItem(null);
74 |
75 | if (inventory.isEmpty()) {
76 | inventory.close();
77 | }
78 | }
79 |
80 | @Override
81 | public void run(InventoryDragEvent event) {
82 | final Inventory inventory = event.getView().getTopInventory();
83 |
84 | if (!(inventory.getHolder(false) instanceof PrizeGui)) return;
85 |
86 | event.setCancelled(true);
87 | }
88 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/enums/Files.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.enums;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import com.ryderbelserion.vital.paper.api.files.FileManager;
5 | import org.bukkit.configuration.file.YamlConfiguration;
6 | import org.bukkit.plugin.java.JavaPlugin;
7 | import org.jetbrains.annotations.NotNull;
8 |
9 | public enum Files {
10 |
11 | users("users.yml");
12 |
13 | private final String fileName;
14 | private final String strippedName;
15 |
16 | private @NotNull final CrazyEnvoys plugin = JavaPlugin.getPlugin(CrazyEnvoys.class);
17 |
18 | private @NotNull final FileManager fileManager = this.plugin.getFileManager();
19 |
20 | /**
21 | * A constructor to build a file
22 | *
23 | * @param fileName the name of the file
24 | */
25 | Files(final String fileName) {
26 | this.fileName = fileName;
27 | this.strippedName = this.fileName.replace(".yml", "");
28 | }
29 |
30 | public final YamlConfiguration getConfiguration() {
31 | return this.fileManager.getFile(this.fileName).getConfiguration();
32 | }
33 |
34 | public final String getStrippedName() {
35 | return this.strippedName;
36 | }
37 |
38 | public final String getFileName() {
39 | return this.fileName;
40 | }
41 |
42 | public void save() {
43 | this.fileManager.saveFile(this.fileName);
44 | }
45 |
46 | public void reload() {
47 | this.fileManager.addFile(this.fileName);
48 | }
49 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/enums/Messages.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.enums;
2 |
3 | import ch.jalu.configme.SettingsManager;
4 | import ch.jalu.configme.properties.Property;
5 | import com.badbones69.crazyenvoys.CrazyEnvoys;
6 | import com.badbones69.crazyenvoys.api.CrazyManager;
7 | import com.badbones69.crazyenvoys.util.MsgUtils;
8 | import com.ryderbelserion.vital.paper.api.enums.Support;
9 | import com.ryderbelserion.vital.utils.Methods;
10 | import me.clip.placeholderapi.PlaceholderAPI;
11 | import org.apache.commons.lang3.StringUtils;
12 | import org.bukkit.command.CommandSender;
13 | import org.bukkit.entity.Player;
14 | import org.jetbrains.annotations.NotNull;
15 | import org.jetbrains.annotations.Nullable;
16 | import com.badbones69.crazyenvoys.config.ConfigManager;
17 | import com.badbones69.crazyenvoys.config.types.ConfigKeys;
18 | import com.badbones69.crazyenvoys.config.types.MessageKeys;
19 | import java.util.HashMap;
20 | import java.util.List;
21 | import java.util.Map;
22 |
23 | public enum Messages {
24 |
25 | ended(MessageKeys.envoy_ended, true),
26 | warning(MessageKeys.envoy_warning),
27 | started(MessageKeys.envoy_started, true),
28 | on_going(MessageKeys.hologram_on_going),
29 | not_running(MessageKeys.hologram_not_running),
30 | reloaded(MessageKeys.envoy_plugin_reloaded),
31 | time_left(MessageKeys.envoy_time_left),
32 | used_flare(MessageKeys.envoy_used_flare),
33 | give_flare(MessageKeys.envoy_give_flare),
34 | new_center(MessageKeys.envoy_new_center),
35 | not_online(MessageKeys.not_online),
36 | given_flare(MessageKeys.envoy_received_flare),
37 | force_start(MessageKeys.envoy_force_start),
38 | not_started(MessageKeys.envoy_not_started),
39 | envoys_remaining(MessageKeys.envoys_remaining, true),
40 | force_end(MessageKeys.envoy_force_ended),
41 | drops_page(MessageKeys.drops_page),
42 | drops_format(MessageKeys.drops_format),
43 | drops_available(MessageKeys.drops_available),
44 | drops_possibilities(MessageKeys.drops_possibilities),
45 | player_only(MessageKeys.player_only),
46 | not_a_number(MessageKeys.not_a_number),
47 | add_location(MessageKeys.envoy_add_location),
48 | remove_location(MessageKeys.envoy_remove_location),
49 | cooldown_left(MessageKeys.cooldown_left),
50 | countdown_in_progress(MessageKeys.countdown_in_progress),
51 | no_permission(MessageKeys.no_permission),
52 | no_claim_permission(MessageKeys.no_claim_permission),
53 | time_till_event(MessageKeys.envoy_time_till_event, true),
54 | cant_use_flares(MessageKeys.envoy_cant_use_flare),
55 | already_started(MessageKeys.envoy_already_started),
56 | enter_editor_mode(MessageKeys.enter_editor_mode),
57 | leave_editor_mode(MessageKeys.exit_editor_mode),
58 | editor_clear_locations(MessageKeys.envoy_clear_locations),
59 | editor_clear_failure(MessageKeys.envoy_clear_failure),
60 | not_enough_players(MessageKeys.not_enough_players),
61 | stop_ignoring_messages(MessageKeys.stop_ignoring_messages),
62 | start_ignoring_messages(MessageKeys.start_ignoring_messages),
63 | kicked_from_editor_mode(MessageKeys.envoy_kicked_from_editor_mode),
64 | not_in_world_guard_region(MessageKeys.not_in_world_guard_region),
65 | no_spawn_locations_found(MessageKeys.no_spawn_locations_found),
66 | command_not_found(MessageKeys.command_not_found),
67 | day(MessageKeys.time_placeholder_day),
68 | hour(MessageKeys.time_placeholder_hour),
69 | minute(MessageKeys.time_placeholder_minute),
70 | second(MessageKeys.time_placeholder_second),
71 | envoy_locations(MessageKeys.envoy_locations),
72 | location_format(MessageKeys.location_format),
73 | help(MessageKeys.help, true);
74 |
75 | private Property property;
76 |
77 | private Property> listProperty;
78 |
79 | private boolean isList = false;
80 |
81 | /**
82 | * Used for strings
83 | *
84 | * @param property the property
85 | */
86 | Messages(Property property) {
87 | this.property = property;
88 | }
89 |
90 | /**
91 | * Used for string lists
92 | *
93 | * @param listProperty the list property
94 | * @param isList Defines if it's a list or not.
95 | */
96 | Messages(Property> listProperty, boolean isList) {
97 | this.listProperty = listProperty;
98 |
99 | this.isList = isList;
100 | }
101 |
102 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
103 | private @NotNull final SettingsManager messages = ConfigManager.getMessages();
104 | private @NotNull final CrazyManager crazyManager = this.plugin.getCrazyManager();
105 |
106 | public String getString() {
107 | return this.messages.getProperty(this.property);
108 | }
109 |
110 | public List getList() {
111 | return this.messages.getProperty(this.listProperty);
112 | }
113 |
114 | private boolean isList() {
115 | return this.isList;
116 | }
117 |
118 | public String getMessage() {
119 | return getMessage(null, new HashMap<>());
120 | }
121 |
122 | public String getMessage(final String placeholder, final String replacement) {
123 | return getMessage(null, placeholder, replacement);
124 | }
125 |
126 | public String getMessage(final Map placeholders) {
127 | return getMessage(null, placeholders);
128 | }
129 |
130 | public String getMessage(@Nullable final CommandSender sender) {
131 | return getMessage(sender, new HashMap<>());
132 | }
133 |
134 | public String getMessage(@Nullable final CommandSender sender, @NotNull final String placeholder, @NotNull final String replacement) {
135 | Map placeholders = new HashMap<>() {{
136 | put(placeholder, replacement);
137 | }};
138 |
139 | return getMessage(sender, placeholders);
140 | }
141 |
142 | public String getMessage(@Nullable final CommandSender sender, @NotNull final Map placeholders) {
143 | return parse(sender, placeholders).replaceAll("\\{prefix}", MsgUtils.getPrefix());
144 | }
145 |
146 | public void sendMessage(final CommandSender sender, final String placeholder, final String replacement) {
147 | sender.sendMessage(getMessage(sender, placeholder, replacement));
148 | }
149 |
150 | public void sendMessage(final CommandSender sender, final Map placeholders) {
151 | sender.sendMessage(getMessage(sender, placeholders));
152 | }
153 |
154 | public void sendMessage(final CommandSender sender) {
155 | sender.sendMessage(getMessage(sender));
156 | }
157 |
158 | private @NotNull String parse(@Nullable final CommandSender sender, @NotNull final Map placeholders) {
159 | String message;
160 |
161 | if (isList()) {
162 | message = StringUtils.chomp(Methods.toString(getList()));
163 | } else {
164 | message = getString();
165 | }
166 |
167 | if (sender != null) {
168 | if (sender instanceof Player player) {
169 | if (Support.placeholder_api.isEnabled()) {
170 | message = PlaceholderAPI.setPlaceholders(player, message);
171 | }
172 | }
173 | }
174 |
175 | if (!placeholders.isEmpty()) {
176 | for (Map.Entry placeholder : placeholders.entrySet()) {
177 | message = message.replace(placeholder.getKey(), placeholder.getValue()).replace(placeholder.getKey().toLowerCase(), placeholder.getValue());
178 | }
179 | }
180 |
181 | return MsgUtils.color(message);
182 | }
183 |
184 | public void broadcastMessage(boolean ignore) {
185 | broadcastMessage(ignore, new HashMap<>());
186 | }
187 |
188 | public void broadcastMessage(boolean ignore, Map placeholder) {
189 | // Send in console because we should lol.
190 | sendMessage(this.plugin.getServer().getConsoleSender(), placeholder);
191 |
192 | if (ConfigManager.getConfig().getProperty(ConfigKeys.envoys_world_messages)) {
193 | for (Player player : this.plugin.getServer().getOnlinePlayers()) {
194 | for (String world : ConfigManager.getConfig().getProperty(ConfigKeys.envoys_allowed_worlds)) {
195 | if (player.getWorld().getName().equalsIgnoreCase(world)) {
196 | if (ignore) {
197 | if (!this.crazyManager.isIgnoringMessages(player.getUniqueId())) sendMessage(player, placeholder);
198 | } else {
199 | sendMessage(player, placeholder);
200 | }
201 | }
202 | }
203 | }
204 | } else {
205 | for (Player player : this.plugin.getServer().getOnlinePlayers()) {
206 | if (ignore) {
207 | if (!this.crazyManager.isIgnoringMessages(player.getUniqueId())) sendMessage(player, placeholder);
208 | } else {
209 | sendMessage(player, placeholder);
210 | }
211 | }
212 | }
213 | }
214 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/enums/PersistentKeys.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.enums;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import org.bukkit.NamespacedKey;
5 | import org.jetbrains.annotations.NotNull;
6 |
7 | public enum PersistentKeys {
8 |
9 | no_firework_damage("firework"),
10 | prize_item("prize_item"),
11 | envoy_flare("envoy_flare");
12 |
13 | private final @NotNull CrazyEnvoys plugin = CrazyEnvoys.get();
14 |
15 | private final String NamespacedKey;
16 |
17 | PersistentKeys(String NamespacedKey) {
18 | this.NamespacedKey = NamespacedKey;
19 | }
20 |
21 | public NamespacedKey getNamespacedKey() {
22 | return new NamespacedKey(this.plugin, this.plugin.getName().toLowerCase() + "_" + this.NamespacedKey);
23 | }
24 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/events/EnvoyEndEvent.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.events;
2 |
3 | import org.bukkit.entity.Player;
4 | import org.bukkit.event.Event;
5 | import org.bukkit.event.HandlerList;
6 | import org.jetbrains.annotations.NotNull;
7 |
8 | /**
9 | * Event is called when the envoy event has ended for any reason.
10 | */
11 | public class EnvoyEndEvent extends Event {
12 |
13 | private static final HandlerList handlers = new HandlerList();
14 | private Player player;
15 | private final EnvoyEndReason reason;
16 |
17 | public EnvoyEndEvent(EnvoyEndReason reason) {
18 | this.reason = reason;
19 | }
20 |
21 | public EnvoyEndEvent(EnvoyEndReason reason, Player player) {
22 | this.reason = reason;
23 | this.player = player;
24 | }
25 |
26 | /**
27 | * Get the reason the envoy ended.
28 | *
29 | * @return The reason it has ended.
30 | */
31 | public EnvoyEndReason getReason() {
32 | return this.reason;
33 | }
34 |
35 | /**
36 | * Get the player that ended the event.
37 | *
38 | * @return The player that ended it. This can be null if it auto ended.
39 | */
40 | public Player getPlayer() {
41 | return this.player;
42 | }
43 |
44 | public static HandlerList getHandlerList() {
45 | return handlers;
46 | }
47 |
48 | @NotNull
49 | public HandlerList getHandlers() {
50 | return handlers;
51 | }
52 |
53 | public enum EnvoyEndReason {
54 |
55 | /**
56 | * Ended because a player forced the envoy event to end.
57 | */
58 | FORCED_END_PLAYER("Forced-End-Player"),
59 | /**
60 | * Ended because the console forced the envoy event to end.
61 | */
62 | FORCED_END_CONSOLE("Forced-End-Console"),
63 | /**
64 | * Ended because the envoy ran out of time.
65 | */
66 | OUT_OF_TIME("Out-Of-Time"),
67 | /**
68 | * Ended because all the crates were collected by the players.
69 | */
70 | ALL_CRATES_COLLECTED("All-Crates-Collected"),
71 | /**
72 | * Ends because no spawn locations for the crates were found.
73 | */
74 | NO_LOCATIONS_FOUND("No-Locations-Found"),
75 | /**
76 | * If the plugin reloads it ends the current envoy.
77 | */
78 | RELOAD("Reload"),
79 | /**
80 | * If the plugin is either unloaded, server reload, stop, or restarting.
81 | */
82 | SHUTDOWN("Shutdown"),
83 | /**
84 | * Ended because some outside source commanded it to end.
85 | */
86 | CUSTOM("Custom");
87 |
88 | private final String name;
89 |
90 | EnvoyEndReason(String name) {
91 | this.name = name;
92 | }
93 |
94 | public String getName() {
95 | return this.name;
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/events/EnvoyOpenEvent.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.events;
2 |
3 | import com.badbones69.crazyenvoys.api.objects.misc.Prize;
4 | import com.badbones69.crazyenvoys.api.objects.misc.Tier;
5 | import org.bukkit.Location;
6 | import org.bukkit.block.Block;
7 | import org.bukkit.entity.Player;
8 | import org.bukkit.event.Cancellable;
9 | import org.bukkit.event.Event;
10 | import org.bukkit.event.HandlerList;
11 | import org.jetbrains.annotations.NotNull;
12 | import java.util.List;
13 |
14 | /**
15 | * Event is called when a player opens a envoy crate.
16 | */
17 | public class EnvoyOpenEvent extends Event implements Cancellable {
18 |
19 | private static final HandlerList handlers = new HandlerList();
20 | private boolean cancelled;
21 | private final Location location;
22 | private final Block block;
23 | private final Player player;
24 | private final Tier tier;
25 | private List prizes;
26 |
27 | public EnvoyOpenEvent(Player player, Block block, Tier tier, List prizes) {
28 | this(player, block.getLocation(), tier, prizes);
29 | }
30 |
31 | public EnvoyOpenEvent(Player player, Location location, Tier tier, List prizes) {
32 | this.player = player;
33 | this.location = location;
34 | this.block = location.getBlock();
35 | this.tier = tier;
36 | this.prizes = prizes;
37 | this.cancelled = false;
38 | }
39 |
40 | /**
41 | * Get the player that opened an envoy crate.
42 | *
43 | * @return The player that opened the crate.
44 | */
45 | public Player getPlayer() {
46 | return this.player;
47 | }
48 |
49 | /**
50 | * Get the location that the crate was located at.
51 | *
52 | * @return The location the crate was located at.
53 | */
54 | public Location getLocation() {
55 | return this.location;
56 | }
57 |
58 | /**
59 | * Get the block that was claimed.
60 | *
61 | * @return The block that was claimed.
62 | */
63 | public Block getBlock() {
64 | return this.block;
65 | }
66 |
67 | /**
68 | * Get the tier of the crate that was opened.
69 | */
70 | public Tier getTier() {
71 | return this.tier;
72 | }
73 |
74 | /**
75 | * Get the prize that was won.
76 | */
77 | public List getPrizes() {
78 | return this.prizes;
79 | }
80 |
81 | /**
82 | * Set the prize that was won.
83 | *
84 | * @param prizes The new prize that was won.
85 | */
86 | public void setPrize(List prizes) {
87 | this.prizes = prizes;
88 | }
89 |
90 | @Override
91 | public boolean isCancelled() {
92 | return this.cancelled;
93 | }
94 |
95 | @Override
96 | public void setCancelled(boolean cancelled) {
97 | this.cancelled = cancelled;
98 | }
99 |
100 | public static HandlerList getHandlerList() {
101 | return handlers;
102 | }
103 |
104 | @NotNull
105 | public HandlerList getHandlers() {
106 | return handlers;
107 | }
108 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/events/EnvoyStartEvent.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.events;
2 |
3 | import org.bukkit.entity.Player;
4 | import org.bukkit.event.Cancellable;
5 | import org.bukkit.event.Event;
6 | import org.bukkit.event.HandlerList;
7 | import org.jetbrains.annotations.NotNull;
8 |
9 | /**
10 | * Event is called when the envoy is started for any reason.
11 | */
12 | public class EnvoyStartEvent extends Event implements Cancellable {
13 |
14 | private static final HandlerList handlers = new HandlerList();
15 | private boolean cancelled;
16 | private Player player;
17 | private final EnvoyStartReason reason;
18 |
19 | public EnvoyStartEvent(EnvoyStartReason reason) {
20 | this.reason = reason;
21 | this.cancelled = false;
22 | }
23 |
24 | public EnvoyStartEvent(EnvoyStartReason reason, Player player) {
25 | this.reason = reason;
26 | this.player = player;
27 | this.cancelled = false;
28 | }
29 |
30 | /**
31 | * Get the reason the envoy event started.
32 | *
33 | * @return The EnvoyStartReason the event started.
34 | */
35 | public EnvoyStartReason getReason() {
36 | return this.reason;
37 | }
38 |
39 | /**
40 | * Get the player that started the event.
41 | *
42 | * @return The player that started it. This can be null if it auto started.
43 | */
44 | public Player getPlayer() {
45 | return this.player;
46 | }
47 |
48 | @Override
49 | public boolean isCancelled() {
50 | return this.cancelled;
51 | }
52 |
53 | @Override
54 | public void setCancelled(boolean cancelled) {
55 | this.cancelled = cancelled;
56 | }
57 |
58 | public static HandlerList getHandlerList() {
59 | return handlers;
60 | }
61 |
62 | @NotNull
63 | public HandlerList getHandlers() {
64 | return handlers;
65 | }
66 |
67 | public enum EnvoyStartReason {
68 |
69 | /**
70 | * Started by a player running the envoy start command.
71 | */
72 | FORCED_START_PLAYER("Forced-Start-Player"),
73 | /**
74 | * Started by the console running the envoy start command.
75 | */
76 | FORCED_START_CONSOLE("Forced-Start-Console"),
77 | /**
78 | * Started by the auto timer that starts the envoy after the cooldown ends.
79 | */
80 | AUTO_TIMER("Auto-Timer"),
81 | /**
82 | * Started because it is the time specified in the config for the envoy to start.
83 | */
84 | SPECIFIED_TIME("Specified-Time"),
85 | /**
86 | * Started because a player used a flare to start the event.
87 | */
88 | FLARE("Flare"),
89 | /**
90 | * Started by an outside source that wanted the envoy event to start.
91 | */
92 | CUSTOM("Custom");
93 |
94 | private final String name;
95 |
96 | EnvoyStartReason(String name) {
97 | this.name = name;
98 | }
99 |
100 | public String getName() {
101 | return this.name;
102 | }
103 | }
104 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/events/FlareUseEvent.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.events;
2 |
3 | import org.bukkit.entity.Player;
4 | import org.bukkit.event.Cancellable;
5 | import org.bukkit.event.Event;
6 | import org.bukkit.event.HandlerList;
7 | import org.jetbrains.annotations.NotNull;
8 |
9 | /**
10 | * Event is called when a player uses a flare to call an envoy event.
11 | */
12 | public class FlareUseEvent extends Event implements Cancellable {
13 |
14 | private static final HandlerList handlers = new HandlerList();
15 |
16 | private boolean cancelled;
17 | private final Player player;
18 |
19 | public FlareUseEvent(Player player) {
20 | this.player = player;
21 | this.cancelled = false;
22 | }
23 |
24 | /**
25 | * Get the player that called the envoy event.
26 | *
27 | * @return The player that used the flare.
28 | */
29 | public Player getPlayer() {
30 | return this.player;
31 | }
32 |
33 | @Override
34 | public boolean isCancelled() {
35 | return this.cancelled;
36 | }
37 |
38 | @Override
39 | public void setCancelled(boolean cancelled) {
40 | this.cancelled = cancelled;
41 | }
42 |
43 | public static HandlerList getHandlerList() {
44 | return handlers;
45 | }
46 |
47 | @NotNull
48 | public HandlerList getHandlers() {
49 | return handlers;
50 | }
51 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/events/NewDropLocationEvent.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.events;
2 |
3 | import org.bukkit.Location;
4 | import org.bukkit.block.Block;
5 | import org.bukkit.entity.Player;
6 | import org.bukkit.event.Cancellable;
7 | import org.bukkit.event.Event;
8 | import org.bukkit.event.HandlerList;
9 | import org.jetbrains.annotations.NotNull;
10 |
11 | /**
12 | * Event is called when a player places a new crate spawning location in editor mode.
13 | */
14 | public class NewDropLocationEvent extends Event implements Cancellable {
15 |
16 | private static final HandlerList handlers = new HandlerList();
17 | private final Player player;
18 | private final Location location;
19 | private final Block block;
20 | private boolean cancelled;
21 |
22 | public NewDropLocationEvent(Player player, Block block) {
23 | this(player, block.getLocation());
24 | }
25 |
26 | public NewDropLocationEvent(Player player, Location location) {
27 | this.player = player;
28 | this.location = location;
29 | this.block = location.getBlock();
30 | this.cancelled = false;
31 | }
32 |
33 | public Location getLocation() {
34 | return this.location;
35 | }
36 |
37 | public Block getBlock() {
38 | return this.block;
39 | }
40 |
41 | public Player getPlayer() {
42 | return this.player;
43 | }
44 |
45 | @Override
46 | public boolean isCancelled() {
47 | return this.cancelled;
48 | }
49 |
50 | @Override
51 | public void setCancelled(boolean cancelled) {
52 | this.cancelled = cancelled;
53 | }
54 |
55 | public static HandlerList getHandlerList() {
56 | return handlers;
57 | }
58 |
59 | @NotNull
60 | public HandlerList getHandlers() {
61 | return handlers;
62 | }
63 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/objects/CoolDownSettings.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.objects;
2 |
3 | import com.badbones69.crazyenvoys.Methods;
4 | import java.util.Calendar;
5 | import java.util.HashMap;
6 | import java.util.Map;
7 | import java.util.UUID;
8 |
9 | public class CoolDownSettings {
10 |
11 | private final Map cooldown = new HashMap<>();
12 |
13 | public void addCooldown(UUID uuid, String cooldownTimer) {
14 | this.cooldown.put(uuid, Methods.getTimeFromString(cooldownTimer));
15 | }
16 |
17 | public void removeCoolDown(UUID uuid) {
18 | this.cooldown.remove(uuid);
19 | }
20 |
21 | public Map getCooldown() {
22 | return this.cooldown;
23 | }
24 |
25 | public void clearCoolDowns() {
26 | this.cooldown.clear();
27 | }
28 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/objects/EditorSettings.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.objects;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import org.bukkit.Material;
5 | import org.bukkit.block.Block;
6 | import org.bukkit.entity.Player;
7 | import org.jetbrains.annotations.NotNull;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 | import java.util.UUID;
11 |
12 | public class EditorSettings {
13 |
14 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
15 |
16 | private @NotNull final LocationSettings locationSettings = this.plugin.getLocationSettings();
17 |
18 | private final List editors = new ArrayList<>();
19 |
20 | public List getEditors() {
21 | return this.editors;
22 | }
23 |
24 | public void addEditor(Player player) {
25 | this.editors.add(player.getUniqueId());
26 | }
27 |
28 | public void removeEditor(Player player) {
29 | this.editors.remove(player.getUniqueId());
30 | }
31 |
32 | public boolean isEditor(Player player) {
33 | return this.editors.contains(player.getUniqueId());
34 | }
35 |
36 | public void showFakeBlocks(Player player) {
37 | for (Block block : this.locationSettings.getSpawnLocations()) {
38 | player.sendBlockChange(block.getLocation(), Material.BEDROCK.createBlockData());
39 | }
40 | }
41 |
42 | public void removeFakeBlocks(Player player) {
43 | for (Block block : this.locationSettings.getSpawnLocations()) {
44 | player.sendBlockChange(block.getLocation(), Material.AIR.createBlockData());
45 | }
46 | }
47 |
48 | public void removeFakeBlocks() {
49 | for (Block block : this.locationSettings.getSpawnLocations()) {
50 | block.getState().update();
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/objects/FlareSettings.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.objects;
2 |
3 | import ch.jalu.configme.SettingsManager;
4 | import com.badbones69.crazyenvoys.Methods;
5 | import com.badbones69.crazyenvoys.api.enums.PersistentKeys;
6 | import org.bukkit.entity.Player;
7 | import org.bukkit.inventory.ItemStack;
8 | import org.bukkit.persistence.PersistentDataType;
9 | import com.badbones69.crazyenvoys.config.ConfigManager;
10 | import com.badbones69.crazyenvoys.config.types.ConfigKeys;
11 |
12 | public class FlareSettings {
13 |
14 | private ItemBuilder flareItemBuilder;
15 |
16 | public void load() {
17 | SettingsManager config = ConfigManager.getConfig();
18 |
19 | this.flareItemBuilder = new ItemBuilder()
20 | .setMaterial(config.getProperty(ConfigKeys.envoys_flare_item_type))
21 | .setGlow(config.getProperty(ConfigKeys.envoys_flare_item_glowing))
22 | .setName(config.getProperty(ConfigKeys.envoys_flare_item_name))
23 | .setLore(config.getProperty(ConfigKeys.envoys_flare_item_lore));
24 | }
25 |
26 | public ItemStack getFlare() {
27 | return getFlare(1);
28 | }
29 |
30 | public ItemStack getFlare(int amount) {
31 | ItemStack itemStack = this.flareItemBuilder.setAmount(amount).build();
32 |
33 | itemStack.editMeta(itemMeta -> itemMeta.getPersistentDataContainer().set(PersistentKeys.envoy_flare.getNamespacedKey(), PersistentDataType.BOOLEAN, true));
34 |
35 | return itemStack;
36 | }
37 |
38 | public boolean isFlare(ItemStack item) {
39 | if (!item.hasItemMeta()) return false;
40 |
41 | return item.getItemMeta().getPersistentDataContainer().has(PersistentKeys.envoy_flare.getNamespacedKey());
42 | }
43 |
44 | public void giveFlare(Player player) {
45 | giveFlare(player, 1);
46 | }
47 |
48 | public void giveFlare(Player player, int amount) {
49 | if (Methods.isInvFull(player)) {
50 | player.getWorld().dropItem(player.getLocation(), getFlare(amount));
51 | } else {
52 | Methods.addItem(player, getFlare(amount));
53 | }
54 | }
55 |
56 | public void takeFlare(Player player) {
57 | player.getInventory().removeItem(getFlare());
58 | }
59 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/objects/LocationSettings.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.objects;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import com.badbones69.crazyenvoys.Methods;
5 | import com.badbones69.crazyenvoys.api.enums.Files;
6 | import org.bukkit.block.Block;
7 | import org.bukkit.configuration.file.FileConfiguration;
8 | import org.jetbrains.annotations.NotNull;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class LocationSettings {
13 |
14 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
15 |
16 | private final List spawnLocations = new ArrayList<>();
17 |
18 | /**
19 | * Ryder Note: This used to be "spawnedLocations".
20 | */
21 | private final List activeLocations = new ArrayList<>();
22 |
23 | private final List failedLocations = new ArrayList<>();
24 |
25 | private final List dropLocations = new ArrayList<>();
26 |
27 | /**
28 | * Adds a drop location.
29 | *
30 | * @param block - The block to add.
31 | */
32 | public void addDropLocations(Block block) {
33 | if (!this.dropLocations.contains(block)) this.dropLocations.add(block);
34 | }
35 |
36 | /**
37 | * Removes a drop location.
38 | *
39 | * @param block - The block to remove.
40 | */
41 | public void removeDropLocation(Block block) {
42 | this.dropLocations.remove(block);
43 | }
44 |
45 | /**
46 | * Clear drop locations.
47 | */
48 | public void clearDropLocations() {
49 | this.dropLocations.clear();
50 | }
51 |
52 | /**
53 | * Add a list of drop locations.
54 | *
55 | * @param blocks - The list of blocks to add.
56 | */
57 | public void addAllDropLocations(List blocks) {
58 | this.dropLocations.addAll(blocks);
59 | }
60 |
61 | /**
62 | * Fetch all drop locations.
63 | *
64 | * @return - The list of drop locations.
65 | */
66 | public List getDropLocations() {
67 | return this.dropLocations;
68 | }
69 |
70 | /**
71 | * Add failed locations.
72 | *
73 | * @param location - The location to add.
74 | */
75 | public void addFailedLocations(String location) {
76 | this.failedLocations.add(location);
77 | }
78 |
79 | /**
80 | * @return - The list of failed locations.
81 | */
82 | public List getFailedLocations() {
83 | return this.failedLocations;
84 | }
85 |
86 | /**
87 | * Add a block to the active locations when an envoy starts.
88 | *
89 | * @param block - The block to add.
90 | */
91 | public void addActiveLocation(Block block) {
92 | if (!this.activeLocations.contains(block)) this.activeLocations.add(block);
93 | }
94 |
95 | /**
96 | * Remove a block from the active locations.
97 | *
98 | * @param block - The block to remove
99 | */
100 | public void removeActiveLocation(Block block) {
101 | this.activeLocations.remove(block);
102 | }
103 |
104 | /**
105 | * Clear all active locations.
106 | */
107 | public void clearActiveLocations() {
108 | this.activeLocations.clear();
109 | }
110 |
111 | /**
112 | * @return All active blocks.
113 | */
114 | public List getActiveLocations() {
115 | return this.activeLocations;
116 | }
117 |
118 | /**
119 | * Add a spawn location at X block.
120 | *
121 | * @param block - The block to add.
122 | */
123 | public void addSpawnLocation(Block block) {
124 | this.spawnLocations.add(block);
125 |
126 | saveLocations();
127 | }
128 |
129 | public void removeSpawnLocation(Block block) {
130 | this.spawnLocations.remove(block);
131 |
132 | saveLocations();
133 | }
134 |
135 | /**
136 | * Clear spawn locations.
137 | */
138 | public void clearSpawnLocations() {
139 | this.spawnLocations.clear();
140 | }
141 |
142 | /**
143 | * @return All spawn locations.
144 | */
145 | public List getSpawnLocations() {
146 | return this.spawnLocations;
147 | }
148 |
149 | /**
150 | * Add all values from the DATA file to spawnLocations.
151 | */
152 | public void populateMap() {
153 | FileConfiguration users = Files.users.getConfiguration();
154 |
155 | getSpawnLocations().clear();
156 |
157 | for (String location : users.getStringList("Locations.Spawns")) {
158 | try {
159 | getSpawnLocations().add(Methods.getBuiltLocation(location).getBlock());
160 | } catch (Exception ignore) {
161 | addFailedLocations(location);
162 | }
163 | }
164 | }
165 |
166 | public void fixLocations() {
167 | if (!getFailedLocations().isEmpty()) {
168 | if (this.plugin.isLogging()) this.plugin.getLogger().info("Attempting to fix " + getFailedLocations().size() + " locations that failed.");
169 |
170 | int failed = 0;
171 | int fixed = 0;
172 |
173 | for (String location : getFailedLocations()) {
174 | try {
175 | getSpawnLocations().add(Methods.getBuiltLocation(location).getBlock());
176 | fixed++;
177 | } catch (Exception ignore) {
178 | failed++;
179 | }
180 | }
181 |
182 | if (fixed > 0) this.plugin.getLogger().info("Was able to fix " + fixed + " locations that failed.");
183 |
184 | if (failed > 0) this.plugin.getLogger().severe("Failed to fix " + failed + " locations and will not reattempt.");
185 | }
186 | }
187 |
188 | public void saveLocations() {
189 | ArrayList locations = new ArrayList<>();
190 |
191 | for (Block block : this.spawnLocations) {
192 | try {
193 | locations.add(Methods.getUnBuiltLocation(block.getLocation()));
194 | } catch (Exception ignored) {}
195 | }
196 |
197 | Files.users.getConfiguration().set("Locations.Spawns", locations);
198 | Files.users.save();
199 | }
200 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/api/objects/misc/Prize.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.api.objects.misc;
2 |
3 | import com.badbones69.crazyenvoys.api.objects.ItemBuilder;
4 | import com.badbones69.crazyenvoys.util.MsgUtils;
5 | import org.bukkit.inventory.ItemStack;
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | public class Prize {
10 |
11 | private final String prizeID;
12 | private int chance;
13 | private boolean dropItems;
14 | private final List messages;
15 | private List commands;
16 | private List items;
17 | private List itemBuilders;
18 | private String displayName;
19 |
20 | public Prize(String prizeID) {
21 | this.prizeID = prizeID;
22 | this.chance = 100;
23 | this.dropItems = false;
24 | this.displayName = "";
25 | this.messages = new ArrayList<>();
26 | this.commands = new ArrayList<>();
27 | this.items = new ArrayList<>();
28 | this.itemBuilders = new ArrayList<>();
29 | }
30 |
31 | public String getDisplayName() {
32 | return this.displayName;
33 | }
34 |
35 | /**
36 | * Get the prizeID of the prize.
37 | *
38 | * @return The prizeID of the prize.
39 | */
40 | public String getPrizeID() {
41 | return this.prizeID;
42 | }
43 |
44 | /**
45 | * Get the chance of the prize being won.
46 | *
47 | * @return The chance as an integer.
48 | */
49 | public int getChance() {
50 | return this.chance;
51 | }
52 |
53 | /**
54 | * Set the chance of the prize being picked out of 100.
55 | *
56 | * @param chance The new chance of the prize out of 100.
57 | */
58 | public Prize setChance(int chance) {
59 | this.chance = chance;
60 |
61 | return this;
62 | }
63 |
64 | public Prize setDisplayName(String displayName) {
65 | this.displayName = displayName;
66 |
67 | return this;
68 | }
69 |
70 | /**
71 | * Check if the items from Items: drop to the floor or go into the player's inventory.
72 | *
73 | * @return True if drops to the ground and false if it goes into their inventory.
74 | */
75 | public boolean getDropItems() {
76 | return this.dropItems;
77 | }
78 |
79 | /**
80 | * Make the items from the Items: option either drop on the ground or go into their inventory.
81 | *
82 | * @param dropItems The option to drop items on the floor or into their inventory.
83 | */
84 | public Prize setDropItems(boolean dropItems) {
85 | this.dropItems = dropItems;
86 |
87 | return this;
88 | }
89 |
90 | /**
91 | * Get the messages that are sent to the player when winning.
92 | *
93 | * @return The messages that are sent to the player.
94 | */
95 | public List getMessages() {
96 | return this.messages;
97 | }
98 |
99 | /**
100 | * Set the messages that the player gets.
101 | *
102 | * @param messages The new messages the player gets. This will auto color code the messages.
103 | */
104 | public Prize setMessages(List messages) {
105 | this.messages.clear();
106 |
107 | for (String message : messages) {
108 | this.messages.add(MsgUtils.color(message));
109 | }
110 |
111 | return this;
112 | }
113 |
114 | /**
115 | * Get the list of commands the prize runs.
116 | */
117 | public List getCommands() {
118 | return this.commands;
119 | }
120 |
121 | /**
122 | * Set the list of commands the prize will run.
123 | *
124 | * @param commands List of commands to be run.
125 | */
126 | public Prize setCommands(List commands) {
127 | this.commands = commands;
128 |
129 | return this;
130 | }
131 |
132 | /**
133 | * Get the items that the prize will give.
134 | *
135 | * @return The items that are won in the prize.
136 | */
137 | public List getItems() {
138 | return new ArrayList<>(this.items);
139 | }
140 |
141 | /**
142 | * Set the items that can be found in this prize.
143 | *
144 | * @param items The new items that are won in the prize.
145 | */
146 | public Prize setItems(List items) {
147 | this.items = items;
148 |
149 | return this;
150 | }
151 |
152 | public List getItemBuilders() {
153 | return this.itemBuilders;
154 | }
155 |
156 | public Prize setItemBuilders(List itemBuilders) {
157 | this.itemBuilders = itemBuilders;
158 | itemBuilders.forEach(itemBuilder -> items.add(itemBuilder.build()));
159 |
160 | return this;
161 | }
162 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/commands/EnvoyTab.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.commands;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import com.badbones69.crazyenvoys.api.CrazyManager;
5 | import com.badbones69.crazyenvoys.api.objects.LocationSettings;
6 | import org.bukkit.command.Command;
7 | import org.bukkit.command.CommandSender;
8 | import org.bukkit.command.TabCompleter;
9 | import org.bukkit.util.StringUtil;
10 | import org.jetbrains.annotations.NotNull;
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | public class EnvoyTab implements TabCompleter {
15 |
16 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
17 |
18 | private @NotNull final LocationSettings locationSettings = this.plugin.getLocationSettings();
19 |
20 | private @NotNull final CrazyManager crazyManager = this.plugin.getCrazyManager();
21 |
22 | @Override
23 | public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String commandLabel, String[] args) {
24 | List completions = new ArrayList<>();
25 |
26 | if (args.length == 1) { // /envoy
27 | if (hasPermission(sender, "help")) completions.add("help");
28 | if (hasPermission(sender, "reload")) completions.add("reload");
29 | if (hasPermission(sender, "time")) completions.add("time");
30 | if (hasPermission(sender, "drops")) completions.add("drops");
31 | if (hasPermission(sender, "ignore")) completions.add("ignore");
32 | if (hasPermission(sender, "flare.give")) completions.add("flare");
33 | if (hasPermission(sender, "edit")) completions.add("edit");
34 | if (hasPermission(sender, "start")) completions.add("start");
35 | if (hasPermission(sender, "stop")) completions.add("stop");
36 | if (hasPermission(sender, "center")) completions.add("center");
37 |
38 | return StringUtil.copyPartialMatches(args[0], completions, new ArrayList<>());
39 | } else if (args.length == 2) {// /envoy arg0
40 | switch (args[0].toLowerCase()) {
41 | case "drop", "drops" -> {
42 | if (hasPermission(sender, "drops")) {
43 | int size = this.crazyManager.isEnvoyActive() ? this.crazyManager.getActiveEnvoys().size() : this.locationSettings.getSpawnLocations().size();
44 |
45 | if ((size % 10) > 0) size++;
46 |
47 | for (int i = 1; i <= size; i++) completions.add(i + "");
48 | }
49 | }
50 | case "flare" -> {
51 | if (hasPermission(sender, "flare.give")) for (int i = 1; i <= 64; i++) completions.add(i + "");
52 | }
53 | }
54 |
55 | return StringUtil.copyPartialMatches(args[1], completions, new ArrayList<>());
56 | } else if (args.length == 3) { // /envoy arg0 arg1
57 | if ("flare".equalsIgnoreCase(args[0])) {
58 | if (hasPermission(sender, "flare.give")) this.plugin.getServer().getOnlinePlayers().forEach(player -> completions.add(player.getName()));
59 | }
60 |
61 | return StringUtil.copyPartialMatches(args[2], completions, new ArrayList<>());
62 | }
63 |
64 | return new ArrayList<>();
65 | }
66 |
67 | private boolean hasPermission(CommandSender sender, String node) {
68 | return sender.hasPermission("envoy." + node) || sender.hasPermission("envoy.bypass");
69 | }
70 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/config/ConfigManager.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.config;
2 |
3 | import ch.jalu.configme.SettingsManager;
4 | import ch.jalu.configme.SettingsManagerBuilder;
5 | import ch.jalu.configme.configurationdata.ConfigurationDataBuilder;
6 | import ch.jalu.configme.resource.YamlFileResourceOptions;
7 | import com.badbones69.crazyenvoys.config.migrate.ConfigMigration;
8 | import com.badbones69.crazyenvoys.config.migrate.LocaleMigration;
9 | import com.badbones69.crazyenvoys.config.types.ConfigKeys;
10 | import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
11 | import org.bukkit.configuration.file.YamlConfiguration;
12 | import com.badbones69.crazyenvoys.config.types.MessageKeys;
13 | import java.io.File;
14 | import java.util.concurrent.CompletableFuture;
15 |
16 | public class ConfigManager {
17 |
18 | private static SettingsManager messages;
19 | private static SettingsManager config;
20 |
21 | public static void load(final File dataFolder, final ComponentLogger logger) {
22 | YamlFileResourceOptions builder = YamlFileResourceOptions.builder().indentationSize(2).build();
23 |
24 | File configFile = new File(dataFolder, "config.yml");
25 |
26 | config = SettingsManagerBuilder
27 | .withYamlFile(configFile, builder)
28 | .migrationService(new ConfigMigration())
29 | .configurationData(ConfigurationDataBuilder.createConfiguration(ConfigKeys.class))
30 | .create();
31 |
32 | copyPluginConfig(dataFolder, logger, config);
33 |
34 | File localeDir = new File(dataFolder, "locale");
35 |
36 | if (!localeDir.exists()) localeDir.mkdirs();
37 |
38 | File messagesFile = new File(localeDir, config.getProperty(ConfigKeys.locale_file) + ".yml");
39 |
40 | // Migrate if this is found.
41 | File oldFile = new File(dataFolder, "Messages.yml");
42 | if (oldFile.exists() && !messagesFile.exists()) {
43 | oldFile.renameTo(messagesFile);
44 | }
45 |
46 | messages = SettingsManagerBuilder
47 | .withYamlFile(messagesFile, builder)
48 | .migrationService(new LocaleMigration())
49 | .configurationData(MessageKeys.class)
50 | .create();
51 |
52 | File file = new File(dataFolder, "data.yml");
53 | if (file.exists()) file.renameTo(new File(dataFolder, "users.yml"));
54 | }
55 |
56 | public static void refresh() {
57 | config.reload();
58 | messages.reload();
59 | }
60 |
61 | public static SettingsManager getConfig() {
62 | return config;
63 | }
64 |
65 | public static SettingsManager getMessages() {
66 | return messages;
67 | }
68 |
69 | private static void copyPluginConfig(final File dataFolder, final ComponentLogger logger, final SettingsManager config) {
70 | File input = new File(dataFolder, "plugin-config.yml");
71 |
72 | if (!input.exists()) return;
73 |
74 | YamlConfiguration configuration = CompletableFuture.supplyAsync(() -> YamlConfiguration.loadConfiguration(input)).join();
75 |
76 | String language = configuration.getString("language", "en-US");
77 |
78 | String prefix = configuration.getString("command_prefix", "&8[&dCrazyEnvoys&8]: ");
79 | String consolePrefix = configuration.getString("console_prefix", "&8[&cCrazyEnvoys&8] ");
80 |
81 | config.setProperty(ConfigKeys.locale_file, language);
82 | config.setProperty(ConfigKeys.command_prefix, prefix);
83 | config.setProperty(ConfigKeys.console_prefix, consolePrefix);
84 |
85 | // Save to file.
86 | config.save();
87 |
88 | // Delete old file.
89 | if (input.delete()) logger.warn("Successfully migrated {}.yml", input.getName());
90 | }
91 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/config/beans/ButtonProperty.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.config.beans;
2 |
3 | public class ButtonProperty {
4 |
5 | private String name;
6 | private int slot;
7 |
8 | public ButtonProperty(final String name, final int slot) {
9 | this.name = name;
10 | this.slot = slot;
11 | }
12 |
13 | public void setName(final String name) {
14 | this.name = name;
15 | }
16 |
17 | public void setSlot(final int slot) {
18 | this.slot = slot;
19 | }
20 |
21 | public final String getName() {
22 | return this.name;
23 | }
24 |
25 | public final int getSlot() {
26 | return this.slot;
27 | }
28 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/config/beans/GuiProperty.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.config.beans;
2 |
3 | public class GuiProperty {
4 |
5 | private String title;
6 | private int size;
7 |
8 | public GuiProperty(final String title, final int size) {
9 | this.title = title;
10 | this.size = size;
11 | }
12 |
13 | public GuiProperty() {
14 | this.title = "&cEnvoy Drops";
15 | this.size = 27;
16 | }
17 |
18 | public void setTitle(final String title) {
19 | this.title = title;
20 | }
21 |
22 | public void setSize(final int size) {
23 | this.size = size;
24 | }
25 |
26 | public final String getTitle() {
27 | return this.title;
28 | }
29 |
30 | public final int getSize() {
31 | return this.size;
32 | }
33 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/config/migrate/ConfigMigration.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.config.migrate;
2 |
3 | import ch.jalu.configme.configurationdata.ConfigurationData;
4 | import ch.jalu.configme.migration.PlainMigrationService;
5 | import ch.jalu.configme.resource.PropertyReader;
6 | import com.badbones69.crazyenvoys.api.enums.Properties;
7 | import org.jetbrains.annotations.NotNull;
8 |
9 | public class ConfigMigration extends PlainMigrationService {
10 |
11 | @Override
12 | protected boolean performMigrations(@NotNull PropertyReader reader, @NotNull ConfigurationData configurationData) {
13 | return Properties.command_prefix.moveString(reader, configurationData)
14 | | Properties.falling_toggle.moveBoolean(reader, configurationData)
15 | | Properties.falling_block.moveString(reader, configurationData)
16 | | Properties.falling_height.moveInteger(reader, configurationData)
17 | | Properties.max_crate_toggle.moveBoolean(reader, configurationData)
18 | | Properties.random_amount.moveBoolean(reader, configurationData)
19 | | Properties.min_crates.moveInteger(reader, configurationData)
20 | | Properties.max_crates.moveInteger(reader, configurationData)
21 | | Properties.random_locations.moveBoolean(reader, configurationData)
22 | | Properties.max_radius.moveInteger(reader, configurationData)
23 | | Properties.min_radius.moveInteger(reader, configurationData)
24 | | Properties.locations_broadcast.moveBoolean(reader, configurationData)
25 | | Properties.run_time.moveString(reader, configurationData)
26 | | Properties.run_time_toggle.moveBoolean(reader, configurationData)
27 | | Properties.cooldown_toggle.moveBoolean(reader, configurationData)
28 | | Properties.envoys_cooldown.moveString(reader, configurationData)
29 | | Properties.envoys_time.moveString(reader, configurationData)
30 | | Properties.envoys_ignore_empty_server.moveBoolean(reader, configurationData)
31 | | Properties.minimum_players_toggle.moveBoolean(reader, configurationData)
32 | | Properties.minimum_players_count.moveInteger(reader, configurationData)
33 | | Properties.minimum_flare_toggle.moveBoolean(reader, configurationData)
34 | | Properties.minimum_flare_count.moveInteger(reader, configurationData)
35 | | Properties.envoys_flare_item_name.moveString(reader, configurationData)
36 | | Properties.envoys_flare_item_type.moveString(reader, configurationData)
37 | | Properties.envoys_flare_item_lore.moveList(reader, configurationData)
38 | | Properties.envoys_flare_world_guard_toggle.moveBoolean(reader, configurationData)
39 | | Properties.envoys_flare_world_guard_regions.moveList(reader, configurationData)
40 | | Properties.envoys_announce_player_pickup.moveBoolean(reader, configurationData)
41 | | Properties.envoys_grab_cooldown_toggle.moveBoolean(reader, configurationData)
42 | | Properties.envoys_grab_cooldown_timer.moveString(reader, configurationData)
43 | | Properties.envoys_grace_period_toggle.moveBoolean(reader, configurationData)
44 | | Properties.envoys_grace_period_timer.moveInteger(reader, configurationData)
45 | | Properties.envoys_grace_period_unlocked.moveString(reader, configurationData)
46 | | Properties.envoys_grace_period_time_unit.moveString(reader, configurationData)
47 | | Properties.envoys_world_messages.moveBoolean(reader, configurationData)
48 | | Properties.envoys_allowed_worlds.moveList(reader, configurationData)
49 | | Properties.envoys_warnings.moveList(reader, configurationData);
50 | }
51 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/config/migrate/LocaleMigration.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.config.migrate;
2 |
3 | import ch.jalu.configme.configurationdata.ConfigurationData;
4 | import ch.jalu.configme.migration.PlainMigrationService;
5 | import ch.jalu.configme.resource.PropertyReader;
6 | import com.badbones69.crazyenvoys.api.enums.Properties;
7 | import org.jetbrains.annotations.NotNull;
8 |
9 | public class LocaleMigration extends PlainMigrationService {
10 |
11 | @Override
12 | protected boolean performMigrations(@NotNull PropertyReader reader, @NotNull ConfigurationData configurationData) {
13 | return Properties.no_permission.moveString(reader, configurationData)
14 | | Properties.no_claim_permission.moveString(reader, configurationData)
15 | | Properties.player_only.moveString(reader, configurationData)
16 | | Properties.not_online.moveString(reader, configurationData)
17 | | Properties.not_a_number.moveString(reader, configurationData)
18 | | Properties.plugin_reloaded.moveString(reader, configurationData)
19 | | Properties.already_started.moveString(reader, configurationData)
20 | | Properties.force_started.moveString(reader, configurationData)
21 | | Properties.force_ended.moveString(reader, configurationData)
22 | | Properties.not_started.moveString(reader, configurationData)
23 | | Properties.warning.moveString(reader, configurationData)
24 | | Properties.started.moveList(reader, configurationData)
25 | | Properties.left.moveList(reader, configurationData)
26 | | Properties.left_list.moveStringToList(reader, configurationData)
27 | | Properties.ended.moveList(reader, configurationData)
28 | | Properties.ended_list.moveStringToList(reader, configurationData)
29 | | Properties.not_enough_players.moveString(reader, configurationData)
30 | | Properties.enter_editor_mode.moveString(reader, configurationData)
31 | | Properties.leave_editor_mode.moveString(reader, configurationData)
32 | | Properties.clear_locations.moveString(reader, configurationData)
33 | | Properties.failed_clear_locations.moveString(reader, configurationData)
34 | | Properties.kicked_from_editor.moveString(reader, configurationData)
35 | | Properties.add_location.moveString(reader, configurationData)
36 | | Properties.remove_location.moveString(reader, configurationData)
37 | | Properties.time_left.moveString(reader, configurationData)
38 | | Properties.time_till_event.moveList(reader, configurationData)
39 | | Properties.time_till_event_list.moveStringToList(reader, configurationData)
40 | | Properties.envoy_used_flare.moveString(reader, configurationData)
41 | | Properties.envoy_cant_use_flare.moveString(reader, configurationData)
42 | | Properties.envoy_give_flare.moveString(reader, configurationData)
43 | | Properties.envoy_given_flare.moveString(reader, configurationData)
44 | | Properties.new_center.moveString(reader, configurationData)
45 | | Properties.not_in_worldguard_region.moveString(reader, configurationData)
46 | | Properties.start_ignoring_messages.moveString(reader, configurationData)
47 | | Properties.stop_ignoring_messages.moveString(reader, configurationData)
48 | | Properties.cooldown_left.moveString(reader, configurationData)
49 | | Properties.countdown_in_progress.moveString(reader, configurationData)
50 | | Properties.drops_page.moveString(reader, configurationData)
51 | | Properties.drops_format.moveString(reader, configurationData)
52 | | Properties.no_spawn_locations.moveString(reader, configurationData)
53 | | Properties.command_not_found.moveString(reader, configurationData)
54 | | Properties.hologram_active.moveString(reader, configurationData)
55 | | Properties.hologram_not_active.moveString(reader, configurationData)
56 | | Properties.placeholder_day.moveString(reader, configurationData)
57 | | Properties.placeholder_hour.moveString(reader, configurationData)
58 | | Properties.placeholder_minute.moveString(reader, configurationData)
59 | | Properties.placeholder_second.moveString(reader, configurationData)
60 | | Properties.crate_locations.moveString(reader, configurationData)
61 | | Properties.location_format.moveString(reader, configurationData)
62 | | Properties.help.moveList(reader, configurationData);
63 | }
64 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/config/types/ConfigKeys.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.config.types;
2 |
3 | import ch.jalu.configme.Comment;
4 | import ch.jalu.configme.SettingsHolder;
5 | import ch.jalu.configme.configurationdata.CommentsConfiguration;
6 | import ch.jalu.configme.properties.Property;
7 | import ch.jalu.configme.properties.PropertyInitializer;
8 | import com.badbones69.crazyenvoys.config.beans.GuiProperty;
9 |
10 | import java.util.List;
11 |
12 | import static ch.jalu.configme.properties.PropertyInitializer.*;
13 | import static ch.jalu.configme.properties.PropertyInitializer.newBeanProperty;
14 |
15 | public class ConfigKeys implements SettingsHolder {
16 |
17 | protected ConfigKeys() {}
18 |
19 | @Override
20 | public void registerComments(CommentsConfiguration conf) {
21 | String[] header = {
22 | "Support: https://discord.gg/badbones-s-live-chat-182615261403283459",
23 | "Github: https://github.com/Crazy-Crew",
24 | "",
25 | "Issues: https://github.com/Crazy-Crew/CrazyEnvoys/issues",
26 | "Features: https://github.com/Crazy-Crew/CrazyEnvoys/issues",
27 | ""
28 | };
29 |
30 | String[] deprecation = {
31 | "",
32 | "Warning: This section is subject to change so it is considered deprecated.",
33 | "This is your warning before the change happens.",
34 | ""
35 | };
36 |
37 | conf.setComment("root", header);
38 | }
39 |
40 | @Comment({
41 | "Choose the language you prefer to use on your server!",
42 | "",
43 | "Currently Available:",
44 | " > en-US ( English )",
45 | "",
46 | "If you do not see your language above, You can contribute by modifying the current en-US.yml",
47 | "https://github.com/Crazy-Crew/CrazyEnvoys/blob/main/paper/src/main/resources/locale/en-US.yml",
48 | "Submit your finalized config using https://bin.bloom.host/ and send it to us in https://discord.gg/badbones-s-live-chat-182615261403283459",
49 | ""
50 | })
51 | public static final Property locale_file = PropertyInitializer.newProperty("root.language", "en-US");
52 |
53 | @Comment("Whether you want CrazyEnvoys to shut up or not, This option is ignored by errors.")
54 | public static final Property verbose_logging = PropertyInitializer.newProperty("root.verbose_logging", true);
55 |
56 | @Comment({
57 | "A list of available hologram plugins:",
58 | " -> DecentHolograms",
59 | " -> FancyHolograms",
60 | " -> CMI",
61 | " -> None",
62 | "",
63 | "If the option is set to blank, it'll pick whatever plugin it feels like picking.",
64 | "Set the value to None if you do not want any."
65 | })
66 | public static final Property hologram_plugin = newProperty("root.hologram-plugin", "");
67 |
68 | @Comment("The command prefix you want shown in front of commands!")
69 | public static final Property command_prefix = PropertyInitializer.newProperty("root.command_prefix", "&8[&dCrazyEnvoys&8]: ");
70 |
71 | @Comment("The console prefix you want shown when the logging messages show up!")
72 | public static final Property console_prefix = PropertyInitializer.newProperty("root.console_prefix" ,"&8[&cCrazyEnvoys&8] ");
73 |
74 | @Comment("Envoys will act as chests with items inside instead of adding to inventory.")
75 | public static final Property envoy_menu_open = PropertyInitializer.newProperty("envoys.open-chest.toggle", false);
76 |
77 | @Comment("Settings related to the menu opened when right clicking an envoy. Requires the option above to be true!")
78 | public static final Property envoy_menu = newBeanProperty(GuiProperty.class, "envoys.open-chest.menu", new GuiProperty("&cEnvoy Drops", 27));
79 |
80 | @Comment("Whether a block should fall when an envoy spawns.")
81 | public static final Property envoy_falling_block_toggle = newProperty("envoys.falling-blocks.toggle", true);
82 |
83 | @Comment("The block type falling when an envoy spawns.")
84 | public static final Property envoy_falling_block_type = newProperty("envoys.falling-blocks.type", "BEACON");
85 |
86 | @Comment("How high should the block spawn when an envoy spawns?")
87 | public static final Property envoy_falling_height = newProperty("envoys.falling-blocks.height", 15);
88 |
89 | @Comment({
90 | "Whether to always spawn the max amount of crates possible set below, If the option is false. Spawn locations set using /envoy edit will instead spawn.",
91 | "Note: You should only use this if random-locations is false."
92 | })
93 | public static final Property envoys_max_drops_toggle = newProperty("envoys.generation.max-drops-toggle", false);
94 |
95 | @Comment("The max amount of crates that will spawn.")
96 | public static final Property envoys_max_drops = newProperty("envoys.generation.max-drops-amount", 20);
97 |
98 | @Comment("The min amount of crates that will spawn.")
99 | public static final Property envoys_min_drops = newProperty("envoys.generation.min-drops-amount", 7);
100 |
101 | @Comment({
102 | "This option will spawn a random number of envoys between min-drops-amount and max-drops-amount.",
103 | "Note: You must set max-drops-toggle to false otherwise this will not function."
104 | })
105 | public static final Property envoys_random_drops = newProperty("envoys.generation.random-drops", true);
106 |
107 | @Comment({
108 | "This option will spawn envoys at complete random",
109 | "Note: You need to use /envoy center at wherever you want the center to be.",
110 | "Second Note: You may have to tweak the options above."
111 | })
112 | public static final Property envoys_random_locations = newProperty("envoys.generation.random-locations.toggle", true);
113 |
114 | @Comment("The maximum distance the envoys will fall from the center.")
115 | public static final Property envoys_max_radius = newProperty("envoys.generation.random-locations.max-radius", 300);
116 |
117 | @Comment("The minimum distance from the middle the envoys will fall from the center.")
118 | public static final Property envoys_min_radius = newProperty("envoys.generation.random-locations.min-radius", 20);
119 |
120 | @Comment("If all drop locations should be broadcast when an envoy starts.")
121 | public static final Property envoys_locations_broadcast = newProperty("envoys.broadcast", false);
122 |
123 | @Comment({
124 | "This option decides whether to run envoys at an interval or on a schedule.",
125 | "Note: If the option is false, It will only start via a command or a player's flare."
126 | })
127 | public static final Property envoys_run_time_toggle = newProperty("envoys.schedule.run-time.toggle", true);
128 |
129 | @Comment("This option decides how long the envoy event should last.")
130 | public static final Property envoys_run_time = newProperty("envoys.schedule.run-time.value", "5m");
131 |
132 | @Comment("This option decides if the envoy event has a cooldown i.e 59 minutes or activates at a specific time of day.")
133 | public static final Property envoys_countdown = newProperty("envoys.schedule.countdown.toggle", true);
134 |
135 | @Comment("The time till the envoy event will happen again.")
136 | public static final Property envoys_cooldown = newProperty("envoys.schedule.countdown.time", "1h");
137 |
138 | @Comment("A specified time of the day that an envoy will happen. Please use 1-12 for hours and 0-59 for minutes.")
139 | public static final Property envoys_time = newProperty("envoys.schedule.countdown.timestamp", "2:00 AM");
140 |
141 | @Comment("If the envoy event should spawn if the server is empty.")
142 | public static final Property envoys_ignore_empty_server = newProperty("envoys.schedule.ignore-empty-server", true);
143 |
144 | @Comment("If the envoy event should require a minimum number of players. This option is no longer required for the flare requirements.")
145 | public static final Property envoys_minimum_players_toggle = newProperty("envoys.required-players.default.toggle", false);
146 |
147 | @Comment("The minimum amount of players needed to start an envoy.")
148 | public static final Property envoys_minimum_players_amount = newProperty("envoys.required-players.default.amount", 12);
149 |
150 | @Comment("If the flare should require a minimum amount of players.")
151 | public static final Property envoys_flare_minimum_players_toggle = newProperty("flare.required-players.toggle", false);
152 |
153 | @Comment("The minimum amount of players needed to use a flare.")
154 | public static final Property envoys_flare_minimum_players_amount = newProperty("flare.required-players.amount", 6);
155 |
156 | @Comment("The name of the flare item.")
157 | public static final Property envoys_flare_item_name = newProperty("flare.item.name", "&7&l(&4&l!&7&l) &cFlare");
158 |
159 | @Comment("The material of the flare item.")
160 | public static final Property envoys_flare_item_type = newProperty("flare.item.type", "REDSTONE_TORCH");
161 |
162 | @Comment("If the flare will glow.")
163 | public static final Property envoys_flare_item_glowing = newProperty("flare.item.glowing", false);
164 |
165 | @Comment("The lore of the flare item.")
166 | public static final Property> envoys_flare_item_lore = newListProperty("flare.item.lore", List.of(
167 | "&7Right click me to",
168 | "&7start an envoy event."
169 | ));
170 |
171 | @Comment("If they are limited to use flares only in specified regions.")
172 | public static final Property envoys_flare_world_guard_toggle = newProperty("flare.support.worldguard.toggle", false);
173 |
174 | @Comment("The name of the regions you can use flares in.")
175 | public static final Property> envoys_flare_world_guard_regions = newListProperty("flare.support.worldguard.regions", List.of(
176 | "Warzone"
177 | ));
178 |
179 | @Comment("Broadcast a message when a player picks up an envoy.")
180 | public static final Property envoys_announce_player_pickup = newProperty("envoys.announce-player-pickup", true);
181 |
182 | @Comment("If the player should wait before being able to grab another envoy.")
183 | public static final Property envoys_grab_cooldown_toggle = newProperty("envoys.grab-cooldown.toggle", false);
184 |
185 | @Comment("The amount of time a player has to wait before grabbing another envoy.")
186 | public static final Property envoys_grab_cooldown_timer = newProperty("envoys.grab-cooldown.time", "15s");
187 |
188 | @Comment("If there should be a grace period when an envoy spawns. What this means is the player will have to wait a certain amount of time.")
189 | public static final Property envoys_grace_period_toggle = newProperty("envoys.grace-period.toggle", false);
190 |
191 | @Comment("The time they have to wait to claim the envoy.")
192 | public static final Property envoys_grace_period_timer = newProperty("envoys.grace-period.timer", 120);
193 |
194 | @Comment("The message shown above the envoy when the grace period is over.")
195 | public static final Property envoys_grace_period_unlocked = newProperty("envoys.grace-period.message", "&cReady to claim.");
196 |
197 | @Comment("The unit of time to show at the end of the countdown since it's in seconds. The space is required!")
198 | public static final Property envoys_grace_period_time_unit = newProperty("envoys.grace-period.time-unit", " seconds.");
199 |
200 | @Comment("If the broadcast messages are only in specific worlds.")
201 | public static final Property envoys_world_messages = newProperty("envoys.world-messages.toggle", false);
202 |
203 | @Comment("The worlds you wish to have messages show up in.")
204 | public static final Property> envoys_allowed_worlds = newListProperty("envoys.world-messages.worlds", List.of(
205 | "world"
206 | ));
207 |
208 | @Comment("Pick what time stamps the warning messages will appear at.")
209 | public static final Property> envoys_warnings = newListProperty("envoys.warnings", List.of(
210 | "30m",
211 | "15m",
212 | "10m",
213 | "1m",
214 | "30s",
215 | "20s",
216 | "10s",
217 | "5s",
218 | "3s",
219 | "1s"
220 | ));
221 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/config/types/MessageKeys.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.config.types;
2 |
3 | import ch.jalu.configme.SettingsHolder;
4 | import ch.jalu.configme.configurationdata.CommentsConfiguration;
5 | import ch.jalu.configme.properties.Property;
6 | import java.util.List;
7 | import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
8 | import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
9 |
10 | public class MessageKeys implements SettingsHolder {
11 |
12 | protected MessageKeys() {}
13 |
14 | @Override
15 | public void registerComments(CommentsConfiguration conf) {
16 | String[] header = {
17 | "Support: https://discord.gg/badbones-s-live-chat-182615261403283459",
18 | "Github: https://github.com/Crazy-Crew",
19 | "",
20 | "Issues: https://github.com/Crazy-Crew/CrazyEnvoys/issues",
21 | "Features: https://github.com/Crazy-Crew/CrazyEnvoys/issues",
22 | "",
23 | "Tips:",
24 | " 1. Make sure to use the {prefix} to add the prefix in front of messages.",
25 | " 2. If you wish to use more than one line for a message just go from a line to a list.",
26 | "Examples:",
27 | " Line:",
28 | " No-Permission: '{prefix}&cYou do not have permission to use that command.'",
29 | " List:",
30 | " No-Permission:",
31 | " - '{prefix}&cYou do not have permission'",
32 | " - '&cto use that command. Please try another.'"
33 | };
34 |
35 | String[] deprecation = {
36 | "",
37 | "Warning: This section is subject to change so it is considered deprecated.",
38 | "This is your warning before the change happens.",
39 | ""
40 | };
41 |
42 | conf.setComment("player", header);
43 | }
44 |
45 | public static final Property no_permission = newProperty("player.no-permission", "{prefix}&cYou do not have permission to use that command.");
46 |
47 | public static final Property no_claim_permission = newProperty("player.no-permission-to-claim", "{prefix}&cYou do not have permission to claim that envoy.");
48 |
49 | public static final Property envoy_already_started = newProperty("envoys.already-started", "{prefix}&cThere is already an envoy event running. Please stop it to start a new one.");
50 |
51 | public static final Property envoy_force_start = newProperty("envoys.force-start", "{prefix}&7You have just started the envoy.");
52 |
53 | public static final Property envoy_not_started = newProperty("envoys.not-started", "{prefix}&cThere is no envoy event going on at this time.");
54 |
55 | public static final Property envoy_force_ended = newProperty("envoys.force-ended", "{prefix}&cYou have just ended the envoy.");
56 |
57 | public static final Property envoy_warning = newProperty("envoys.warning", "{prefix}&c[&4ALERT&c] &7There is an envoy event happening in &6{time}.");
58 |
59 | public static final Property> envoy_started = newListProperty("envoys.started.list", List.of(
60 | "{prefix}&7An envoy event has just started. &6{amount} &7crates have spawned around spawn for 5m."
61 | ));
62 |
63 | public static final Property> envoys_remaining = newListProperty("envoys.left", List.of(
64 | "{prefix}&6{player} &7has just found a tier envoy. There are now &6{amount} &7left to find."
65 | ));
66 |
67 | public static final Property> envoy_ended = newListProperty("envoys.ended", List.of(
68 | "{prefix}&cThe envoy event has ended. Thanks for playing and please come back for the next one."
69 | ));
70 |
71 | public static final Property not_enough_players = newProperty("envoys.not-enough-players", "{prefix}&7Not enough players are online to start the envoy event. Only &6{amount} &7players are online.");
72 |
73 | public static final Property enter_editor_mode = newProperty("envoys.enter-editor-mode", "{prefix}&7You are now in editor mode.");
74 |
75 | public static final Property exit_editor_mode = newProperty("envoys.leave-editor-mode", "{prefix}&7You have now left editor mode.");
76 |
77 | public static final Property envoy_clear_locations = newProperty("envoys.editor-clear-locations", "{prefix}&7You have cleared all the editor spawn locations.");
78 |
79 | public static final Property envoy_clear_failure = newProperty("envoys.editor-clear-failure", "{prefix}&7You must be in Editor mode to clear the spawn locations.");
80 |
81 | public static final Property envoy_kicked_from_editor_mode = newProperty("envoys.kicked-from-editor-mode", "{prefix}&cSorry but an envoy is active. Please stop it or wait till it''s over.");
82 |
83 | public static final Property envoy_add_location = newProperty("envoys.add-location", "{prefix}&7You have just added a spawn location.");
84 |
85 | public static final Property envoy_remove_location = newProperty("envoys.remove-location", "{prefix}&cYou have just removed a spawn location.");
86 |
87 | public static final Property envoy_time_left = newProperty("envoys.time-left", "{prefix}&7The current envoy has &6{time}&7 left.");
88 |
89 | public static final Property> envoy_time_till_event = newListProperty("envoys.time-till-event", List.of(
90 | "{prefix}&7The next envoy will start in &6{time}&7."
91 | ));
92 |
93 | public static final Property envoy_used_flare = newProperty("envoys.flare.used-flare", "{prefix}&7You have just started an envoy event with a flare.");
94 |
95 | public static final Property envoy_cant_use_flare = newProperty("envoys.flare.cant-use-flares", "{prefix}&cYou do not have permission to use flares.");
96 |
97 | public static final Property envoy_give_flare = newProperty("envoys.flare.sent-flare", "{prefix}&7You have just given &6{player} {amount} &7flares.");
98 |
99 | public static final Property envoy_received_flare = newProperty("envoys.flare.received-flare", "{prefix}&7You have been given &6{amount} &7flares.");
100 |
101 | public static final Property envoy_new_center = newProperty("envoys.new-center", "{prefix}&7You have just set a new center for the random envoy crates.");
102 |
103 | public static final Property not_in_world_guard_region = newProperty("envoys.not-in-world-guard-region", "{prefix}&cYou must be in the WarZone to use a flare.");
104 |
105 | public static final Property start_ignoring_messages = newProperty("envoys.start-ignoring-messages", "{prefix}&7You are now ignoring the collecting messages.");
106 |
107 | public static final Property stop_ignoring_messages = newProperty("envoys.stop-ignoring-messages", "{prefix}&7You now see all the collecting messages.");
108 |
109 | public static final Property cooldown_left = newProperty("envoys.cooldown-left", "{prefix}&7You still have &6{time} &7till you can collect another crate.");
110 |
111 | public static final Property countdown_in_progress = newProperty("envoys.countdown-in-progress", "{prefix}&7You cannot claim any envoys for another &6{time} seconds.");
112 |
113 | public static final Property drops_available = newProperty("envoys.drops-available", "{prefix}&7List of all available envoys.");
114 |
115 | public static final Property drops_possibilities = newProperty("envoys.drops-possibilities", "{prefix}&7List of location envoy''s may spawn at.");
116 |
117 | public static final Property drops_page = newProperty("envoys.drops-page", "{prefix}&7Use /crazyenvoys drops [page] to see more.");
118 |
119 | public static final Property drops_format = newProperty("envoys.drops-format", "&7[&6{id}&7]: {world}, {x}, {y}, {z}");
120 |
121 | public static final Property no_spawn_locations_found = newProperty("envoys.no-spawn-locations-found", "{prefix}&cNo spawn locations were found and so the event has been cancelled and the cooldown has been reset.");
122 |
123 | public static final Property hologram_on_going = newProperty("envoys.hologram-placeholders.on-going", "On Going");
124 |
125 | public static final Property hologram_not_running = newProperty("envoys.hologram-placeholders.not-running", "Not Running");
126 |
127 | public static final Property time_placeholder_day = newProperty("envoys.time-placeholders.day", "d");
128 | public static final Property time_placeholder_hour = newProperty("envoys.time-placeholders.hour", "h");
129 | public static final Property time_placeholder_minute = newProperty("envoys.time-placeholders.minute", "m");
130 | public static final Property time_placeholder_second = newProperty("envoys.time-placeholders.second", "s");
131 |
132 | public static final Property envoy_locations = newProperty("envoys.envoy-locations", "&e&lAll Envoy Locations: \\n&c[ID], [World]: [X], [Y], [Z] &r{locations}");
133 |
134 | public static final Property location_format = newProperty("envoys.location-format", "\\n&8[&3{id}&8] &c{world}: {x}, {y}, {z}");
135 |
136 | public static final Property command_not_found = newProperty("misc.command-not-found", "{prefix}&cPlease do /crazyenvoys help for more information.");
137 |
138 | public static final Property player_only = newProperty("misc.player-only", "{prefix}&cOnly players can use that command.");
139 |
140 | public static final Property not_online = newProperty("misc.not-online", "{prefix}&cThat player is not online at this time.");
141 |
142 | public static final Property not_a_number = newProperty("misc.not-a-number", "{prefix}&cThat is not a number.");
143 |
144 | public static final Property envoy_plugin_reloaded = newProperty("misc.config-reload", "{prefix}&7You have just reloaded all the files.");
145 |
146 | public static final Property> help = newListProperty("misc.help", List.of(
147 | "&6/crazyenvoys help &7- Shows the envoy help menu.",
148 | "&6/crazyenvoys reload &7- Reloads all the config files.",
149 | "&6/crazyenvoys time &7- Shows the time till the envoy starts or ends.",
150 | "&6/crazyenvoys drops [page] &7- Shows all current crate locations.",
151 | "&6/crazyenvoys ignore &7- Shuts up the envoy collecting message.",
152 | "&6/crazyenvoys flare [amount] [player] &7- Give a player a flare to call an envoy event.",
153 | "&6/crazyenvoys edit &7- Edit the crate locations with bedrock.",
154 | "&6/crazyenvoys start &7- Force starts the envoy.",
155 | "&6/crazyenvoys stop &7- Force stops the envoy.",
156 | "&6/crazyenvoys center &7- Set the center of the random crate drops."
157 | ));
158 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/listeners/EnvoyEditListener.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.listeners;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import com.badbones69.crazyenvoys.Methods;
5 | import com.badbones69.crazyenvoys.api.CrazyManager;
6 | import com.badbones69.crazyenvoys.api.enums.Messages;
7 | import com.badbones69.crazyenvoys.api.objects.EditorSettings;
8 | import com.badbones69.crazyenvoys.api.objects.LocationSettings;
9 | import org.bukkit.Material;
10 | import org.bukkit.block.Block;
11 | import org.bukkit.entity.Player;
12 | import org.bukkit.event.EventHandler;
13 | import org.bukkit.event.Listener;
14 | import org.bukkit.event.block.BlockBreakEvent;
15 | import org.bukkit.event.block.BlockPlaceEvent;
16 | import org.jetbrains.annotations.NotNull;
17 | import java.util.UUID;
18 |
19 | public class EnvoyEditListener implements Listener {
20 |
21 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
22 |
23 | private @NotNull final EditorSettings editorSettings = this.plugin.getEditorSettings();
24 |
25 | private @NotNull final LocationSettings locationSettings = this.plugin.getLocationSettings();
26 |
27 | private @NotNull final CrazyManager crazyManager = this.plugin.getCrazyManager();
28 |
29 | @EventHandler(ignoreCancelled = true)
30 | public void onBlockPlace(final BlockPlaceEvent event) {
31 | Player player = event.getPlayer();
32 | Block block = event.getBlock();
33 |
34 | if (!this.editorSettings.isEditor(player)) return;
35 |
36 | event.setCancelled(true);
37 |
38 | if (Methods.getItemInHand(player).getType() != Material.BEDROCK) return;
39 |
40 | this.locationSettings.addSpawnLocation(block);
41 |
42 | Messages.add_location.sendMessage(player);
43 |
44 | for (UUID uuid : this.editorSettings.getEditors()) {
45 | if (uuid == player.getUniqueId()) player.sendBlockChange(block.getLocation(), Material.BEDROCK.createBlockData());
46 | }
47 | }
48 |
49 | @EventHandler(ignoreCancelled = true)
50 | public void onBlockBreak(BlockBreakEvent event) {
51 | Player player = event.getPlayer();
52 | Block block = event.getBlock();
53 |
54 | if (!this.editorSettings.isEditor(player)) return;
55 |
56 | event.setCancelled(true);
57 |
58 | if (!this.crazyManager.isLocation(block.getLocation())) return;
59 |
60 | block.getState().update();
61 |
62 | this.locationSettings.removeSpawnLocation(block);
63 |
64 | Messages.remove_location.sendMessage(player);
65 | }
66 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/listeners/FireworkDamageListener.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.listeners;
2 |
3 | import com.badbones69.crazyenvoys.api.enums.PersistentKeys;
4 | import org.bukkit.entity.Entity;
5 | import org.bukkit.entity.Firework;
6 | import org.bukkit.event.EventHandler;
7 | import org.bukkit.event.Listener;
8 | import org.bukkit.event.entity.EntityDamageEvent;
9 | import org.bukkit.persistence.PersistentDataContainer;
10 |
11 | public class FireworkDamageListener implements Listener {
12 |
13 | @EventHandler(ignoreCancelled = true)
14 | public void onFireworkDamage(EntityDamageEvent event) {
15 | Entity directEntity = event.getDamageSource().getDirectEntity();
16 |
17 | if (directEntity instanceof Firework firework) {
18 | PersistentDataContainer container = firework.getPersistentDataContainer();
19 |
20 | if (container.has(PersistentKeys.no_firework_damage.getNamespacedKey())) {
21 | event.setCancelled(true);
22 | }
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/listeners/FlareClickListener.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.listeners;
2 |
3 | import ch.jalu.configme.SettingsManager;
4 | import com.badbones69.crazyenvoys.CrazyEnvoys;
5 | import com.badbones69.crazyenvoys.Methods;
6 | import com.badbones69.crazyenvoys.api.CrazyManager;
7 | import com.badbones69.crazyenvoys.api.enums.Messages;
8 | import com.badbones69.crazyenvoys.api.events.EnvoyStartEvent;
9 | import com.badbones69.crazyenvoys.api.objects.FlareSettings;
10 | import org.bukkit.entity.Player;
11 | import org.bukkit.event.EventHandler;
12 | import org.bukkit.event.Listener;
13 | import org.bukkit.event.block.Action;
14 | import org.bukkit.event.player.PlayerInteractEvent;
15 | import org.bukkit.inventory.ItemStack;
16 | import org.jetbrains.annotations.NotNull;
17 | import com.badbones69.crazyenvoys.config.ConfigManager;
18 | import com.badbones69.crazyenvoys.config.types.ConfigKeys;
19 | import java.util.HashMap;
20 | import java.util.Map;
21 |
22 | public class FlareClickListener implements Listener {
23 |
24 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
25 | private @NotNull final SettingsManager config = ConfigManager.getConfig();
26 |
27 | private @NotNull final CrazyManager crazyManager = this.plugin.getCrazyManager();
28 |
29 | private @NotNull final FlareSettings flareSettings = this.plugin.getFlareSettings();
30 |
31 | @EventHandler(ignoreCancelled = true)
32 | public void onFlareInteract(PlayerInteractEvent event) {
33 | Player player = event.getPlayer();
34 |
35 | if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
36 | ItemStack flare = Methods.getItemInHand(player);
37 |
38 | if (this.flareSettings.isFlare(flare)) {
39 | event.setCancelled(true);
40 |
41 | if (!player.hasPermission("envoy.flare.use")) {
42 | Messages.cant_use_flares.sendMessage(player);
43 | return;
44 | }
45 |
46 | if (this.crazyManager.isEnvoyActive()) {
47 | Messages.already_started.sendMessage(player);
48 |
49 | return;
50 | }
51 |
52 | int online = this.plugin.getServer().getOnlinePlayers().size();
53 |
54 | if (this.config.getProperty(ConfigKeys.envoys_flare_minimum_players_toggle) && online < this.config.getProperty(ConfigKeys.envoys_flare_minimum_players_amount)) {
55 | Map placeholder = new HashMap<>();
56 | placeholder.put("{amount}", String.valueOf(online));
57 |
58 | Messages.not_enough_players.sendMessage(player, placeholder);
59 |
60 | return;
61 | }
62 |
63 | boolean toggle = false;
64 |
65 | if (this.plugin.getServer().getPluginManager().isPluginEnabled("WorldEdit") && this.plugin.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
66 | if (this.config.getProperty(ConfigKeys.envoys_flare_world_guard_toggle)) {
67 | for (String region : this.config.getProperty(ConfigKeys.envoys_flare_world_guard_regions)) {
68 | if (this.crazyManager.getWorldGuardPluginSupport().inRegion(region, player.getLocation())) toggle = true;
69 | }
70 | } else {
71 | toggle = true;
72 | }
73 | } else {
74 | toggle = true;
75 | }
76 |
77 | if (!toggle) {
78 | Messages.not_in_world_guard_region.sendMessage(player);
79 |
80 | return;
81 | }
82 |
83 | EnvoyStartEvent envoyStartEvent = new EnvoyStartEvent(EnvoyStartEvent.EnvoyStartReason.FLARE);
84 | this.plugin.getServer().getPluginManager().callEvent(envoyStartEvent);
85 |
86 | if (!envoyStartEvent.isCancelled() && this.crazyManager.startEnvoyEvent()) {
87 | Messages.used_flare.sendMessage(player);
88 |
89 | this.flareSettings.takeFlare(player);
90 | }
91 | }
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/listeners/timer/CountdownTimer.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.listeners.timer;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
5 | import org.bukkit.plugin.java.JavaPlugin;
6 | import org.jetbrains.annotations.NotNull;
7 |
8 | /**
9 | * A simple countdown timer using the Runnable interface in seconds!
10 | *
11 | * @author ExpDev
12 | */
13 | public class CountdownTimer extends FoliaRunnable {
14 |
15 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
16 |
17 | // Seconds and shiz
18 | private final int seconds;
19 | private int secondsLeft;
20 |
21 | public CountdownTimer(JavaPlugin plugin, int seconds) {
22 | super(plugin.getServer().getGlobalRegionScheduler());
23 |
24 | this.seconds = seconds;
25 | this.secondsLeft = seconds;
26 | }
27 |
28 | /**
29 | * Runs the timer once, decrements seconds etc...
30 | * Really wish we could make it protected/private, so you couldn't access it.
31 | */
32 | @Override
33 | public void run() {
34 | // Is the timer up?
35 | if (this.secondsLeft < 1) {
36 | cancel();
37 |
38 | return;
39 | }
40 |
41 | // Decrement the seconds left.
42 | this.secondsLeft--;
43 | }
44 |
45 | /**
46 | * Gets the total seconds this timer was set to run for.
47 | *
48 | * @return Total seconds timer should run.
49 | */
50 | public int getTotalSeconds() {
51 | return this.seconds;
52 | }
53 |
54 | /**
55 | * Gets the seconds left this timer should run.
56 | *
57 | * @return Seconds left timer should run.
58 | */
59 | public int getSecondsLeft() {
60 | return this.secondsLeft;
61 | }
62 |
63 | /**
64 | * Schedules this instance to "run" every second.
65 | */
66 | public void scheduleTimer() {
67 | runAtFixedRate(this.plugin, 0L, 20L);
68 | }
69 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/MetricsWrapper.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import org.bstats.bukkit.Metrics;
5 |
6 | public class MetricsWrapper {
7 |
8 | private final CrazyEnvoys plugin = CrazyEnvoys.get();
9 |
10 | public MetricsWrapper(final int serviceId) {
11 | new Metrics(this.plugin, serviceId);
12 | }
13 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/claims/WorldGuardSupport.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support.claims;
2 |
3 | import com.badbones69.crazyenvoys.support.interfaces.WorldGuardVersion;
4 | import com.sk89q.worldedit.bukkit.BukkitWorld;
5 | import com.sk89q.worldedit.math.BlockVector3;
6 | import com.sk89q.worldguard.WorldGuard;
7 | import com.sk89q.worldguard.protection.ApplicableRegionSet;
8 | import com.sk89q.worldguard.protection.managers.RegionManager;
9 | import com.sk89q.worldguard.protection.regions.ProtectedRegion;
10 | import org.bukkit.Location;
11 |
12 | public class WorldGuardSupport implements WorldGuardVersion {
13 |
14 | @Override
15 | public boolean inRegion(String regionName, Location loc) {
16 | BukkitWorld world = new BukkitWorld(loc.getWorld());
17 | BlockVector3 vector = BlockVector3.at(loc.getX(), loc.getY(), loc.getZ());
18 |
19 | try {
20 | RegionManager instance = WorldGuard.getInstance().getPlatform().getRegionContainer().get(world);
21 |
22 | if (instance != null) {
23 | ApplicableRegionSet regionSet = instance.getApplicableRegions(vector);
24 |
25 | for (ProtectedRegion region : regionSet) {
26 | if (regionName.equalsIgnoreCase(region.getId())) return true;
27 | }
28 | }
29 | } catch (NullPointerException e) {
30 | return false;
31 | }
32 |
33 | return false;
34 | }
35 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/holograms/HologramManager.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support.holograms;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import com.badbones69.crazyenvoys.api.objects.misc.Tier;
5 | import org.bukkit.ChatColor;
6 | import org.bukkit.Location;
7 | import org.bukkit.util.Vector;
8 | import org.jetbrains.annotations.NotNull;
9 | import org.jetbrains.annotations.Nullable;
10 | import java.util.ArrayList;
11 | import java.util.Collections;
12 | import java.util.List;
13 | import java.util.UUID;
14 | import java.util.regex.Matcher;
15 | import java.util.regex.Pattern;
16 |
17 | @SuppressWarnings("deprecation")
18 | public abstract class HologramManager {
19 |
20 | protected CrazyEnvoys plugin = CrazyEnvoys.get();
21 |
22 | public abstract void createHologram(final Location location, final Tier tier, final String id);
23 |
24 | public abstract void removeHologram(final String id);
25 |
26 | public abstract boolean exists(final String id);
27 |
28 | public abstract void purge(final boolean isShutdown);
29 |
30 | public abstract String getName();
31 |
32 | protected @NotNull final String name() {
33 | return this.plugin.getName().toLowerCase() + "-" + UUID.randomUUID();
34 | }
35 |
36 | protected @NotNull final String name(final String id) {
37 | return this.plugin.getName().toLowerCase() + "-" + id;
38 | }
39 |
40 | protected @NotNull final Vector getVector(@NotNull final Tier tier) {
41 | return new Vector(0.5, tier.getHoloHeight(), 0.5);
42 | }
43 |
44 | protected @Nullable final String color(@NotNull final String message) {
45 | if (message.isEmpty()) return null;
46 |
47 | final Matcher matcher = Pattern.compile("#[a-fA-F\\d]{6}").matcher(message);
48 | final StringBuilder buffer = new StringBuilder();
49 |
50 | while (matcher.find()) {
51 | matcher.appendReplacement(buffer, net.md_5.bungee.api.ChatColor.of(matcher.group()).toString());
52 | }
53 |
54 | return ChatColor.translateAlternateColorCodes('&', matcher.appendTail(buffer).toString());
55 | }
56 |
57 | protected @NotNull final List lines(@NotNull final Tier tier) {
58 | if (tier.getHoloMessage().isEmpty()) return Collections.emptyList();
59 |
60 | final List lines = new ArrayList<>();
61 |
62 | tier.getHoloMessage().forEach(line -> lines.add(color(line)));
63 |
64 | return lines;
65 | }
66 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/holograms/types/CMIHologramsSupport.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support.holograms.types;
2 |
3 | import com.Zrips.CMI.CMI;
4 | import com.Zrips.CMI.Modules.Display.CMIBillboard;
5 | import com.Zrips.CMI.Modules.Holograms.CMIHologram;
6 | import com.badbones69.crazyenvoys.api.objects.misc.Tier;
7 | import com.badbones69.crazyenvoys.support.holograms.HologramManager;
8 | import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
9 | import net.Zrips.CMILib.Colors.CMIChatColor;
10 | import net.Zrips.CMILib.Container.CMILocation;
11 | import org.bukkit.Location;
12 | import org.bukkit.entity.Player;
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | public class CMIHologramsSupport extends HologramManager {
17 |
18 | private final com.Zrips.CMI.Modules.Holograms.HologramManager hologramManager = CMI.getInstance().getHologramManager();
19 |
20 | @Override
21 | public void createHologram(final Location location, final Tier tier, final String id) {
22 | if (!tier.isHoloEnabled()) {
23 | removeHologram(id);
24 |
25 | return;
26 | }
27 |
28 | // We don't want to create a new one if one already exists.
29 | if (exists(id)) return;
30 |
31 | final CMIHologram hologram = new CMIHologram(name(id), new CMILocation(location.clone().add(getVector(tier))));
32 |
33 | hologram.setNewDisplayMethod(true);
34 | hologram.setBillboard(CMIBillboard.CENTER);
35 |
36 | hologram.setLines(lines(tier));
37 |
38 | this.hologramManager.addHologram(hologram);
39 |
40 | new FoliaRunnable(this.plugin.getServer().getGlobalRegionScheduler()) {
41 | @Override
42 | public void run() {
43 | location.getNearbyEntitiesByType(Player.class, 5).forEach(player -> hologramManager.handleHoloUpdates(player, hologram.getLocation()));
44 | }
45 | }.run(this.plugin);
46 | }
47 |
48 | @Override
49 | public void removeHologram(final String id) {
50 | final CMIHologram hologram = this.hologramManager.getByName(name(id));
51 |
52 | if (hologram != null) {
53 | hologram.remove();
54 | }
55 | }
56 |
57 | @Override
58 | public boolean exists(final String id) {
59 | return this.hologramManager.getByName(name(id)) != null;
60 | }
61 |
62 | @Override
63 | public void purge(final boolean isShutdown) {
64 | final String name = this.plugin.getName().toLowerCase();
65 |
66 | final List holograms = new ArrayList<>() {{
67 | hologramManager.getHolograms().forEach((id, hologram) -> {
68 | if (id.startsWith(name + "-")) {
69 | add(id.replace(name + "-", ""));
70 | }
71 | });
72 | }};
73 |
74 | holograms.forEach(this::removeHologram);
75 | }
76 |
77 | @Override
78 | public final String getName() {
79 | return "CMI";
80 | }
81 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/holograms/types/DecentHologramsSupport.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support.holograms.types;
2 |
3 | import com.badbones69.crazyenvoys.api.objects.misc.Tier;
4 | import com.badbones69.crazyenvoys.support.holograms.HologramManager;
5 | import eu.decentsoftware.holograms.api.DHAPI;
6 | import eu.decentsoftware.holograms.api.holograms.Hologram;
7 | import org.bukkit.Location;
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | public class DecentHologramsSupport extends HologramManager {
12 |
13 | private final Map holograms = new HashMap<>();
14 |
15 | @Override
16 | public void createHologram(final Location location, final Tier tier, final String id) {
17 | if (!tier.isHoloEnabled()) {
18 | removeHologram(id);
19 |
20 | return;
21 | }
22 |
23 | // We don't want to create a new one if one already exists.
24 | if (exists(id)) return;
25 |
26 | final Hologram hologram = DHAPI.createHologram(name(id), location.clone().add(getVector(tier)));
27 |
28 | tier.getHoloMessage().forEach(line -> {
29 | if (line != null) {
30 | String coloredLine = color(line);
31 |
32 | if (coloredLine != null) {
33 | DHAPI.addHologramLine(hologram, coloredLine);
34 | }
35 | }
36 | });
37 |
38 | this.holograms.putIfAbsent(name(id), hologram);
39 | }
40 |
41 | @Override
42 | public void removeHologram(final String id) {
43 | DHAPI.removeHologram(name(id));
44 | }
45 |
46 | @Override
47 | public boolean exists(final String id) {
48 | return DHAPI.getHologram(name(id)) != null;
49 | }
50 |
51 | @Override
52 | public void purge(final boolean isShutdown) {
53 | this.holograms.forEach((key, value) -> {
54 | removeHologram(key);
55 |
56 | value.delete();
57 | });
58 |
59 | this.holograms.clear();
60 | }
61 |
62 | @Override
63 | public final String getName() {
64 | return "DecentHolograms";
65 | }
66 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/holograms/types/FancyHologramsSupport.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support.holograms.types;
2 |
3 | import com.badbones69.crazyenvoys.api.objects.misc.Tier;
4 | import com.badbones69.crazyenvoys.support.holograms.HologramManager;
5 | import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
6 | import de.oliver.fancyholograms.api.FancyHologramsPlugin;
7 | import de.oliver.fancyholograms.api.data.TextHologramData;
8 | import de.oliver.fancyholograms.api.hologram.Hologram;
9 | import org.bukkit.Location;
10 | import org.bukkit.Server;
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | public class FancyHologramsSupport extends HologramManager {
15 |
16 | private final de.oliver.fancyholograms.api.HologramManager manager = FancyHologramsPlugin.get().getHologramManager();
17 |
18 | @Override
19 | public void createHologram(final Location location, final Tier tier, final String id) {
20 | if (!tier.isHoloEnabled()) {
21 | removeHologram(id);
22 |
23 | return;
24 | }
25 |
26 | // We don't want to create a new one if one already exists.
27 | if (exists(id)) return;
28 |
29 | TextHologramData hologramData = new TextHologramData(name(id), location.clone().add(getVector(tier)));
30 |
31 | hologramData.setText(tier.getHoloMessage());
32 |
33 | final Hologram hologram = this.manager.create(hologramData);
34 |
35 | hologram.createHologram();
36 |
37 | final Server server = this.plugin.getServer();
38 |
39 | new FoliaRunnable(this.plugin.getServer().getGlobalRegionScheduler()) {
40 | @Override
41 | public void run() {
42 | server.getOnlinePlayers().forEach(hologram::updateShownStateFor);
43 | }
44 | }.run(this.plugin);
45 |
46 | this.manager.addHologram(hologram);
47 | }
48 |
49 | @Override
50 | public void removeHologram(final String id) {
51 | final Hologram hologram = this.manager.getHologram(name(id)).orElse(null);
52 |
53 | if (hologram == null) return;
54 |
55 | FancyHologramsPlugin.get().getHologramThread().submit(() -> this.manager.removeHologram(hologram));
56 | }
57 |
58 | @Override
59 | public boolean exists(final String id) {
60 | return this.manager.getHologram(name(id)).orElse(null) != null;
61 | }
62 |
63 | @Override
64 | public void purge(final boolean isShutdown) {
65 | final String name = this.plugin.getName().toLowerCase();
66 |
67 | final List holograms = new ArrayList<>() {{
68 | manager.getHolograms().forEach(hologram -> {
69 | final String id = hologram.getName();
70 |
71 | if (id.startsWith(name + "-")) {
72 | add(id.replace(name + "-", ""));
73 | }
74 | });
75 | }};
76 |
77 | holograms.forEach(this::removeHologram);
78 | }
79 |
80 | @Override
81 | public final String getName() {
82 | return "FancyHolograms";
83 | }
84 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/interfaces/WorldGuardVersion.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support.interfaces;
2 |
3 | import org.bukkit.Location;
4 |
5 | public interface WorldGuardVersion {
6 |
7 | boolean inRegion(String regionName, Location loc);
8 |
9 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/support/placeholders/PlaceholderAPISupport.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.support.placeholders;
2 |
3 | import ch.jalu.configme.SettingsManager;
4 | import com.badbones69.crazyenvoys.CrazyEnvoys;
5 | import com.badbones69.crazyenvoys.api.CrazyManager;
6 | import me.clip.placeholderapi.expansion.PlaceholderExpansion;
7 | import org.bukkit.OfflinePlayer;
8 | import org.jetbrains.annotations.NotNull;
9 | import com.badbones69.crazyenvoys.config.ConfigManager;
10 | import com.badbones69.crazyenvoys.config.types.ConfigKeys;
11 | import com.badbones69.crazyenvoys.config.types.MessageKeys;
12 |
13 | public class PlaceholderAPISupport extends PlaceholderExpansion {
14 |
15 | private @NotNull final CrazyEnvoys plugin = CrazyEnvoys.get();
16 |
17 | private @NotNull final SettingsManager config = ConfigManager.getConfig();
18 | private @NotNull final SettingsManager messages = ConfigManager.getMessages();
19 |
20 | private @NotNull final CrazyManager crazyManager = this.plugin.getCrazyManager();
21 |
22 | @Override
23 | public String onRequest(OfflinePlayer player, @NotNull String identifier) {
24 | String lower = identifier.toLowerCase();
25 |
26 | boolean isEnabled = this.config.getProperty(ConfigKeys.envoys_grace_period_toggle);
27 |
28 | if (lower.equals("envoys_time")) {
29 | if (isEnabled) {
30 | if (this.crazyManager.getCountdownTimer() != null) {
31 | int seconds = this.crazyManager.getCountdownTimer().getSecondsLeft();
32 |
33 | if (seconds != 0) return seconds + this.config.getProperty(ConfigKeys.envoys_grace_period_time_unit);
34 | }
35 |
36 | return this.config.getProperty(ConfigKeys.envoys_grace_period_unlocked);
37 | }
38 |
39 | return this.config.getProperty(ConfigKeys.envoys_grace_period_unlocked);
40 | }
41 |
42 | return switch (lower) {
43 | case "cooldown" -> this.crazyManager.isEnvoyActive() ? this.messages.getProperty(MessageKeys.hologram_on_going) : this.crazyManager.getNextEnvoyTime();
44 | case "time_left" -> this.crazyManager.isEnvoyActive() ? this.crazyManager.getEnvoyRunTimeLeft() : this.messages.getProperty(MessageKeys.hologram_not_running);
45 | case "envoys_left" -> String.valueOf(this.crazyManager.getActiveEnvoys().size());
46 | default -> "";
47 | };
48 | }
49 |
50 | @Override
51 | public boolean persist() {
52 | return true;
53 | }
54 |
55 | @Override
56 | public boolean canRegister() {
57 | return true;
58 | }
59 |
60 | @Override
61 | @NotNull
62 | public String getIdentifier() {
63 | return this.plugin.getName().toLowerCase();
64 | }
65 |
66 | @Override
67 | @NotNull
68 | public String getAuthor() {
69 | return this.plugin.getDescription().getAuthors().toString();
70 | }
71 |
72 | @Override
73 | @NotNull
74 | public String getVersion() {
75 | return this.plugin.getDescription().getVersion();
76 | }
77 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/util/MiscUtils.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.util;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import org.bukkit.Location;
5 |
6 | public class MiscUtils {
7 |
8 | private static final CrazyEnvoys plugin = CrazyEnvoys.get();
9 |
10 | public static String toString(final Location location) {
11 | return location.getWorld().getName() + ":" + location.getX() + ":" + location.getY() + ":" + location.getZ();
12 | }
13 |
14 | public static boolean isLogging() {
15 | return plugin.isLogging();
16 | }
17 | }
--------------------------------------------------------------------------------
/paper/src/main/java/com/badbones69/crazyenvoys/util/MsgUtils.java:
--------------------------------------------------------------------------------
1 | package com.badbones69.crazyenvoys.util;
2 |
3 | import com.badbones69.crazyenvoys.CrazyEnvoys;
4 | import org.bukkit.ChatColor;
5 | import org.bukkit.command.CommandSender;
6 | import org.bukkit.entity.Player;
7 | import com.badbones69.crazyenvoys.config.ConfigManager;
8 | import com.badbones69.crazyenvoys.config.types.ConfigKeys;
9 | import java.util.regex.Matcher;
10 | import java.util.regex.Pattern;
11 | import static java.util.regex.Matcher.quoteReplacement;
12 |
13 | @SuppressWarnings("ALL")
14 | public class MsgUtils {
15 |
16 | private static final CrazyEnvoys plugin = CrazyEnvoys.get();
17 |
18 | public static String color(String message) {
19 | Matcher matcher = Pattern.compile("#[a-fA-F\\d]{6}").matcher(message);
20 | StringBuilder buffer = new StringBuilder();
21 |
22 | while (matcher.find()) {
23 | matcher.appendReplacement(buffer, net.md_5.bungee.api.ChatColor.of(matcher.group()).toString());
24 | }
25 |
26 | return ChatColor.translateAlternateColorCodes('&', matcher.appendTail(buffer).toString());
27 | }
28 |
29 | public static void sendMessage(CommandSender commandSender, String message, boolean prefixToggle) {
30 | if (message == null || message.isEmpty()) return;
31 |
32 | String prefix = getPrefix();
33 |
34 | if (commandSender instanceof Player player) {
35 | if (!prefix.isEmpty() && prefixToggle) player.sendMessage(color(message.replaceAll("%prefix%", quoteReplacement(prefix))).replaceAll("%Prefix%", quoteReplacement(prefix))); else player.sendMessage(color(message));
36 |
37 | return;
38 | }
39 |
40 | if (!prefix.isEmpty() && prefixToggle) commandSender.sendMessage(color(message.replaceAll("%prefix%", quoteReplacement(prefix))).replaceAll("%Prefix%", quoteReplacement(prefix))); else commandSender.sendMessage(color(message));
41 | }
42 |
43 | public static String getPrefix() {
44 | return color(ConfigManager.getConfig().getProperty(ConfigKeys.command_prefix));
45 | }
46 | }
--------------------------------------------------------------------------------
/paper/src/main/resources/locale/en-US.yml:
--------------------------------------------------------------------------------
1 | # Support: https://discord.gg/badbones-s-live-chat-182615261403283459
2 | # Github: https://github.com/Crazy-Crew
3 | #
4 | # Issues: https://github.com/Crazy-Crew/CrazyEnvoys/issues
5 | # Features: https://github.com/Crazy-Crew/CrazyEnvoys/issues
6 | #
7 | # Tips:
8 | # 1. Make sure to use the {prefix} to add the prefix in front of messages.
9 | # 2. If you wish to use more than one line for a message just go from a line to a list.
10 | # Examples:
11 | # Line:
12 | # No-Permission: '{prefix}&cYou do not have permission to use that command.'
13 | # List:
14 | # No-Permission:
15 | # - '{prefix}&cYou do not have permission'
16 | # - '&cto use that command. Please try another.'
17 | player:
18 | no-permission: '{prefix}&cYou do not have permission to use that command.'
19 | no-permission-to-claim: '{prefix}&cYou do not have permission to claim that envoy.'
20 | envoys:
21 | already-started: '{prefix}&cThere is already an envoy event running. Please stop
22 | it to start a new one.'
23 | force-start: '{prefix}&7You have just started the envoy.'
24 | not-started: '{prefix}&cThere is no envoy event going on at this time.'
25 | force-ended: '{prefix}&cYou have just ended the envoy.'
26 | warning: '{prefix}&c[&4ALERT&c] &7There is an envoy event happening in &6{time}.'
27 | started: '{prefix}&7An envoy event has just started. &6{amount} &7crates have
28 | spawned around spawn for 5m.'
29 | left: '{prefix}&6{player} &7has just found a tier envoy. There are now &6{amount}
30 | &7left to find.'
31 | ended: '{prefix}&cThe envoy event has ended. Thanks for playing and please come
32 | back for the next one.'
33 | not-enough-players: '{prefix}&7Not enough players are online to start the envoy
34 | event. Only &6{amount} &7players are online.'
35 | enter-editor-mode: '{prefix}&7You are now in editor mode.'
36 | leave-editor-mode: '{prefix}&7You have now left editor mode.'
37 | editor-clear-locations: '{prefix}&7You have cleared all the editor spawn locations.'
38 | editor-clear-failure: '{prefix}&7You must be in Editor mode to clear the spawn
39 | locations.'
40 | kicked-from-editor-mode: '{prefix}&cSorry but an envoy is active. Please stop
41 | it or wait till it''''s over.'
42 | add-location: '{prefix}&7You have just added a spawn location.'
43 | remove-location: '{prefix}&cYou have just removed a spawn location.'
44 | time-left: '{prefix}&7The current envoy has &6{time}&7 left.'
45 | time-till-event: '{prefix}&7The next envoy will start in &6{time}&7.'
46 | flare:
47 | used-flare: '{prefix}&7You have just started an envoy event with a flare.'
48 | cant-use-flares: '{prefix}&cYou do not have permission to use flares.'
49 | sent-flare: '{prefix}&7You have just given &6{player} {amount} &7flares.'
50 | received-flare: '{prefix}&7You have been given &6{amount} &7flares.'
51 | new-center: '{prefix}&7You have just set a new center for the random envoy crates.'
52 | not-in-world-guard-region: '{prefix}&cYou must be in the WarZone to use a flare.'
53 | start-ignoring-messages: '{prefix}&7You are now ignoring the collecting messages.'
54 | stop-ignoring-messages: '{prefix}&7You now see all the collecting messages.'
55 | cooldown-left: '{prefix}&7You still have &6{time} &7till you can collect another
56 | crate.'
57 | countdown-in-progress: '{prefix}&7You cannot claim any envoys for another &6{time}
58 | seconds.'
59 | drops-available: '{prefix}&7List of all available envoys.'
60 | drops-possibilities: '{prefix}&7List of location envoy''''s may spawn at.'
61 | drops-page: '{prefix}&7Use /crazyenvoys drops [page] to see more.'
62 | drops-format: '&7[&6{id}&7]: {world}, {x}, {y}, {z}'
63 | no-spawn-locations-found: '{prefix}&cNo spawn locations were found and so the
64 | event has been cancelled and the cooldown has been reset.'
65 | hologram-placeholders:
66 | on-going: On Going
67 | not-running: Not Running
68 | time-placeholders:
69 | day: d
70 | hour: h
71 | minute: m
72 | second: s
73 | envoy-locations: '&e&lAll Envoy Locations: \n&c[ID], [World]: [X], [Y], [Z] &r{locations}'
74 | location-format: '\n&8[&3{id}&8] &c{world}: {x}, {y}, {z}'
75 | misc:
76 | command-not-found: '{prefix}&cPlease do /crazyenvoys help for more information.'
77 | player-only: '{prefix}&cOnly players can use that command.'
78 | not-online: '{prefix}&cThat player is not online at this time.'
79 | not-a-number: '{prefix}&cThat is not a number.'
80 | config-reload: '{prefix}&7You have just reloaded all the files.'
81 | help:
82 | - '&6/crazyenvoys help &7- Shows the envoy help menu.'
83 | - '&6/crazyenvoys reload &7- Reloads all the config files.'
84 | - '&6/crazyenvoys time &7- Shows the time till the envoy starts or ends.'
85 | - '&6/crazyenvoys drops [page] &7- Shows all current crate locations.'
86 | - '&6/crazyenvoys ignore &7- Shuts up the envoy collecting message.'
87 | - '&6/crazyenvoys flare [amount] [player] &7- Give a player a flare to call an
88 | envoy event.'
89 | - '&6/crazyenvoys edit &7- Edit the crate locations with bedrock.'
90 | - '&6/crazyenvoys start &7- Force starts the envoy.'
91 | - '&6/crazyenvoys stop &7- Force stops the envoy.'
92 | - '&6/crazyenvoys center &7- Set the center of the random crate drops.'
93 |
--------------------------------------------------------------------------------
/paper/src/main/resources/locale/pl-PL.yml:
--------------------------------------------------------------------------------
1 | # Pomoc: https://discord.gg/badbones-s-live-chat-182615261403283459
2 | # Github: https://github.com/Crazy-Crew
3 | #
4 | # Problemy: https://github.com/Crazy-Crew/CrazyEnvoys/issues
5 | # Nowe funkcje: https://github.com/Crazy-Crew/CrazyEnvoys/issues
6 | #
7 | # Rady:
8 | # 1. Upewnij się, że dodajesz {prefix} na początku swoich wiadomości.
9 | # 2. Jeżeli chcesz użyć więcej niż jednej lini użyj list.
10 | # Przykłady:
11 | # Linia:
12 | # No-Permission: '{prefix}&cNie masz uprawnień, aby użyć tej komendy.'
13 | # List:
14 | # No-Permission:
15 | # - '{prefix}&cNie masz uprawnień,'
16 | # - '&caby użyć tej komendy. Spróbuj innej.'
17 | player:
18 | no-permission: "{prefix}&cNie masz uprawnień, aby użyć tej komendy."
19 | no-permission-to-claim: "{prefix}&cNie masz uprawnień, aby otworzyć ten zrzut."
20 | envoys:
21 | already-started: "{prefix}&cWydarzenie zrzutów już jest w trakcie działania. Zatrzymaj je, aby rozpocząć kolejne."
22 | force-start: "{prefix}&7Zacząłeś zrzuty."
23 | not-started: "{prefix}&cW tym momencie żadne wydarzenie zrzutów nie jest aktywne."
24 | force-ended: "{prefix}&cZakończyłeś zrzuty."
25 | warning: "{prefix}&c[&4UWAGA&c] &7Wydarzenie zrzutów zacznie się za &6{time}."
26 | started: "{prefix}&7Zrzuty właśnie zaczęły spadać. &6{amount} &7zrzutów spadło i będzie tam leżało przez 5m."
27 | left: "{prefix}&6{player} &7znalazł zrzut. Pozostało &6{amount} zrzutów"
28 | ended: "{prefix}&cWydarzenie zrzutów właśnie się zakończyło, oczekujcie nowego."
29 | not-enough-players: "{prefix}&7Nie wystarczająco graczy, aby zacząć wydarzenie zrzutów. Tylko &6{amount} &7jest teraz aktywnych."
30 | enter-editor-mode: "{prefix}&7Wszedłeś w tryb edycji."
31 | leave-editor-mode: "{prefix}&7Opuściłeś tryb edycji."
32 | editor-clear-locations: "{prefix}&7Wyczyściłeś pozycje zrzutów w edytorze."
33 | editor-clear-failure: "{prefix}&7Musisz być edytorze, aby zmieniać pozycje zrzutów."
34 | kicked-from-editor-mode: "{prefix}&cWydarzenie zrzutów jest aktywne. Zatrzymaj je lub poczekaj do jego."
35 | add-location: "{prefix}&7Dodałeś lokację zrzutu."
36 | remove-location: "{prefix}&cUsunąłeś lokację zrzutu."
37 | time-left: "{prefix}&7Aktualne wydarzenie będzie trwało jescze przez &6{time}&7."
38 | time-till-event: "{prefix}&7Następne wydarzenie zrzutów odbędzie za &6{time}&7."
39 | flare:
40 | used-flare: "{prefix}&7Rozpocząłeś wydarzenie zrzutów za pomocą flary."
41 | cant-use-flares: "{prefix}&cNie masz uprawnień do korzystania z flary."
42 | sent-flare: "{prefix}&7Flary przekazane graczowi &6{player} &7w ilości {amount}."
43 | received-flare: "{prefix}&7Dostałeś flary w ilości &6{amount}&7."
44 | new-center: "{prefix}&7Ustawiłeś nowe centrum zrzutów."
45 | not-in-world-guard-region: "{prefix}&cMusisz być w strefie wojny aby używać flar."
46 | start-ignoring-messages: "{prefix}&7Od teraz wiadomośći zbiorowe nie będą ci wyświetlane."
47 | stop-ignoring-messages: "{prefix}&7Od teraz będziesz widział wiadomości zbiorowe."
48 | cooldown-left: "{prefix}&7Musisz odczekać jeszcze &6{time} &7zanim otworzysz kolejne zrzuty."
49 | countdown-in-progress: "{prefix}&7Nie możesz otwierać rzutów prezez następne &6{time}s."
50 | drops-available: "{prefix}&7Lista wszystkich zrzutów."
51 | drops-possibilities: "{prefix}&7Lista lokacji na które mogą spadać zrzuty."
52 | drops-page: "{prefix}&7Użyj /crazyenvoys drop [strona], aby zobaczyć więcej."
53 | drops-format: "&7[&6{id}&7]: {world}, {x}, {y}, {z}"
54 | no-spawn-locations-found: "{prefix}&cŻadne pozycje zrzutów nie zostały znalezione, więc wydarzenie zostało zakończone, a opóźnienie zresetowane."
55 | hologram-placeholders:
56 | on-going: W trakcie
57 | not-running: Brak akcji
58 | time-placeholders:
59 | day: d
60 | hour: g
61 | minute: m
62 | second: s
63 | envoy-locations: '&e&lPozycje zrzutów: \n&c[ID], [Świat]: [X], [Y], [Z] &r{locations}'
64 | location-format: '\n&8[&3{id}&8] &c{world}: {x}, {y}, {z}'
65 | misc:
66 | command-not-found: "{prefix}&cNieznaleziono komendy. Użyj /crazyenvoys help, aby zobaczyć listę komend."
67 | player-only: "{prefix}&cTylko gracze mogą używać tej komendy."
68 | not-online: "{prefix}&cTen gracz nie jest aktywny w tym momencie."
69 | not-a-number: "{prefix}&cTo nie jest liczba."
70 | config-reload: "{prefix}&7Przeładowałeś wszystkie pliki."
71 | help:
72 | - "&6/crazyenvoys help &7- Pokazuje te informacje."
73 | - "&6/crazyenvoys reload &7- Przeładowuje wszystkie pliki związane z ustawieniami pluginu."
74 | - "&6/crazyenvoys time &7- Pokazuje czas do startu lub końca wydarzenia zrzutów."
75 | - "&6/crazyenvoys drops [page] &7- Pokazuje wszystkie aktualne pozycje."
76 | - "&6/crazyenvoys ignore &7- Włącza ingorowanie wiadomości zbiorowych."
77 | - "&6/crazyenvoys flare [ilość] [gracz] &7- Daje graczowi flary pozwalające rozpocząć event."
78 | - "&6/crazyenvoys edit &7- Edytuj pozycje zrzutów za pomocą bedrock'a."
79 | - "&6/crazyenvoys start &7- Zmusza do rozpoczęcia zrzutu."
80 | - "&6/crazyenvoys stop &7- Zmusza do zakończenia zrzutu."
81 | - "&6/crazyenvoys center &7- Ustawia centrum losowego zrzutu."
82 |
--------------------------------------------------------------------------------
/paper/src/main/resources/plugin.yml:
--------------------------------------------------------------------------------
1 | name: '${name}'
2 | main: '${group}.${name}'
3 |
4 | authors: ${authors}
5 |
6 | version: '${version}'
7 | api-version: '${apiVersion}'
8 | description: '${description}'
9 | website: '${website}'
10 |
11 | folia-supported: true
12 |
13 | softdepend:
14 | - CMI
15 | - DecentHolograms
16 | - PlaceholderAPI
17 | - MVdWPlaceholderAPI
18 | - Multiverse-Core
19 | - MultiWorld
20 | - MyWorlds
21 | - WorldEdit
22 | - WorldGuard
23 | - Oraxen
24 | - ItemsAdder
25 |
26 | commands:
27 | crazyenvoys:
28 | description: "Manage your envoys however you want."
29 | aliases:
30 | - envoys
31 | - envoy
32 |
33 | permissions:
34 | envoy.bypass:
35 | default: op
36 | envoy.locations:
37 | default: false
38 | envoy.stop:
39 | default: false
40 | envoy.start:
41 | default: false
42 | envoy.edit:
43 | default: false
44 | envoy.flare.use:
45 | default: false
46 | envoy.flare.give:
47 | default: false
48 | envoy.reload:
49 | default: false
50 | envoy.ignore:
51 | default: true
52 | envoy.drops:
53 | default: true
54 | envoy.help:
55 | default: true
56 | envoy.time:
57 | default: true
--------------------------------------------------------------------------------
/paper/src/main/resources/tiers/Basic.yml:
--------------------------------------------------------------------------------
1 | Settings:
2 | # If they need a permission to claim this envoy. Set too false to disable.
3 | Claim-Permission: false
4 | # What permission they need.
5 | Claim-Permission-Name: 'basic.envoy.use'
6 | Prize-Message:
7 | - '&7You have won &c{reward} &7from &c{tier}.'
8 | Spawn-Chance: 85 #The chance that this tier will spawn.
9 | Use-Chance: true #If true then it uses the chance option in the prizes and if false then each prize has a 1/(Amount of Prizes) chance of winning.
10 | Placed-Block: 'CHEST' #The block that will be clicked when they land.
11 | Bulk-Prizes: #This allows players to win multiple prizes from one crate.
12 | Toggle: false #Toggle if players can win multiple prizes.
13 | Random: true #If true then it will pick a random bulk from 1-MaxBulk.
14 | Max-Bulk: 3 #The max amount of prizes.
15 | Hologram-Toggle: true #Toggle on and off holograms.
16 | Hologram-Height: 1.5 #How high the hologram will be from the crate.
17 | Hologram-Range: 8 # The distance the hologram can be seen. Only works with CMI and DecentHolograms
18 | Hologram: #Requires 3rd party plugins such as DecentHolograms to function. https://github.com/Crazy-Crew/CrazyEnvoys/blob/main/platforms/paper/src/main/java/com/badbones69/crazyenvoys/support/libraries/PluginSupport.java
19 | # Available placeholders:
20 | # %crazyenvoys_crates_time% shows the grace period of the envoy if the option in config.yml called Crate-Countdown.Toggle is enabled.
21 | - '&7&l(&6&l!&7&l) Basic Crate'
22 | - '%crazyenvoys_crates_time%'
23 | Firework-Toggle: true #Toggle on or off fireworks.
24 | Firework-Colors: #The colors the fireworks will be.
25 | - 'Gray'
26 | - 'Black'
27 | - 'Orange'
28 | Signal-Flare:
29 | Toggle: true
30 | Time: '15s'
31 | Colors:
32 | - 'Gray'
33 | - 'Black'
34 | - 'Orange'
35 | ###################################
36 | # Items: Options
37 | # Item: - You can choose the item with its id and meta data.
38 | # Amount: - Choose how many of the item you get.
39 | # Name: - The display name that goes on the item.
40 | # Lore:,,, - The lore that will go under the enchantments. Split lines with a ','
41 | # Glowing: - Will make the item have a glowing effect without having an enchantment on the item. (Only supports 1.8 - 1.11)
42 | # Unbreakable-Item: - Will add the Unbreaking NBT tag to the item to allow custom textured items to be gained through the envoys.
43 | # : - Choose the enchantment you want to add to the item. You can use the in-game names of the enchantment if you want. Replace the spaces in the name with "_".
44 | ###################################
45 | Prizes: #The prizes that can be won.
46 | '1': #Prize number
47 | DisplayName: '&a$1,000' #The display name used in {reward}
48 | Chance: 10 #The chance that it will be won.
49 | Drop-Items: false #Drop all items in the Items: option on the ground instead of into their inventory.
50 | Messages: #The message that will be sent to the player if won.
51 | - '&7You have just won {reward}.'
52 | Commands: #The commands that will be run when this prize is won.
53 | - 'eco give {player} 1000'
54 | '2':
55 | DisplayName: '&616 Gold Apples' #The display name used in %reward%
56 | Chance: 75
57 | Drop-Items: false
58 | Messages:
59 | - '&7You have just won {reward}.'
60 | Items:
61 | - 'Item:GOLDEN_APPLE, Amount:16, Name:&dJuicy Golden Apple, Lore:&7I am a yummy apple,&7Make sure to savor my flavor.'
62 | '3':
63 | DisplayName: '&dFood Pack' #The display name used in {reward}
64 | Chance: 40
65 | Drop-Items: false
66 | Messages:
67 | - '&7You have just had a great harvest.'
68 | Items:
69 | - 'Item:COOKED_BEEF, Amount:16'
70 | - 'Item:APPLE, Amount:16'
71 | - 'Item:COOKED_COD, Amount:16'
72 | - 'Item:COOKED_SALMON, Amount:16'
73 | - 'Item:CARROT, Amount:16'
74 | - 'Item:BREAD, Amount:16'
--------------------------------------------------------------------------------
/paper/src/main/resources/tiers/Lucky.yml:
--------------------------------------------------------------------------------
1 | Settings:
2 | # If they need a permission to claim this envoy. Set too false to disable.
3 | Claim-Permission: false
4 | # What permission they need.
5 | Claim-Permission-Name: 'lucky.envoy.use'
6 | Prize-Message:
7 | - '&7You have won &c{reward} &7from &c{tier}.'
8 | Spawn-Chance: 25
9 | Use-Chance: true
10 | Placed-Block: 'ENDER_CHEST'
11 | Bulk-Prizes:
12 | Toggle: false
13 | Random: true
14 | Max-Bulk: 3
15 | Hologram-Toggle: true
16 | Hologram-Height: 1.5
17 | Hologram-Range: 8
18 | Hologram: #Requires 3rd party plugins such as DecentHolograms to function. https://github.com/Crazy-Crew/CrazyEnvoys/blob/main/platforms/paper/src/main/java/com/badbones69/crazyenvoys/support/libraries/PluginSupport.java
19 | # %crazyenvoys_crates_time% shows the grace period of the envoy if the option in config.yml called Crate-Countdown.Toggle is enabled.
20 | - '&7&l(&e&l!&7&l) &e&lLucky Crate'
21 | - '%crazyenvoys_crates_time%'
22 | Firework-Toggle: true
23 | Firework-Colors:
24 | - 'Gray'
25 | - 'Black'
26 | - 'Yellow'
27 | Signal-Flare:
28 | Toggle: true
29 | Time: '25s'
30 | Colors:
31 | - 'Gray'
32 | - 'Black'
33 | - 'Yellow'
34 | ###################################
35 | # Items: Options
36 | # Item: - You can choose the item with its id and meta data.
37 | # Amount: - Choose how many of the item you get.
38 | # Name: - The display name that goes on the item.
39 | # Lore:,,, - The lore that will go under the enchantments. Split lines with a ','
40 | # Glowing: - Will make the item have a glowing effect without having an enchantment on the item. (Only supports 1.8 - 1.11)
41 | # Unbreakable-Item: - Will add the Unbreaking NBT tag to the item to allow custom textured items to be gained through the envoys.
42 | # : - Choose the enchantment you want to add to the item. You can use the in-game names of the enchantment if you want. Replace the spaces in the name with "_".
43 | ###################################
44 | Prizes:
45 | '1':
46 | DisplayName: '&a$10,000'
47 | Chance: 50
48 | Messages:
49 | - '&7You have just found {reward}.'
50 | Commands:
51 | - 'eco give {player} 10000'
52 | '2':
53 | DisplayName: '&eLucky &7Sword.'
54 | Chance: 25
55 | Drop-Items: false
56 | Messages:
57 | - '&7Congratulations you have just won a {reward}.'
58 | Items:
59 | - 'Item:DIAMOND_SWORD, Amount:1, Name:&eLucky Sword, Sharpness:2, Unbreaking:1, Knockback:1, Fire_Aspect:1, Looting:1'
60 | '3':
61 | DisplayName: '&eLucky &7Armor'
62 | Chance: 10
63 | Drop-Items: false
64 | Messages:
65 | - '&7Congratulations you have just won a {reward} set.'
66 | # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html
67 | # Available Patterns: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimPattern.html
68 | Items:
69 | - 'Item:DIAMOND_HELMET, Damage:50, Trim-Pattern:SENTRY, Trim-Material:QUARTZ, Amount:1, Name:&eLucky Helmet, Protection:2, Unbreaking:1'
70 | - 'Item:DIAMOND_CHESTPLATE, Damage:50, Trim-Pattern:DUNE, Trim-Material:REDSTONE, Amount:1, Name:&eLucky Chestplate, Protection:2, Unbreaking:1'
71 | - 'Item:DIAMOND_LEGGINGS, Damage:50, Trim-Pattern:HOST, Trim-Material:COPPER, Amount:1, Name:&eLucky Leggings, Protection:2, Unbreaking:1'
72 | - 'Item:DIAMOND_BOOTS, Damage:50, Trim-Pattern:SHAPER, Trim-Material:GOLD, Amount:1, Name:&eLucky Boots, Protection:2, Unbreaking:1'
--------------------------------------------------------------------------------
/paper/src/main/resources/tiers/Titan.yml:
--------------------------------------------------------------------------------
1 | Settings:
2 | # If they need a permission to claim this envoy. Set too false to disable.
3 | Claim-Permission: false
4 | # What permission they need.
5 | Claim-Permission-Name: 'titan.envoy.use'
6 | # A default message if the prize doesn't have any Messages
7 | # i.e Messages: [] or the value isn't there.
8 | Prize-Message:
9 | - '&7You have won &c{reward} &7from &c{tier}.'
10 | Spawn-Chance: 10
11 | Use-Chance: true
12 | Placed-Block: 'ENCHANTING_TABLE'
13 | Bulk-Prizes:
14 | Toggle: false
15 | Random: true
16 | Max-Bulk: 3
17 | Hologram-Toggle: true
18 | Hologram-Height: 1.5
19 | Hologram-Range: 8 # Only works with CMI/DecentHolograms
20 | Hologram: #Requires 3rd party plugins such as DecentHolograms to function. https://github.com/Crazy-Crew/CrazyEnvoys/blob/main/platforms/paper/src/main/java/com/badbones69/crazyenvoys/support/libraries/PluginSupport.java
21 | # %crazyenvoys_crates_time% shows the grace period of the envoy if the option in config.yml called Crate-Countdown.Toggle is enabled.
22 | - '&7&l(&4&l!&7&l) &4&lTitan Crate'
23 | - '%crazyenvoys_crates_time%'
24 | Firework-Toggle: true
25 | Firework-Colors:
26 | - 'Gray'
27 | - 'Black'
28 | - 'Red'
29 | Signal-Flare:
30 | Toggle: true
31 | Time: '40s'
32 | Colors:
33 | - 'Gray'
34 | - 'Black'
35 | - 'Red'
36 | ###################################
37 | # Items: Options
38 | # Item: - You can choose the item with its id and meta data.
39 | # Amount: - Choose how many of the item you get.
40 | # Name: - The display name that goes on the item.
41 | # Lore:,,, - The lore that will go under the enchantments. Split lines with a ','
42 | # Glowing: - Will make the item have a glowing effect without having an enchantment on the item. (Only supports 1.8 - 1.11)
43 | # Unbreakable-Item: - Will add the Unbreaking NBT tag to the item to allow custom textured items to be gained through the envoys.
44 | # : - Choose the enchantment you want to add to the item. You can use the in-game names of the enchantment if you want. Replace the spaces in the name with "_".
45 | ###################################
46 | Prizes:
47 | '1':
48 | DisplayName: '&a$1,000,000'
49 | Chance: 50
50 | Messages:
51 | - '&7You have just found {reward}.'
52 | Commands:
53 | - 'eco give {player} 1000000'
54 | '2':
55 | DisplayName: '&4Titan &7Sword.'
56 | Chance: 25
57 | Drop-Items: false
58 | Messages:
59 | - '&7Congratulations you have just won a {reward}.'
60 | Items:
61 | - 'Item:DIAMOND_SWORD, Amount:1, Name:&4Titan Sword, Sharpness:5, Unbreaking:3, Knockback:2, Fire_Aspect:2, Looting:3'
62 | '3':
63 | DisplayName: '&4Titan &7Armor'
64 | Chance: 10
65 | Drop-Items: false
66 | Messages:
67 | - '&7Congratulations you have just won a {reward} set.'
68 | # Available Materials: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimMaterial.html
69 | # Available Patterns: https://jd.papermc.io/paper/1.20/org/bukkit/inventory/meta/trim/TrimPattern.html
70 | Items:
71 | - 'Item:DIAMOND_HELMET, Damage:50, Trim-Pattern:SENTRY, Trim-Material:QUARTZ, Amount:1, Name:&4Titan Helmet, Protection:4, Unbreaking:3'
72 | - 'Item:DIAMOND_CHESTPLATE, Damage:50, Trim-Pattern:DUNE, Trim-Material:REDSTONE, Amount:1, Name:&4Titan Chestplate, Protection:4, Unbreaking:3'
73 | - 'Item:DIAMOND_LEGGINGS, Damage:50, Trim-Pattern:HOST, Trim-Material:COPPER, Amount:1, Name:&4Titan Leggings, Protection:4, Unbreaking:3'
74 | - 'Item:DIAMOND_BOOTS, Damage:50, Trim-Pattern:SHAPER, Trim-Material:GOLD, Amount:1, Name:&4Titan Boots, Protection:4, Unbreaking:3'
--------------------------------------------------------------------------------
/paper/src/main/resources/users.yml:
--------------------------------------------------------------------------------
1 | Next-Envoy: 0000000000000
2 | Center: 'World:world, X:0, Y:0, Z:0'
3 | Locations:
4 | Spawns: { }
5 | Spawned: { }
--------------------------------------------------------------------------------
/publish/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("root-plugin")
3 |
4 | alias(libs.plugins.minotaur)
5 | alias(libs.plugins.hangar)
6 | }
7 |
8 | val content: String = rootProject.file("changelog.md").readText(Charsets.UTF_8)
9 |
10 | val isBeta = System.getenv("BETA") != null
11 | val pluginName = rootProject.name
12 | val mcVersion = libs.versions.minecraft.get()
13 |
14 | tasks {
15 | modrinth {
16 | token.set(System.getenv("MODRINTH_TOKEN"))
17 |
18 | projectId.set(rootProject.name)
19 |
20 | versionType.set(if (isBeta) "beta" else "release")
21 |
22 | versionName.set("$pluginName ${rootProject.version}")
23 | versionNumber.set(rootProject.version as String)
24 |
25 | changelog.set(content)
26 |
27 | uploadFile.set(rootProject.projectDir.resolve("jars/$pluginName-${rootProject.version}.jar"))
28 |
29 | gameVersions.set(listOf(mcVersion))
30 |
31 | loaders.addAll(listOf("purpur", "paper", "folia"))
32 |
33 | syncBodyFrom.set(rootProject.file("description.md").readText(Charsets.UTF_8))
34 |
35 | autoAddDependsOn.set(false)
36 | detectLoaders.set(false)
37 |
38 | dependencies {
39 | optional.project("fancyholograms")
40 | optional.project("DecentHolograms")
41 | }
42 | }
43 |
44 | hangarPublish {
45 | publications.register("plugin") {
46 | apiKey.set(System.getenv("HANGAR_KEY"))
47 |
48 | id.set(pluginName)
49 |
50 | version.set(rootProject.version as String)
51 |
52 | channel.set(if (isBeta) "Beta" else "Release")
53 |
54 | changelog.set(content)
55 |
56 | platforms {
57 | paper {
58 | jar.set(rootProject.projectDir.resolve("jars/$pluginName-${rootProject.version}.jar"))
59 |
60 | platformVersions.set(listOf(mcVersion))
61 |
62 | dependencies {
63 | url("PlaceholderAPI", "https://hangar.papermc.io/HelpChat/PlaceholderAPI") {
64 | required = false
65 | }
66 |
67 | url("FancyHolograms", "https://modrinth.com/plugin/fancyholograms") {
68 | required = false
69 | }
70 |
71 | url("Oraxen", "https://polymart.org/product/629/oraxen") {
72 | required = false
73 | }
74 |
75 | url("Nexo", "https://polymart.org/resource/nexo.6901") {
76 | required = false
77 | }
78 |
79 | url("CMI", "https://www.spigotmc.org/resources/cmi-298-commands-insane-kits-portals-essentials-economy-mysql-sqlite-much-more.3742/") {
80 | required = false
81 | }
82 |
83 | url("DecentHolograms", "https://modrinth.com/plugin/decentholograms") {
84 | required = false
85 | }
86 |
87 | url("ItemsAdder", "https://polymart.org/product/1851/itemsadder") {
88 | required = false
89 | }
90 | }
91 | }
92 | }
93 | }
94 | }
95 | }
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "CrazyEnvoys"
2 |
3 | listOf(
4 | "publish" to "publish",
5 |
6 | "paper" to "paper",
7 | ).forEach(::includeProject)
8 |
9 | fun includeProject(pair: Pair): Unit = includeProject(pair.first, pair.second)
10 |
11 | fun includeProject(name: String, block: ProjectDescriptor.() -> Unit) {
12 | include(name)
13 | project(":$name").apply(block)
14 | }
15 |
16 | fun includeProject(path: String, name: String) {
17 | includeProject(name) {
18 | this.name = "${rootProject.name.lowercase()}-$name"
19 | this.projectDir = File(path)
20 | }
21 | }
22 |
23 | fun includeProject(name: String) {
24 | includeProject(name) {
25 | this.name = "${rootProject.name.lowercase()}-$name"
26 | }
27 | }
--------------------------------------------------------------------------------