├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── behavior-bug-or-plugin-incompatibility.yml │ ├── config.yml │ └── feature-request.yml ├── pull_request_template.md ├── release-drafter.yml ├── renovate.json ├── stale.yml └── workflows │ ├── announce-release-on-discord.yml │ ├── build-pr.yml │ ├── close_invalid_prs.yml │ ├── publish.yml │ └── release-drafter.yml ├── .gitignore ├── LICENSE ├── PlotSquaredv6Support ├── build.gradle.kts └── src │ └── main │ └── java │ └── net │ └── onelitefeather │ └── antiredstoneclockremastered │ └── plotsquared │ └── v6 │ ├── PlotSquaredLegacySupport.java │ └── RedstoneClockFlag.java ├── PlotSquaredv7Support ├── build.gradle.kts └── src │ └── main │ └── java │ └── net │ └── onelitefeather │ └── antiredstoneclockremastered │ └── plotsquared │ └── v7 │ ├── PlotSquaredModernSupport.java │ └── RedstoneClockFlag.java ├── README.md ├── WorldGuardv6Support ├── .gitignore ├── build.gradle.kts └── src │ └── main │ └── java │ └── net │ └── onelitefeather │ └── antiredstoneclockremastered │ └── worldguard │ └── v6 │ └── WorldGuardLegacySupport.java ├── WorldGuardv7Support ├── build.gradle.kts └── src │ └── main │ └── java │ └── net │ └── onelitefeather │ └── antiredstoneclockremastered │ └── worldguard │ └── v7 │ └── WorldGuardModernSupport.java ├── build-logic ├── build.gradle.kts └── src │ └── main │ └── kotlin │ ├── extensions.kt │ └── olf.build-logic.gradle.kts ├── build.gradle.kts ├── crowdin.yml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── internal-api ├── .gitignore ├── build.gradle.kts └── src │ └── main │ └── java │ └── net │ └── onelitefeather │ └── antiredstoneclockremastered │ └── api │ ├── AbstractPlotsquaredSupport.java │ ├── AbstractWorldGuardSupport.java │ ├── PlotsquaredSupport.java │ └── WorldGuardSupport.java ├── settings.gradle.kts └── src └── main ├── java └── net │ └── onelitefeather │ └── antiredstoneclockremastered │ ├── AntiRedstoneClockRemastered.java │ ├── commands │ ├── DisplayActiveClocksCommand.java │ ├── FeatureCommand.java │ └── ReloadCommand.java │ ├── listener │ ├── ComparatorListener.java │ ├── ObserverListener.java │ ├── PistonListener.java │ ├── PlayerListener.java │ ├── RedstoneListener.java │ └── SculkListener.java │ ├── model │ └── RedstoneClock.java │ ├── service │ ├── RedstoneClockService.java │ └── UpdateService.java │ ├── translations │ └── PluginTranslationRegistry.java │ └── utils │ ├── CheckTPS.java │ └── Constants.java └── resources ├── antiredstoneclockremasterd.properties ├── antiredstoneclockremasterd_de_DE.properties ├── antiredstoneclockremasterd_es_ES.properties ├── antiredstoneclockremasterd_fr_FR.properties ├── antiredstoneclockremasterd_zh_CN.properties └── config.yml /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @OneLiteFeatherNET/antiredstone-remastered-maintainers 2 | /.github/CODEOWNERS @OneLiteFeatherNET/core-team -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/behavior-bug-or-plugin-incompatibility.yml: -------------------------------------------------------------------------------- 1 | name: Behavior Bug or Plugin Incompatibility 2 | description: Report issues with plugin incompatibility or other behavior related issues. 3 | labels: [ "status: needs triage", "type: bug" ] 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: Server Logs 8 | description: | 9 | Upload your server log from `logs/latest.log` here 10 | validations: 11 | required: true 12 | - type: textarea 13 | attributes: 14 | label: Expected behavior 15 | description: What you expected to see. 16 | validations: 17 | required: true 18 | 19 | - type: textarea 20 | attributes: 21 | label: Actual behavior 22 | description: What you actually saw. 23 | validations: 24 | required: true 25 | 26 | - type: textarea 27 | attributes: 28 | label: Steps to reproduce 29 | description: This may include a build schematic, a video, or detailed instructions to help reconstruct the issue. 30 | validations: 31 | required: true 32 | 33 | - type: textarea 34 | attributes: 35 | label: Plugin and Datapack List 36 | description: | 37 | All plugins and datapacks running on your server. 38 | To list plugins, run `/plugins`. For datapacks, run `/datapack list`. 39 | validations: 40 | required: true 41 | 42 | - type: textarea 43 | attributes: 44 | label: Paper version 45 | description: | 46 | Run `/version` on your server and **paste** the full, unmodified output here. 47 | "latest" is *not* a version; we require the output of `/version` so we can adequately track down the issue. 48 | Additionally, do NOT provide a screenshot, you MUST paste the entire output. 49 |
50 | Example 51 | 52 | ``` 53 | > version 54 | [19:36:32 INFO]: Checking version, please wait... 55 | [19:36:32 INFO]: This server is running Paper version 1.20.6-148-ver/1.20.6@20f5165 (2024-07-02T15:37:33Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT) 56 | You are running the latest version 57 | Previous version: git-Paper-446 (MC: 1.19.3) 58 | ``` 59 | 60 |
61 | validations: 62 | required: true 63 | - type: textarea 64 | attributes: 65 | label: Plugin version 66 | description: | 67 | Run `/about AntiRedstoneClock-Remastered` on your server and **paste** the full, unmodified output here. 68 | "latest" is *not* a version; we require the output of `/about AntiRedstoneClock-Remastered` so we can adequately track down the issue. 69 | Additionally, do NOT provide a screenshot, you MUST paste the entire output. 70 |
71 | Example 72 | 73 | ``` 74 | > about AntiRedstoneClock-Remastered 75 | [19:37:16 INFO]: AntiRedstoneClock-Remastered version 1.1.0 76 | [19:37:16 INFO]: Authors: OneLiteFeather and TheMeinerLP 77 | ``` 78 | 79 |
80 | validations: 81 | required: true 82 | - type: textarea 83 | attributes: 84 | label: Other 85 | description: | 86 | Please include other helpful information below. 87 | The more information we receive, the quicker and more effective we can be at finding the solution to the issue. 88 | validations: 89 | required: false 90 | 91 | - type: markdown 92 | attributes: 93 | value: | 94 | Before submitting this issue, please ensure the following: 95 | 96 | 1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads). 97 | 2. You searched for and ensured there isn't already an open issue regarding this. 98 | 3. Your version of Minecraft is supported by AntiRedstoneClock-Remastered. 99 | 4. You are running the latest version of AntiRedstoneClock-Remastered from [our hangar page](https://hangar.papermc.io/OneLiteFeather/AntiRedstoneClock-Remastered). -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: AntiRedstoneClock-Remastered Discord 4 | url: https://discord.onelitefeather.net 5 | about: If you are having issues with timings or have other minor issues, come ask us on our Discord server! -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: Suggest an idea for AntiRedstoneClock-Remastered 3 | labels: [ "status: needs triage", "type: feature" ] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thank you for filling out a feature request for AntiRedstoneClock-Remastered! Please be as detailed as possible so that we may consider and review the request easier. 9 | We ask that you search all the issues to avoid a duplicate feature request. If one exists, please reply if you have anything to add. 10 | Before requesting a new feature, please make sure you are using the latest version and that the feature you are requesting is not already in AntiRedstoneClock-Remastered. 11 | 12 | - type: textarea 13 | attributes: 14 | label: Is your feature request related to a problem? 15 | description: Please give some context for this request. Why do you want it added? 16 | validations: 17 | required: true 18 | 19 | - type: textarea 20 | attributes: 21 | label: Describe the solution you'd like. 22 | description: A clear and concise description of what you want. 23 | validations: 24 | required: true 25 | 26 | - type: textarea 27 | attributes: 28 | label: Describe alternatives you've considered. 29 | description: List any alternatives you might have tried to get the feature you want. 30 | validations: 31 | required: true 32 | 33 | - type: textarea 34 | attributes: 35 | label: Other 36 | description: Add any other context or screenshots about the feature request below. 37 | validations: 38 | required: false 39 | 40 | - type: markdown 41 | attributes: 42 | value: | 43 | Before submitting this feature request, please search our issue tracker to ensure your feature has not 44 | already been requested. -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 24 | 25 | ## Proposed changes 26 | 27 | Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. 28 | If it fixes a bug or resolves a feature request, be sure to link to that issue. 29 | 30 | ## Types of changes 31 | 32 | What types of changes does your code introduce to this project? 33 | _Put an `x` in the boxes that apply_ 34 | 35 | - [ ] Bugfix (non-breaking change which fixes an issue) 36 | - [ ] New feature (non-breaking change which adds functionality) 37 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 38 | - [ ] Documentation Update (if none of the other choices apply) 39 | 40 | ## Checklist 41 | 42 | _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of 43 | them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before 44 | merging your code._ 45 | 46 | - [ ] I have read the [CONTRIBUTING.md](https://github.com/OneLiteFeatherNET/.github/blob/main/CONTRIBUTING.md) 47 | - [ ] I have added tests that prove my fix is effective or that my feature works 48 | - [ ] I have added necessary documentation (if appropriate) 49 | 50 | ## Further comments 51 | 52 | If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you 53 | did and what alternatives you considered, etc... -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | _extends: .github -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended", 5 | ":semanticCommitsDisabled" 6 | ], 7 | "ignoreDeps": [], 8 | "labels": [ 9 | "Renovate" 10 | ], 11 | "rebaseWhen": "conflicted", 12 | "schedule": [ 13 | "on the first day of the month" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | daysUntilStale: 30 2 | daysUntilClose: 7 3 | only: issues 4 | exemptLabels: 5 | - "Bug" 6 | - "Enhancement" 7 | - "Approved" 8 | - "Priority" 9 | - "Under investigation" 10 | staleLabel: "resolution: stale" 11 | markComment: > 12 | This issue has been automatically marked as stale because it has not had 13 | recent activity. It will be closed if no further activity occurs. If the issue is still present and can be reproduced, please let the team know. 14 | Thank you for your contributions. 15 | closeComment: > 16 | This issue has been automatically closed because it has not had activity in 17 | a long time. If the issue still applies to the most recent supported 18 | version, please reply to this issue and the team will reopen it. -------------------------------------------------------------------------------- /.github/workflows/announce-release-on-discord.yml: -------------------------------------------------------------------------------- 1 | name: Announce release on discord 2 | on: 3 | release: 4 | types: [ published ] 5 | jobs: 6 | send_announcement: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Send custom message with args 10 | env: 11 | DISCORD_WEBHOOK: ${{ secrets.ONELITEFATHERNET_GITHUB_WEBHOOK }} 12 | DISCORD_USERNAME: AntiRedstoneClock-Remastered Release 13 | DISCORD_AVATAR: https://raw.githubusercontent.com/OneLiteFeatherNET/assets/blob/main/onelitefeathernet.png 14 | DISCORD_THREAD_ID: '1239259280662597725' 15 | uses: OneLiteFeatherNET/action-discord@master 16 | with: 17 | args: | 18 | "<@&1250397109207830589>" 19 | "" 20 | " **AntiRedstoneClock-Remastered ${{ github.event.release.tag_name }} has been released!**" 21 | "" 22 | "Click here to view changelog: https://github.com/OneLiteFeatherNET/AntiRedstoneClock-Remastered/releases/tag/${{ github.event.release.tag_name }}" 23 | "" 24 | "The download is available at:" 25 | "- Hangar: " 26 | "- Modrinth: " -------------------------------------------------------------------------------- /.github/workflows/build-pr.yml: -------------------------------------------------------------------------------- 1 | name: Build PR 2 | on: [pull_request] 3 | jobs: 4 | build_pr: 5 | if: github.repository_owner == 'OneLiteFeatherNET' 6 | runs-on: ${{ matrix.os }} 7 | strategy: 8 | matrix: 9 | os: [ubuntu-latest, windows-latest, macos-latest] 10 | steps: 11 | - name: Checkout Repository 12 | uses: actions/checkout@v4 13 | - name: Validate Gradle Wrapper 14 | uses: gradle/actions/wrapper-validation@v4 15 | - name: Setup Java 16 | uses: actions/setup-java@v4 17 | with: 18 | distribution: temurin 19 | java-version: 21 20 | - name: Build on ${{ matrix.os }} 21 | run: ./gradlew clean build 22 | -------------------------------------------------------------------------------- /.github/workflows/close_invalid_prs.yml: -------------------------------------------------------------------------------- 1 | name: Close invalid PRs 2 | 3 | on: 4 | pull_request_target: 5 | types: [ opened ] 6 | 7 | jobs: 8 | run: 9 | if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'main' }} 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: superbrothers/close-pull-request@v3 13 | with: 14 | comment: "Please do not open pull requests from the `main` branch, create a new branch instead." -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish AntiRedstoneClock-Remasterd to platforms 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - develop 7 | jobs: 8 | publish: 9 | name: 'Publish to EldoNexus, Modrinth and Hangar' 10 | # Run on all label events (won't be duplicated) or all push events or on PR syncs not from the same repo 11 | if: github.repository_owner == 'OneLiteFeatherNET' 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout Repository 15 | uses: actions/checkout@v4 16 | - name: Validate Gradle Wrapper 17 | uses: gradle/wrapper-validation-action@v3 18 | - name: Setup Java 19 | uses: actions/setup-java@v4 20 | with: 21 | distribution: temurin 22 | cache: gradle 23 | java-version: 21 24 | - name: Publish 25 | env: 26 | HANGAR_SECRET: ${{secrets.HANGAR_KEY}} 27 | MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }} 28 | ELDO_USERNAME: "${{ secrets.ELDO_USERNAME }}" 29 | ELDO_PASSWORD: "${{ secrets.ELDO_PASSWORD }}" 30 | run: ./gradlew build modrinth publishAllPublicationsToHangar publish 31 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: draft release 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - main 7 | - develop 8 | pull_request: 9 | types: [opened, reopened, synchronize] 10 | pull_request_target: 11 | types: [opened, reopened, synchronize] 12 | permissions: 13 | contents: read 14 | jobs: 15 | update_release_draft: 16 | permissions: 17 | contents: write 18 | pull-requests: write 19 | if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: release-drafter/release-drafter@v6 23 | env: 24 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Eclipse ### 20 | .apt_generated 21 | .classpath 22 | .factorypath 23 | .project 24 | .settings 25 | .springBeans 26 | .sts4-cache 27 | bin/ 28 | !**/src/main/**/bin/ 29 | !**/src/test/**/bin/ 30 | 31 | ### NetBeans ### 32 | /nbproject/private/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ 37 | 38 | ### VS Code ### 39 | .vscode/ 40 | 41 | ### Mac OS ### 42 | .DS_Store 43 | 44 | ### Project 45 | run-*/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . -------------------------------------------------------------------------------- /PlotSquaredv6Support/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation(platform(libs.psv6.platform)) 3 | compileOnly(libs.psv6.core) 4 | compileOnly(libs.psv6.bukkit) { isTransitive = false } 5 | } -------------------------------------------------------------------------------- /PlotSquaredv6Support/src/main/java/net/onelitefeather/antiredstoneclockremastered/plotsquared/v6/PlotSquaredLegacySupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.plotsquared.v6; 2 | 3 | import com.plotsquared.bukkit.util.BukkitUtil; 4 | import com.plotsquared.core.PlotSquared; 5 | import com.plotsquared.core.plot.flag.GlobalFlagContainer; 6 | import net.onelitefeather.antiredstoneclockremastered.api.AbstractPlotsquaredSupport; 7 | import org.bukkit.Bukkit; 8 | import org.bukkit.Location; 9 | import org.bukkit.plugin.Plugin; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | public final class PlotSquaredLegacySupport extends AbstractPlotsquaredSupport { 13 | @Override 14 | public void init() { 15 | GlobalFlagContainer.getInstance().addFlag(new RedstoneClockFlag(false)); 16 | } 17 | 18 | @Override 19 | public boolean isAllowedPlot(@NotNull Location location) { 20 | var plotArea = PlotSquared.get().getPlotAreaManager().getPlotArea(BukkitUtil.adapt(location)); 21 | if (plotArea != null) { 22 | var flag = plotArea.getFlagContainer().getFlag(RedstoneClockFlag.class); 23 | if (flag != null) { 24 | return flag.getValue(); 25 | } 26 | } 27 | return false; 28 | } 29 | 30 | @Override 31 | @SuppressWarnings("deprecation") 32 | public String getVersion() { 33 | Plugin plotSquaredPlugin = Bukkit.getPluginManager().getPlugin("PlotSquared"); 34 | if (plotSquaredPlugin == null) { 35 | return "unknown"; 36 | } 37 | return plotSquaredPlugin.getDescription().getVersion(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /PlotSquaredv6Support/src/main/java/net/onelitefeather/antiredstoneclockremastered/plotsquared/v6/RedstoneClockFlag.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.plotsquared.v6; 2 | 3 | import com.plotsquared.core.configuration.caption.StaticCaption; 4 | import com.plotsquared.core.plot.flag.types.BooleanFlag; 5 | import org.checkerframework.checker.nullness.qual.NonNull; 6 | 7 | public final class RedstoneClockFlag extends BooleanFlag { 8 | protected RedstoneClockFlag(boolean value) { 9 | super(value, StaticCaption.of("Set to `false` to disable RedstoneClock in the plot.")); 10 | } 11 | 12 | @Override 13 | protected RedstoneClockFlag flagOf(@NonNull Boolean value) { 14 | return new RedstoneClockFlag(value); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PlotSquaredv7Support/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation(platform(libs.psv7.platform)) 3 | compileOnly(libs.psv7.core) 4 | compileOnly(libs.psv7.bukkit) { isTransitive = false } 5 | } -------------------------------------------------------------------------------- /PlotSquaredv7Support/src/main/java/net/onelitefeather/antiredstoneclockremastered/plotsquared/v7/PlotSquaredModernSupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.plotsquared.v7; 2 | 3 | import com.plotsquared.bukkit.util.BukkitUtil; 4 | import com.plotsquared.core.PlotSquared; 5 | import com.plotsquared.core.plot.Plot; 6 | import com.plotsquared.core.plot.flag.GlobalFlagContainer; 7 | import net.onelitefeather.antiredstoneclockremastered.api.AbstractPlotsquaredSupport; 8 | import org.bukkit.Bukkit; 9 | import org.bukkit.Location; 10 | import org.bukkit.plugin.Plugin; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | public final class PlotSquaredModernSupport extends AbstractPlotsquaredSupport { 14 | @Override 15 | public void init() { 16 | GlobalFlagContainer.getInstance().addFlag(RedstoneClockFlag.REDSTONE_CLOCK_FALSE); 17 | } 18 | 19 | @Override 20 | public boolean isAllowedPlot(@NotNull Location location) { 21 | var plotArea = PlotSquared.get().getPlotAreaManager().getPlotArea(BukkitUtil.adapt(location)); 22 | if (plotArea == null) return false; 23 | Plot plot = plotArea.getPlot(BukkitUtil.adapt(location)); 24 | if (plot == null) return false; 25 | return plot.getFlag(RedstoneClockFlag.class); 26 | } 27 | 28 | @Override 29 | @SuppressWarnings("deprecation") 30 | public String getVersion() { 31 | Plugin plotSquaredPlugin = Bukkit.getPluginManager().getPlugin("PlotSquared"); 32 | if (plotSquaredPlugin == null) { 33 | return "unknown"; 34 | } 35 | return plotSquaredPlugin.getDescription().getVersion(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /PlotSquaredv7Support/src/main/java/net/onelitefeather/antiredstoneclockremastered/plotsquared/v7/RedstoneClockFlag.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.plotsquared.v7; 2 | 3 | import com.plotsquared.core.configuration.caption.StaticCaption; 4 | import com.plotsquared.core.plot.flag.types.BooleanFlag; 5 | import org.checkerframework.checker.nullness.qual.NonNull; 6 | 7 | public final class RedstoneClockFlag extends BooleanFlag { 8 | 9 | public static final RedstoneClockFlag REDSTONE_CLOCK_TRUE = new RedstoneClockFlag(true); 10 | public static final RedstoneClockFlag REDSTONE_CLOCK_FALSE = new RedstoneClockFlag(false); 11 | 12 | protected RedstoneClockFlag(boolean value) { 13 | super(value, StaticCaption.of("Set to `false` to disable RedstoneClock in the plot.")); 14 | } 15 | 16 | @Override 17 | protected RedstoneClockFlag flagOf(@NonNull Boolean value) { 18 | return value ? REDSTONE_CLOCK_TRUE : REDSTONE_CLOCK_FALSE; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AntiRedstoneClock-Remastered 2 | [![Crowdin](https://badges.crowdin.net/e/79ae9c901c3d260349569fca62af7b2f/localized.svg)](https://onelitefeather.crowdin.com/antiredstoneclock-remastered) 3 | 4 | This plugin is inspired by https://gitlab.com/Trafalcraft/antiRedstoneClock 5 | 6 | We re-created the whole code and improved everything. On top, we support Plotsquared v7 and Worldguard v7. 7 | 8 | ### Goal 9 | The goal of this plugin is to detect redstone clocks, inform staff or console about active ones and optionally destroy / disable the redstone clocks so your server can save performance for something else. Also it can prevent players doing harm with heavy clocks, but this is more of a side effect. 10 | 11 | ### Not a goal 12 | It's not planned to support Paper forks or spigot directly - this plugin is developed to work on Paper, if you are using a fork of paper or spigot and it doesn't work because of your fork, you are likely on your own then. 13 | Also this plugin is not a "performance tool", it won't make your server run better directly. 14 | Third, support from 1.13 backwards likely won't happen. 15 | 16 | ## Minecraft Version Support 17 | Only the last 3 versions of a major Minecraft are supported. 18 | For Minecraft version 1.19, it would be 1.19.4, 19 | For Minecraft version 1.20, it would be 1.20.6 and so on 20 | 21 | ## Features 22 | - 1.19+ Support 23 | - Java 21 only support 24 | - Plotsquared v6 and v7 support 25 | - WorldGuard Support 26 | - 1.19,1.20,1.21 ready 27 | - Clock detection 28 | - Sculk support 29 | - Config Migration(Soon) 30 | - Prevent duplicated loading of anti-redstoneclock plugins 31 | 32 | > [!CAUTION] 33 | > The "world" world is ignored by default 34 | 35 | ## Contribution 36 | You want to help us? Sure go for it, we would love to see your contribution! You can look for open issues or if you have a nice idea, please open an issue or ask us on discord if you can add your feature with a PR. Communication is key. 37 | 38 | ## Dependencies (soft-depend, can be used together) 39 | - Plotsquared v7 https://github.com/IntellectualSites/PlotSquared 40 | - Worldguard v7 https://github.com/EngineHub/WorldGuard 41 | 42 | ## Permissions: 43 | ``` 44 | antiredstoneclockremastered.notify.admin 45 | ``` 46 | > [!CAUTION] 47 | > All others can be taken from the Plugin.yml or use LuckPerms, which are automatically suggested there 48 | 49 | ## Commmands 50 | - /arcm reload 51 | - Reloads the config 52 | - /arcm help 53 | - Shows all commands and descriptions 54 | - /arcm display 55 | - Shows current cached redstone clocks 56 | 57 | ## More information / external links / Download 58 | Hangar: https://hangar.papermc.io/OneLiteFeather/AntiRedstoneClock-Remastered 59 | 60 | Modrinth: https://modrinth.com/plugin/AntiRedstoneClock-Remastered 61 | 62 | Discord: https://discord.onelitefeather.net 63 | -------------------------------------------------------------------------------- /WorldGuardv6Support/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Eclipse ### 20 | .apt_generated 21 | .classpath 22 | .factorypath 23 | .project 24 | .settings 25 | .springBeans 26 | .sts4-cache 27 | bin/ 28 | !**/src/main/**/bin/ 29 | !**/src/test/**/bin/ 30 | 31 | ### NetBeans ### 32 | /nbproject/private/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ 37 | 38 | ### VS Code ### 39 | .vscode/ 40 | 41 | ### Mac OS ### 42 | .DS_Store -------------------------------------------------------------------------------- /WorldGuardv6Support/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileOnly(libs.wg6) 3 | compileOnly("com.sk89q.worldedit:worldedit-bukkit:6.0") { 4 | exclude("org.bukkit", "bukkit") 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /WorldGuardv6Support/src/main/java/net/onelitefeather/antiredstoneclockremastered/worldguard/v6/WorldGuardLegacySupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.worldguard.v6; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldguard.bukkit.RegionQuery; 5 | import com.sk89q.worldguard.bukkit.WorldGuardPlugin; 6 | import com.sk89q.worldguard.bukkit.protection.DelayedRegionOverlapAssociation; 7 | import com.sk89q.worldguard.protection.ApplicableRegionSet; 8 | import com.sk89q.worldguard.protection.association.RegionAssociable; 9 | import com.sk89q.worldguard.protection.flags.StateFlag; 10 | import com.sk89q.worldguard.protection.flags.registry.FlagConflictException; 11 | import com.sk89q.worldguard.protection.flags.registry.FlagRegistry; 12 | import com.sk89q.worldguard.protection.managers.RegionManager; 13 | import com.sk89q.worldguard.protection.regions.ProtectedRegion; 14 | import net.onelitefeather.antiredstoneclockremastered.api.AbstractWorldGuardSupport; 15 | import org.bukkit.Bukkit; 16 | import org.bukkit.Location; 17 | import org.bukkit.plugin.Plugin; 18 | import org.jetbrains.annotations.NotNull; 19 | 20 | public final class WorldGuardLegacySupport extends AbstractWorldGuardSupport { 21 | 22 | private static final StateFlag REDSTONECLOCK_FLAG = new StateFlag("redstone-clock", false); 23 | 24 | private static final WorldGuardPlugin WORLD_GUARD_PLUGIN = loadPlugin(); 25 | 26 | public WorldGuardLegacySupport(@NotNull Plugin plugin) { 27 | super(plugin); 28 | } 29 | 30 | private static WorldGuardPlugin loadPlugin() { 31 | 32 | Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard"); 33 | 34 | // WorldGuard may be loaded 35 | if (plugin instanceof WorldGuardPlugin wgp) return wgp; 36 | return null; 37 | } 38 | 39 | @Override 40 | public boolean isRegionAllowed(@NotNull Location location) { 41 | boolean result = false; 42 | if (WORLD_GUARD_PLUGIN != null) { 43 | RegionQuery query = WORLD_GUARD_PLUGIN.getRegionContainer().createQuery(); 44 | ApplicableRegionSet set = query.getApplicableRegions(location); 45 | RegionAssociable associable = new DelayedRegionOverlapAssociation(query, location); 46 | if (set.testState(associable, REDSTONECLOCK_FLAG)) { 47 | result = true; 48 | } else { 49 | RegionManager regionManager = WORLD_GUARD_PLUGIN.getRegionManager(location.getWorld()); 50 | result = checkRegionFromConfigFile(location, regionManager); 51 | } 52 | } 53 | return result; 54 | } 55 | 56 | private boolean checkRegionFromConfigFile(@NotNull Location loc, RegionManager regionManager) { 57 | if (regionManager != null) { 58 | ApplicableRegionSet regions = getRegion(regionManager, loc); 59 | for (String ignoreRegion : this.plugin.getConfig().getStringList(configPath)) { 60 | for (ProtectedRegion region : regions.getRegions()) { 61 | if (region.getId().equals(ignoreRegion)) { 62 | return true; 63 | } 64 | } 65 | } 66 | } 67 | return false; 68 | } 69 | 70 | private ApplicableRegionSet getRegion(RegionManager regionManager, Location loc) { 71 | Vector vector = new Vector(loc.getX(), loc.getY(), loc.getZ()); 72 | return regionManager.getApplicableRegions(vector); 73 | } 74 | 75 | @Override 76 | @SuppressWarnings("deprecation") 77 | public String getVersion() { 78 | if (WORLD_GUARD_PLUGIN == null) { 79 | return "undefined"; 80 | } else { 81 | return WORLD_GUARD_PLUGIN.getDescription().getVersion().substring(0, 1); 82 | } 83 | } 84 | 85 | @Override 86 | public boolean registerFlag() { 87 | boolean flagLoaded = false; 88 | if (WORLD_GUARD_PLUGIN != null) { 89 | FlagRegistry registry = WORLD_GUARD_PLUGIN.getFlagRegistry(); 90 | try { 91 | // register our flag with the registry 92 | registry.register(REDSTONECLOCK_FLAG); 93 | flagLoaded = true; 94 | } catch (FlagConflictException e) { 95 | Bukkit.getLogger().severe("A plugin already use the flag redstoneclock. WorldGuard flag support will not work"); 96 | } 97 | } 98 | return flagLoaded; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /WorldGuardv7Support/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileOnly(libs.wg7) 3 | } 4 | -------------------------------------------------------------------------------- /WorldGuardv7Support/src/main/java/net/onelitefeather/antiredstoneclockremastered/worldguard/v7/WorldGuardModernSupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.worldguard.v7; 2 | 3 | import com.sk89q.worldedit.bukkit.BukkitAdapter; 4 | import com.sk89q.worldguard.WorldGuard; 5 | import com.sk89q.worldguard.bukkit.BukkitWorldGuardPlatform; 6 | import com.sk89q.worldguard.bukkit.WorldGuardPlugin; 7 | import com.sk89q.worldguard.protection.ApplicableRegionSet; 8 | import com.sk89q.worldguard.protection.association.DelayedRegionOverlapAssociation; 9 | import com.sk89q.worldguard.protection.association.RegionAssociable; 10 | import com.sk89q.worldguard.protection.flags.StateFlag; 11 | import com.sk89q.worldguard.protection.flags.registry.FlagConflictException; 12 | import com.sk89q.worldguard.protection.flags.registry.FlagRegistry; 13 | import com.sk89q.worldguard.protection.managers.RegionManager; 14 | import com.sk89q.worldguard.protection.regions.ProtectedRegion; 15 | import com.sk89q.worldguard.protection.regions.RegionQuery; 16 | import net.onelitefeather.antiredstoneclockremastered.api.AbstractWorldGuardSupport; 17 | import org.bukkit.Bukkit; 18 | import org.bukkit.Location; 19 | import org.bukkit.World; 20 | import org.bukkit.plugin.Plugin; 21 | import org.jetbrains.annotations.NotNull; 22 | 23 | public final class WorldGuardModernSupport extends AbstractWorldGuardSupport { 24 | 25 | private static final WorldGuardPlugin WORLD_GUARD_PLUGIN = loadPlugin(); 26 | 27 | private static final StateFlag REDSTONECLOCK_FLAG = new StateFlag("redstone-clock", false); 28 | 29 | public WorldGuardModernSupport(@NotNull Plugin plugin) { 30 | super(plugin); 31 | } 32 | 33 | @Override 34 | public boolean isRegionAllowed(@NotNull Location location) { 35 | boolean result = false; 36 | if (WORLD_GUARD_PLUGIN != null) { 37 | RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery(); 38 | ApplicableRegionSet set = query.getApplicableRegions(BukkitAdapter.adapt(location)); 39 | RegionAssociable associable = new DelayedRegionOverlapAssociation(query, BukkitAdapter.adapt(location)); 40 | if (set.testState(associable, REDSTONECLOCK_FLAG)) { 41 | return true; 42 | } else { 43 | RegionManager regionManager = getRegionManager(location.getWorld()); 44 | result = checkRegionFromConfigFile(location, regionManager); 45 | } 46 | } 47 | return result; 48 | } 49 | 50 | private static WorldGuardPlugin loadPlugin() { 51 | 52 | Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard"); 53 | 54 | // WorldGuard may be loaded 55 | if (plugin instanceof WorldGuardPlugin wgp) return wgp; 56 | return null; 57 | } 58 | 59 | private boolean checkRegionFromConfigFile(@NotNull Location location, RegionManager regionManager) { 60 | if (regionManager != null) { 61 | ApplicableRegionSet regions = regionManager.getApplicableRegions(BukkitAdapter.adapt(location).toVector().toBlockPoint()); 62 | for (String ignoreRegion : this.plugin.getConfig().getStringList(configPath)) { 63 | for (ProtectedRegion region : regions.getRegions()) { 64 | if (region.getId().equals(ignoreRegion)) { 65 | return true; 66 | } 67 | } 68 | } 69 | } 70 | return false; 71 | } 72 | 73 | private RegionManager getRegionManager(World world) { 74 | BukkitWorldGuardPlatform wgPlatform = (BukkitWorldGuardPlatform) WorldGuard.getInstance().getPlatform(); 75 | com.sk89q.worldedit.world.World worldEditWorld = wgPlatform.getMatcher().getWorldByName(world.getName()); 76 | return wgPlatform.getRegionContainer().get(worldEditWorld); 77 | } 78 | 79 | @Override 80 | @SuppressWarnings("deprecation") 81 | public String getVersion() { 82 | if (WORLD_GUARD_PLUGIN == null) { 83 | return "undefined"; 84 | } else { 85 | return WORLD_GUARD_PLUGIN.getDescription().getVersion().substring(0, 1); 86 | } 87 | } 88 | 89 | @Override 90 | public boolean registerFlag() { 91 | boolean flagLoaded = false; 92 | FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry(); 93 | try { 94 | registry.register(REDSTONECLOCK_FLAG); 95 | flagLoaded = true; 96 | } catch (FlagConflictException e) { 97 | Bukkit.getLogger().severe("A plugin already use the flag redstone-clock. WorldGuard flag support will not work"); 98 | } 99 | return flagLoaded; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /build-logic/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | gradlePluginPortal() 7 | } 8 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/extensions.kt: -------------------------------------------------------------------------------- 1 | import org.gradle.api.Project 2 | import org.gradle.api.publish.PublishingExtension 3 | import org.gradle.api.publish.maven.MavenPublication 4 | import org.gradle.kotlin.dsl.configure 5 | import org.gradle.kotlin.dsl.get 6 | import org.gradle.kotlin.dsl.named 7 | import java.io.ByteArrayOutputStream 8 | 9 | fun Project.publishShadowJar() { 10 | configurePublication { 11 | artifact(tasks["shadowJar"]) 12 | artifact(tasks["sourcesJar"]) 13 | } 14 | } 15 | 16 | private fun Project.configurePublication(configurer: MavenPublication.() -> Unit) { 17 | extensions.configure { 18 | publications.named("mavenJava") { 19 | apply(configurer) 20 | } 21 | } 22 | } 23 | 24 | fun Project.latestCommitHash(): String { 25 | return runGitCommand(listOf("rev-parse", "--short", "HEAD")) 26 | } 27 | 28 | fun Project.latestCommitMessage(): String { 29 | return runGitCommand(listOf("log", "-1", "--pretty=%B")) 30 | } 31 | 32 | fun Project.branchName(): String { 33 | return runGitCommand(listOf("rev-parse", "--abbrev-ref", "HEAD")) 34 | } 35 | 36 | fun Project.runGitCommand(args: List): String { 37 | val byteOut = ByteArrayOutputStream() 38 | exec { 39 | commandLine = listOf("git") + args 40 | standardOutput = byteOut 41 | } 42 | return byteOut.toString(Charsets.UTF_8.name()).trim() 43 | } 44 | -------------------------------------------------------------------------------- /build-logic/src/main/kotlin/olf.build-logic.gradle.kts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneLiteFeatherNET/AntiRedstoneClock-Remastered/7140110718458f326fa04e55f036d87f6783424d/build-logic/src/main/kotlin/olf.build-logic.gradle.kts -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.papermc.hangarpublishplugin.model.Platforms 2 | import net.minecrell.pluginyml.bukkit.BukkitPluginDescription 3 | import xyz.jpenilla.runpaper.task.RunServer 4 | 5 | plugins { 6 | id("java") 7 | alias(libs.plugins.shadowJar) 8 | alias(libs.plugins.publishdata) 9 | alias(libs.plugins.paper.run) 10 | alias(libs.plugins.paper.yml) 11 | alias(libs.plugins.hangar) 12 | alias(libs.plugins.modrinth) 13 | id("olf.build-logic") 14 | `maven-publish` 15 | } 16 | 17 | if (!File("$rootDir/.git").exists()) { 18 | logger.lifecycle( 19 | """ 20 | ************************************************************************************** 21 | You need to fork and clone this repository! Don't download a .zip file. 22 | If you need assistance, consult the GitHub docs: https://docs.github.com/get-started/quickstart/fork-a-repo 23 | ************************************************************************************** 24 | """.trimIndent() 25 | ).also { System.exit(1) } 26 | } 27 | 28 | group = "net.onelitefeather" 29 | version = "1.2.2" 30 | val supportedMinecraftVersions = listOf( 31 | "1.19.4", 32 | "1.20.6", 33 | "1.21" 34 | ) 35 | allprojects { 36 | apply { 37 | plugin("java") 38 | } 39 | repositories { 40 | mavenCentral() 41 | maven("https://repo.codemc.io/repository/maven-public") 42 | maven("https://maven.enginehub.org/repo/") 43 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 44 | maven("https://repo.papermc.io/repository/maven-public/") 45 | maven("https://oss.sonatype.org/content/repositories/snapshots/") 46 | } 47 | dependencies { 48 | if (name != "internal-api") { 49 | compileOnly(project(":internal-api")) 50 | } 51 | compileOnly(rootProject.libs.paper) 52 | } 53 | } 54 | 55 | dependencies { 56 | implementation(libs.bstats) 57 | implementation(libs.minimessage) 58 | implementation(libs.cloud.command.paper) 59 | implementation(libs.cloud.command.extras) 60 | implementation(libs.cloud.command.annotations) 61 | implementation(libs.semver) 62 | implementation(libs.adventure.text.feature.pagination) 63 | annotationProcessor(libs.cloud.command.annotations) 64 | 65 | implementation(project(":internal-api")) 66 | implementation(project(":WorldGuardv6Support")) 67 | implementation(project(":WorldGuardv7Support")) 68 | implementation(project(":PlotSquaredv6Support")) 69 | implementation(project(":PlotSquaredv7Support")) 70 | } 71 | 72 | java { 73 | toolchain.languageVersion.set(JavaLanguageVersion.of(21)) 74 | } 75 | 76 | publishData { 77 | useEldoNexusRepos(false) 78 | publishTask("shadowJar") 79 | } 80 | 81 | tasks { 82 | named("jar") { 83 | archiveClassifier.set("unshaded") 84 | } 85 | named("build") { 86 | dependsOn(shadowJar) 87 | } 88 | supportedMinecraftVersions.forEach { serverVersion -> 89 | register("run-$serverVersion") { 90 | minecraftVersion(serverVersion) 91 | jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true") 92 | group = "run paper" 93 | runDirectory.set(file("run-$serverVersion")) 94 | pluginJars(rootProject.tasks.shadowJar.map { it.archiveFile }.get()) 95 | } 96 | } 97 | shadowJar { 98 | archiveClassifier.set("") 99 | relocate("org.bstats", "net.onelitefeather.antiredstoneclockremastered.org.bstats") 100 | } 101 | } 102 | 103 | 104 | paper { 105 | main = "net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered" 106 | apiVersion = "1.19" 107 | authors = listOf("OneLiteFeather", "TheMeinerLP") 108 | serverDependencies { 109 | register("PlotSquared") { 110 | required = false 111 | } 112 | register("WorldGuard") { 113 | required = false 114 | } 115 | } 116 | permissions { 117 | register("antiredstoneclockremastered.notify.admin") 118 | register("antiredstoneclockremastered.notify.disable.donation") 119 | register("antiredstoneclockremastered.notify.admin.update") { 120 | default = BukkitPluginDescription.Permission.Default.OP 121 | } 122 | register("antiredstoneclockremastered.command.reload") 123 | register("antiredstoneclockremastered.command.help") 124 | register("antiredstoneclockremastered.command.feature.check.observer") 125 | register("antiredstoneclockremastered.command.feature.check.piston") 126 | register("antiredstoneclockremastered.command.feature.check.sculk") 127 | register("antiredstoneclockremastered.command.feature.check.redstone_and_repeater") 128 | register("antiredstoneclockremastered.command.feature.check.world.add") 129 | register("antiredstoneclockremastered.command.feature.check.world.remove") 130 | register("antiredstoneclockremastered.command.feature.check.region.remove") 131 | register("antiredstoneclockremastered.command.feature.check.region.add") 132 | register("antiredstoneclockremastered.command.feature.clock.notifyAdmins") 133 | register("antiredstoneclockremastered.command.feature.clock.notifyConsole") 134 | register("antiredstoneclockremastered.command.feature.clock.drop") 135 | register("antiredstoneclockremastered.command.feature.clock.enddelay") 136 | register("antiredstoneclockremastered.command.feature.clock.maxCount") 137 | } 138 | } 139 | val branch = rootProject.branchName() 140 | val baseVersion = publishData.getVersion(false) 141 | val isRelease = !baseVersion.contains('-') 142 | val isMainBranch = branch == "master" 143 | if (!isRelease || isMainBranch) { // Only publish releases from the main branch 144 | val suffixedVersion = 145 | if (isRelease) baseVersion else baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER") 146 | val changelogContent = if (isRelease) { 147 | "See [GitHub](https://github.com/OneLiteFeatherNET/AntiRedstoneClock-Remastered) for release notes." 148 | } else { 149 | val commitHash = rootProject.latestCommitHash() 150 | "[$commitHash](https://github.com/OneLiteFeatherNET/AntiRedstoneClock-Remastered/commit/$commitHash) ${rootProject.latestCommitMessage()}" 151 | } 152 | hangarPublish { 153 | publications.register("AntiRedstoneClock-Remastered") { 154 | version.set(suffixedVersion) 155 | channel.set(if (isRelease) "Release" else "Snapshot") 156 | changelog.set(changelogContent) 157 | apiKey.set(System.getenv("HANGAR_SECRET")) 158 | id.set("AntiRedstoneClock-Remastered") 159 | 160 | platforms { 161 | register(Platforms.PAPER) { 162 | jar.set(tasks.shadowJar.flatMap { it.archiveFile }) 163 | platformVersions.set(supportedMinecraftVersions) 164 | } 165 | } 166 | } 167 | } 168 | modrinth { 169 | token.set(System.getenv("MODRINTH_TOKEN")) 170 | projectId.set("UWh9tyEa") 171 | versionType.set(if (isRelease) "release" else "beta") 172 | versionNumber.set(suffixedVersion) 173 | versionName.set(suffixedVersion) 174 | changelog.set(changelogContent) 175 | changelog.set(changelogContent) 176 | uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile }) 177 | gameVersions.addAll(supportedMinecraftVersions) 178 | loaders.add("paper") 179 | loaders.add("bukkit") 180 | } 181 | } 182 | 183 | publishing { 184 | publications.create("maven") { 185 | // Configure our maven publication 186 | publishData.configurePublication(this) 187 | } 188 | 189 | repositories { 190 | // We add EldoNexus as our repository. The used url is defined by the publish data. 191 | maven { 192 | authentication { 193 | credentials(PasswordCredentials::class) { 194 | // Those credentials need to be set under "Settings -> Secrets -> Actions" in your repository 195 | username = System.getenv("ELDO_USERNAME") 196 | password = System.getenv("ELDO_PASSWORD") 197 | } 198 | } 199 | 200 | name = "EldoNexus" 201 | setUrl(publishData.getRepository()) 202 | } 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /crowdin.yml: -------------------------------------------------------------------------------- 1 | files: 2 | - source: src/main/resources/antiredstoneclockremasterd.properties 3 | translation: /src/main/resources/antiredstoneclockremasterd_%locale_with_underscore%.properties 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneLiteFeatherNET/AntiRedstoneClock-Remastered/7140110718458f326fa04e55f036d87f6783424d/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.14.1-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\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH="\\\"\\\"" 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | -------------------------------------------------------------------------------- /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= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 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 | -------------------------------------------------------------------------------- /internal-api/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Eclipse ### 20 | .apt_generated 21 | .classpath 22 | .factorypath 23 | .project 24 | .settings 25 | .springBeans 26 | .sts4-cache 27 | bin/ 28 | !**/src/main/**/bin/ 29 | !**/src/test/**/bin/ 30 | 31 | ### NetBeans ### 32 | /nbproject/private/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ 37 | 38 | ### VS Code ### 39 | .vscode/ 40 | 41 | ### Mac OS ### 42 | .DS_Store -------------------------------------------------------------------------------- /internal-api/build.gradle.kts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneLiteFeatherNET/AntiRedstoneClock-Remastered/7140110718458f326fa04e55f036d87f6783424d/internal-api/build.gradle.kts -------------------------------------------------------------------------------- /internal-api/src/main/java/net/onelitefeather/antiredstoneclockremastered/api/AbstractPlotsquaredSupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.api; 2 | 3 | public abstract non-sealed class AbstractPlotsquaredSupport implements PlotsquaredSupport { 4 | } 5 | -------------------------------------------------------------------------------- /internal-api/src/main/java/net/onelitefeather/antiredstoneclockremastered/api/AbstractWorldGuardSupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.api; 2 | 3 | import org.bukkit.plugin.Plugin; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public abstract non-sealed class AbstractWorldGuardSupport implements WorldGuardSupport { 7 | 8 | protected final @NotNull Plugin plugin; 9 | protected final @NotNull String configPath = "check.ignoredRegions"; 10 | 11 | protected AbstractWorldGuardSupport(@NotNull Plugin plugin) { 12 | this.plugin = plugin; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /internal-api/src/main/java/net/onelitefeather/antiredstoneclockremastered/api/PlotsquaredSupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.api; 2 | 3 | import org.bukkit.Location; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public sealed interface PlotsquaredSupport permits AbstractPlotsquaredSupport { 7 | 8 | void init(); 9 | 10 | boolean isAllowedPlot(@NotNull Location location); 11 | 12 | String getVersion(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /internal-api/src/main/java/net/onelitefeather/antiredstoneclockremastered/api/WorldGuardSupport.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.api; 2 | 3 | import org.bukkit.Location; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public sealed interface WorldGuardSupport permits AbstractWorldGuardSupport { 7 | 8 | boolean isRegionAllowed(@NotNull Location location); 9 | 10 | String getVersion(); 11 | 12 | boolean registerFlag(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "AntiRedstoneClock-Remastered" 2 | includeBuild("build-logic") 3 | include("internal-api") 4 | include("WorldGuardv6Support") 5 | include("WorldGuardv7Support") 6 | include("PlotSquaredv6Support") 7 | include("PlotSquaredv7Support") 8 | 9 | pluginManagement { 10 | repositories { 11 | maven("https://eldonexus.de/repository/maven-public/") 12 | gradlePluginPortal() 13 | } 14 | } 15 | 16 | 17 | dependencyResolutionManagement { 18 | versionCatalogs { 19 | create("libs") { 20 | version("publishdata", "1.4.0") 21 | version("modrinth", "2.+") 22 | version("hangar", "0.1.3") 23 | version("paper.yml", "0.6.0") 24 | version("paper.run", "2.3.1") 25 | version("shadowJar", "9.0.0-beta15") 26 | 27 | version("paper", "1.20.6-R0.1-SNAPSHOT") 28 | version("bstats", "3.1.0") 29 | 30 | version("cloudcommand", "2.0.0") 31 | version("cloudcommandPaper", "2.0.0-SNAPSHOT") 32 | version("cloudcommandAnnotations", "2.0.0") 33 | version("cloudcommandExtras", "2.0.0-SNAPSHOT") 34 | 35 | version("adventure", "4.17.0") 36 | version("adventure-text-feature-pagination", "4.0.0-SNAPSHOT") 37 | version("semver", "0.10.2") 38 | 39 | // WorldGuard 40 | version("wgv6", "6.2") 41 | version("wgv7", "7.0.13") 42 | library("wg6", "com.sk89q.worldguard", "worldguard-legacy").versionRef("wgv6") 43 | library("wg7", "com.sk89q.worldguard", "worldguard-bukkit").versionRef("wgv7") 44 | 45 | // PlotSquared 46 | version("psv4", "4.453") 47 | version("psv6", "1.52") 48 | version("psv7", "1.52") 49 | 50 | library("psv4.core", "com.github.IntellectualSites.PlotSquared","Core").versionRef("psv4") 51 | library("psv4.bukkit", "com.github.IntellectualSites.PlotSquared","Bukkit").versionRef("psv4") 52 | 53 | library("psv6.platform", "com.intellectualsites.bom","bom-1.16.x").versionRef("psv6") 54 | library("psv7.platform", "com.intellectualsites.bom","bom-newest").versionRef("psv7") 55 | library("psv6.core", "com.plotsquared","PlotSquared-Core").withoutVersion() 56 | library("psv6.bukkit", "com.plotsquared","PlotSquared-Bukkit").withoutVersion() 57 | library("psv7.core", "com.intellectualsites.plotsquared","plotsquared-core").withoutVersion() 58 | library("psv7.bukkit", "com.intellectualsites.plotsquared","plotsquared-bukkit").withoutVersion() 59 | 60 | library("paper", "io.papermc.paper", "paper-api").versionRef("paper") 61 | library("minimessage", "net.kyori", "adventure-text-minimessage").versionRef("adventure") 62 | library("adventure.text.feature.pagination", "net.kyori", "adventure-text-feature-pagination").versionRef("adventure-text-feature-pagination") 63 | library("bstats", "org.bstats", "bstats-bukkit").versionRef("bstats") 64 | 65 | library("cloud.command.paper", "org.incendo", "cloud-paper").versionRef("cloudcommandPaper") 66 | library("cloud.command.annotations", "org.incendo", "cloud-annotations").versionRef("cloudcommandAnnotations") 67 | library("cloud.command.extras", "org.incendo", "cloud-minecraft-extras").versionRef("cloudcommandExtras") 68 | 69 | library("semver", "com.github.zafarkhaja", "java-semver").versionRef("semver") 70 | 71 | plugin("publishdata","de.chojo.publishdata").versionRef("publishdata") 72 | plugin("modrinth", "com.modrinth.minotaur").versionRef("modrinth") 73 | plugin("hangar", "io.papermc.hangar-publish-plugin").versionRef("hangar") 74 | plugin("paper.yml", "net.minecrell.plugin-yml.paper").versionRef("paper.yml") 75 | plugin("paper.run", "xyz.jpenilla.run-paper").versionRef("paper.run") 76 | plugin("shadowJar", "com.gradleup.shadow").versionRef("shadowJar") 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/AntiRedstoneClockRemastered.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered; 2 | 3 | import net.kyori.adventure.key.Key; 4 | import net.kyori.adventure.text.Component; 5 | import net.kyori.adventure.text.minimessage.MiniMessage; 6 | import net.kyori.adventure.translation.GlobalTranslator; 7 | import net.kyori.adventure.translation.TranslationRegistry; 8 | import net.kyori.adventure.util.UTF8ResourceBundleControl; 9 | import net.onelitefeather.antiredstoneclockremastered.api.PlotsquaredSupport; 10 | import net.onelitefeather.antiredstoneclockremastered.api.WorldGuardSupport; 11 | import net.onelitefeather.antiredstoneclockremastered.commands.DisplayActiveClocksCommand; 12 | import net.onelitefeather.antiredstoneclockremastered.commands.FeatureCommand; 13 | import net.onelitefeather.antiredstoneclockremastered.commands.ReloadCommand; 14 | import net.onelitefeather.antiredstoneclockremastered.listener.ComparatorListener; 15 | import net.onelitefeather.antiredstoneclockremastered.listener.ObserverListener; 16 | import net.onelitefeather.antiredstoneclockremastered.listener.PistonListener; 17 | import net.onelitefeather.antiredstoneclockremastered.listener.PlayerListener; 18 | import net.onelitefeather.antiredstoneclockremastered.listener.RedstoneListener; 19 | import net.onelitefeather.antiredstoneclockremastered.listener.SculkListener; 20 | import net.onelitefeather.antiredstoneclockremastered.plotsquared.v6.PlotSquaredLegacySupport; 21 | import net.onelitefeather.antiredstoneclockremastered.plotsquared.v7.PlotSquaredModernSupport; 22 | import net.onelitefeather.antiredstoneclockremastered.service.RedstoneClockService; 23 | import net.onelitefeather.antiredstoneclockremastered.service.UpdateService; 24 | import net.onelitefeather.antiredstoneclockremastered.translations.PluginTranslationRegistry; 25 | import net.onelitefeather.antiredstoneclockremastered.utils.CheckTPS; 26 | import net.onelitefeather.antiredstoneclockremastered.worldguard.v6.WorldGuardLegacySupport; 27 | import net.onelitefeather.antiredstoneclockremastered.worldguard.v7.WorldGuardModernSupport; 28 | import org.bstats.bukkit.Metrics; 29 | import org.bstats.charts.DrilldownPie; 30 | import org.bstats.charts.SimplePie; 31 | import org.bukkit.Material; 32 | import org.bukkit.command.CommandSender; 33 | import org.bukkit.plugin.Plugin; 34 | import org.bukkit.plugin.java.JavaPlugin; 35 | import org.incendo.cloud.annotations.AnnotationParser; 36 | import org.incendo.cloud.bukkit.CloudBukkitCapabilities; 37 | import org.incendo.cloud.component.DefaultValue; 38 | import org.incendo.cloud.execution.ExecutionCoordinator; 39 | import org.incendo.cloud.minecraft.extras.MinecraftHelp; 40 | import org.incendo.cloud.minecraft.extras.RichDescription; 41 | import org.incendo.cloud.paper.LegacyPaperCommandManager; 42 | 43 | import java.io.IOException; 44 | import java.net.URL; 45 | import java.net.URLClassLoader; 46 | import java.nio.file.Files; 47 | import java.nio.file.Path; 48 | import java.util.HashMap; 49 | import java.util.HashSet; 50 | import java.util.Locale; 51 | import java.util.Map; 52 | import java.util.ResourceBundle; 53 | 54 | import static org.incendo.cloud.parser.standard.StringParser.greedyStringParser; 55 | 56 | public final class AntiRedstoneClockRemastered extends JavaPlugin { 57 | private CheckTPS tps; 58 | 59 | private RedstoneClockService redstoneClockService; 60 | private WorldGuardSupport worldGuardSupport; 61 | 62 | private PlotsquaredSupport plotsquaredSupport; 63 | 64 | private Metrics metrics; 65 | private AnnotationParser annotationParser; 66 | 67 | public static final Component PREFIX = MiniMessage.miniMessage().deserialize("[AntiRedstoneClock]"); 68 | private UpdateService updateService; 69 | 70 | @Override 71 | public void onLoad() { 72 | saveDefaultConfig(); 73 | reloadConfig(); 74 | enableWorldGuardSupport(); 75 | } 76 | 77 | 78 | @Override 79 | public void onEnable() { 80 | final TranslationRegistry translationRegistry = new PluginTranslationRegistry(TranslationRegistry.create(Key.key("antiredstoneclockremastered", "translations"))); 81 | translationRegistry.defaultLocale(Locale.US); 82 | Path langFolder = getDataFolder().toPath().resolve("lang"); 83 | var languages = new HashSet<>(getConfig().getStringList("translations")); 84 | languages.add("en-US"); 85 | if (Files.exists(langFolder)) { 86 | try (var urlClassLoader = new URLClassLoader(new URL[]{langFolder.toUri().toURL()})) { 87 | languages.stream().map(Locale::forLanguageTag).forEach(r -> { 88 | var bundle = ResourceBundle.getBundle("antiredstoneclockremasterd", r, urlClassLoader, UTF8ResourceBundleControl.get()); 89 | translationRegistry.registerAll(r, bundle, false); 90 | }); 91 | } catch (IOException e) { 92 | throw new RuntimeException(e); 93 | } 94 | } else { 95 | languages.stream().map(Locale::forLanguageTag).forEach(r -> { 96 | var bundle = ResourceBundle.getBundle("antiredstoneclockremasterd", r, UTF8ResourceBundleControl.get()); 97 | translationRegistry.registerAll(r, bundle, false); 98 | }); 99 | } 100 | GlobalTranslator.translator().addSource(translationRegistry); 101 | donationInformation(); 102 | updateService(); 103 | enableCommandFramework(); 104 | enablePlotsquaredSupport(); 105 | enableTPSChecker(); 106 | enableRedstoneClockService(); 107 | enableBStatsSupport(); 108 | registerEvents(); 109 | registerCommands(); 110 | } 111 | 112 | private void updateService() { 113 | this.updateService = new UpdateService(this); 114 | this.updateService.run(); 115 | this.updateService.notifyConsole(getComponentLogger()); 116 | } 117 | 118 | @Override 119 | public void onDisable() { 120 | this.updateService.shutdown(); 121 | } 122 | 123 | private void donationInformation() { 124 | getComponentLogger().info(Component.translatable("antiredstoneclockremastered.notify.donation.console")); 125 | } 126 | 127 | private void registerCommands() { 128 | if (this.annotationParser != null) { 129 | this.annotationParser.parse(new ReloadCommand(this)); 130 | this.annotationParser.parse(new DisplayActiveClocksCommand(this)); 131 | this.annotationParser.parse(new FeatureCommand(this)); 132 | } 133 | } 134 | 135 | private void enableCommandFramework() { 136 | LegacyPaperCommandManager commandManager = LegacyPaperCommandManager.createNative( 137 | this, 138 | ExecutionCoordinator.asyncCoordinator() 139 | ); 140 | if (commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { 141 | commandManager.registerBrigadier(); 142 | } 143 | else if (commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { 144 | commandManager.registerAsynchronousCompletions(); 145 | } 146 | annotationParser = new AnnotationParser<>(commandManager, CommandSender.class); 147 | annotationParser.descriptionMapper(string -> RichDescription.of(Component.translatable(string))); 148 | MinecraftHelp help = MinecraftHelp.create( 149 | "/arcm help", 150 | commandManager, 151 | sender -> sender 152 | ); 153 | commandManager.command( 154 | commandManager.commandBuilder("arcm").literal("help") 155 | .permission("antiredstoneclockremastered.command.help") 156 | .optional("query", greedyStringParser(), DefaultValue.constant("")) 157 | .handler(context -> { 158 | help.queryCommands(context.get("query"), context.sender()); 159 | }) 160 | ); 161 | } 162 | 163 | private void enablePlotsquaredSupport() { 164 | Plugin plugin = getServer().getPluginManager().getPlugin("PlotSquared"); 165 | if (plugin == null) { 166 | this.getLogger().warning("PlotSquared hasn't been found!"); 167 | return; 168 | } 169 | @SuppressWarnings("deprecation") 170 | int psVersion = Integer.parseInt(plugin.getDescription().getVersion().split("\\.")[0]); 171 | if (psVersion < 6) { 172 | getLogger().warning("We don't support PS5 currently also you use a unsupported version of PlotSquared!!!"); 173 | return; 174 | } else if (psVersion < 7) { 175 | getLogger().warning("You use a legacy version of PlotSquared!"); 176 | this.plotsquaredSupport = new PlotSquaredLegacySupport(); 177 | } else { 178 | getLogger().info("Thanks to hold your software up-to date <3"); 179 | this.plotsquaredSupport = new PlotSquaredModernSupport(); 180 | } 181 | this.plotsquaredSupport.init(); 182 | } 183 | 184 | private void enableWorldGuardSupport() { 185 | Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard"); 186 | if (plugin == null) { 187 | this.getLogger().warning("WorldGuard hasn't been found!"); 188 | return; 189 | } 190 | @SuppressWarnings("deprecation") 191 | int wgVersion = Integer.parseInt(plugin.getDescription().getVersion().split("\\.")[0]); 192 | if (wgVersion > 6) { 193 | this.worldGuardSupport = new WorldGuardModernSupport(this); 194 | } else { 195 | this.worldGuardSupport = new WorldGuardLegacySupport(this); 196 | } 197 | 198 | if (this.worldGuardSupport.registerFlag()) { 199 | this.getLogger().info("Flag redstoneclock registered"); 200 | } else { 201 | this.getLogger().severe("An error occurred while registering redstoneclock flag"); 202 | } 203 | } 204 | 205 | private void registerEvents() { 206 | getServer().getPluginManager().registerEvents(new PlayerListener(this.redstoneClockService, this), this); 207 | if (getConfig().getBoolean("check.observer", true)) { 208 | getServer().getPluginManager().registerEvents(new ObserverListener(this), this); 209 | } 210 | if (getConfig().getBoolean("check.sculk", true)) { 211 | var sculk = Material.getMaterial("SCULK"); 212 | if (sculk != null) { 213 | getServer().getPluginManager().registerEvents(new SculkListener(this), this); 214 | } 215 | } 216 | if (getConfig().getBoolean("check.piston", true)) { 217 | getServer().getPluginManager().registerEvents(new PistonListener(this), this); 218 | } 219 | if (getConfig().getBoolean("check.comparator", true)) { 220 | var comparator = Material.getMaterial("COMPARATOR"); 221 | if (comparator != null) { 222 | getServer().getPluginManager().registerEvents(new ComparatorListener(comparator, this), this); 223 | } else { 224 | getServer().getPluginManager().registerEvents(new ComparatorListener(Material.getMaterial("REDSTONE_COMPARATOR_OFF"), this), this); 225 | getServer().getPluginManager().registerEvents(new ComparatorListener(Material.getMaterial("REDSTONE_COMPARATOR_ON"), this), this); 226 | } 227 | } 228 | if (getConfig().getBoolean("check.redstoneAndRepeater", true)) { 229 | var repeater = Material.getMaterial("REPEATER"); 230 | if (repeater != null) { 231 | getServer().getPluginManager().registerEvents(new RedstoneListener(repeater, this), this); 232 | } else { 233 | getServer().getPluginManager().registerEvents(new RedstoneListener(Material.getMaterial("DIODE_BLOCK_ON"), this), this); 234 | getServer().getPluginManager().registerEvents(new RedstoneListener(Material.getMaterial("DIODE_BLOCK_OFF"), this), this); 235 | } 236 | } 237 | } 238 | 239 | private void enableRedstoneClockService() { 240 | this.redstoneClockService = new RedstoneClockService(this); 241 | } 242 | 243 | private void enableTPSChecker() { 244 | this.tps = new CheckTPS(this, 245 | getConfig().getInt("tps.interval", 2), 246 | getConfig().getInt("tps.max", 20), 247 | getConfig().getInt("tps.min", 15) 248 | ); 249 | this.tps.startCheck(); 250 | } 251 | 252 | private void enableBStatsSupport() { 253 | this.metrics = new Metrics(this, 19085); 254 | this.metrics.addCustomChart(new SimplePie("worldguard", this::bstatsWorldGuardVersion)); 255 | this.metrics.addCustomChart(new SimplePie("plotsquared", this::bstatsPlotSquaredVersion)); 256 | this.metrics.addCustomChart(new DrilldownPie("maxcount", this::bstatsMaxCount)); 257 | } 258 | 259 | private Map> bstatsMaxCount() { 260 | var map = new HashMap>(); 261 | var count = getConfig().getInt("clock.maxCount"); 262 | var entry = Map.of(String.valueOf(count), 1); 263 | switch (count) { 264 | case 0 -> map.put("0 \uD83D\uDEAB", entry); 265 | case 1, 2, 3, 4, 5 -> map.put("1-5 \uD83D\uDE10", entry); 266 | case 6, 7, 8, 9, 10 -> map.put("6-10 \uD83D\uDE42", entry); 267 | case 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 -> map.put("11-25 \uD83D\uDE0A", entry); 268 | case 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 -> 269 | map.put("26-50 \uD83D\uDE00", entry); 270 | default -> map.put("50+ \uD83D\uDE01", entry); 271 | } 272 | return map; 273 | } 274 | 275 | private String bstatsPlotSquaredVersion() { 276 | if (this.plotsquaredSupport != null) { 277 | return this.plotsquaredSupport.getVersion(); 278 | } 279 | return "unknown"; 280 | } 281 | 282 | private String bstatsWorldGuardVersion() { 283 | if (this.worldGuardSupport != null) { 284 | return this.worldGuardSupport.getVersion(); 285 | } 286 | return "unknown"; 287 | } 288 | 289 | public CheckTPS getTps() { 290 | return tps; 291 | } 292 | 293 | public RedstoneClockService getRedstoneClockService() { 294 | return redstoneClockService; 295 | } 296 | 297 | public WorldGuardSupport getWorldGuardSupport() { 298 | return worldGuardSupport; 299 | } 300 | 301 | public PlotsquaredSupport getPlotsquaredSupport() { 302 | return plotsquaredSupport; 303 | } 304 | 305 | public UpdateService getUpdateService() { 306 | return updateService; 307 | } 308 | } 309 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/commands/DisplayActiveClocksCommand.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.commands; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import net.kyori.adventure.text.TranslationArgument; 5 | import net.kyori.adventure.text.event.ClickEvent; 6 | import net.kyori.adventure.text.feature.pagination.Pagination; 7 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 8 | import net.onelitefeather.antiredstoneclockremastered.model.RedstoneClock; 9 | import org.bukkit.command.CommandSender; 10 | import org.bukkit.entity.Player; 11 | import org.incendo.cloud.annotation.specifier.Greedy; 12 | import org.incendo.cloud.annotations.Argument; 13 | import org.incendo.cloud.annotations.Command; 14 | import org.incendo.cloud.annotations.CommandDescription; 15 | import org.incendo.cloud.annotations.Permission; 16 | import org.jetbrains.annotations.NotNull; 17 | import org.jetbrains.annotations.Nullable; 18 | 19 | import java.util.Collection; 20 | import java.util.List; 21 | 22 | public final class DisplayActiveClocksCommand implements Pagination.Renderer.RowRenderer { 23 | 24 | private final AntiRedstoneClockRemastered plugin; 25 | 26 | private final Pagination.Builder pagination = Pagination.builder().resultsPerPage(4); 27 | 28 | public DisplayActiveClocksCommand(AntiRedstoneClockRemastered plugin) { 29 | this.plugin = plugin; 30 | } 31 | 32 | @Command("arcm display [page]") 33 | @CommandDescription("antiredstoneclockremastered.command.display.description") 34 | @Permission("antiredstoneclockremastered.command.display") 35 | public void displayClocks(CommandSender commandSender, @Greedy @Argument("page") Integer page) { 36 | Pagination build = pagination.build( 37 | AntiRedstoneClockRemastered.PREFIX, 38 | this, 39 | this::mapToCommand); 40 | if (page == null) { 41 | page = 0; 42 | } 43 | build.render(this.plugin.getRedstoneClockService().getRedstoneClocks(), Math.max(1, page)) 44 | .forEach(commandSender::sendMessage); 45 | 46 | } 47 | 48 | private String mapToCommand(int i) { 49 | return "/arcm display " + i; 50 | } 51 | 52 | private Component mapClockToMessage(RedstoneClock redstoneClock) { 53 | var location = redstoneClock.getLocation(); 54 | return Component.empty().hoverEvent(Component.translatable("antiredstoneclockremastered.command.display.clock.hover").asHoverEvent()).append( 55 | Component.translatable("antiredstoneclockremastered.command.display.clock.text") 56 | .arguments( 57 | TranslationArgument.numeric(redstoneClock.getTriggerCount()), 58 | TranslationArgument.numeric(location.getBlockX()), 59 | TranslationArgument.numeric(location.getBlockY()), 60 | TranslationArgument.numeric(location.getBlockZ()), 61 | Component.empty() 62 | .clickEvent(ClickEvent.callback(audience -> { 63 | if (audience instanceof final Player executor) { 64 | executor.teleport(location); 65 | } 66 | })) 67 | ) 68 | ); 69 | } 70 | 71 | @Override 72 | public @NotNull Collection renderRow(@Nullable RedstoneClock redstoneClock, int index) { 73 | return List.of(mapClockToMessage(redstoneClock)); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/commands/FeatureCommand.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.commands; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import net.kyori.adventure.text.TranslationArgument; 5 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 6 | import org.bukkit.World; 7 | import org.bukkit.command.CommandSender; 8 | import org.incendo.cloud.annotations.Argument; 9 | import org.incendo.cloud.annotations.Command; 10 | import org.incendo.cloud.annotations.CommandDescription; 11 | import org.incendo.cloud.annotations.Permission; 12 | 13 | import java.util.List; 14 | 15 | @Command("arcm feature") 16 | public final class FeatureCommand { 17 | 18 | private final AntiRedstoneClockRemastered plugin; 19 | 20 | public FeatureCommand(AntiRedstoneClockRemastered plugin) { 21 | this.plugin = plugin; 22 | } 23 | 24 | @Command("check observer") 25 | @CommandDescription("antiredstoneclockremastered.command.feature.check.toggle.observer.description") 26 | @Permission("antiredstoneclockremastered.command.feature.check.observer") 27 | public void toggleObserver(CommandSender sender) { 28 | plugin.getConfig().set("check.observer", !plugin.getConfig().getBoolean("check.observer")); 29 | plugin.saveConfig(); 30 | plugin.getRedstoneClockService().reload(); 31 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("check.observer")); 32 | } 33 | 34 | @Command("check piston") 35 | @CommandDescription("antiredstoneclockremastered.command.feature.check.toggle.piston.description") 36 | @Permission("antiredstoneclockremastered.command.feature.check.piston") 37 | public void togglePiston(CommandSender sender) { 38 | plugin.getConfig().set("check.piston", !plugin.getConfig().getBoolean("check.piston")); 39 | plugin.saveConfig(); 40 | plugin.getRedstoneClockService().reload(); 41 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("check.piston")); 42 | } 43 | 44 | @Command("check comparator") 45 | @CommandDescription("antiredstoneclockremastered.command.feature.check.toggle.comparator.description") 46 | @Permission("antiredstoneclockremastered.command.feature.check.comparator") 47 | public void toggleComparator(CommandSender sender) { 48 | plugin.getConfig().set("check.comparator", !plugin.getConfig().getBoolean("check.comparator")); 49 | plugin.saveConfig(); 50 | plugin.getRedstoneClockService().reload(); 51 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("check.comparator")); 52 | } 53 | 54 | @Command("check sculk") 55 | @CommandDescription("antiredstoneclockremastered.command.feature.check.toggle.sculk.description") 56 | @Permission("antiredstoneclockremastered.command.feature.check.sculk") 57 | public void toggleSculk(CommandSender sender) { 58 | plugin.getConfig().set("check.sculk", !plugin.getConfig().getBoolean("check.sculk")); 59 | plugin.saveConfig(); 60 | plugin.getRedstoneClockService().reload(); 61 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("check.sculk")); 62 | } 63 | 64 | @Command("check redstone_and_repeater") 65 | @CommandDescription("antiredstoneclockremastered.command.feature.check.toggle.redstone_and_repeater.description") 66 | @Permission("antiredstoneclockremastered.command.feature.check.redstone_and_repeater") 67 | public void toggleRedstoneAndRepeater(CommandSender sender) { 68 | plugin.getConfig().set("check.redstoneAndRepeater", !plugin.getConfig().getBoolean("check.redstoneAndRepeater")); 69 | plugin.saveConfig(); 70 | plugin.getRedstoneClockService().reload(); 71 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("check.redstoneAndRepeater")); 72 | } 73 | 74 | private void sendMessageToggleMessage(CommandSender sender, boolean value) { 75 | if (value) { 76 | sender.sendMessage(Component.translatable("antiredstoneclockremastered.command.feature.check.toggle.enabled").arguments(AntiRedstoneClockRemastered.PREFIX)); 77 | } else { 78 | sender.sendMessage(Component.translatable("antiredstoneclockremastered.command.feature.check.toggle.disabled").arguments(AntiRedstoneClockRemastered.PREFIX)); 79 | } 80 | } 81 | 82 | @Command("check ignored_worlds add ") 83 | @CommandDescription("antiredstoneclockremastered.command.feature.check.world.add.description") 84 | @Permission("antiredstoneclockremastered.command.feature.check.world.add") 85 | public void addIgnoredWorld(CommandSender sender, @Argument("world") World world) { 86 | List worlds = plugin.getConfig().getStringList("check.ignoredWorlds"); 87 | worlds.add(world.getName()); 88 | plugin.getConfig().set("check.ignoredWorlds", worlds); 89 | plugin.saveConfig(); 90 | plugin.getRedstoneClockService().reload(); 91 | sender.sendMessage(Component.translatable("antiredstoneclockremastered.command.feature.check.world.add").arguments(AntiRedstoneClockRemastered.PREFIX, Component.text(world.getName()))); 92 | } 93 | 94 | @Command("check ignored_worlds remove ") 95 | @CommandDescription("antiredstoneclockremastered.command.feature.check.world.remove.description") 96 | @Permission("antiredstoneclockremastered.command.feature.check.world.remove") 97 | public void removeIgnoredWorld(CommandSender sender, @Argument("world") World world) { 98 | List worlds = plugin.getConfig().getStringList("check.ignoredWorlds"); 99 | worlds.remove(world.getName()); 100 | plugin.getConfig().set("check.ignoredWorlds", worlds); 101 | plugin.saveConfig(); 102 | plugin.getRedstoneClockService().reload(); 103 | sender.sendMessage(Component.translatable("antiredstoneclockremastered.command.feature.check.world.remove").arguments(AntiRedstoneClockRemastered.PREFIX, Component.text(world.getName()))); 104 | } 105 | 106 | @Command("check ignored_regions add ") 107 | @CommandDescription("antiredstoneclockremastered.command.feature.check.region.add.description") 108 | @Permission("antiredstoneclockremastered.command.feature.check.region.add") 109 | public void addIgnoredRegion(CommandSender sender, @Argument("region") String region) { 110 | List regions = plugin.getConfig().getStringList("check.ignoredRegions"); 111 | regions.add(region); 112 | plugin.getConfig().set("check.ignoredRegions", regions); 113 | plugin.saveConfig(); 114 | plugin.getRedstoneClockService().reload(); 115 | sender.sendMessage(Component.translatable("antiredstoneclockremastered.command.feature.check.region.add").arguments(AntiRedstoneClockRemastered.PREFIX, Component.text(region))); 116 | } 117 | 118 | @Command("check ignored_regions remove ") 119 | @CommandDescription("antiredstoneclockremastered.command.feature.check.region.remove.description") 120 | @Permission("antiredstoneclockremastered.command.feature.check.region.remove") 121 | public void removeIgnoredRegion(CommandSender sender, @Argument("region") String region) { 122 | List regions = plugin.getConfig().getStringList("check.ignoredRegions"); 123 | regions.remove(region); 124 | plugin.getConfig().set("check.ignoredRegions", regions); 125 | plugin.saveConfig(); 126 | plugin.getRedstoneClockService().reload(); 127 | sender.sendMessage(Component.translatable("antiredstoneclockremastered.command.feature.check.region.remove").arguments(AntiRedstoneClockRemastered.PREFIX, Component.text(region))); 128 | } 129 | 130 | @Command("clock autoBreak") 131 | @CommandDescription("antiredstoneclockremastered.command.feature.clock.toggle.autoBreak.description") 132 | @Permission("antiredstoneclockremastered.command.feature.clock.autoBreak") 133 | public void toggleAutoBreak(CommandSender sender) { 134 | plugin.getConfig().set("clock.autoBreak", !plugin.getConfig().getBoolean("clock.autoBreak")); 135 | plugin.saveConfig(); 136 | plugin.getRedstoneClockService().reload(); 137 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("clock.autoBreak")); 138 | } 139 | 140 | @Command("clock notify_admins") 141 | @CommandDescription("antiredstoneclockremastered.command.feature.clock.toggle.notifyAdmins.description") 142 | @Permission("antiredstoneclockremastered.command.feature.clock.notifyAdmins") 143 | public void toggleNotifyAdmins(CommandSender sender) { 144 | plugin.getConfig().set("clock.notifyAdmins", !plugin.getConfig().getBoolean("clock.notifyAdmins")); 145 | plugin.saveConfig(); 146 | plugin.getRedstoneClockService().reload(); 147 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("clock.notifyAdmins")); 148 | } 149 | 150 | @Command("clock notify_console") 151 | @CommandDescription("antiredstoneclockremastered.command.feature.clock.toggle.notifyConsole.description") 152 | @Permission("antiredstoneclockremastered.command.feature.clock.notifyConsole") 153 | public void toggleNotifyConsole(CommandSender sender) { 154 | plugin.getConfig().set("clock.notifyConsole", !plugin.getConfig().getBoolean("clock.notifyConsole")); 155 | plugin.saveConfig(); 156 | plugin.getRedstoneClockService().reload(); 157 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("clock.notifyConsole")); 158 | } 159 | 160 | @Command("clock drop") 161 | @CommandDescription("antiredstoneclockremastered.command.feature.clock.toggle.drop.description") 162 | @Permission("antiredstoneclockremastered.command.feature.clock.drop") 163 | public void toggleDrop(CommandSender sender) { 164 | plugin.getConfig().set("clock.drop", !plugin.getConfig().getBoolean("clock.drop")); 165 | plugin.saveConfig(); 166 | plugin.getRedstoneClockService().reload(); 167 | sendMessageToggleMessage(sender, plugin.getConfig().getBoolean("clock.drop")); 168 | } 169 | 170 | @Command("clock endDelay ") 171 | @CommandDescription("antiredstoneclockremastered.command.feature.clock.set.delay.description") 172 | @Permission("antiredstoneclockremastered.command.feature.clock.enddelay") 173 | public void setEndDelay(CommandSender sender,@Argument("delay") Integer endDeplay) { 174 | plugin.getConfig().set("clock.endDelay", endDeplay); 175 | plugin.saveConfig(); 176 | plugin.getRedstoneClockService().reload(); 177 | sendMessageSetMessage(sender, plugin.getConfig().getInt("clock.endDelay")); 178 | } 179 | 180 | @Command("clock maxCount ") 181 | @CommandDescription("antiredstoneclockremastered.command.feature.clock.set.maxCount.description") 182 | @Permission("antiredstoneclockremastered.command.feature.clock.maxCount") 183 | public void setMaxCount(CommandSender sender,@Argument("count") Integer count) { 184 | plugin.getConfig().set("clock.maxCount", count); 185 | plugin.saveConfig(); 186 | plugin.getRedstoneClockService().reload(); 187 | sendMessageSetMessage(sender, plugin.getConfig().getInt("clock.maxCount")); 188 | } 189 | 190 | private void sendMessageSetMessage(CommandSender sender, Integer value) { 191 | sender.sendMessage(Component.translatable("antiredstoneclockremastered.command.feature.clock.set").arguments(AntiRedstoneClockRemastered.PREFIX, TranslationArgument.numeric(value))); 192 | } 193 | 194 | } 195 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/commands/ReloadCommand.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.commands; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 5 | import org.bukkit.command.CommandSender; 6 | import org.incendo.cloud.annotations.Command; 7 | import org.incendo.cloud.annotations.CommandDescription; 8 | import org.incendo.cloud.annotations.Permission; 9 | 10 | public final class ReloadCommand { 11 | 12 | private final AntiRedstoneClockRemastered plugin; 13 | 14 | public ReloadCommand(AntiRedstoneClockRemastered plugin) { 15 | this.plugin = plugin; 16 | } 17 | 18 | @Command("arcm reload") 19 | @CommandDescription("antiredstoneclockremastered.command.reload.description") 20 | @Permission("antiredstoneclockremastered.command.reload") 21 | public void reloadConfig(CommandSender commandSender) { 22 | this.plugin.getRedstoneClockService().reload(); 23 | commandSender.sendMessage(Component.translatable("antiredstoneclockremastered.command.reload.success").arguments(AntiRedstoneClockRemastered.PREFIX)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/listener/ComparatorListener.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.listener; 2 | 3 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 4 | import org.bukkit.Material; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.EventPriority; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.block.BlockRedstoneEvent; 9 | 10 | public final class ComparatorListener implements Listener { 11 | private final Material comparatorMaterial; 12 | private final AntiRedstoneClockRemastered antiRedstoneClockRemastered; 13 | 14 | public ComparatorListener(Material comparatorMaterial, AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 15 | this.comparatorMaterial = comparatorMaterial; 16 | this.antiRedstoneClockRemastered = antiRedstoneClockRemastered; 17 | } 18 | 19 | @EventHandler(priority = EventPriority.LOWEST) 20 | private void onRedstoneComparatorClock(BlockRedstoneEvent blockRedstoneEvent) { 21 | 22 | if (!this.antiRedstoneClockRemastered.getTps().isTpsOk()) return; 23 | if (!this.antiRedstoneClockRemastered.getConfig().getBoolean("check.comparator")) return; 24 | 25 | var block = blockRedstoneEvent.getBlock(); 26 | var type = block.getType(); 27 | if (type != comparatorMaterial) return; 28 | 29 | if (blockRedstoneEvent.getOldCurrent() != 0) return; 30 | 31 | this.antiRedstoneClockRemastered.getRedstoneClockService().checkAndUpdateClockState(block); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/listener/ObserverListener.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.listener; 2 | 3 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 4 | import org.bukkit.Material; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.EventPriority; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.block.BlockRedstoneEvent; 9 | 10 | public final class ObserverListener implements Listener { 11 | private final Material material; 12 | private final AntiRedstoneClockRemastered antiRedstoneClockRemastered; 13 | 14 | public ObserverListener(AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 15 | this.material = Material.OBSERVER; 16 | this.antiRedstoneClockRemastered = antiRedstoneClockRemastered; 17 | } 18 | 19 | @EventHandler(priority = EventPriority.LOWEST) 20 | private void onRedstoneObserverClock(BlockRedstoneEvent blockRedstoneEvent) { 21 | 22 | if (!this.antiRedstoneClockRemastered.getTps().isTpsOk()) return; 23 | if (!this.antiRedstoneClockRemastered.getConfig().getBoolean("check.observer")) return; 24 | 25 | var block = blockRedstoneEvent.getBlock(); 26 | var type = block.getType(); 27 | if (type != material) return; 28 | 29 | if (blockRedstoneEvent.getOldCurrent() != 0) return; 30 | 31 | this.antiRedstoneClockRemastered.getRedstoneClockService().checkAndUpdateClockStateWithActive(block); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/listener/PistonListener.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.listener; 2 | 3 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 4 | import org.bukkit.Material; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.EventPriority; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.block.BlockPistonExtendEvent; 9 | import org.bukkit.event.block.BlockPistonRetractEvent; 10 | import org.bukkit.event.block.BlockRedstoneEvent; 11 | 12 | public final class PistonListener implements Listener { 13 | private final AntiRedstoneClockRemastered antiRedstoneClockRemastered; 14 | 15 | public PistonListener(AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 16 | this.antiRedstoneClockRemastered = antiRedstoneClockRemastered; 17 | } 18 | 19 | @EventHandler(priority = EventPriority.LOWEST) 20 | private void onPistonExtendEvent(BlockPistonExtendEvent blockPistonExtendEvent) { 21 | 22 | if (!this.antiRedstoneClockRemastered.getTps().isTpsOk()) return; 23 | if (!this.antiRedstoneClockRemastered.getConfig().getBoolean("check.piston")) return; 24 | 25 | var block = blockPistonExtendEvent.getBlock(); 26 | 27 | this.antiRedstoneClockRemastered.getRedstoneClockService().checkAndUpdateClockStateWithActiveManual(block, false); 28 | } 29 | 30 | @EventHandler(priority = EventPriority.LOWEST) 31 | private void onPistonRetractEvent(BlockPistonRetractEvent blockPistonExtendEvent) { 32 | if (!this.antiRedstoneClockRemastered.getTps().isTpsOk()) return; 33 | if (!this.antiRedstoneClockRemastered.getConfig().getBoolean("check.piston")) return; 34 | 35 | var block = blockPistonExtendEvent.getBlock(); 36 | 37 | this.antiRedstoneClockRemastered.getRedstoneClockService().checkAndUpdateClockStateWithActiveManual(block, true); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/listener/PlayerListener.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.listener; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 5 | import net.onelitefeather.antiredstoneclockremastered.service.RedstoneClockService; 6 | import net.onelitefeather.antiredstoneclockremastered.utils.Constants; 7 | import org.bukkit.block.BlockFace; 8 | import org.bukkit.event.EventHandler; 9 | import org.bukkit.event.EventPriority; 10 | import org.bukkit.event.Listener; 11 | import org.bukkit.event.block.BlockBreakEvent; 12 | import org.bukkit.event.player.PlayerJoinEvent; 13 | 14 | public final class PlayerListener implements Listener { 15 | 16 | private final RedstoneClockService redstoneClockService; 17 | private final AntiRedstoneClockRemastered antiRedstoneClockRemastered; 18 | 19 | public PlayerListener(RedstoneClockService redstoneClockService, AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 20 | this.redstoneClockService = redstoneClockService; 21 | this.antiRedstoneClockRemastered = antiRedstoneClockRemastered; 22 | } 23 | 24 | @EventHandler 25 | private void onPlayerJoinEvent(PlayerJoinEvent playerJoinEvent) { 26 | var player = playerJoinEvent.getPlayer(); 27 | if (player.isOp() || (player.hasPermission(Constants.PERMISSION_NOTIFY) && !player.hasPermission(Constants.DISABLE_DONATION_NOTIFY))) { 28 | player.sendMessage(Component.translatable("antiredstoneclockremastered.notify.donation.player").arguments(AntiRedstoneClockRemastered.PREFIX)); 29 | } 30 | if (player.isOp() || player.hasPermission(Constants.PERMISSION_NOTIFY_UPDATE)) { 31 | this.antiRedstoneClockRemastered.getUpdateService().notifyPlayer(player); 32 | } 33 | } 34 | 35 | @EventHandler(priority = EventPriority.HIGHEST) 36 | private void onBlockBreak(BlockBreakEvent blockBreakEvent) { 37 | var block = blockBreakEvent.getBlock(); 38 | recheck: 39 | if (Constants.REDSTONE_ITEMS.contains(block.getType())) { 40 | this.redstoneClockService.removeClockByLocation(block.getLocation()); 41 | } else { 42 | block = block.getRelative(BlockFace.UP); 43 | break recheck; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/listener/RedstoneListener.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.listener; 2 | 3 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 4 | import org.bukkit.Material; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.EventPriority; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.block.BlockRedstoneEvent; 9 | 10 | public final class RedstoneListener implements Listener { 11 | private final Material reperaterMaterial; 12 | private final AntiRedstoneClockRemastered antiRedstoneClockRemastered; 13 | 14 | public RedstoneListener(Material reperaterMaterial, AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 15 | this.reperaterMaterial = reperaterMaterial; 16 | this.antiRedstoneClockRemastered = antiRedstoneClockRemastered; 17 | } 18 | 19 | @EventHandler(priority = EventPriority.LOWEST) 20 | private void onRedstoneClock(BlockRedstoneEvent blockRedstoneEvent) { 21 | 22 | if (!this.antiRedstoneClockRemastered.getTps().isTpsOk()) return; 23 | if (!this.antiRedstoneClockRemastered.getConfig().getBoolean("check.redstoneAndRepeater")) return; 24 | 25 | var block = blockRedstoneEvent.getBlock(); 26 | var type = block.getType(); 27 | if (type != Material.REDSTONE_WIRE && type != reperaterMaterial) return; 28 | 29 | if (blockRedstoneEvent.getOldCurrent() != 0) return; 30 | 31 | this.antiRedstoneClockRemastered.getRedstoneClockService().checkAndUpdateClockState(block); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/listener/SculkListener.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.listener; 2 | 3 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 4 | import org.bukkit.event.EventHandler; 5 | import org.bukkit.event.EventPriority; 6 | import org.bukkit.event.Listener; 7 | import org.bukkit.event.block.BlockReceiveGameEvent; 8 | 9 | public final class SculkListener implements Listener { 10 | 11 | private final AntiRedstoneClockRemastered antiRedstoneClockRemastered; 12 | 13 | public SculkListener(AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 14 | this.antiRedstoneClockRemastered = antiRedstoneClockRemastered; 15 | } 16 | 17 | @EventHandler(priority = EventPriority.LOWEST) 18 | private void onBlockReceiveGameEvent(BlockReceiveGameEvent event) { 19 | if (!this.antiRedstoneClockRemastered.getTps().isTpsOk()) return; 20 | if (!this.antiRedstoneClockRemastered.getConfig().getBoolean("check.sculk")) return; 21 | var block = event.getBlock(); 22 | this.antiRedstoneClockRemastered.getRedstoneClockService().checkAndUpdateClockState(block); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/model/RedstoneClock.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.model; 2 | 3 | import org.bukkit.Location; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public final class RedstoneClock { 7 | 8 | /** 9 | * How often the clocks gets triggered 10 | */ 11 | private int triggerCount = 0; 12 | 13 | /** 14 | * Shows if the piston/observer extended/enabled 15 | */ 16 | private boolean active; 17 | private boolean detected; 18 | 19 | /** 20 | * Where's the clock located 21 | */ 22 | private final @NotNull Location location; 23 | private final long endTime; 24 | 25 | public RedstoneClock(@NotNull Location location, long endTime) { 26 | this.location = location; 27 | this.endTime = endTime; 28 | } 29 | 30 | public void incrementTriggerCount() { 31 | this.triggerCount++; 32 | } 33 | 34 | public int getTriggerCount() { 35 | return triggerCount; 36 | } 37 | 38 | public void setActive(boolean active) { 39 | this.active = active; 40 | } 41 | 42 | public boolean isActive() { 43 | return active; 44 | } 45 | 46 | public boolean isDetected() { 47 | return detected; 48 | } 49 | 50 | public void setDetected(boolean detected) { 51 | this.detected = detected; 52 | } 53 | 54 | public boolean isTimeOut() { 55 | return (System.currentTimeMillis() / 1000) >= endTime; 56 | } 57 | 58 | @NotNull 59 | public Location getLocation() { 60 | return location; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/service/RedstoneClockService.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.service; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import net.kyori.adventure.text.event.ClickEvent; 5 | import net.kyori.adventure.text.minimessage.MiniMessage; 6 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 7 | import net.onelitefeather.antiredstoneclockremastered.model.RedstoneClock; 8 | import net.onelitefeather.antiredstoneclockremastered.utils.Constants; 9 | import org.bukkit.Bukkit; 10 | import org.bukkit.Location; 11 | import org.bukkit.Material; 12 | import org.bukkit.block.Block; 13 | import org.bukkit.enchantments.Enchantment; 14 | import org.bukkit.entity.Player; 15 | import org.bukkit.inventory.ItemStack; 16 | import org.jetbrains.annotations.NotNull; 17 | import org.jetbrains.annotations.Nullable; 18 | 19 | import java.util.Collection; 20 | import java.util.Collections; 21 | import java.util.List; 22 | import java.util.Map; 23 | import java.util.concurrent.ConcurrentHashMap; 24 | import java.util.logging.Level; 25 | 26 | public final class RedstoneClockService { 27 | 28 | private final @NotNull AntiRedstoneClockRemastered antiRedstoneClockRemastered; 29 | private int endTimeDelay; 30 | private int maxClockCount; 31 | private boolean autoBreakBlock; 32 | private boolean notifyAdmins; 33 | private boolean notifyConsole; 34 | private boolean dropItems; 35 | private List ignoredWorlds; 36 | 37 | private final ConcurrentHashMap activeClockTesters = new ConcurrentHashMap<>(); 38 | private final ItemStack SILK_TOUCH_PICKAXE = new ItemStack(Material.DIAMOND_PICKAXE); 39 | 40 | public RedstoneClockService(@NotNull AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 41 | this.antiRedstoneClockRemastered = antiRedstoneClockRemastered; 42 | this.endTimeDelay = antiRedstoneClockRemastered.getConfig().getInt("clock.endDelay", 300); 43 | this.maxClockCount = antiRedstoneClockRemastered.getConfig().getInt("clock.maxCount", 150); 44 | this.autoBreakBlock = antiRedstoneClockRemastered.getConfig().getBoolean("clock.autoBreak", true); 45 | this.notifyAdmins = antiRedstoneClockRemastered.getConfig().getBoolean("clock.notifyAdmins", true); 46 | this.notifyConsole = antiRedstoneClockRemastered.getConfig().getBoolean("clock.notifyConsole", true); 47 | this.dropItems = antiRedstoneClockRemastered.getConfig().getBoolean("clock.drop", false); 48 | this.ignoredWorlds = antiRedstoneClockRemastered.getConfig().getStringList("check.ignoredWorlds"); 49 | SILK_TOUCH_PICKAXE.addEnchantment(Enchantment.SILK_TOUCH, 1); 50 | } 51 | 52 | public void checkAndUpdateClockStateWithActiveManual(@NotNull Location location, boolean state) { 53 | if (this.ignoredWorlds.contains(location.getWorld().getName())) return; 54 | if (this.antiRedstoneClockRemastered.getWorldGuardSupport() != null && this.antiRedstoneClockRemastered.getWorldGuardSupport().isRegionAllowed(location)) 55 | return; 56 | if (this.antiRedstoneClockRemastered.getPlotsquaredSupport() != null && this.antiRedstoneClockRemastered.getPlotsquaredSupport().isAllowedPlot(location)) 57 | return; 58 | var clock = getClockByLocation(location); 59 | if (clock != null) { 60 | if (clock.isActive()) { 61 | if (clock.isTimeOut()) { 62 | removeClockByClock(clock); 63 | return; 64 | } 65 | if (clock.getTriggerCount() >= this.maxClockCount) { 66 | destroyRedstoneClock(location, clock); 67 | return; 68 | } 69 | clock.incrementTriggerCount(); 70 | clock.setActive(false); 71 | return; 72 | } else { 73 | clock.setActive(state); 74 | } 75 | } 76 | addRedstoneClockTest(location); 77 | } 78 | 79 | public void checkAndUpdateClockStateWithActiveManual(@NotNull Block block, boolean state) { 80 | checkAndUpdateClockStateWithActiveManual(block.getLocation(), state); 81 | } 82 | 83 | public void checkAndUpdateClockStateWithActive(@NotNull Block block) { 84 | checkAndUpdateClockStateWithActive(block.getLocation()); 85 | } 86 | 87 | public void checkAndUpdateClockStateWithActive(@NotNull Location location) { 88 | if (this.ignoredWorlds.contains(location.getWorld().getName())) return; 89 | if (this.antiRedstoneClockRemastered.getWorldGuardSupport() != null && this.antiRedstoneClockRemastered.getWorldGuardSupport().isRegionAllowed(location)) 90 | return; 91 | if (this.antiRedstoneClockRemastered.getPlotsquaredSupport() != null && this.antiRedstoneClockRemastered.getPlotsquaredSupport().isAllowedPlot(location)) 92 | return; 93 | var clock = getClockByLocation(location); 94 | if (clock != null) { 95 | if (clock.isActive()) { 96 | if (clock.isTimeOut()) { 97 | removeClockByClock(clock); 98 | return; 99 | } 100 | if (clock.getTriggerCount() >= this.maxClockCount) { 101 | destroyRedstoneClock(location, clock); 102 | return; 103 | } 104 | clock.incrementTriggerCount(); 105 | clock.setActive(false); 106 | return; 107 | } else { 108 | clock.setActive(true); 109 | } 110 | } 111 | addRedstoneClockTest(location); 112 | } 113 | 114 | public void checkAndUpdateClockState(@NotNull Block block) { 115 | checkAndUpdateClockState(block.getLocation()); 116 | } 117 | 118 | public void checkAndUpdateClockState(@NotNull Location location) { 119 | if (this.ignoredWorlds.contains(location.getWorld().getName())) return; 120 | if (this.antiRedstoneClockRemastered.getWorldGuardSupport() != null && this.antiRedstoneClockRemastered.getWorldGuardSupport().isRegionAllowed(location)) 121 | return; 122 | if (this.antiRedstoneClockRemastered.getPlotsquaredSupport() != null && this.antiRedstoneClockRemastered.getPlotsquaredSupport().isAllowedPlot(location)) 123 | return; 124 | var clock = getClockByLocation(location); 125 | if (clock != null) { 126 | if (clock.isTimeOut()) { 127 | removeClockByClock(clock); 128 | return; 129 | } 130 | if (clock.getTriggerCount() >= this.maxClockCount) { 131 | destroyRedstoneClock(location, clock); 132 | return; 133 | } 134 | clock.incrementTriggerCount(); 135 | return; 136 | } 137 | addRedstoneClockTest(location); 138 | } 139 | 140 | private void destroyRedstoneClock(@NotNull Location location, @NotNull RedstoneClock clock) { 141 | if (this.autoBreakBlock) breakBlock(location); 142 | if (!clock.isDetected()) { 143 | clock.setDetected(true); 144 | if (this.notifyConsole) { 145 | this.antiRedstoneClockRemastered.getLogger().log(Level.WARNING, "Redstone Clock detected at: X,Y,Z({0},{1},{2})", new Object[]{location.getBlockX(), location.getBlockY(), location.getBlockZ()}); 146 | } 147 | if (this.notifyAdmins) { 148 | for (final Player player : Bukkit.getOnlinePlayers()) { 149 | if (player.isOp() || player.hasPermission(Constants.PERMISSION_NOTIFY)) { 150 | sendNotification(player, location); 151 | } 152 | } 153 | } 154 | 155 | } 156 | removeClockByClock(clock); 157 | } 158 | 159 | private void sendNotification(final Player player, final Location location) { 160 | final var component = Component.translatable("service.notify.detected.clock") 161 | .arguments(AntiRedstoneClockRemastered.PREFIX, 162 | Component.text(location.getBlockX()), 163 | Component.text(location.getBlockY()), 164 | Component.text(location.getBlockZ()), 165 | Component.empty().clickEvent(ClickEvent.callback(audience -> { 166 | if (audience instanceof final Player executor) { 167 | executor.teleport(location); 168 | } 169 | }))); 170 | player.sendMessage(component); 171 | } 172 | 173 | private void breakBlock(@NotNull Location location) { 174 | Block block = location.getBlock(); 175 | if (this.dropItems) { 176 | var drops = block.getDrops(SILK_TOUCH_PICKAXE); 177 | drops.forEach(itemStack -> block.getWorld().dropItem(location, itemStack)); 178 | } 179 | Runnable removeTask = () -> block.setType(Material.AIR, true); 180 | Bukkit.getScheduler().runTaskLater(antiRedstoneClockRemastered, removeTask, 1); 181 | 182 | } 183 | 184 | public void addRedstoneClockTest(@NotNull Location location) { 185 | this.activeClockTesters.putIfAbsent(location, new RedstoneClock(location, (System.currentTimeMillis() / 1000) + endTimeDelay)); 186 | } 187 | 188 | public void reload() { 189 | this.antiRedstoneClockRemastered.reloadConfig(); 190 | this.endTimeDelay = antiRedstoneClockRemastered.getConfig().getInt("clock.endDelay", 300); 191 | this.maxClockCount = antiRedstoneClockRemastered.getConfig().getInt("clock.maxCount", 150); 192 | this.autoBreakBlock = antiRedstoneClockRemastered.getConfig().getBoolean("clock.autoBreak", true); 193 | this.notifyAdmins = antiRedstoneClockRemastered.getConfig().getBoolean("clock.notifyAdmins", true); 194 | this.notifyConsole = antiRedstoneClockRemastered.getConfig().getBoolean("clock.notifyConsole", true); 195 | this.dropItems = antiRedstoneClockRemastered.getConfig().getBoolean("clock.drop", false); 196 | this.ignoredWorlds = antiRedstoneClockRemastered.getConfig().getStringList("check.ignoredWorlds"); 197 | } 198 | 199 | public void removeClockByLocation(@NotNull Location location) { 200 | this.activeClockTesters.remove(location); 201 | } 202 | 203 | public void removeClockByClock(@NotNull RedstoneClock redstoneClock) { 204 | removeClockByLocation(redstoneClock.getLocation()); 205 | } 206 | 207 | public boolean containsLocation(@NotNull Location location) { 208 | return this.activeClockTesters.containsKey(location); 209 | } 210 | 211 | @Nullable 212 | public RedstoneClock getClockByLocation(@NotNull Location location) { 213 | return this.activeClockTesters.get(location); 214 | } 215 | 216 | @NotNull 217 | public Collection getRedstoneClocks() { 218 | return Collections.unmodifiableCollection(this.activeClockTesters.values()); 219 | } 220 | 221 | @NotNull 222 | public Collection getRedstoneClockLocations() { 223 | return Collections.unmodifiableCollection(this.activeClockTesters.keySet()); 224 | } 225 | 226 | @NotNull 227 | public Map getActiveTester() { 228 | return Map.copyOf(this.activeClockTesters); 229 | } 230 | 231 | } 232 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/service/UpdateService.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.service; 2 | 3 | import com.github.zafarkhaja.semver.Version; 4 | import net.kyori.adventure.text.Component; 5 | import net.kyori.adventure.text.logger.slf4j.ComponentLogger; 6 | import net.onelitefeather.antiredstoneclockremastered.AntiRedstoneClockRemastered; 7 | import net.onelitefeather.antiredstoneclockremastered.utils.Constants; 8 | import org.bukkit.Bukkit; 9 | import org.bukkit.entity.Player; 10 | import org.bukkit.scheduler.BukkitTask; 11 | import org.jetbrains.annotations.Nullable; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | 15 | import java.io.IOException; 16 | import java.net.http.HttpClient; 17 | import java.net.http.HttpResponse; 18 | 19 | public final class UpdateService implements Runnable { 20 | private final HttpClient hangarClient = HttpClient.newBuilder().build(); 21 | private static final Logger LOGGER = LoggerFactory.getLogger(UpdateService.class); 22 | private final Version localVersion; 23 | private Version remoteVersion; 24 | private final BukkitTask scheduler; 25 | private final String DOWNLOAD_URL = "https://hangar.papermc.io/OneLiteFeather/AntiRedstoneClock-Remastered/versions/%s"; 26 | 27 | public UpdateService(AntiRedstoneClockRemastered antiRedstoneClockRemastered) { 28 | this.localVersion = Version.parse(antiRedstoneClockRemastered.getPluginMeta().getVersion()); 29 | this.scheduler = Bukkit.getScheduler().runTaskTimerAsynchronously(antiRedstoneClockRemastered, this, 0, 20 * 60 * 60 * 3); 30 | } 31 | 32 | 33 | @Override 34 | public void run() { 35 | var remoteVersion = getNewerVersion(); 36 | if (remoteVersion != null) { 37 | this.remoteVersion = remoteVersion; 38 | for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { 39 | if (onlinePlayer.isOp() || onlinePlayer.hasPermission(Constants.PERMISSION_NOTIFY_UPDATE)) { 40 | notifyPlayer(localVersion, remoteVersion, onlinePlayer); 41 | } 42 | } 43 | } 44 | } 45 | 46 | public void notifyConsole(ComponentLogger logger) { 47 | if (this.remoteVersion != null && this.remoteVersion.isHigherThan(this.localVersion)) { 48 | logger.warn(Component.translatable("antiredstoneclockremastered.notify.update.console") 49 | .arguments(Component.text(localVersion.toString()), 50 | Component.text(remoteVersion.toString()), 51 | Component.text(DOWNLOAD_URL.formatted(remoteVersion.toString())) 52 | )); 53 | } 54 | } 55 | 56 | 57 | public void notifyPlayer(Player player) { 58 | if (this.remoteVersion != null && this.remoteVersion.isHigherThan(this.localVersion)) { 59 | notifyPlayer(this.localVersion, this.remoteVersion, player); 60 | } 61 | } 62 | 63 | 64 | private void notifyPlayer(Version localVersion, Version remoteVersion, Player player) { 65 | player.sendMessage(Component.translatable("antiredstoneclockremastered.notify.update.player") 66 | .arguments(AntiRedstoneClockRemastered.PREFIX, 67 | Component.text(localVersion.toString()), 68 | Component.text(remoteVersion.toString()) 69 | )); 70 | } 71 | 72 | 73 | @Nullable 74 | private Version getNewerVersion() { 75 | try { 76 | HttpResponse httpResponse = hangarClient.send(Constants.LATEST_RELEASE_VERSION_REQUEST, HttpResponse.BodyHandlers.ofString()); 77 | Version remoteVersion = Version.parse(httpResponse.body()); 78 | if (remoteVersion.isHigherThan(this.localVersion)) { 79 | return remoteVersion; 80 | } 81 | } catch (IOException | InterruptedException e) { 82 | LOGGER.error("Something went wrong to check updates", e); 83 | } 84 | return null; 85 | } 86 | 87 | public void shutdown() { 88 | this.hangarClient.shutdownNow(); 89 | this.scheduler.cancel(); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/translations/PluginTranslationRegistry.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.translations; 2 | 3 | import net.kyori.adventure.key.Key; 4 | import net.kyori.adventure.text.Component; 5 | import net.kyori.adventure.text.ComponentLike; 6 | import net.kyori.adventure.text.TranslatableComponent; 7 | import net.kyori.adventure.text.minimessage.Context; 8 | import net.kyori.adventure.text.minimessage.MiniMessage; 9 | import net.kyori.adventure.text.minimessage.ParsingException; 10 | import net.kyori.adventure.text.minimessage.tag.Tag; 11 | import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue; 12 | import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; 13 | import net.kyori.adventure.translation.TranslationRegistry; 14 | import org.jetbrains.annotations.NotNull; 15 | import org.jetbrains.annotations.Nullable; 16 | 17 | import java.text.MessageFormat; 18 | import java.util.List; 19 | import java.util.Locale; 20 | import java.util.Objects; 21 | 22 | public final class PluginTranslationRegistry implements TranslationRegistry { 23 | 24 | private final TranslationRegistry backedRegistry; 25 | 26 | public PluginTranslationRegistry(TranslationRegistry backedRegistry) { 27 | this.backedRegistry = backedRegistry; 28 | } 29 | 30 | @Override 31 | public boolean contains(@NotNull String key) { 32 | return backedRegistry.contains(key); 33 | } 34 | 35 | @Override 36 | public @NotNull Key name() { 37 | return backedRegistry.name(); 38 | } 39 | 40 | @Override 41 | public @Nullable MessageFormat translate(@NotNull String key, @NotNull Locale locale) { 42 | return null; 43 | } 44 | 45 | @Override 46 | public @Nullable Component translate( 47 | @NotNull TranslatableComponent component, 48 | @NotNull Locale locale 49 | ) { 50 | final MessageFormat translationFormat = backedRegistry.translate(component.key(), locale); 51 | 52 | if (translationFormat == null) { 53 | return null; 54 | } 55 | 56 | final String miniMessageString = translationFormat.toPattern(); 57 | 58 | final Component resultingComponent; 59 | 60 | if (component.arguments().isEmpty()) { 61 | resultingComponent = MiniMessage.miniMessage().deserialize(miniMessageString); 62 | } else { 63 | resultingComponent = MiniMessage.miniMessage().deserialize(miniMessageString, 64 | new ArgumentTag(component.arguments())); 65 | } 66 | 67 | if (component.children().isEmpty()) { 68 | return resultingComponent; 69 | } else { 70 | return resultingComponent.children(component.children()); 71 | } 72 | } 73 | 74 | @Override 75 | public void defaultLocale(@NotNull Locale locale) { 76 | backedRegistry.defaultLocale(locale); 77 | } 78 | 79 | @Override 80 | public void register(@NotNull String key, @NotNull Locale locale, @NotNull MessageFormat format) { 81 | backedRegistry.register(key, locale, format); 82 | } 83 | 84 | @Override 85 | public void unregister(@NotNull String key) { 86 | backedRegistry.unregister(key); 87 | } 88 | 89 | private static final class ArgumentTag implements TagResolver { 90 | private static final String NAME = "argument"; 91 | private static final String NAME_1 = "arg"; 92 | 93 | private final List argumentComponents; 94 | 95 | private ArgumentTag(final @NotNull List argumentComponents) { 96 | this.argumentComponents = Objects.requireNonNull(argumentComponents, "argumentComponents"); 97 | } 98 | 99 | @Override 100 | public Tag resolve( 101 | final @NotNull String name, 102 | final @NotNull ArgumentQueue arguments, 103 | final @NotNull Context ctx 104 | ) throws ParsingException { 105 | final int index = arguments.popOr("No argument number provided") 106 | .asInt().orElseThrow(() -> ctx.newException("Invalid argument number", arguments)); 107 | 108 | if (index < 0 || index >= argumentComponents.size()) { 109 | throw ctx.newException("Invalid argument number", arguments); 110 | } 111 | 112 | return Tag.inserting(argumentComponents.get(index)); 113 | } 114 | 115 | @Override 116 | public boolean has(final @NotNull String name) { 117 | return name.equals(NAME) || name.equals(NAME_1); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/utils/CheckTPS.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.utils; 2 | 3 | import org.bukkit.plugin.Plugin; 4 | 5 | public final class CheckTPS { 6 | 7 | private long lastPoll = System.currentTimeMillis(); 8 | private boolean tpsOk = true; 9 | private long tps = 20; 10 | private final Plugin plugin; 11 | private final int interval; 12 | private final int maximimumTPS; 13 | private final int minimumTPS; 14 | 15 | public CheckTPS(Plugin plugin, int interval, int maximimumTPS, int minimumTPS) { 16 | this.plugin = plugin; 17 | this.interval = interval; 18 | this.maximimumTPS = maximimumTPS; 19 | this.minimumTPS = minimumTPS; 20 | } 21 | 22 | public void startCheck() { 23 | if (this.minimumTPS > 0 || this.maximimumTPS > 0) { 24 | this.plugin.getServer().getScheduler().runTaskTimer(this.plugin, this::runCheck, 0, 20L * this.interval); 25 | } 26 | } 27 | 28 | private void runCheck() { 29 | var current = System.currentTimeMillis(); 30 | var spendTime = (current - this.lastPoll) / 1000; 31 | if (spendTime <= 0) spendTime = 1; 32 | this.tps = (20L * this.interval / spendTime); 33 | if (this.minimumTPS < 0) { 34 | this.tpsOk = (this.tps <= this.maximimumTPS); 35 | } else if (this.maximimumTPS < 0) { 36 | this.tpsOk = (this.tps >= this.minimumTPS); 37 | } else { 38 | this.tpsOk = (this.tps >= this.minimumTPS && this.tps <= this.maximimumTPS); 39 | } 40 | this.lastPoll = current; 41 | } 42 | 43 | public boolean isTpsOk() { 44 | return this.tpsOk; 45 | } 46 | 47 | public long getTps() { 48 | return this.tps; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/net/onelitefeather/antiredstoneclockremastered/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package net.onelitefeather.antiredstoneclockremastered.utils; 2 | 3 | import org.bukkit.Material; 4 | 5 | import java.net.URI; 6 | import java.net.http.HttpRequest; 7 | import java.util.ArrayList; 8 | import java.util.Collection; 9 | import java.util.List; 10 | 11 | public final class Constants { 12 | 13 | public static final String PERMISSION_NOTIFY = "antiredstoneclockremastered.notify.admin"; 14 | public static final String PERMISSION_NOTIFY_UPDATE = "antiredstoneclockremastered.notify.admin.update"; 15 | public static final String DISABLE_DONATION_NOTIFY = "antiredstoneclockremastered.notify.disable.donation"; 16 | public static final URI LATEST_RELEASE_VERSION_URI = URI.create("https://hangar.papermc.io/api/v1/projects/AntiRedstoneClock-Remastered/latestrelease"); 17 | public static final HttpRequest LATEST_RELEASE_VERSION_REQUEST = HttpRequest.newBuilder().GET().uri(LATEST_RELEASE_VERSION_URI).build(); 18 | 19 | public static final Collection REDSTONE_ITEMS = new ArrayList<>(initRedstoneItems()); 20 | 21 | private static Collection initRedstoneItems() { 22 | List materials = new ArrayList<>(); 23 | materials.add(Material.getMaterial("REDSTONE_WIRE")); 24 | if (Material.getMaterial("DIODE_BLOCK_OFF") != null) { 25 | // under 1.13 26 | materials.add(Material.getMaterial("DIODE_BLOCK_OFF")); 27 | materials.add(Material.getMaterial("DIODE_BLOCK_ON")); 28 | materials.add(Material.getMaterial("PISTON_BASE")); 29 | materials.add(Material.getMaterial("PISTON_EXTENSION")); 30 | materials.add(Material.getMaterial("PISTON_STICKY_BASE")); 31 | materials.add(Material.getMaterial("REDSTONE_COMPARATOR_OFF")); 32 | materials.add(Material.getMaterial("REDSTONE_COMPARATOR_ON")); 33 | } else { 34 | materials.add(Material.getMaterial("REPEATER")); 35 | materials.add(Material.getMaterial("PISTON")); 36 | materials.add(Material.getMaterial("STICKY_PISTON")); 37 | materials.add(Material.getMaterial("COMPARATOR")); 38 | materials.add(Material.getMaterial("OBSERVER")); 39 | } 40 | return materials; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/resources/antiredstoneclockremasterd.properties: -------------------------------------------------------------------------------- 1 | service.notify.detected.clock= Redstone Clock detected at: X,Y,Z(,,) 2 | antiredstoneclockremastered.command.reload.success= The configuration has been reloaded. A server restart is still recommended instead of just reloads 3 | antiredstoneclockremastered.command.reload.description=Reloads the AntiRedstone Clock Remastered 4 | antiredstoneclockremastered.command.display.clock.text=Clock(,,) was triggered 5 | antiredstoneclockremastered.command.display.clock.hover=Click me to teleport 6 | antiredstoneclockremastered.command.display.description=Shows you all active cached Cocks 7 | antiredstoneclockremastered.command.feature.check.toggle.enabled= The function is now: Enabled 8 | antiredstoneclockremastered.command.feature.check.toggle.disabled= The function is now: Disabled 9 | antiredstoneclockremastered.command.feature.check.toggle.observer.description=Turn the detection function of obeservers on or off 10 | antiredstoneclockremastered.command.feature.check.toggle.piston.description=Turn the detection function of pistons on or off 11 | antiredstoneclockremastered.command.feature.check.toggle.comparator.description=Turn the detection function of comparators on or off 12 | antiredstoneclockremastered.command.feature.check.toggle.sculk.description=Turn the detection function of sculks on or off 13 | antiredstoneclockremastered.command.feature.check.toggle.redstone_and_repeater.description=Turn the detection function of redstone and repeaters on or off 14 | antiredstoneclockremastered.command.feature.check.world.add= The world '' has been added to the ignored worlds list 15 | antiredstoneclockremastered.command.feature.check.world.remove= The world '' has been removed from the ignored worlds list 16 | antiredstoneclockremastered.command.feature.check.world.add.description=This command adds a world to the ignored worlds list 17 | antiredstoneclockremastered.command.feature.check.world.remove.description=This command removes a world from the ignored worlds list 18 | antiredstoneclockremastered.command.feature.check.region.add= The region '' has been added to the ignored regions list 19 | antiredstoneclockremastered.command.feature.check.region.remove= The region '' has been removed from the ignored regions list 20 | antiredstoneclockremastered.command.feature.check.region.add.description=This command adds a region to the ignored regions list 21 | antiredstoneclockremastered.command.feature.check.region.remove.description=This command removes a region from the ignored regions list 22 | antiredstoneclockremastered.command.feature.clock.set= The value of this function is now: 23 | antiredstoneclockremastered.command.feature.clock.toggle.autoBreak.description=Turn the function of auto break on or off 24 | antiredstoneclockremastered.command.feature.clock.toggle.notifyAdmins.description=Turn the function of admin notifications on or off 25 | antiredstoneclockremastered.command.feature.clock.toggle.notifyConsole.description=Turn the function of console notifications on or off 26 | antiredstoneclockremastered.command.feature.clock.toggle.drop.description=Turn the function of drop items on or off 27 | antiredstoneclockremastered.command.feature.clock.set.delay.description=Sets the desired value for the function 28 | antiredstoneclockremastered.command.feature.clock.set.maxCount.description=Sets the desired value for the function 29 | antiredstoneclockremastered.notify.donation.console=To keep the project alive, we ask for donations to our https://opencollective.com/onelitefeather/projects/antiredstoneclock-remastered 30 | antiredstoneclockremastered.notify.donation.player= To keep the project alive, we ask for donations to our OpenCollective 31 | antiredstoneclockremastered.notify.update.player= Your version() is older than our latest published version (). Please update as soon as possible to get continued support. Or click me to get on the download page! 32 | antiredstoneclockremastered.notify.update.console=Your version() is older than our latest published version (). Please update as soon as possible to get continued support. Or click use this link -------------------------------------------------------------------------------- /src/main/resources/antiredstoneclockremasterd_de_DE.properties: -------------------------------------------------------------------------------- 1 | service.notify.detected.clock= Redstone-Clock erkannt\: X,Y,Z(,,) 2 | antiredstoneclockremastered.command.reload.success= Die Konfiguration wurde neu geladen. Ein Serverneustart wird immer noch empfohlen statt nur neu zu laden 3 | antiredstoneclockremastered.command.reload.description=Lade die AntiRedstone Clock Remastered neu 4 | antiredstoneclockremastered.command.display.clock.text=Clock(,,) was triggered 5 | antiredstoneclockremastered.command.display.clock.hover=Klicke mich, um dich zu teleportieren 6 | antiredstoneclockremastered.command.display.description=Zeigt alle aktiven Zwischengespeichert-Clocks 7 | antiredstoneclockremastered.command.feature.check.toggle.enabled= Die Funktion ist jetzt\: aktiviert 8 | antiredstoneclockremastered.command.feature.check.toggle.disabled= Die Funktion ist jetzt\: deaktiviert 9 | antiredstoneclockremastered.command.feature.check.toggle.observer.description=Schalte die Erkennungsfunktion von Observers ein oder aus 10 | antiredstoneclockremastered.command.feature.check.toggle.piston.description=Schaltet die Erkennungsfunktion von Kolben ein oder aus 11 | antiredstoneclockremastered.command.feature.check.toggle.comparator.description=Schaltet die Erkennungsfunktion von Vergleichern ein oder aus 12 | antiredstoneclockremastered.command.feature.check.toggle.sculk.description=Schalte die Erkennungsfunktion der Sculk-Sensoren ein oder aus 13 | antiredstoneclockremastered.command.feature.check.toggle.redstone_and_repeater.description=Schaltet die Erkennungsfunktion von Redstone und Repeater ein oder aus 14 | antiredstoneclockremastered.command.feature.check.world.add= Die Welt '' wurde zur Liste der ignorierten Welten hinzugefügt 15 | antiredstoneclockremastered.command.feature.check.world.remove= Die Welt '' wurde von der Liste ignorierter Welten entfernt 16 | antiredstoneclockremastered.command.feature.check.world.add.description=Dieser Befehl fügt eine Welt zur Liste ignorierter Welten hinzu 17 | antiredstoneclockremastered.command.feature.check.world.remove.description=Dieser Befehl entfernt eine Welt von der Liste ignorierter Welten 18 | antiredstoneclockremastered.command.feature.check.region.add= Die Region '' wurde zur Liste der ignorierten Regionen hinzugefügt 19 | antiredstoneclockremastered.command.feature.check.region.remove= Die Region '' wurde aus der Liste der ignorierten Regionen entfernt 20 | antiredstoneclockremastered.command.feature.check.region.add.description=Dieser Befehl fügt eine Region zur Liste der ignorierten Regionen hinzu 21 | antiredstoneclockremastered.command.feature.check.region.remove.description=Dieser Befehl entfernt eine Region von der Liste der ignorierten Regionen 22 | antiredstoneclockremastered.command.feature.clock.set= Der Wert dieser Funktion ist jetzt\: 23 | antiredstoneclockremastered.command.feature.clock.toggle.autoBreak.description=Schalte die Funktion der Auto-Zerstören ein oder aus 24 | antiredstoneclockremastered.command.feature.clock.toggle.notifyAdmins.description=Schalten Sie die Funktion der Admin-Benachrichtigungen ein oder aus 25 | antiredstoneclockremastered.command.feature.clock.toggle.notifyConsole.description=Schalte die Funktion der Konsolen-Benachrichtigungen ein oder aus 26 | antiredstoneclockremastered.command.feature.clock.toggle.drop.description=Schalte die Funktion der Drop-Items ein oder aus 27 | antiredstoneclockremastered.command.feature.clock.set.delay.description=Setzt den gewünschten Wert für die Funktion 28 | antiredstoneclockremastered.command.feature.clock.set.maxCount.description=Setzt den gewünschten Wert für die Funktion 29 | antiredstoneclockremastered.notify.donation.console=Um das Projekt am Leben zu erhalten, bitten wir um Spenden an unsere https\://opencollective.com/onelitefeather/projects/antiredstoneclock-remastered 30 | antiredstoneclockremastered.notify.donation.player= Um das Projekt am Leben zu erhalten, bitten wir um Spenden an unsere OpenCollective 31 | antiredstoneclockremastered.notify.update.player= Ihre Version () ist älter als unsere zuletzt veröffentlichte Version (). Bitte aktualisieren Sie so bald wie möglich, um weitere Support zu erhalten. Oder klicken Sie auf mich, um auf die Download-Seite zu gelangen\! 32 | antiredstoneclockremastered.notify.update.console=Ihre Version () ist älter als unsere zuletzt veröffentlichte Version (). Bitte aktualisieren Sie baldmöglichst um weitere Support zu erhalten. Oder klicken Sie auf diesen Link -------------------------------------------------------------------------------- /src/main/resources/antiredstoneclockremasterd_es_ES.properties: -------------------------------------------------------------------------------- 1 | service.notify.detected.clock= Se detectó un Reloj de Redstone en: X,Y,Z(,,) 2 | antiredstoneclockremastered.command.reload.success= La configuración ha sido recargada. Se recomienda reiniciar el servidor en lugar de solo recargar 3 | antiredstoneclockremastered.command.reload.description=Recarga el AntiRedstone Clock Remastered 4 | antiredstoneclockremastered.command.display.clock.text=El reloj(,,) se activó 5 | antiredstoneclockremastered.command.display.clock.hover=Haz clic para teletransportarte 6 | antiredstoneclockremastered.command.display.description=Muestra todos los relojes activos en caché 7 | antiredstoneclockremastered.command.feature.check.toggle.enabled= La función ahora está: Habilitada 8 | antiredstoneclockremastered.command.feature.check.toggle.disabled= La función ahora está: Deshabilitada 9 | antiredstoneclockremastered.command.feature.check.toggle.observer.description=Activa o desactiva la función de detección de observadores 10 | antiredstoneclockremastered.command.feature.check.toggle.piston.description=Activa o desactiva la función de detección de pistones 11 | antiredstoneclockremastered.command.feature.check.toggle.comparator.description=Activa o desactiva la función de detección de comparadores 12 | antiredstoneclockremastered.command.feature.check.toggle.sculk.description=Activa o desactiva la función de detección de sensores de sculk 13 | antiredstoneclockremastered.command.feature.check.toggle.redstone_and_repeater.description=Activa o desactiva la función de detección de redstone y repetidores 14 | antiredstoneclockremastered.command.feature.check.world.add= El mundo '' ha sido añadido a la lista de mundos ignorados 15 | antiredstoneclockremastered.command.feature.check.world.remove= El mundo '' ha sido eliminado de la lista de mundos ignorados 16 | antiredstoneclockremastered.command.feature.check.world.add.description=Este comando añade un mundo a la lista de mundos ignorados 17 | antiredstoneclockremastered.command.feature.check.world.remove.description=Este comando elimina un mundo de la lista de mundos ignorados 18 | antiredstoneclockremastered.command.feature.check.region.add= La región '' ha sido añadida a la lista de regiones ignoradas 19 | antiredstoneclockremastered.command.feature.check.region.remove= La región '' ha sido eliminada de la lista de regiones ignoradas 20 | antiredstoneclockremastered.command.feature.check.region.add.description=Este comando añade una región a la lista de regiones ignoradas 21 | antiredstoneclockremastered.command.feature.check.region.remove.description=Este comando elimina una región de la lista de regiones ignoradas 22 | antiredstoneclockremastered.command.feature.clock.set= El valor de esta función es ahora: 23 | antiredstoneclockremastered.command.feature.clock.toggle.autoBreak.description=Activa o desactiva la función de rotura automática 24 | antiredstoneclockremastered.command.feature.clock.toggle.notifyAdmins.description=Activa o desactiva la función de notificaciones para administradores 25 | antiredstoneclockremastered.command.feature.clock.toggle.notifyConsole.description=Activa o desactiva la función de notificaciones para la consola 26 | antiredstoneclockremastered.command.feature.clock.toggle.drop.description=Activa o desactiva la función de soltar objetos 27 | antiredstoneclockremastered.command.feature.clock.set.delay.description=Establece el valor deseado para la función 28 | antiredstoneclockremastered.command.feature.clock.set.maxCount.description=Establece el valor deseado para la función 29 | antiredstoneclockremastered.notify.donation.console=Para mantener el proyecto activo, solicitamos donaciones a nuestro https://opencollective.com/onelitefeather/projects/antiredstoneclock-remastered 30 | antiredstoneclockremastered.notify.donation.player= Para mantener el proyecto activo, solicitamos donaciones a nuestro OpenCollective 31 | antiredstoneclockremastered.notify.update.player= Tu versión () es más antigua que nuestra última versión publicada (). Por favor, actualiza lo antes posible para recibir soporte continuo. ¡O haz clic aquí para ir a la página de descarga! 32 | antiredstoneclockremastered.notify.update.console=Tu versión () es más antigua que nuestra última versión publicada (). Por favor, actualiza lo antes posible para recibir soporte continuo. O haz clic en este enlace: -------------------------------------------------------------------------------- /src/main/resources/antiredstoneclockremasterd_fr_FR.properties: -------------------------------------------------------------------------------- 1 | service.notify.detected.clock= Horloge de redstone détectée en \: X,Y,Z(,,) 2 | antiredstoneclockremastered.command.reload.success= La configuration a été rechargée. Un redémarrage du serveur est toujours recommandé au lieu de simples rechargements 3 | antiredstoneclockremastered.command.reload.description=Recharger l'horloge AntiRedstone remastérisée 4 | antiredstoneclockremastered.command.display.clock.text=L'horloge(,,) a été activée 5 | antiredstoneclockremastered.command.display.clock.hover=Cliquez sur moi pour vous téléporter 6 | antiredstoneclockremastered.command.display.description=Vous montre toutes les horloges actives en cache 7 | antiredstoneclockremastered.command.feature.check.toggle.enabled= La fonction est maintenant \: Activée 8 | antiredstoneclockremastered.command.feature.check.toggle.disabled= La fonction est maintenant \: Désactivée 9 | antiredstoneclockremastered.command.feature.check.toggle.observer.description=Active ou désactive la fonction de détection des observers 10 | antiredstoneclockremastered.command.feature.check.toggle.piston.description=Active ou désactive la fonction de détection des pistons 11 | antiredstoneclockremastered.command.feature.check.toggle.comparator.description=Active ou désactive la fonction de détection des comparateurs 12 | antiredstoneclockremastered.command.feature.check.toggle.sculk.description=Active ou désactive la fonction de détection des sculks 13 | antiredstoneclockremastered.command.feature.check.toggle.redstone_and_repeater.description=Active ou désactive la fonction de détection de la redstone et des répéteurs 14 | antiredstoneclockremastered.command.feature.check.world.add= Le monde '' a été ajouté à la liste des mondes ignorés 15 | antiredstoneclockremastered.command.feature.check.world.remove= Le monde '' a été supprimé de la liste des mondes ignorés 16 | antiredstoneclockremastered.command.feature.check.world.add.description=Cette commande ajoute un monde à la liste des mondes ignorés 17 | antiredstoneclockremastered.command.feature.check.world.remove.description=Cette commande supprime un monde de la liste des mondes ignorés 18 | antiredstoneclockremastered.command.feature.check.region.add= La région '' a été ajoutée à la liste des régions ignorées 19 | antiredstoneclockremastered.command.feature.check.region.remove= La région '' a été retirée de la liste des régions ignorées 20 | antiredstoneclockremastered.command.feature.check.region.add.description=Cette commande ajoute une région à la liste des régions ignorées 21 | antiredstoneclockremastered.command.feature.check.region.remove.description=Cette commande supprime une région de la liste des régions ignorées 22 | antiredstoneclockremastered.command.feature.clock.set= La valeur de cette fonction est maintenant \: 23 | antiredstoneclockremastered.command.feature.clock.toggle.autoBreak.description=Active ou désactive la fonction de cassage automatique 24 | antiredstoneclockremastered.command.feature.clock.toggle.notifyAdmins.description=Active ou désactive la fonction des notifications d'administration 25 | antiredstoneclockremastered.command.feature.clock.toggle.notifyConsole.description=Active ou désactive la fonction des notifications de la console 26 | antiredstoneclockremastered.command.feature.clock.toggle.drop.description=Active ou désactive la fonction de drop d'items 27 | antiredstoneclockremastered.command.feature.clock.set.delay.description=Définit la valeur souhaitée pour la fonction 28 | antiredstoneclockremastered.command.feature.clock.set.maxCount.description=Définit la valeur souhaitée pour la fonction 29 | antiredstoneclockremastered.notify.donation.console=Pour assurer la continuité du projet, nous sollicitons des dons sur https\://opencollective.com/onelitefeather/projects/antiredstoneclock-remastered 30 | antiredstoneclockremastered.notify.donation.player= Pour assurer la continuité du projet, nous sollicitons des dons sur notre OpenCollective 31 | antiredstoneclockremastered.notify.update.player= Votre version () est plus ancienne que notre dernière version publiée (). Veuillez mettre à jour dès que possible pour continuer à bénéficier du support. Ou cliquez sur moi pour accéder à la page de téléchargement \! 32 | antiredstoneclockremastered.notify.update.console=Votre version () est plus ancienne que notre dernière version publiée (). Veuillez mettre à jour dès que possible pour continuer à bénéficier du support. Ou cliquez sur ce lien -------------------------------------------------------------------------------- /src/main/resources/antiredstoneclockremasterd_zh_CN.properties: -------------------------------------------------------------------------------- 1 | service.notify.detected.clock= 检测到此位置存在高频红石: X,Y,Z(,,) 2 | antiredstoneclockremastered.command.reload.success= 配置文件已重载. 部分功能可能需要重启后才会生效 3 | antiredstoneclockremastered.command.reload.description=重载 AntiRedstone Clock Remastered 4 | antiredstoneclockremastered.command.display.clock.text=高频红石(,,) 触发了 5 | antiredstoneclockremastered.command.display.clock.hover=点此传送 6 | antiredstoneclockremastered.command.display.description=显示所有已激活的缓存时钟 7 | antiredstoneclockremastered.command.feature.check.toggle.enabled= 功能: 启用 8 | antiredstoneclockremastered.command.feature.check.toggle.disabled= 功能: 禁用 9 | antiredstoneclockremastered.command.feature.check.toggle.observer.description=启用或禁用检测侦测器高频 10 | antiredstoneclockremastered.command.feature.check.toggle.piston.description=启用或禁用检测活塞高频 11 | antiredstoneclockremastered.command.feature.check.toggle.comparator.description=启用或禁用比较器高频 12 | antiredstoneclockremastered.command.feature.check.toggle.sculk.description=启用或禁用幽匿感测体高频 13 | antiredstoneclockremastered.command.feature.check.toggle.redstone_and_repeater.description=启用或禁用红石中继器高频 14 | antiredstoneclockremastered.command.feature.check.world.add= 世界 '' 已被添加至忽略列表 15 | antiredstoneclockremastered.command.feature.check.world.remove= 世界 '' 已从忽略列表中移除 16 | antiredstoneclockremastered.command.feature.check.world.add.description=将指定世界添加至忽略列表 17 | antiredstoneclockremastered.command.feature.check.world.remove.description=将指定世界从忽略表中移除 18 | antiredstoneclockremastered.command.feature.check.region.add= 区域'' 已被添加至忽略列表 19 | antiredstoneclockremastered.command.feature.check.region.remove= 区域 '' 已从忽略列表中移除 20 | antiredstoneclockremastered.command.feature.check.region.add.description=将指定区域添加至忽略列表 21 | antiredstoneclockremastered.command.feature.check.region.remove.description=将指定区域从忽略表中移除 22 | antiredstoneclockremastered.command.feature.clock.set= 该功能的值已设置为: 23 | antiredstoneclockremastered.command.feature.clock.toggle.autoBreak.description=启用或禁用自动破坏功能 24 | antiredstoneclockremastered.command.feature.clock.toggle.notifyAdmins.description=启用或禁用管理员提醒功能 25 | antiredstoneclockremastered.command.feature.clock.toggle.notifyConsole.description=启用或禁用控制台提醒功能 26 | antiredstoneclockremastered.command.feature.clock.toggle.drop.description=启用或禁用掉落物品功能 27 | antiredstoneclockremastered.command.feature.clock.set.delay.description=为功能设置对应的延迟 28 | antiredstoneclockremastered.command.feature.clock.set.maxCount.description=为功能设置对应的最大数量 29 | antiredstoneclockremastered.notify.donation.console=为了维护计划, 请考虑通过 https://opencollective.com/onelitefeather/projects/antiredstoneclock-remastered 捐赠支持我们 30 | antiredstoneclockremastered.notify.donation.player= 为了维护计划, 请考虑向 OpenCollective 捐赠 31 | antiredstoneclockremastered.notify.update.player= 你的版本() 已旧于新版 (). 请尽快更新以获得支持. 或点此进入下载页! 32 | antiredstoneclockremastered.notify.update.console=你的版本() 旧于发布的新版 (). 请尽快更新以获得支持, 或通过链接进行更新 33 | -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | translations: 2 | - 'en-US' 3 | check: 4 | redstoneAndRepeater: true 5 | observer: true 6 | piston: true 7 | comparator: true 8 | sculk: true 9 | ignoredWorlds: 10 | - world 11 | ignoredRegions: [] 12 | 13 | clock: 14 | endDelay: 300 15 | maxCount: 150 16 | autoBreak: true 17 | notifyAdmins: false 18 | notifyConsole: true 19 | drop: true 20 | 21 | tps: 22 | interval: 2 23 | max: 20 24 | min: 15 --------------------------------------------------------------------------------