Compare commits

...

117 Commits

Author SHA1 Message Date
craftaro-plugins-overview[bot] 46637d829d
Updates contents of README.md 2024-04-18 17:10:10 +00:00
Christian Koop 5bcfbde8c4
Merge branch 'development' 2024-04-06 21:14:02 +02:00
Christian Koop 4c4b6fe6dd
Release v3.0.6 2024-04-06 21:13:57 +02:00
Christian Koop ff12fda7d2
Revert "Bump com.sk89q.worldedit:worldedit-bukkit from 7.2.20 to 7.3.0 (#37)"
This reverts commit 018e26c1b0.

Apparently 7.3 now requires java language features newer than Java 8... We can't upgrade right now
2024-04-06 21:12:41 +02:00
Christian Koop 4dffd7e2a8
fix: Fix ConcurrentModificationException on PlayerData-Storage (#39) 2024-04-06 21:11:13 +02:00
dependabot[bot] 018e26c1b0
Bump com.sk89q.worldedit:worldedit-bukkit from 7.2.20 to 7.3.0 (#37)
Bumps com.sk89q.worldedit:worldedit-bukkit from 7.2.20 to 7.3.0.

---
updated-dependencies:
- dependency-name: com.sk89q.worldedit:worldedit-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-06 21:06:14 +02:00
dependabot[bot] 68a4dc5c09
Bump io.netty:netty-all from 4.1.107.Final to 4.1.108.Final (#38)
Bumps [io.netty:netty-all](https://github.com/netty/netty) from 4.1.107.Final to 4.1.108.Final.
- [Commits](https://github.com/netty/netty/compare/netty-4.1.107.Final...netty-4.1.108.Final)

---
updated-dependencies:
- dependency-name: io.netty:netty-all
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-01 14:38:32 +02:00
Christian Koop 7d86423744
fix: Wrap World#getMinHeight with fallback for older Minecraft versions
The method did not exist *back then* and we still want to support Spigot 1.8.8
2024-03-27 19:47:18 +01:00
Christian Koop e9642ad0cc
fix: Replace usage of deprecated SWorldBorder with new NmsWorldBorder
SWorldBorder will be removed soon™️
2024-03-27 19:41:04 +01:00
Christian Koop 211e6a0fcb
fix: Fix NullPointerException when using portals 2024-03-27 19:32:44 +01:00
Christian Koop 2a2886e9ae
fix: Replace incorrect player lookups using Bukkit#getPlayer with -Exact
#34
2024-03-27 19:27:38 +01:00
Christian Koop a1f63b5336
Merge pull request #35 from TeamHRLive/development
Fix for /is members
2024-03-27 19:19:09 +01:00
TeamHR 389b9087fd
[Fixed] Island Scan MinY Level fixed. Instead of 0 it will now fetch from World.MinHeight. 2024-03-27 19:16:49 +01:00
TeamHR 373d5267d4
[Fixed] /is members Was throwing NPE for Players 2024-03-27 19:16:48 +01:00
TeamHR 0f51665bc3
[Fixes] Leaderboard Skull not loading and showing black skulls.
[CleanUp] Cleaned Debug Messages
2024-03-27 19:16:48 +01:00
TeamHR c35002eb4d
[Fixes] Leaderboard Skull not loading and showing black skulls. 2024-03-27 19:16:47 +01:00
Christian Koop 89b208c136
Merge branch 'master' into development 2024-03-27 19:16:11 +01:00
Ahmet Hakan c951cf924b Update CoopCommand.java
To get the difference between "AhmHkn" and "AhmHkn1" need to use "getPlayerExact"
2024-03-27 19:14:17 +01:00
ceze88 2b3d640a22 Release v3.0.5 2024-03-20 12:34:09 +01:00
ceze88 a75a4eae2d Small internal code change for CustomCrops compatibility 2024-03-20 12:34:00 +01:00
Brianna O'Keefe cc27a5744c Change default world heights. 2024-03-14 18:26:07 -05:00
Brianna OKeefe 9ba7647f53 Fixed some nesting issues. 2024-03-14 18:23:15 -05:00
craftaro-plugins-overview[bot] bd848cc0b3
Updates contents of README.md 2024-03-07 20:52:48 +00:00
Christian Koop cb699a46df
Adds plugin logo at docs/Logo.png 2024-03-07 21:45:14 +01:00
TeamHR b02e594676
fix: Multiple GUI menus that displays player heads (#32) 2024-03-04 13:30:53 +01:00
TeamHR 798f53c148
fix: Leaderbord showing broken skulls (#31)
[Fixed] Leaderboard showing wrong skulls. Using SkullUtils to fetch Skull and applying skin.
2024-03-03 19:30:05 +01:00
Christian Koop c69a5884e6
Merge pull request #30 from TeamHRLive/development
Development
2024-03-02 16:42:14 +01:00
TeamHR 9fe0fde5b2 [Fixes] /is settings not saving for player islands as there is case mismatch.
[Fixes] Operators/Players were not able to fly with Island Fly Upgrade
2024-03-02 20:21:45 +05:30
dependabot[bot] d450049632
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.1 to 3.5.2 (#28)
Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.5.1 to 3.5.2.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.5.1...maven-shade-plugin-3.5.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 12:26:35 +01:00
dependabot[bot] 726acf28dd
Bump com.sk89q.worldedit:worldedit-bukkit from 7.2.18 to 7.2.20 (#29)
Bumps com.sk89q.worldedit:worldedit-bukkit from 7.2.18 to 7.2.20.

---
updated-dependencies:
- dependency-name: com.sk89q.worldedit:worldedit-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 12:26:27 +01:00
TeamHR 383a21ef7a [Fixed] Player's /is settings was not saving.
[Fixed] Ops were not able to fly on ISLAND unless /GMC. Now They can still fly if Fly upgrade is disabled.
2024-03-01 10:50:42 +05:30
Christian Koop 9c2da8c669
Release v3.0.4 2024-02-26 11:59:28 +01:00
Christian Koop 041c146038
ci: Fix potentially problematic `increment_version` value 2024-02-26 11:33:02 +01:00
Christian Koop f87632c2e5
fix: Corrects method signature for required getHandlerList in events #27
The method needs to be static or an IllegalPluginAccessException is thrown when trying to use the event
2024-02-26 10:43:33 +01:00
ceze88 0c8fc5d979 Release v3.0.3 2024-02-23 17:08:14 +01:00
ceze88 fd158996df Fix hologram leaderboards not showing 2024-02-23 17:07:31 +01:00
ceze88 3129adce6f Release v3.0.2 2024-02-12 22:41:59 +01:00
ceze88 491143ce45 Make sure non island members can't access EpicSpawners GUI 2024-02-12 22:41:28 +01:00
ceze88 994357fe8e Temporary fix for hook system 2024-02-12 22:41:02 +01:00
Christian Koop 3aa85c751e
feat: Adds previous island owner to `IslandOwnershipTransferEvent` (#14)
Instead of resolving the previous owner and risk a potential web/api request getting triggert,
although the previous owner might never be used, I decided on just providing the UUID we already have.

The plugins can then still find the (Offline)Player themselves when needed.
2024-01-30 11:45:52 +01:00
ceze88 0b685b31df Release v3.0.1 2024-01-25 20:19:32 +01:00
ceze88 d6819abab2 Update to latest core build 2024-01-25 20:19:07 +01:00
dependabot[bot] eab020f569
Bump com.sk89q.worldedit:worldedit-bukkit from 7.2.9 to 7.2.18 (#22)
Bumps com.sk89q.worldedit:worldedit-bukkit from 7.2.9 to 7.2.18.

---
updated-dependencies:
- dependency-name: com.sk89q.worldedit:worldedit-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 18:09:36 +01:00
dependabot[bot] 1e84f621c9
Bump me.clip:placeholderapi from 2.11.3 to 2.11.5 (#23)
Bumps me.clip:placeholderapi from 2.11.3 to 2.11.5.

---
updated-dependencies:
- dependency-name: me.clip:placeholderapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 18:09:26 +01:00
dependabot[bot] 693f14242a
Bump com.github.MilkBowl:VaultAPI from 1.7 to 1.7.1 (#25)
Bumps [com.github.MilkBowl:VaultAPI](https://github.com/MilkBowl/VaultAPI) from 1.7 to 1.7.1.
- [Release notes](https://github.com/MilkBowl/VaultAPI/releases)
- [Commits](https://github.com/MilkBowl/VaultAPI/compare/1.7...1.7.1)

---
updated-dependencies:
- dependency-name: com.github.MilkBowl:VaultAPI
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 18:08:37 +01:00
dependabot[bot] 1efd8cadfb
Bump io.papermc:paperlib from 1.0.7 to 1.0.8 (#20)
Bumps [io.papermc:paperlib](https://github.com/PaperMC/PaperLib) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/PaperMC/PaperLib/releases)
- [Changelog](https://github.com/PaperMC/PaperLib/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PaperMC/PaperLib/compare/v1.0.7...v1.0.8)

---
updated-dependencies:
- dependency-name: io.papermc:paperlib
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 18:08:29 +01:00
dependabot[bot] 7fa4795ec0
Bump actions/upload-artifact from 3 to 4 (#21)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 18:07:38 +01:00
dependabot[bot] c95f96ffe1
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.0 to 3.5.1 (#24)
Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.5.0...maven-shade-plugin-3.5.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 18:07:29 +01:00
dependabot[bot] fbe8d0cbc4
Bump actions/checkout from 3 to 4 (#19)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 18:07:10 +01:00
ceze88 bc15c264d9 Release v3.0.0 2024-01-13 16:33:30 +01:00
ceze88 53cde6f804 Migrate to dynamic dependency loading 2024-01-13 16:33:16 +01:00
Christian Koop c2e1d82c09
Release v3.0.0-b7-SNAPSHOT 2023-10-23 18:14:14 +02:00
Christian Koop 1a2124fb2f
Revert "Don't handle PortalTeleportEvent when target world is disabled in config"
This reverts commit b2b3b3d976.

That event handler didn't affect players
2023-08-21 19:12:53 +02:00
Christian Koop b2b3b3d976
Don't handle PortalTeleportEvent when target world is disabled in config
Related to 5711389549
2023-08-21 18:18:22 +02:00
Christian Koop 5711389549
Don't handle PortalEnterEvent when target world is disabled in config
This allows vanilla and third-party plugins to take over properly without the stuck-teleport or
something else to interfer with that.
2023-08-21 16:53:06 +02:00
Christian Koop 24dc591f75
Release v3.0.0-b6-SNAPSHOT 2023-08-21 16:17:51 +02:00
Christian Koop c12c82afe2
Fallback gracefully and log missing Economy plugin instead of Exception
Some places I kept the exception because there is no handling or return type in place that allows
for that economy transaction to fail.
So instead of not rewarding the player with the money, an exception is logged instead
2023-08-21 10:58:23 +02:00
Christian Koop 7589bae8b0
Fix Exception when running /is leaderboard 2023-08-18 21:29:07 +02:00
Christian Koop 3105cdf86d
Release v3.0.0-b5-SNAPSHOT 2023-08-18 10:47:59 +02:00
Christian Koop c9abab64d5
Fixes errors when using hologram related admin commands
e.g. `/island admin sethologram bank`
2023-08-18 10:47:26 +02:00
Christian Koop 64c4affe3f
Fixes error when setting island to non-public while visitors are on it 2023-08-18 10:45:29 +02:00
Christian Koop 25e401826c
Replace FabledSkyBlock placeholders without PlaceholderAPI installed 2023-08-18 10:35:10 +02:00
Christian Koop 2e37efefd4
Correctly replace color codes after replacing PlaceholderAPI placeholder
A user reported that user/group prefixes may containt color codes like `&e` which are not
replaced in the end to be rendered correctly

I believe the responsible plugin should take care of that but apparently there are multiple...
So we just replace them in the end ^^
2023-08-18 09:52:30 +02:00
Christian Koop f22ac073f7
Merge pull request #18 from BaxAndrei/development-1
Fixes generators in the nether dimension
2023-08-18 09:28:53 +02:00
BaxAndrei 011a9ed640
FIX Generators Nether 2023-08-17 22:49:30 +03:00
Christian Koop 0891be3166
GitHub Actions: Upload unsigned and signed jars as build artifacts 2023-08-16 20:14:12 +02:00
Christian Koop 3e94aa3f78
Release v3.0.0-b4-SNAPSHOT 2023-08-16 20:12:57 +02:00
Christian Koop 596305bd33
Improve default Materials for `biomes.yml` 2023-08-16 20:12:24 +02:00
Christian Koop 4df43fccad
Fixes startup issues because of renamed Enum constants
The constants #name() was used when reading various plugin configurations.
After me renaming them in 308d8ca7b9 they stopped
matching in the configurations and broke everything horibly.

This commit introduces a friendly name to keep the new names but still support existing configuration files.
2023-08-16 17:27:05 +02:00
Christian Koop b29111b96d
Drop support for LeaderHeads plugin
Last update was in 2020 and it is marked as abandoned.

I think users had enough time to find an alternative + I can't find an official maven repository for it,
making clean builds hard
2023-08-16 09:51:16 +02:00
Christian Koop 57f49b6c1f
GitHub Actions: Have the build workflow compile the needed Spigot jar 2023-08-15 22:19:16 +02:00
Christian Koop 688e24aa8d
Configure Dependabot to check GitHub Actions 2023-08-15 22:12:34 +02:00
Christian Koop d34483c6ff
GitHub Actions: Introduce build workflow with maven auto-publish 2023-08-15 22:12:19 +02:00
Christian Koop 41db72c590
Release v3.0.0-SNAPSHOT 2023-08-15 21:54:46 +02:00
Christian Koop eb75ed8a38
pom.xml: Change project's groupId, artifactId to com.craftaro 2023-08-15 21:54:37 +02:00
Christian Koop 2da22bd260
Replace Songoda in strings with Craftaro 2023-08-15 21:54:07 +02:00
Christian Koop c43e4cb799
Updates EpicSpawners Dependency + Implementation to API v1.0.0-SNAPSHOT 2023-08-15 21:36:53 +02:00
Christian Koop 700b293f9c
Updates UltimateStacker Dependency+Implementation to API v1.0.0-SNAPSHOT 2023-08-15 19:02:31 +02:00
Christian Koop a259589897
Replace deprecated usages of NmsManager with Nms 2023-08-15 18:58:04 +02:00
Christian Koop 2caf39d49e
Move everything from com.songoda to com.craftaro package 2023-08-15 18:57:00 +02:00
Christian Koop f47354980b
Replace usages of now incompatible CompatibleMaterial with XMaterial 2023-08-15 18:48:40 +02:00
Christian Koop c44a684ecd
Replace usages of now incompatible CompatibleSound with XSound 2023-07-29 16:21:35 +02:00
Christian Koop 20b0246270
Switch from SongodaCore to CraftaroCore v3.0.0-SNAPSHOT + update imports 2023-07-29 15:06:06 +02:00
Christian Koop 308d8ca7b9
Heavy code style changes and slight refactoring 2023-07-29 14:03:50 +02:00
Christian Koop e1c28007bb
Creates `.editorconfig` 2023-07-29 14:03:50 +02:00
Christian Koop 9b34c6e8b3
Creates .github/FUNDING.yml 2023-07-26 21:31:34 +02:00
Christian Koop b8646657f0
Creates .github/dependabot.yml 2023-07-26 21:31:34 +02:00
Christian Koop 6776ee0af6
Modernize and clean up `pom.xml` and `plugin.yml` 2023-07-26 21:31:34 +02:00
Christian Koop ab2b876256
Updates .gitignore 2023-07-26 21:27:09 +02:00
craftaro-plugins-overview[bot] 34e7fca817
Updates contents of README.md (#17)
Co-authored-by: craftaro-plugins-overview[bot] <111250264+craftaro-plugins-overview[bot]@users.noreply.github.com>
2023-07-26 19:14:04 +02:00
ceze88 7774fd236d Release 2.5.2 2023-04-13 19:55:59 +02:00
ceze88 34146b5fc4 Updates SongodaCore to 2.6.19 2023-04-13 19:55:42 +02:00
Christian Koop 1e83188e6a
Release v2.5.2-BETA 2023-03-29 22:04:45 +02:00
Christian Koop 028d67355f
Updates SongodaCore to 2.6.19-DEV for Spigot 1.19.4 support 2023-03-29 22:04:33 +02:00
Christian Koop 7eb195a474
Switch LICENSE to CC BY-NC-ND 4.0
Co-authored-by: Eli Rickard <38917063+EliRickard@users.noreply.github.com>
2023-03-29 21:29:09 +02:00
Christian Koop 0d9bcbf9fa
Release v2.5.1-DEV 2023-01-11 22:18:51 +01:00
Christian Koop 42167e79a6
Update SongodaCore to v2.6.18-DEV 2023-01-11 22:17:14 +01:00
efekurbann cd57ce89e9 Fix Coop Saving System (Island.Coop.Unload setting) 2022-10-14 22:21:27 +03:00
Christian Koop baff0b3497
Merge branch 'development' 2022-09-05 23:02:53 +02:00
Christian Koop 17a78e610d
Release v2.5.0 2022-09-05 23:02:48 +02:00
Christian Koop cdc5f2a350
Minor code cleanup: Use import for HologramManager 2022-09-05 23:02:05 +02:00
songoda-projects-overview[bot] 455d9549e7 Bump SongodaCore version to `2.6.16` 2022-09-05 22:21:04 +02:00
ceze88 72edb61405 Fix island level scan (Revert changes with chunk loading)
Commit: ff37711087
2022-08-24 16:24:00 +02:00
songoda-projects-overview[bot] 52fd85642e Bump SongodaCore version to `2.6.15-DEV` 2022-08-15 00:48:13 +02:00
Christian Koop fedb18621c
Merge branch 'development' 2022-07-30 21:28:39 +02:00
Christian Koop 9c4ba6e003
Release v2.4.2 2022-07-30 21:28:34 +02:00
Christian Koop 90e86e89c5
Update SongodaCore to v2.6.14-DEV 2022-07-30 21:28:18 +02:00
Christian Koop a71e55265d
Include Minecraft 1.19 as officially supported version 2022-07-30 21:27:50 +02:00
Christian Koop 362962b452
Merge branch 'master' into development 2022-07-28 22:27:36 +02:00
GKasparov cc6fd41cf6
Merge pull request #15 from efekurbann/master
Fixed: players can not teleport to offline member's island
2022-07-14 09:06:39 +03:00
GKasparov 12f76a60b1
Merge pull request #16 from BetTD/BetTD-patch-1
Fix maven-shade-plugin being missing
2022-07-02 11:29:16 +03:00
Raúl M 39aff67010
Fix maven-shade-plugin being missing
Apache released maven-shade-plugin v3.3.0 some time ago on their stable repos, so the snapshots repository is no longer required.
2022-05-26 02:57:19 +02:00
Christian Koop 1f360aee0a
Merge branch 'development' 2022-03-20 11:21:07 +01:00
Christian Koop d063afdd9c
Release v2.4.1 2022-03-20 11:20:32 +01:00
Christian Koop 8778140175
Improves cross-version compatibility by using the MethodMapping class 2022-03-18 21:53:31 +01:00
Christian Koop e5e136b7d3
Updates to Core v2.6.12 (MC1.18.2) + new hologram api implementation 2022-03-18 21:53:31 +01:00
Efe Kurban 76e1f26a06
Update IslandManager.java 2022-03-03 21:46:23 +03:00
569 changed files with 20603 additions and 19428 deletions

26
.editorconfig Normal file
View File

@ -0,0 +1,26 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
# max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
[{*.yaml,*.yml,*.json,*.lang,*.graphqlconfig,*.har,*.jsb2,*.jsb3,*.webmanifest,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}]
indent_size = 2
tab_width = 2
[{*.markdown,*.md,*.html,*.htm,*.ng,*.sht,*.shtm,*.shtml,*.ts,*.ats,*.js,*.cjs,*.bash,*.sh,*.zsh}]
indent_size = 2
tab_width = 2

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
custom: [ 'https://craftaro.to/+' ]

View File

@ -0,0 +1,22 @@
name: Prepare Workspace
description: Prepares the workspace for compilation
inputs:
maven_username:
required: false
description: The username to use for the Maven server
maven_password:
required: false
description: The password to use for the Maven server
runs:
using: composite
steps:
- uses: craftaro/GH-Commons/.github/actions/setup_workspace@master
with:
maven_username: ${{ inputs.maven_username }}
maven_password: ${{ inputs.maven_password }}
- uses: SpraxDev/Action-SpigotMC@v4
with:
versions: 1.20.1

16
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,16 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: maven
directory: /
target-branch: development
schedule:
interval: monthly
- package-ecosystem: github-actions
directory: /
target-branch: development
schedule:
interval: monthly

84
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,84 @@
name: Build
on:
push:
branches: [ master, development ]
tags:
- 'v*'
pull_request:
types: [ opened, synchronize, reopened ]
permissions: read-all
env:
DEPLOYMENT_POM_PATH: ./dependency-reduced-pom.xml
DEPLOYMENT_ARTIFACT_DIR: ./target
DEPLOYMENT_ARTIFACT_SELECTOR: FabledSkyBlock-*.jar
jobs:
Build:
name: Build + Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare Workspace
uses: ./.github/actions/setup_project_workspace
with:
maven_username: ${{ secrets.PLUGINS_MAVEN_REPO_USERNAME }}
maven_password: ${{ secrets.PLUGINS_MAVEN_REPO_PASSWORD }}
- name: Set project version
uses: craftaro/GH-Commons/.github/actions/maven_set_project_version@master
with:
append_snapshot: ${{ github.ref_type == 'tag' && 'false' || 'true' }}
version: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
increment_version: ${{ github.ref_type != 'tag' && 'patch' || '' }}
increment_version_only_if_not_snapshot_version: ${{ github.ref == 'refs/heads/development' && 'true' || 'false' }}
- name: Build with Maven
run: mvn -B -Duser.name="GitHub Actions on $GITHUB_REPOSITORY (id=$GITHUB_RUN_ID)" -DskipTests clean package
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
- name: Sign jar archives
uses: craftaro/GH-Commons/.github/actions/sign_jars@master
with:
jar_file_selector: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
keystore_gpg_encrypted: ${{ secrets.PLUGINS_JARSIGNER_KEYSTORE_GPG }}
keystore_gpg_password: ${{ secrets.PLUGINS_JARSIGNER_KEYSTORE_GPG_PASSWORD }}
keystore_password: ${{ secrets.PLUGINS_JARSIGNER_KEYSTORE_PASSWORD }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-Signed
path: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}/${{ env.DEPLOYMENT_ARTIFACT_SELECTOR }}
- name: Deploy to Maven repo
if: ${{ github.event_name == 'push' }}
uses: craftaro/GH-Commons/.github/actions/maven_deploy@master
with:
repository_url: ${{ vars.PLUGINS_MAVEN_REPO_URL_RELEASE }}
repository_url_snapshots: ${{ vars.PLUGINS_MAVEN_REPO_URL_SNAPSHOT }}
maven_pom_path: ${{ env.DEPLOYMENT_POM_PATH }}
maven_out_dir: ${{ env.DEPLOYMENT_ARTIFACT_DIR }}
discord_webhook:
name: Send Discord Webhook
runs-on: ubuntu-latest
needs: [ Build ]
if: ${{ always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/development' || github.ref_type == 'tag') }}
steps:
- uses: actions/checkout@v4
- name: Notify Webhook
uses: craftaro/GH-Commons/.github/actions/discord_send_job_results@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
webhook_url: ${{ secrets.DISCORD_BUILD_STATUS_WEBHOOK }}

46
.gitignore vendored
View File

@ -1,40 +1,10 @@
## JetBrains IDEs
/.idea/
*.iml
## Maven
/**/target/
dependency-reduced-pom.xml
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.war
*.nar
*.settings
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.gradle/
/.settings/
/.idea/
**/build/
/bin/
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
/target/
*.iml
## Misc.
.DS_Store

328
LICENSE
View File

@ -1,9 +1,327 @@
Copyright (c) 2019 Brianna OKeefe
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
International Public License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software with minimal restriction, including the rights to use, copy, modify or merge while excluding the rights to publish, (re)distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-NonCommercial-NoDerivatives 4.0 International Public
License ("Public License"). To the extent this Public License may be
interpreted as a contract, You are granted the Licensed Rights in
consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the
Licensor receives from making the Licensed Material available under
these terms and conditions.
The same distribution rights and limitations above shall similarly apply to any and all source code, and other means that can be used to emulate this work.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Section 1 -- Definitions.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
c. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
d. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
e. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
f. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
g. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
h. NonCommercial means not primarily intended for or directed towards
commercial advantage or monetary compensation. For purposes of
this Public License, the exchange of the Licensed Material for
other material subject to Copyright and Similar Rights by digital
file-sharing or similar means is NonCommercial provided there is
no payment of monetary compensation in connection with the
exchange.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part, for NonCommercial purposes only; and
b. produce and reproduce, but not Share, Adapted Material
for NonCommercial purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties, including when
the Licensed Material is used other than for NonCommercial
purposes.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material, You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
For the avoidance of doubt, You do not have permission under
this Public License to Share Adapted Material.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database for NonCommercial purposes
only and provided You do not Share Adapted Material;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================

View File

@ -1,72 +1,43 @@
<p align="center">
<img alt="FabledSkyblock"
src="https://proxy.songoda.com/200/https://cdn2.songoda.com/products/fabledskyblock/iVa2K5aURiwKfwYkNZUkJ7UH0SGkHwz3JnBGVeBX.png">
</p>
<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<img src="docs/Logo.png" width="128px">
<h1 align="center">FabledSkyblock</h1>
# FabledSkyBlock
**Bring your servers SkyBlock experience to the next level with the ability to fine-tune island settings, create custom islands, view leaderboards, and much more.**
<p align="center">
<b>
Bring your servers SkyBlock experience to the next level with the ability to fine-tune
island settings, create custom islands, view leaderboards, and much more.
</b>
</p>
<p align="center">
<a href="https://discord.gg/songoda">
<img alt="Discord" src="https://img.shields.io/discord/293212540723396608?color=7289DA&label=Discord&logo=discord&logoColor=7289DA">
</a>
<a href="https://www.patreon.com/join/songoda">
<img alt="Patreon" src="https://img.shields.io/badge/-Support_on_Patreon-F96854.svg?logo=patreon&style=flat&logoColor=white">
</a>
<br>
<img alt="Latest" src="https://img.shields.io/badge/-ver_2.3.11-4078C0.svg?logo=github&style=flat&logoColor=white&color=blue&label=Latest&labelColor=black">
<a href="https://app.codacy.com/gh/songoda/FabledSkyblock/dashboard">
<img alt="quality" src="https://img.shields.io/codacy/grade/489f0babdfef4739a10a0859f2ae0f24">
</a>
<img alt="Last Updated" src="https://img.shields.io/github/last-commit/songoda/FabledSkyblock">
<br>
<a href="https://bstats.org/plugin/bukkit/FabledSkyblock/4544">
<img alt="Servers" src="https://img.shields.io/bstats/servers/4544">
</a>
<img alt="Maintained" src="https://img.shields.io/maintenance/yes/2020">
</p>
[![Discord][Discord shield]][Discord invite]
<br>
[![Latest version][Latest version shield]][Plugin page]
[![bStats Servers][bStats shield]][bStats page]
</div>
## Table of Contents
* [Introduction](#introduction)
* [Marketplace](#marketplace)
* [Documentation](#documentation)
* [Support](#support)
* [Suggestions](#suggestions)
## Introduction
FabledSkyblock is a powerful all in one skyblock plugin that allows you to create the perfect skyblock experience
tailored to your server for players to enjoy.
The plugin features numerous GUIs that allow you to customize the plugin in-game, and allows players to manage their islands.
Create and set up new starter island options in-game, using the structure tool and island template manager.
Manage the default permissions of visitors and island members through the island admin settings GUI,
allow island owners to manage what visitors, island members and island operators can do
on their islands through the island settings GUI,
and you are able to limit the settings that island owners would have access to through permissions.
Manage generators and island upgrades through the island admin GUIs
All in all, this plugin is the perfect skyblock plugin to create a unique experience for your server,
and its extensive list of permissions gives you full control over what players are able to access.
## Marketplace
You can visit [our marketplace](https://songoda.com/marketplace/product/fabledskyblock-the-ultimate-skyblock-plugin.17)
to download FabledSkyblock as well as take a look at many other fantastic plugins which are sure to catch your eye.
## Download (Marketplace)
You can visit [our marketplace][Plugin page] to download FabledSkyBlock as well as take a
look at many other fantastic plugins which are sure to catch your eye.
## Documentation
You can find all the information about FabledSkyblock, including dependencies,
commands, permissions and incompatible plugins on [our wiki](https://wiki.songoda.com/Fabled_Skyblock).
You can find all the information about FabledSkyBlock, including dependencies, commands, permissions and incompatible
plugins on [our wiki][Plugin wiki].
Feel free to also contribute to the wiki as a way to help others in the community with using the plugin.
## Support
If you encounter any issues while using the plugin,
feel free to create a ticket on [our support desk](https://support.songoda.com).
If you encounter any issues while using the plugin, feel free to contact us on
[our Discord server][Discord invite].
## Suggestions
For suggestions about features you think should be added to the plugin to increase its functionality,
feel free to create a thread over on [our feedback site](https://feedback.songoda.com).
For suggestions about features you think should be added to the plugin to increase its functionality, feel free to
create a thread over on [our Discord server][Discord invite].
[Plugin page]: https://songoda.com/product/13
[Plugin wiki]: https://songoda.notion.site/FabledSkyBlock-def1e06fa65e4106998202b97020c183
[Discord invite]: https://discord.gg/7TXM8xr2Ng
[Discord shield]: https://img.shields.io/discord/1214289374506917889?color=5865F2&label=Discord&logo=discord&logoColor=5865F2
[Latest version shield]: https://img.shields.io/badge/dynamic/xml?style=flat&color=blue&logo=github&logoColor=white&label=Latest&url=https%3A%2F%2Fraw.githubusercontent.com%2Fcraftaro%2FFabledSkyBlock%2Fmaster%2Fpom.xml&query=%2F*%5Blocal-name()%3D'project'%5D%2F*%5Blocal-name()%3D'version'%5D
[bStats page]: https://bstats.org/plugin/bukkit/FabledSkyBlock/4544
[bStats shield]: https://img.shields.io/bstats/servers/4544?label=Servers

BIN
docs/Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

309
pom.xml
View File

@ -1,22 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.4.0</version>
<packaging>jar</packaging>
<groupId>com.craftaro</groupId>
<artifactId>FabledSkyBlock</artifactId>
<version>3.0.6</version>
<name>FabledSkyBlock</name>
<description>Bring your server's SkyBlock experience to the next level with the ability to fine-tune island settings, create custom islands, view leaderboards, and much more</description>
<url>https://craftaro.com/marketplace/product/17</url>
<properties>
<maven.compiler.release>8</maven.compiler.release>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>FabledSkyblock-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${project.name}-${project.version}</finalName>
<shadedArtifactAttached>false</shadedArtifactAttached>
<useDependencyReducedPomInJar>true</useDependencyReducedPomInJar>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>com.craftaro.core</pattern>
<shadedPattern>com.craftaro.skyblock.core</shadedPattern>
</relocation>
<relocation>
<pattern>com.eatthepath.uuid</pattern>
<shadedPattern>com.craftaro.skyblock.third_party.com.eatthepath.uuid</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
<exclude>LICENSE</exclude>
<exclude>LICENSE.**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.craftaro:CraftaroCore</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
</includes>
<excludes>
<exclude>**/third_party/org/apache/**</exclude>
<exclude>**/third_party/net/kyori/**</exclude>
<exclude>**/third_party/com/zaxxer/**</exclude>
<exclude>**/third_party/org/jooq/**</exclude>
<exclude>**/third_party/org/mariadb/**</exclude>
<exclude>**/third_party/com/h2database/**</exclude>
<exclude>**/third_party/org/h2/**</exclude>
<exclude>**/third_party/com/cryptomorin/**</exclude>
<exclude>**/third_party/org/reactivestreams/**</exclude>
<exclude>**/third_party/io/papermc/lib/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
@ -24,127 +96,22 @@
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version>
<executions>
<execution>
<id>shaded</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>com.songoda:SongodaCore</include>
<include>io.papermc:paperlib</include>
<include>com.eatthepath:fast-uuid</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>com.songoda.core</pattern>
<shadedPattern>${project.groupId}.skyblock.core</shadedPattern>
</relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>${project.groupId}.paperlib</shadedPattern>
</relocation>
<relocation>
<pattern>com.eatthepath.uuid</pattern>
<shadedPattern>${project.groupId}.fast-uuid</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>spigot-repo</id>
<id>craftaro-minecraft-plugins</id>
<url>https://repo.craftaro.com/repository/minecraft-plugins/</url>
</repository>
<repository>
<id>SpigotMC</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
@ -153,13 +120,13 @@
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
<id>enginehub-maven</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<id>jitpack.io</id>
<url>https://jitpack.io/</url>
</repository>
<repository>
@ -170,95 +137,97 @@
<dependencies>
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>LATEST</version>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId>
<version>3.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.8</version>
<scope>compile</scope>
</dependency>
<exclusions>
<exclusion>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
</exclusion>
</exclusions>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18</version>
<artifactId>spigot-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId>
<version>2.6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>UltimateStacker</artifactId>
<version>2.1.1</version>
<version>1.7.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.9.2</version>
<version>2.11.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.robin</groupId>
<artifactId>LeaderHeadsAPI</artifactId>
<version>1.0</version>
<groupId>com.craftaro</groupId>
<artifactId>UltimateStacker-API</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>epicspawners</artifactId>
<version>7.0.1</version>
<groupId>com.craftaro</groupId>
<artifactId>EpicSpawners-API</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.1.0R1</version>
<version>7.2.20</version>
<scope>provided</scope>
</dependency>
<exclusions>
<exclusion>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
</exclusion>
</exclusions>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.16.29</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.108.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.eatthepath</groupId>
<artifactId>fast-uuid</artifactId>
<version>0.1</version>
<version>0.2.0</version>
<scope>compile</scope>
</dependency>
<!-- TODO: Check what repo has com.Zrips:Residence -->
<dependency>
<groupId>com.Zrips</groupId>
<artifactId>Residence</artifactId>

View File

@ -0,0 +1,594 @@
package com.craftaro.skyblock;
import com.craftaro.core.SongodaCore;
import com.craftaro.core.SongodaPlugin;
import com.craftaro.core.compatibility.ServerProject;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.configuration.Config;
import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.hooks.HologramManager;
import com.craftaro.core.hooks.LogManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.api.SkyBlockAPI;
import com.craftaro.skyblock.ban.BanManager;
import com.craftaro.skyblock.bank.BankManager;
import com.craftaro.skyblock.biome.BiomeManager;
import com.craftaro.skyblock.challenge.FabledChallenge;
import com.craftaro.skyblock.command.CommandManager;
import com.craftaro.skyblock.command.commands.SkyBlockCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.confirmation.ConfirmationTask;
import com.craftaro.skyblock.cooldown.CooldownManager;
import com.craftaro.skyblock.economy.EconomyManager;
import com.craftaro.skyblock.generator.GeneratorManager;
import com.craftaro.skyblock.invite.InviteManager;
import com.craftaro.skyblock.island.IslandManager;
import com.craftaro.skyblock.island.reward.RewardManager;
import com.craftaro.skyblock.leaderboard.LeaderboardManager;
import com.craftaro.skyblock.levelling.IslandLevelManager;
import com.craftaro.skyblock.limit.LimitationInstanceHandler;
import com.craftaro.skyblock.listeners.BlockListeners;
import com.craftaro.skyblock.listeners.BucketListeners;
import com.craftaro.skyblock.listeners.ChatListeners;
import com.craftaro.skyblock.listeners.DeathListeners;
import com.craftaro.skyblock.listeners.EntityListeners;
import com.craftaro.skyblock.listeners.FallBreakListeners;
import com.craftaro.skyblock.listeners.FoodListeners;
import com.craftaro.skyblock.listeners.GrowListeners;
import com.craftaro.skyblock.listeners.InteractListeners;
import com.craftaro.skyblock.listeners.InventoryListeners;
import com.craftaro.skyblock.listeners.ItemListeners;
import com.craftaro.skyblock.listeners.JoinListeners;
import com.craftaro.skyblock.listeners.MoveListeners;
import com.craftaro.skyblock.listeners.PistonListeners;
import com.craftaro.skyblock.listeners.PortalListeners;
import com.craftaro.skyblock.listeners.ProjectileListeners;
import com.craftaro.skyblock.listeners.QuitListeners;
import com.craftaro.skyblock.listeners.RespawnListeners;
import com.craftaro.skyblock.listeners.SpawnerListeners;
import com.craftaro.skyblock.listeners.SpongeListeners;
import com.craftaro.skyblock.listeners.TeleportListeners;
import com.craftaro.skyblock.listeners.WorldListeners;
import com.craftaro.skyblock.listeners.hooks.EpicSpawners;
import com.craftaro.skyblock.listeners.hooks.UltimateStacker;
import com.craftaro.skyblock.localization.LocalizationManager;
import com.craftaro.skyblock.menus.admin.Creator;
import com.craftaro.skyblock.menus.admin.Generator;
import com.craftaro.skyblock.menus.admin.Levelling;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.permission.PermissionManager;
import com.craftaro.skyblock.placeholder.PlaceholderManager;
import com.craftaro.skyblock.playerdata.PlayerDataManager;
import com.craftaro.skyblock.playtime.PlaytimeTask;
import com.craftaro.skyblock.scoreboard.ScoreboardManager;
import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.stackable.StackableManager;
import com.craftaro.skyblock.structure.StructureManager;
import com.craftaro.skyblock.tasks.HologramTask;
import com.craftaro.skyblock.tasks.MobNetherWaterTask;
import com.craftaro.skyblock.upgrade.UpgradeManager;
import com.craftaro.skyblock.usercache.UserCacheManager;
import com.craftaro.skyblock.visit.VisitManager;
import com.craftaro.skyblock.visit.VisitTask;
import com.craftaro.skyblock.world.WorldManager;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.HandlerList;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class SkyBlock extends SongodaPlugin {
private FileManager fileManager;
private final WorldManager worldManager = new WorldManager(this);
private UserCacheManager userCacheManager;
private VisitManager visitManager;
private BanManager banManager;
private IslandManager islandManager;
private UpgradeManager upgradeManager;
private PlayerDataManager playerDataManager;
private CooldownManager cooldownManager;
private ScoreboardManager scoreboardManager;
private InviteManager inviteManager;
private BiomeManager biomeManager;
private IslandLevelManager levellingManager;
private EconomyManager economyManager;
private CommandManager commandManager;
private StructureManager structureManager;
private StackableManager stackableManager;
private SoundManager soundManager;
private GeneratorManager generatorManager;
private LeaderboardManager leaderboardManager;
private PlaceholderManager placeholderManager;
private MessageManager messageManager;
private HologramTask hologramTask;
private MobNetherWaterTask mobNetherWaterTask;
private LimitationInstanceHandler limitationHandler;
private LocalizationManager localizationManager;
private RewardManager rewardManager;
private FabledChallenge fabledChallenge;
private BankManager bankManager;
private PermissionManager permissionManager;
private Permission vaultPermission;
private boolean paper;
private boolean paperAsync;
private final GuiManager guiManager = new GuiManager(this);
/**
* @deprecated Use {@link org.bukkit.plugin.java.JavaPlugin#getPlugin(Class)} instead
*/
@Deprecated
public static SkyBlock getInstance() {
return getPlugin(SkyBlock.class);
}
// Add ymlFiles to cache
private FileConfiguration biomes;
private FileConfiguration challenges;
private FileConfiguration config;
private FileConfiguration generators;
private FileConfiguration language;
private FileConfiguration levelling;
private FileConfiguration limits;
private FileConfiguration menus;
private FileConfiguration placeholders;
private FileConfiguration rewards;
private FileConfiguration scoreboard;
private FileConfiguration settings;
private FileConfiguration stackables;
private FileConfiguration upgrades;
@Override
public void onPluginLoad() {
}
@Override
public void onPluginEnable() {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_20) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) {
this.getLogger().warning("This Minecraft version is not officially supported.");
}
if (this.paper = ServerProject.isServer(ServerProject.PAPER)) {
try {
Bukkit.spigot().getClass().getMethod("getPaperConfig");
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) {
this.paperAsync = true;
} else {
this.paperAsync = ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) &&
Bukkit.spigot().getPaperConfig().getBoolean("settings.async-chunks.enable", false);
}
} catch (NoSuchMethodException ignored) {
this.paperAsync = false;
}
this.getLogger().info("Enabling Paper hooks");
}
SongodaCore.registerPlugin(this, 17, XMaterial.GRASS_BLOCK);
// Load Economy
this.economyManager = new EconomyManager(this);
// Load Holograms
HologramManager.load(this);
this.fileManager = new FileManager(this);
if (!loadConfigs()) {
this.getServer().getPluginManager().disablePlugin(this);
return;
}
this.permissionManager = new PermissionManager(this);
this.localizationManager = new LocalizationManager();
this.worldManager.loadWorlds();
this.userCacheManager = new UserCacheManager(this);
this.visitManager = new VisitManager(this);
this.banManager = new BanManager(this);
this.islandManager = new IslandManager(this);
this.upgradeManager = new UpgradeManager(this);
this.playerDataManager = new PlayerDataManager(this);
this.cooldownManager = new CooldownManager(this);
this.limitationHandler = new LimitationInstanceHandler();
this.fabledChallenge = new FabledChallenge(this);
this.scoreboardManager = new ScoreboardManager(this);
this.inviteManager = new InviteManager(this);
this.biomeManager = new BiomeManager(this);
this.levellingManager = new IslandLevelManager(this);
this.commandManager = new CommandManager(this);
this.structureManager = new StructureManager(this);
this.soundManager = new SoundManager(this);
if (this.config.getBoolean("Island.Generator.Enable")) {
this.generatorManager = new GeneratorManager(this);
}
if (this.config.getBoolean("Island.Stackable.Enable")) {
this.stackableManager = new StackableManager(this);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> this.stackableManager.loadSavedStackables(), 5L);
}
this.leaderboardManager = new LeaderboardManager(this);
this.placeholderManager = new PlaceholderManager(this);
this.placeholderManager.registerPlaceholders();
this.messageManager = new MessageManager(this);
this.rewardManager = new RewardManager(this);
this.rewardManager.loadRewards();
this.bankManager = new BankManager(this);
if (this.config.getBoolean("Island.Task.PlaytimeTask")) {
new PlaytimeTask(this.playerDataManager, this.islandManager).runTaskTimerAsynchronously(this, 0L, 20L);
}
if (this.config.getBoolean("Island.Task.VisitTask")) {
new VisitTask(this.playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
}
new ConfirmationTask(this.playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
// Start Tasks
this.hologramTask = HologramTask.startTask(this);
this.mobNetherWaterTask = MobNetherWaterTask.startTask(this);
PluginManager pluginManager = getServer().getPluginManager();
pluginManager.registerEvents(new JoinListeners(this), this);
pluginManager.registerEvents(new QuitListeners(this), this);
pluginManager.registerEvents(new BlockListeners(this), this);
pluginManager.registerEvents(new InteractListeners(this), this);
pluginManager.registerEvents(new EntityListeners(this), this);
pluginManager.registerEvents(new BucketListeners(this), this);
pluginManager.registerEvents(new ProjectileListeners(this), this);
pluginManager.registerEvents(new InventoryListeners(this), this);
pluginManager.registerEvents(new ItemListeners(this), this);
pluginManager.registerEvents(new TeleportListeners(this), this);
pluginManager.registerEvents(new PortalListeners(this), this);
pluginManager.registerEvents(new MoveListeners(this), this);
pluginManager.registerEvents(new DeathListeners(this), this);
pluginManager.registerEvents(new RespawnListeners(this), this);
pluginManager.registerEvents(new ChatListeners(this), this);
pluginManager.registerEvents(new SpawnerListeners(this), this);
pluginManager.registerEvents(new FoodListeners(this), this);
pluginManager.registerEvents(new GrowListeners(this), this);
pluginManager.registerEvents(new PistonListeners(this), this);
pluginManager.registerEvents(new FallBreakListeners(this), this);
pluginManager.registerEvents(new WorldListeners(this), this);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
pluginManager.registerEvents(new SpongeListeners(this), this);
}
if (pluginManager.isPluginEnabled("EpicSpawners")) {
pluginManager.registerEvents(new EpicSpawners(this), this);
}
if (pluginManager.isPluginEnabled("UltimateStacker")) {
pluginManager.registerEvents(new UltimateStacker(this), this);
}
pluginManager.registerEvents(new Levelling(), this);
pluginManager.registerEvents(new Generator(), this);
pluginManager.registerEvents(new Creator(), this);
this.getCommand("skyblock").setExecutor(new SkyBlockCommand(this));
if (pluginManager.isPluginEnabled("Vault")) {
this.vaultPermission = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
}
switch (this.config.getString("Economy.Manager", "Default")) {
case "Vault":
getEconomyManager().setEconomy("Vault");
break;
case "PlayerPoints":
getEconomyManager().setEconomy("PlayerPoints");
break;
case "Reserve":
getEconomyManager().setEconomy("Reserve");
break;
default:
this.getLogger().warning("EconomyManager is default");
}
LogManager.load();
SkyBlockAPI.setImplementation(this);
}
@Override
public void onPluginDisable() {
if (this.userCacheManager != null) {
this.userCacheManager.onDisable();
}
if (this.scoreboardManager != null) {
this.scoreboardManager.disable();
}
if (this.islandManager != null) {
this.islandManager.onDisable();
}
if (this.visitManager != null) {
this.visitManager.onDisable();
}
if (this.banManager != null) {
this.banManager.onDisable();
}
if (this.playerDataManager != null) {
this.playerDataManager.onDisable();
}
if (this.cooldownManager != null) {
this.cooldownManager.onDisable();
}
if (this.hologramTask != null) {
this.hologramTask.onDisable();
}
if (this.mobNetherWaterTask != null) {
this.mobNetherWaterTask.onDisable();
}
if (this.fabledChallenge != null) {
this.fabledChallenge.onDisable();
}
HandlerList.unregisterAll(this);
}
@Override
public void onDataLoad() {
}
@Override
public void onConfigReload() {
if (!loadConfigs()) {
this.getLogger().warning("Config are not reload !");
} else {
this.getLogger().info("Configurations Loaded !");
}
}
@Override
public List<Config> getExtraConfig() {
return null;
}
private boolean loadConfigs() {
try {
this.biomes = this.getFileManager().getConfig(new File(this.getDataFolder(), "biomes.yml")).getFileConfiguration();
this.challenges = this.getFileManager().getConfig(new File(this.getDataFolder(), "challenges.yml")).getFileConfiguration();
this.config = this.getFileManager().getConfig(new File(this.getDataFolder(), "config.yml")).getFileConfiguration();
this.generators = this.getFileManager().getConfig(new File(this.getDataFolder(), "generators.yml")).getFileConfiguration();
this.language = this.getFileManager().getConfig(new File(this.getDataFolder(), "language.yml")).getFileConfiguration();
this.levelling = this.getFileManager().getConfig(new File(this.getDataFolder(), "levelling.yml")).getFileConfiguration();
this.limits = this.getFileManager().getConfig(new File(this.getDataFolder(), "limits.yml")).getFileConfiguration();
this.menus = this.getFileManager().getConfig(new File(this.getDataFolder(), "menus.yml")).getFileConfiguration();
this.placeholders = this.getFileManager().getConfig(new File(this.getDataFolder(), "placeholders.yml")).getFileConfiguration();
this.rewards = this.getFileManager().getConfig(new File(this.getDataFolder(), "rewards.yml")).getFileConfiguration();
this.scoreboard = this.getFileManager().getConfig(new File(this.getDataFolder(), "scoreboard.yml")).getFileConfiguration();
this.settings = this.getFileManager().getConfig(new File(this.getDataFolder(), "settings.yml")).getFileConfiguration();
this.stackables = this.getFileManager().getConfig(new File(this.getDataFolder(), "stackables.yml")).getFileConfiguration();
this.upgrades = this.getFileManager().getConfig(new File(this.getDataFolder(), "upgrades.yml")).getFileConfiguration();
return true;
} catch (Exception exception) {
exception.printStackTrace();
return false;
}
}
public String formatText(String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}
public FileManager getFileManager() {
return this.fileManager;
}
public WorldManager getWorldManager() {
return this.worldManager;
}
public UserCacheManager getUserCacheManager() {
return this.userCacheManager;
}
public VisitManager getVisitManager() {
return this.visitManager;
}
public BanManager getBanManager() {
return this.banManager;
}
public BankManager getBankManager() {
return this.bankManager;
}
public IslandManager getIslandManager() {
return this.islandManager;
}
public UpgradeManager getUpgradeManager() {
return this.upgradeManager;
}
public PlayerDataManager getPlayerDataManager() {
return this.playerDataManager;
}
public CooldownManager getCooldownManager() {
return this.cooldownManager;
}
public ScoreboardManager getScoreboardManager() {
return this.scoreboardManager;
}
public void setScoreboardManager(ScoreboardManager scoreboardManager) {
this.scoreboardManager = scoreboardManager;
}
public InviteManager getInviteManager() {
return this.inviteManager;
}
public BiomeManager getBiomeManager() {
return this.biomeManager;
}
public IslandLevelManager getLevellingManager() {
return this.levellingManager;
}
public CommandManager getCommandManager() {
return this.commandManager;
}
public StructureManager getStructureManager() {
return this.structureManager;
}
public SoundManager getSoundManager() {
return this.soundManager;
}
public GeneratorManager getGeneratorManager() {
return this.generatorManager;
}
public void setGeneratorManager(GeneratorManager generatorManager) {
this.generatorManager = generatorManager;
}
public LeaderboardManager getLeaderboardManager() {
return this.leaderboardManager;
}
public PlaceholderManager getPlaceholderManager() {
return this.placeholderManager;
}
public MessageManager getMessageManager() {
return this.messageManager;
}
public HologramTask getHologramTask() {
return this.hologramTask;
}
public MobNetherWaterTask getMobNetherWaterTask() {
return this.mobNetherWaterTask;
}
public StackableManager getStackableManager() {
return this.stackableManager;
}
public LimitationInstanceHandler getLimitationHandler() {
return this.limitationHandler;
}
@Override
public ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, String id) {
return this.worldManager.getWorldGeneratorForMapName(worldName);
}
public LocalizationManager getLocalizationManager() {
return this.localizationManager;
}
public RewardManager getRewardManager() {
return this.rewardManager;
}
public FabledChallenge getFabledChallenge() {
return this.fabledChallenge;
}
public PermissionManager getPermissionManager() {
return this.permissionManager;
}
public GuiManager getGuiManager() {
return this.guiManager;
}
public boolean isPaper() {
return this.paper;
}
public boolean isPaperAsync() {
return this.paperAsync;
}
public Permission getVaultPermission() {
return this.vaultPermission;
}
public EconomyManager getEconomyManager() {
return this.economyManager;
}
public FileConfiguration getBiomes() {
return this.biomes;
}
public FileConfiguration getChallenges() {
return this.challenges;
}
public FileConfiguration getConfiguration() {
return this.config;
}
public FileConfiguration getGenerators() {
return this.generators;
}
public FileConfiguration getLanguage() {
return this.language;
}
public FileConfiguration getLevelling() {
return this.levelling;
}
public FileConfiguration getLimits() {
return this.limits;
}
public FileConfiguration getMenus() {
return this.menus;
}
public FileConfiguration getPlaceholders() {
return this.placeholders;
}
public FileConfiguration getRewards() {
return this.rewards;
}
public FileConfiguration getSettings() {
return this.settings;
}
public FileConfiguration getStackables() {
return this.stackables;
}
public FileConfiguration getUpgrades() {
return this.upgrades;
}
public FileConfiguration getScoreboard() {
return this.scoreboard;
}
}

View File

@ -1,13 +1,12 @@
package com.songoda.skyblock.api;
package com.craftaro.skyblock.api;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.biome.BiomeManager;
import com.songoda.skyblock.api.island.IslandManager;
import com.songoda.skyblock.api.levelling.LevellingManager;
import com.songoda.skyblock.api.structure.StructureManager;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.api.biome.BiomeManager;
import com.craftaro.skyblock.api.island.IslandManager;
import com.craftaro.skyblock.api.levelling.LevellingManager;
import com.craftaro.skyblock.api.structure.StructureManager;
public class SkyBlockAPI {
private static SkyBlock implementation;
private static IslandManager islandManager;

View File

@ -1,13 +1,12 @@
package com.songoda.skyblock.api.ban;
package com.craftaro.skyblock.api.ban;
import com.craftaro.skyblock.api.island.Island;
import com.google.common.base.Preconditions;
import com.songoda.skyblock.api.island.Island;
import java.util.Set;
import java.util.UUID;
public class Ban {
private final Island handle;
public Ban(Island handle) {
@ -26,7 +25,7 @@ public class Ban {
* @return A Set of players that have banned from the Island
*/
public Set<UUID> getBans() {
return handle.getIsland().getBan().getBans();
return this.handle.getIsland().getBan().getBans();
}
/**
@ -34,7 +33,7 @@ public class Ban {
*/
public void addBan(UUID issuer, UUID banned) {
Preconditions.checkArgument(banned != null, "Cannot add ban to null banned uuid");
handle.getIsland().getBan().addBan(issuer, banned);
this.handle.getIsland().getBan().addBan(issuer, banned);
}
/**
@ -42,13 +41,13 @@ public class Ban {
*/
public void removeBan(UUID uuid) {
Preconditions.checkArgument(uuid != null, "Cannot remove ban to null uuid");
handle.getIsland().getBan().removeBan(uuid);
this.handle.getIsland().getBan().removeBan(uuid);
}
/**
* @return Implementation for the Island
*/
public Island getIsland() {
return handle;
return this.handle;
}
}

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.api.bank;
package com.craftaro.skyblock.api.bank;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.bank.Transaction;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.bank.BankManager;
import com.craftaro.skyblock.bank.Transaction;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -10,14 +10,16 @@ import java.util.List;
import java.util.UUID;
public class TransactionLog {
public BankManager getImplementation() {
return SkyBlock.getInstance().getBankManager();
return SkyBlock.getPlugin(SkyBlock.class).getBankManager();
}
public List<Transaction> getLogForPlayer(UUID uuid) {
Player player = Bukkit.getPlayer(uuid);
if (player == null) return null;
if (player == null) {
return null;
}
return getImplementation().getTransactionList(player);
}
}

View File

@ -1,16 +1,15 @@
package com.songoda.skyblock.api.biome;
package com.craftaro.skyblock.api.biome;
import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.island.IslandWorld;
import com.google.common.base.Preconditions;
import com.songoda.core.compatibility.CompatibleBiome;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.island.IslandWorld;
import org.bukkit.block.Biome;
public class BiomeManager {
private final com.craftaro.skyblock.biome.BiomeManager biomeManager;
private final com.songoda.skyblock.biome.BiomeManager biomeManager;
public BiomeManager(com.songoda.skyblock.biome.BiomeManager biomeManager) {
public BiomeManager(com.craftaro.skyblock.biome.BiomeManager biomeManager) {
this.biomeManager = biomeManager;
}
@ -21,6 +20,6 @@ public class BiomeManager {
Preconditions.checkArgument(island != null, "Cannot set biome to null island");
Preconditions.checkArgument(biome != null, "Cannot set biome to null biome");
this.biomeManager.setBiome(island.getIsland(), IslandWorld.Normal, CompatibleBiome.getBiome(biome), null);
this.biomeManager.setBiome(island.getIsland(), IslandWorld.NORMAL, CompatibleBiome.getBiome(biome), null);
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandBanEvent extends IslandEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final OfflinePlayer issuer, banned;
private boolean cancelled = false;
@ -22,16 +22,16 @@ public class IslandBanEvent extends IslandEvent implements Cancellable {
}
public OfflinePlayer getIssuer() {
return issuer;
return this.issuer;
}
public OfflinePlayer getBanned() {
return banned;
return this.banned;
}
@Override
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
@Override
@ -40,7 +40,7 @@ public class IslandBanEvent extends IslandEvent implements Cancellable {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.block.Biome;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandBiomeChangeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private Biome biome;
@ -20,7 +20,7 @@ public class IslandBiomeChangeEvent extends IslandEvent {
}
public Biome getBiome() {
return biome;
return this.biome;
}
public void setBiome(Biome biome) {
@ -28,7 +28,7 @@ public class IslandBiomeChangeEvent extends IslandEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandCreateEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Player player;
@ -20,11 +20,11 @@ public class IslandCreateEvent extends IslandEvent {
}
public Player getPlayer() {
return player;
return this.player;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandDeleteEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
public IslandDeleteEvent(Island island) {
@ -16,7 +16,7 @@ public class IslandDeleteEvent extends IslandEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,22 +1,21 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.event.Event;
public abstract class IslandEvent extends Event {
private final Island island;
protected IslandEvent(Island island) {
this.island = island;
}
protected IslandEvent(Island island, boolean async) {
super(async);
protected IslandEvent(Island island, boolean isAsync) {
super(isAsync);
this.island = island;
}
public Island getIsland() {
return island;
return this.island;
}
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.invite.IslandInvitation;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.invite.IslandInvitation;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandInviteEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final IslandInvitation invite;
@ -16,15 +16,15 @@ public class IslandInviteEvent extends IslandEvent {
}
public IslandInvitation getInvite() {
return invite;
return this.invite;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public HandlerList getHandlerList() {
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,13 +1,13 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.api.island.IslandRole;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.IslandRole;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandKickEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Player kicker;
private final OfflinePlayer kicked;
@ -26,19 +26,19 @@ public class IslandKickEvent extends IslandEvent {
}
public OfflinePlayer getKicked() {
return kicked;
return this.kicked;
}
public Player getKicker() {
return kicker;
return this.kicker;
}
public IslandRole getRole() {
return role;
return this.role;
}
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
public void setCancelled(boolean cancel) {
@ -46,7 +46,7 @@ public class IslandKickEvent extends IslandEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.api.island.IslandLevel;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.IslandLevel;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandLevelChangeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final IslandLevel level;
@ -20,11 +20,11 @@ public class IslandLevelChangeEvent extends IslandEvent {
}
public IslandLevel getLevel() {
return level;
return this.level;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandLoadEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
public IslandLoadEvent(Island island) {
@ -16,7 +16,7 @@ public class IslandLoadEvent extends IslandEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.api.island.IslandLocation;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.IslandLocation;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandLocationChangeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final IslandLocation location;
@ -20,11 +20,11 @@ public class IslandLocationChangeEvent extends IslandEvent {
}
public IslandLocation getLocation() {
return location;
return this.location;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,14 +1,14 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.api.island.IslandMessage;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.IslandMessage;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class IslandMessageChangeEvent extends IslandEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final IslandMessage message;
private boolean cancelled = false;
@ -27,11 +27,11 @@ public class IslandMessageChangeEvent extends IslandEvent implements Cancellable
}
public IslandMessage getMessage() {
return message;
return this.message;
}
public List<String> getLines() {
return lines;
return this.lines;
}
public void setLines(List<String> lines) {
@ -39,7 +39,7 @@ public class IslandMessageChangeEvent extends IslandEvent implements Cancellable
}
public String getAuthor() {
return author;
return this.author;
}
public void setAuthor(String author) {
@ -48,7 +48,7 @@ public class IslandMessageChangeEvent extends IslandEvent implements Cancellable
@Override
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
@Override
@ -57,7 +57,7 @@ public class IslandMessageChangeEvent extends IslandEvent implements Cancellable
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,30 +1,30 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
@Deprecated
public class IslandOpenEvent extends IslandEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final boolean open;
private boolean cancelled = false;
@Deprecated
public IslandOpenEvent(Island island, boolean open) {
super(island);
this.open = open;
}
@Deprecated
public boolean isOpen() {
return open;
return this.open;
}
@Override
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
@Override
@ -33,11 +33,11 @@ public class IslandOpenEvent extends IslandEvent implements Cancellable {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public HandlerList getHandlerList() {
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,30 +1,38 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class IslandOwnershipTransferEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final OfflinePlayer owner;
private final UUID previousOwnerId;
public IslandOwnershipTransferEvent(Island island, OfflinePlayer owner) {
public IslandOwnershipTransferEvent(Island island, OfflinePlayer owner, UUID previousOwnerId) {
super(island);
this.owner = owner;
this.previousOwnerId = previousOwnerId;
}
public OfflinePlayer getOwner() {
return this.owner;
}
public UUID getPreviousOwnerId() {
return this.previousOwnerId;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
public OfflinePlayer getOwner() {
return owner;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandPasswordChangeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private String password;
@ -19,7 +19,7 @@ public class IslandPasswordChangeEvent extends IslandEvent {
}
public String getPassword() {
return password;
return this.password;
}
public void setPassword(String password) {
@ -27,7 +27,7 @@ public class IslandPasswordChangeEvent extends IslandEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.api.island.IslandRole;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.IslandRole;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandRoleChangeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final OfflinePlayer player;
@ -23,15 +23,15 @@ public class IslandRoleChangeEvent extends IslandEvent {
}
public OfflinePlayer getPlayer() {
return player;
return this.player;
}
public IslandRole getRole() {
return role;
return this.role;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.api.island.IslandStatus;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.IslandStatus;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandStatusChangeEvent extends IslandEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final IslandStatus status;
private boolean cancelled = false;
@ -17,12 +17,12 @@ public class IslandStatusChangeEvent extends IslandEvent implements Cancellable
}
public IslandStatus getStatus() {
return status;
return this.status;
}
@Override
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
@Override
@ -31,11 +31,11 @@ public class IslandStatusChangeEvent extends IslandEvent implements Cancellable
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public HandlerList getHandlerList() {
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandUnbanEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final OfflinePlayer unbanned;
@ -20,11 +20,11 @@ public class IslandUnbanEvent extends IslandEvent {
}
public OfflinePlayer getUnbanned() {
return unbanned;
return this.unbanned;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandUnloadEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
public IslandUnloadEvent(Island island) {
@ -16,7 +16,7 @@ public class IslandUnloadEvent extends IslandEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.api.island.IslandUpgrade;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.IslandUpgrade;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandUpgradeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Player player;
@ -23,15 +23,15 @@ public class IslandUpgradeEvent extends IslandEvent {
}
public Player getPlayer() {
return player;
return this.player;
}
public IslandUpgrade getUpgrade() {
return upgrade;
return this.upgrade;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.island;
package com.craftaro.skyblock.api.event.island;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.WeatherType;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class IslandWeatherChangeEvent extends IslandEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final boolean sync;
private final WeatherType weather;
@ -23,19 +23,19 @@ public class IslandWeatherChangeEvent extends IslandEvent {
}
public WeatherType getWeather() {
return weather;
return this.weather;
}
public int getTime() {
return time;
return this.time;
}
public boolean isSync() {
return sync;
return this.sync;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,10 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
public abstract class PlayerEvent extends Event {
private final Player player;
private final Island island;
@ -14,17 +13,17 @@ public abstract class PlayerEvent extends Event {
this.island = island;
}
protected PlayerEvent(Player player, Island island, boolean async) {
super(async);
protected PlayerEvent(Player player, Island island, boolean isAsync) {
super(isAsync);
this.player = player;
this.island = island;
}
public Player getPlayer() {
return player;
return this.player;
}
public Island getIsland() {
return island;
return this.island;
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerIslandChatEvent extends PlayerEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private boolean cancelled = false;
@ -23,7 +23,7 @@ public class PlayerIslandChatEvent extends PlayerEvent implements Cancellable {
}
public String getMessage() {
return message;
return this.message;
}
public void setMessage(String message) {
@ -31,7 +31,7 @@ public class PlayerIslandChatEvent extends PlayerEvent implements Cancellable {
}
public String getFormat() {
return format;
return this.format;
}
public void setFormat(String format) {
@ -39,7 +39,7 @@ public class PlayerIslandChatEvent extends PlayerEvent implements Cancellable {
}
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
public void setCancelled(boolean cancelled) {
@ -47,7 +47,7 @@ public class PlayerIslandChatEvent extends PlayerEvent implements Cancellable {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerIslandChatSwitchEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final boolean chat;
@ -20,11 +20,11 @@ public class PlayerIslandChatSwitchEvent extends PlayerEvent {
}
public boolean isChat() {
return chat;
return this.chat;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerIslandEnterEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
public PlayerIslandEnterEvent(Player player, Island island) {
@ -17,7 +17,7 @@ public class PlayerIslandEnterEvent extends PlayerEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerIslandExitEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
public PlayerIslandExitEvent(Player player, Island island) {
@ -17,7 +17,7 @@ public class PlayerIslandExitEvent extends PlayerEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerIslandJoinEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
private boolean cancelled = false;
@ -19,7 +19,7 @@ public class PlayerIslandJoinEvent extends PlayerEvent {
}
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
public void setCancelled(boolean cancel) {
@ -27,7 +27,7 @@ public class PlayerIslandJoinEvent extends PlayerEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerIslandLeaveEvent extends PlayerEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private boolean cancelled = false;
@ -16,7 +16,7 @@ public class PlayerIslandLeaveEvent extends PlayerEvent implements Cancellable {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
@ -26,7 +26,7 @@ public class PlayerIslandLeaveEvent extends PlayerEvent implements Cancellable {
@Override
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
@Override

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerIslandSwitchEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Island lastIsland;
@ -20,11 +20,11 @@ public class PlayerIslandSwitchEvent extends PlayerEvent {
}
public Island getLastIsland() {
return lastIsland;
return this.lastIsland;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerVoteEvent extends PlayerEvent implements Cancellable {
private boolean cancelled = false;
private static final HandlerList HANDLERS = new HandlerList();
@ -16,7 +16,7 @@ public class PlayerVoteEvent extends PlayerEvent implements Cancellable {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
@ -26,7 +26,7 @@ public class PlayerVoteEvent extends PlayerEvent implements Cancellable {
@Override
public boolean isCancelled() {
return cancelled;
return this.cancelled;
}
@Override

View File

@ -1,8 +1,9 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import com.songoda.skyblock.api.island.Island;
import com.craftaro.skyblock.api.island.Island;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerVoteRemoveEvent extends PlayerEvent {
private static final HandlerList HANDLERS = new HandlerList();
@ -12,11 +13,11 @@ public class PlayerVoteRemoveEvent extends PlayerEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.api.event.player;
package com.craftaro.skyblock.api.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerWithdrawMoneyEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final Player player;
@ -21,15 +21,15 @@ public class PlayerWithdrawMoneyEvent extends Event {
}
public Player getPlayer() {
return player;
return this.player;
}
public double getMoney() {
return money;
return this.money;
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}

View File

@ -1,9 +1,8 @@
package com.songoda.skyblock.api.invite;
package com.craftaro.skyblock.api.invite;
import org.bukkit.entity.Player;
public class IslandInvitation {
private final Player invited, inviter;
private final int time;
@ -14,14 +13,14 @@ public class IslandInvitation {
}
public Player getInvited() {
return invited;
return this.invited;
}
public Player getInviter() {
return inviter;
return this.inviter;
}
public int getTime() {
return time;
return this.time;
}
}

View File

@ -0,0 +1,508 @@
package com.craftaro.skyblock.api.island;
import com.craftaro.skyblock.api.SkyBlockAPI;
import com.craftaro.skyblock.api.ban.Ban;
import com.craftaro.skyblock.api.utils.APIUtil;
import com.craftaro.skyblock.api.visit.Visit;
import com.craftaro.skyblock.island.IslandCoop;
import com.craftaro.skyblock.island.IslandPermission;
import com.craftaro.skyblock.island.IslandStatus;
import com.google.common.base.Preconditions;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.WeatherType;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class Island {
private com.craftaro.skyblock.island.Island handle;
private OfflinePlayer player;
public Island(com.craftaro.skyblock.island.Island handle, OfflinePlayer player) {
this.handle = handle;
this.player = player;
}
/**
* @return The Island UUID
*/
public UUID getIslandUUID() {
return this.handle.getIslandUUID();
}
/**
* @return The Island owner UUID
*/
public UUID getOwnerUUID() {
return this.handle.getOwnerUUID();
}
/**
* @return The original Island owner UUID
*/
public UUID getOriginalOwnerUUID() {
return this.handle.getOriginalOwnerUUID();
}
/**
* @return The Island size
*/
public int getSize() {
return this.handle.getSize();
}
/**
* Set the size of the Island
*/
public void setSize(int size) {
Preconditions.checkArgument(size <= 1000, "Cannot set size to greater than 1000");
Preconditions.checkArgument(size >= 20, "Cannot set size to less than 20");
this.handle.setSize(size);
}
/**
* @return The Island radius
*/
public double getRadius() {
return this.handle.getRadius();
}
/**
* @return true if not null, false otherwise
*/
public boolean hasPassword() {
return this.handle.hasPassword();
}
/**
* Set the password for ownership
*/
public void setPassword(String password) {
Preconditions.checkArgument(password != null, "Cannot set password to null password");
this.handle.setPassword(password);
}
/**
* Get the Location from the World in island world from World in environment.
*
* @return Location of Island
*/
public Location getLocation(IslandWorld world, IslandEnvironment environment) {
Preconditions.checkArgument(world != null, "World in island world null does not exist");
Preconditions.checkArgument(environment != null, "World in environment null does not exist");
return this.handle.getLocation(APIUtil.toImplementation(world), APIUtil.toImplementation(environment));
}
/**
* Set the Location from the World in island world from world in environment
* followed by position
*/
public void setLocation(IslandWorld world, IslandEnvironment environment, int x, int y, int z) {
Preconditions.checkArgument(world != null, "World in island world null does not exist");
Preconditions.checkArgument(environment != null, "World in environment null does not exist");
World bukkitWorld = getLocation(world, environment).getWorld();
this.handle.setLocation(APIUtil.toImplementation(world), APIUtil.toImplementation(environment), new Location(bukkitWorld, x, y, z));
}
/**
* @return true of conditions met, false otherwise
*/
public boolean isBorder() {
return this.handle.isBorder();
}
/**
* Set the border visible to players for the Island
*/
public void setBorder(boolean border) {
this.handle.setBorder(border);
}
/**
* @return The color of the Island border
*/
public IslandBorderColor getBorderColor() {
return APIUtil.fromImplementation(this.handle.getBorderColor());
}
/**
* Set the border color for the Island
*/
public void setBorderColor(IslandBorderColor color) {
Preconditions.checkArgument(color != null, "IslandBorderColor null does not exist");
this.handle.setBorderColor(APIUtil.toImplementation(color));
}
/**
* @return The biome set for the Island
*/
public Biome getBiome() {
return this.handle.getBiome();
}
/**
* Set the biome for the Island
*/
public void setBiome(Biome biome) {
Preconditions.checkArgument(biome != null, "Cannot set biome to null biome");
this.handle.setBiome(biome);
}
/**
* @return true of conditions met, false otherwise
*/
public boolean isDayCycleSynchronizedSynchronized() {
return this.handle.isWeatherSynchronized();
}
/**
* Set the Day Cycle of the Island to be Synchronized with the World cycle
*/
public void setDayCycleSynchronzied(boolean sync) {
this.handle.setWeatherSynchronized(sync);
}
/**
* @return The WeatherType set for the Island
*/
public WeatherType getWeather() {
return this.handle.getWeather();
}
/**
* Set the weather for the Island
*/
public void setWeather(WeatherType weatherType) {
Preconditions.checkArgument(weatherType != null, "Cannot set weather to null weather");
this.handle.setWeather(weatherType);
}
/**
* @return The time set for the Island
*/
public int getTime() {
return this.handle.getTime();
}
/**
* Set the time for the Island
*/
public void setTime(int time) {
this.handle.setTime(time);
}
/**
* @return A Set of cooped players
*/
public Map<UUID, IslandCoop> getCoopPlayers() {
return this.handle.getCoopPlayers();
}
/**
* Add a player to the coop players for the Island
*/
public void addCoopPlayer(UUID uuid, IslandCoop islandCoop) {
Preconditions.checkArgument(uuid != null, "Cannot add coop player to null uuid");
this.handle.addCoopPlayer(uuid, islandCoop);
}
/**
* Add a player to the coop players for the Island
*/
public void addCoopPlayer(OfflinePlayer player, IslandCoop islandCoop) {
Preconditions.checkArgument(player != null, "Cannot add coop player to null player");
this.handle.addCoopPlayer(player.getUniqueId(), islandCoop);
}
/**
* Remove a player from the coop players for the Island
*/
public void removeCoopPlayer(UUID uuid) {
Preconditions.checkArgument(uuid != null, "Cannot remove coop player to null uuid");
this.handle.removeCoopPlayer(uuid);
}
/**
* Remove a player from the coop players for the Island
*/
public void removeCoopPlayer(OfflinePlayer player) {
Preconditions.checkArgument(player != null, "Cannot remove coop player to null player");
this.handle.removeCoopPlayer(player.getUniqueId());
}
/**
* @return true of conditions met, false otherwise
*/
public boolean isCoopPlayer(UUID uuid) {
Preconditions.checkArgument(uuid != null, "Cannot return condition to null uuid");
return this.handle.isCoopPlayer(uuid);
}
/**
* @return true of conditions met, false otherwise
*/
public boolean isCoopPlayer(OfflinePlayer player) {
Preconditions.checkArgument(player != null, "Cannot return condition to null player");
return this.handle.isCoopPlayer(player.getUniqueId());
}
/**
* @return The IslandRole of a player or Visitor if not found
*/
public IslandRole getRole(OfflinePlayer player) {
Preconditions.checkArgument(player != null, "Cannot get role for null player");
if (isCoopPlayer(player.getUniqueId())) {
return IslandRole.COOP;
}
for (com.craftaro.skyblock.island.IslandRole role : com.craftaro.skyblock.island.IslandRole.values()) {
if (this.handle.hasRole(role, player.getUniqueId())) {
return APIUtil.fromImplementation(role);
}
}
return IslandRole.VISITOR;
}
/**
* @return A Set of players with IslandRole
*/
public Set<UUID> getPlayersWithRole(IslandRole role) {
Preconditions.checkArgument(role != null, "Cannot get players will null role");
return this.handle.getRole(APIUtil.toImplementation(role));
}
/**
* Set the IslandRole of a player for the Island
*
* @return true of conditions met, false otherwise
*/
public boolean setRole(OfflinePlayer player, IslandRole role) {
Preconditions.checkArgument(player != null, "Cannot set role of null player");
return setRole(player.getUniqueId(), role);
}
/**
* Set the IslandRole of a player for the Island
*
* @return true of conditions met, false otherwise
*/
public boolean setRole(UUID uuid, IslandRole role) {
Preconditions.checkArgument(uuid != null, "Cannot set role of null player");
Preconditions.checkArgument(role != null, "Cannot set role to null role");
return this.handle.setRole(APIUtil.toImplementation(role), uuid);
}
/**
* Remove the IslandRole of a player for the Island
*
* @return true of conditions met, false otherwise
*/
public boolean removeRole(OfflinePlayer player, IslandRole role) {
Preconditions.checkArgument(player != null, "Cannot remove role of null player");
return removeRole(player.getUniqueId(), role);
}
/**
* Remove the IslandRole of a player for the Island
*
* @return true of conditions met, false otherwise
*/
public boolean removeRole(UUID uuid, IslandRole role) {
Preconditions.checkArgument(uuid != null, "Cannot remove role of null player");
Preconditions.checkArgument(role != null, "Cannot remove role to null role");
return this.handle.removeRole(APIUtil.toImplementation(role), uuid);
}
/**
* @return true of conditions met, false otherwise
*/
public boolean hasRole(OfflinePlayer player, IslandRole role) {
Preconditions.checkArgument(player != null, "Cannot check role of null player");
return this.handle.hasRole(APIUtil.toImplementation(role), player.getUniqueId());
}
/**
* @return true of conditions met, false otherwise
*/
public boolean hasRole(UUID uuid, IslandRole role) {
Preconditions.checkArgument(uuid != null, "Cannot check role of null player");
Preconditions.checkArgument(role != null, "Cannot check role to null role");
return this.handle.hasRole(APIUtil.toImplementation(role), uuid);
}
/**
* Set the condition of an IslandUpgrade for the Island
*/
public void setUpgrade(Player player, IslandUpgrade upgrade, boolean status) {
Preconditions.checkArgument(upgrade != null, "Cannot set upgrade to null upgrade");
this.handle.setUpgrade(player, APIUtil.toImplementation(upgrade), status);
}
/**
* @return true of conditions met, false otherwise
*/
public boolean hasUpgrade(IslandUpgrade upgrade) {
Preconditions.checkArgument(upgrade != null, "Cannot check upgrade to null upgrade");
return this.handle.hasUpgrade(APIUtil.toImplementation(upgrade));
}
/**
* @return true of conditions met, false otherwise
*/
public boolean isUpgrade(IslandUpgrade upgrade) {
Preconditions.checkArgument(upgrade != null, "Cannot check upgrade to null upgrade");
return this.handle.isUpgrade(APIUtil.toImplementation(upgrade));
}
/**
* @return A List of Settings of an IslandRole for the Island
*/
public List<IslandPermission> getSettings(IslandRole role) {
Preconditions.checkArgument(role != null, "Cannot get settings to null role");
return this.handle.getSettings(APIUtil.toImplementation(role));
}
/**
* @return true of conditions met, false otherwise
*/
@Deprecated
public boolean isOpen() {
return this.handle.getStatus() == com.craftaro.skyblock.island.IslandStatus.OPEN;
}
@Deprecated
public void setOpen(boolean open) {
this.handle.setStatus(open ? com.craftaro.skyblock.island.IslandStatus.OPEN : IslandStatus.CLOSED);
}
/**
* @return A List from IslandMessage for the Island
*/
public List<String> getMessage(IslandMessage message) {
Preconditions.checkArgument(message != null, "Cannot get message for null message");
return this.handle.getMessage(APIUtil.toImplementation(message));
}
/**
* @return The author of an IslandMessage for the Island
*/
public String getMessageAuthor(IslandMessage message) {
Preconditions.checkArgument(message != null, "Cannot get message author for null message");
return this.handle.getMessageAuthor(APIUtil.toImplementation(message));
}
/**
* Set the IslandMessage for the Island
*/
public void setMessage(IslandMessage message, String author, List<String> messageLines) {
Preconditions.checkArgument(message != null, "Cannot set message for null message");
this.handle.setMessage(APIUtil.toImplementation(message), author, messageLines);
}
/**
* @return true of conditions met, false otherwise
*/
public boolean hasStructure() {
return this.handle.hasStructure();
}
/**
* @return The Structure name for the Island
*/
public String getStructure() {
return this.handle.getStructure();
}
/**
* Set the Structure for the Island
*/
public void setStructure(String structure) {
Preconditions.checkArgument(structure != null, "Cannot set structure to null structure");
this.handle.setStructure(structure);
}
/**
* @return The Visit implementation for the Island
*/
public Visit getVisit() {
return new Visit(this);
}
/**
* @return The Ban implementation for the Island
*/
public Ban getBan() {
return new Ban(this);
}
/**
* @return The Level implementation for the Island
*/
public IslandLevel getLevel() {
return new IslandLevel(this);
}
/**
* @return true of conditions met, false otherwise
*/
public boolean isLoaded() {
return this.handle != null;
}
/**
* Loads the Island if unloaded
*/
public void load() {
if (this.handle == null) {
SkyBlockAPI.getImplementation().getIslandManager().loadIsland(this.player);
this.handle = SkyBlockAPI.getImplementation().getIslandManager().getIsland(this.player);
}
}
/**
* Unloads the Island if loaded
*/
public void unload() {
if (this.handle != null) {
SkyBlockAPI.getImplementation().getIslandManager().unloadIsland(getIsland(), null);
this.handle = null;
}
}
/**
* Sets the player of the Island
*/
public void setPlayer(OfflinePlayer player) {
this.player = player;
}
/**
* @return Implementation for the Island
*/
public com.craftaro.skyblock.island.Island getIsland() {
return this.handle;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Island)) {
return false;
}
Island other = (Island) obj;
return other.getIslandUUID().equals(getIslandUUID());
}
}

View File

@ -0,0 +1,5 @@
package com.craftaro.skyblock.api.island;
public enum IslandBorderColor {
BLUE, GREEN, RED
}

View File

@ -1,7 +1,5 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
public enum IslandEnvironment {
ISLAND, VISITOR, MAIN
}

View File

@ -1,13 +1,13 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock;
import com.google.common.base.Preconditions;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.Location;
import org.bukkit.Material;
public class IslandLevel {
private final Island handle;
public IslandLevel(Island handle) {
@ -47,7 +47,7 @@ public class IslandLevel {
*/
public void setMaterialAmount(Material material, int amount) {
Preconditions.checkArgument(material != null, "Cannot set material amount to null material");
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).name(), amount);
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).get().name(), amount);
}
/**
@ -56,7 +56,7 @@ public class IslandLevel {
public void setMaterialAmount(Material material, byte data, int amount) {
Preconditions.checkArgument(material != null, "Cannot set material amount to null material");
//TODO: Add data support
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).name(),
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).get().name(),
amount);
}
@ -66,8 +66,8 @@ public class IslandLevel {
public long getMaterialAmount(Material material) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
XMaterial materials = CompatibleMaterial.getMaterial(material.name()).get();
com.craftaro.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
if (level.getMaterials().containsKey(materials.name())) {
return level.getMaterials().get(materials.name());
@ -82,9 +82,9 @@ public class IslandLevel {
public long getMaterialAmount(Material material, byte data) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
XMaterial materials = CompatibleMaterial.getMaterial(material.name()).get();
//TODO: data support
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
com.craftaro.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
if (level.getMaterials().containsKey(materials.name())) {
return level.getMaterials().get(materials.name());
@ -98,7 +98,7 @@ public class IslandLevel {
*/
public long getMaterialPoints(Material material) {
Preconditions.checkArgument(material != null, "Cannot get material points to null material");
return this.handle.getIsland().getLevel().getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).name());
return this.handle.getIsland().getLevel().getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).get().name());
}
/**
@ -106,8 +106,7 @@ public class IslandLevel {
*/
public long getMaterialPoints(Material material, byte data) {
Preconditions.checkArgument(material != null, "Cannot get material points to null material");
return this.handle.getIsland().getLevel()
.getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).name());
return this.handle.getIsland().getLevel().getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).get().name());
//TODO: add data support
}
@ -115,15 +114,14 @@ public class IslandLevel {
* @return Implementation for the Island
*/
public Island getIsland() {
return handle;
return this.handle;
}
/**
* Update the island level for a determined location
* @param location
*/
public void updateLevel(Location location){
public void updateLevel(Location location) {
Preconditions.checkArgument(location != null, "Cannot update level of a null island");
SkyBlock.getInstance().getLevellingManager().updateLevel(this.handle.getIsland(), location);
SkyBlock.getPlugin(SkyBlock.class).getLevellingManager().updateLevel(this.handle.getIsland(), location);
}
}

View File

@ -1,10 +1,9 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
import org.bukkit.Location;
import org.bukkit.World;
public class IslandLocation {
private final IslandEnvironment environment;
private final IslandWorld world;
private final Location location;
@ -16,30 +15,30 @@ public class IslandLocation {
}
public IslandEnvironment getEnvironment() {
return environment;
return this.environment;
}
public IslandWorld getWorld() {
return world;
return this.world;
}
public Location getLocation() {
return location;
return this.location;
}
public World getBukkitWorld() {
return location.getWorld();
return this.location.getWorld();
}
public int getX() {
return location.getBlockX();
return this.location.getBlockX();
}
public int getY() {
return location.getBlockY();
return this.location.getBlockY();
}
public int getZ() {
return location.getBlockZ();
return this.location.getBlockZ();
}
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.api.structure.Structure;
import com.craftaro.skyblock.api.utils.APIUtil;
import com.craftaro.skyblock.permission.PermissionManager;
import com.google.common.base.Preconditions;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.structure.Structure;
import com.songoda.skyblock.api.utils.APIUtil;
import com.songoda.skyblock.permission.PermissionManager;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
@ -15,13 +15,12 @@ import java.util.Set;
import java.util.UUID;
public class IslandManager {
private final com.songoda.skyblock.island.IslandManager islandManager;
private final com.craftaro.skyblock.island.IslandManager islandManager;
private final PermissionManager permissionManager;
public IslandManager(com.songoda.skyblock.island.IslandManager islandManager) {
public IslandManager(com.craftaro.skyblock.island.IslandManager islandManager) {
this.islandManager = islandManager;
this.permissionManager = SkyBlock.getInstance().getPermissionManager();
this.permissionManager = SkyBlock.getPlugin(SkyBlock.class).getPermissionManager();
}
/**
@ -29,7 +28,7 @@ public class IslandManager {
*/
public static boolean hasIsland(OfflinePlayer player) {
Preconditions.checkArgument(player != null, "Cannot check island to null player");
return new com.songoda.skyblock.utils.player.OfflinePlayer(player.getUniqueId()).getOwner() != null;
return new com.craftaro.skyblock.utils.player.OfflinePlayer(player.getUniqueId()).getOwner() != null;
}
/**
@ -45,7 +44,7 @@ public class IslandManager {
* Gives Island ownership to a player of their Island
*/
public void giveOwnership(Island island, OfflinePlayer player) {
Preconditions.checkArgument(player != null, "Cannot give ownership to null island");
Preconditions.checkArgument(island != null, "Cannot give ownership to null island");
Preconditions.checkArgument(player != null, "Cannot give ownership to null player");
this.islandManager.giveOwnership(island.getIsland(), player);
@ -190,7 +189,7 @@ public class IslandManager {
Preconditions.checkArgument(structure != null, "Cannot create island to null structure");
if (!hasIsland(player)) {
return islandManager.createIsland(player, (com.songoda.skyblock.structure.Structure) structure);
return this.islandManager.createIsland(player, (com.craftaro.skyblock.structure.Structure) structure);
}
return false;
@ -207,7 +206,7 @@ public class IslandManager {
this.islandManager.deleteIsland(island.getIsland(), true);
}
/*
* If force is set to true, the island will be deleted and no conditions will be
* checked, else it will only delete the island if the island deletion
@ -261,7 +260,7 @@ public class IslandManager {
public Island getIslandAtLocation(Location location) {
Preconditions.checkArgument(location != null, "Cannot get island to null location");
com.songoda.skyblock.island.Island island = this.islandManager.getIslandAtLocation(location);
com.craftaro.skyblock.island.Island island = this.islandManager.getIslandAtLocation(location);
if (island != null) {
return island.getAPIWrapper();
@ -289,7 +288,7 @@ public class IslandManager {
public Island getIslandPlayerAt(Player player) {
Preconditions.checkArgument(player != null, "Cannot get Island to null player");
com.songoda.skyblock.island.Island island = this.islandManager.getIslandPlayerAt(player);
com.craftaro.skyblock.island.Island island = this.islandManager.getIslandPlayerAt(player);
if (island != null) {
return island.getAPIWrapper();
@ -320,7 +319,7 @@ public class IslandManager {
public Island getIsland(OfflinePlayer player) {
Preconditions.checkArgument(player != null, "Cannot get island to null player");
com.songoda.skyblock.island.Island island = this.islandManager.getIsland(player);
com.craftaro.skyblock.island.Island island = this.islandManager.getIsland(player);
if (island != null) {
return island.getAPIWrapper();
@ -339,7 +338,7 @@ public class IslandManager {
public Island getIslandByUUID(UUID islandUUID) {
Preconditions.checkArgument(islandUUID != null, "Cannot get island with a null UUID");
com.songoda.skyblock.island.Island island = this.islandManager.getIslandByUUID(islandUUID);
com.craftaro.skyblock.island.Island island = this.islandManager.getIslandByUUID(islandUUID);
return island != null ? island.getAPIWrapper() : null;
}
@ -349,12 +348,9 @@ public class IslandManager {
*/
public List<Island> getIslands() {
List<Island> islands = new ArrayList<>();
for (int i = 0; i < this.islandManager.getIslands().size(); i++) {
islands.add(this.islandManager.getIslands().get(this.islandManager.getIslands().keySet().toArray()[i])
.getAPIWrapper());
islands.add(this.islandManager.getIslands().get(this.islandManager.getIslands().keySet().toArray()[i]).getAPIWrapper());
}
return islands;
}
}

View File

@ -1,7 +1,5 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
public enum IslandMessage {
WELCOME, SIGNATURE, SIGN
}

View File

@ -1,7 +1,5 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
public enum IslandRole {
COOP, VISITOR, MEMBER, OPERATOR, OWNER
}

View File

@ -0,0 +1,5 @@
package com.craftaro.skyblock.api.island;
public enum IslandStatus {
OPEN, CLOSED, WHITELISTED
}

View File

@ -1,7 +1,5 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
public enum IslandUpgrade {
CROP, SPAWNER, FLY, DROPS, SIZE, SPEED, JUMP
}

View File

@ -1,7 +1,5 @@
package com.songoda.skyblock.api.island;
package com.craftaro.skyblock.api.island;
public enum IslandWorld {
OVERWORLD, NETHER, END
}

View File

@ -1,15 +1,14 @@
package com.songoda.skyblock.api.levelling;
package com.craftaro.skyblock.api.levelling;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.skyblock.api.island.Island;
import com.craftaro.skyblock.levelling.IslandLevelManager;
import com.craftaro.skyblock.levelling.calculator.Calculator;
import com.craftaro.skyblock.levelling.calculator.CalculatorRegistry;
import com.google.common.base.Preconditions;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.api.island.Island;
import com.songoda.skyblock.levelling.IslandLevelManager;
import com.songoda.skyblock.levelling.calculator.Calculator;
import com.songoda.skyblock.levelling.calculator.CalculatorRegistry;
import org.bukkit.Material;
public class LevellingManager {
private final IslandLevelManager levellingManager;
public LevellingManager(IslandLevelManager levellingManager) {
@ -23,15 +22,13 @@ public class LevellingManager {
Preconditions.checkArgument(island != null, "Cannot calculate points to null island");
this.levellingManager.startScan(null, island.getIsland());
}
/**
* Register a new material calculator for a determined material
* @param calculator
* @param material
*/
public void registerCalculator(Calculator calculator, Material material){
public void registerCalculator(Calculator calculator, Material material) {
Preconditions.checkArgument(calculator != null, "Cannot use a null calculator");
Preconditions.checkArgument(material != null, "Cannot use a null material");
CalculatorRegistry.registerCalculator(calculator, CompatibleMaterial.getMaterial(material));
CalculatorRegistry.registerCalculator(calculator, CompatibleMaterial.getMaterial(material).get());
}
}

View File

@ -1,16 +1,15 @@
package com.songoda.skyblock.api.structure;
package com.craftaro.skyblock.api.structure;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import java.util.List;
public interface Structure {
String getName();
CompatibleMaterial getMaterial();
XMaterial getMaterial();
void setMaterial(CompatibleMaterial material);
void setMaterial(XMaterial material);
String getOverworldFile();

View File

@ -1,13 +1,12 @@
package com.songoda.skyblock.api.structure;
package com.craftaro.skyblock.api.structure;
import java.util.ArrayList;
import java.util.List;
public class StructureManager {
private final com.craftaro.skyblock.structure.StructureManager structureManager;
private final com.songoda.skyblock.structure.StructureManager structureManager;
public StructureManager(com.songoda.skyblock.structure.StructureManager structureManager) {
public StructureManager(com.craftaro.skyblock.structure.StructureManager structureManager) {
this.structureManager = structureManager;
}
@ -22,13 +21,13 @@ public class StructureManager {
* @return true of conditions met, false otherwise
*/
public boolean hasStructure(String structure) {
return structureManager.containsStructure(structure);
return this.structureManager.containsStructure(structure);
}
/**
* @return A List of Structures for an Island
*/
public List<Structure> getStructures() {
return new ArrayList<>(structureManager.getStructures());
return new ArrayList<>(this.structureManager.getStructures());
}
}

View File

@ -0,0 +1,219 @@
package com.craftaro.skyblock.api.utils;
import com.craftaro.core.nms.world.NmsWorldBorder;
import com.craftaro.skyblock.api.island.IslandBorderColor;
import com.craftaro.skyblock.api.island.IslandUpgrade;
import com.craftaro.skyblock.api.island.IslandWorld;
import com.craftaro.skyblock.island.IslandEnvironment;
import com.craftaro.skyblock.island.IslandMessage;
import com.craftaro.skyblock.island.IslandRole;
import com.craftaro.skyblock.island.IslandStatus;
import com.craftaro.skyblock.upgrade.Upgrade;
public final class APIUtil {
public static com.craftaro.skyblock.island.IslandWorld toImplementation(IslandWorld world) {
switch (world) {
case NETHER:
return com.craftaro.skyblock.island.IslandWorld.NETHER;
case OVERWORLD:
return com.craftaro.skyblock.island.IslandWorld.NORMAL;
case END:
return com.craftaro.skyblock.island.IslandWorld.END;
}
return null;
}
public static IslandWorld fromImplementation(com.craftaro.skyblock.island.IslandWorld world) {
switch (world) {
case NETHER:
return IslandWorld.NETHER;
case NORMAL:
return IslandWorld.OVERWORLD;
case END:
return IslandWorld.END;
}
return null;
}
public static IslandEnvironment toImplementation(com.craftaro.skyblock.api.island.IslandEnvironment environment) {
switch (environment) {
case ISLAND:
return IslandEnvironment.ISLAND;
case MAIN:
return IslandEnvironment.MAIN;
case VISITOR:
return IslandEnvironment.VISITOR;
}
return null;
}
public static com.craftaro.skyblock.api.island.IslandEnvironment fromImplementation(IslandEnvironment environment) {
switch (environment) {
case ISLAND:
return com.craftaro.skyblock.api.island.IslandEnvironment.ISLAND;
case MAIN:
return com.craftaro.skyblock.api.island.IslandEnvironment.MAIN;
case VISITOR:
return com.craftaro.skyblock.api.island.IslandEnvironment.VISITOR;
}
return null;
}
public static IslandStatus toImplementation(com.craftaro.skyblock.api.island.IslandStatus status) {
switch (status) {
case OPEN:
return IslandStatus.OPEN;
case CLOSED:
return IslandStatus.CLOSED;
case WHITELISTED:
return IslandStatus.WHITELISTED;
}
return null;
}
public static com.craftaro.skyblock.api.island.IslandStatus fromImplementation(IslandStatus status) {
switch (status) {
case OPEN:
return com.craftaro.skyblock.api.island.IslandStatus.OPEN;
case CLOSED:
return com.craftaro.skyblock.api.island.IslandStatus.CLOSED;
case WHITELISTED:
return com.craftaro.skyblock.api.island.IslandStatus.WHITELISTED;
}
return null;
}
public static IslandRole toImplementation(com.craftaro.skyblock.api.island.IslandRole role) {
switch (role) {
case VISITOR:
return IslandRole.VISITOR;
case COOP:
return IslandRole.COOP;
case MEMBER:
return IslandRole.MEMBER;
case OPERATOR:
return IslandRole.OPERATOR;
case OWNER:
return IslandRole.OWNER;
}
return null;
}
public static com.craftaro.skyblock.api.island.IslandRole fromImplementation(IslandRole role) {
switch (role) {
case VISITOR:
return com.craftaro.skyblock.api.island.IslandRole.VISITOR;
case COOP:
return com.craftaro.skyblock.api.island.IslandRole.COOP;
case MEMBER:
return com.craftaro.skyblock.api.island.IslandRole.MEMBER;
case OPERATOR:
return com.craftaro.skyblock.api.island.IslandRole.OPERATOR;
case OWNER:
return com.craftaro.skyblock.api.island.IslandRole.OWNER;
}
return null;
}
public static Upgrade.Type toImplementation(IslandUpgrade upgrade) {
switch (upgrade) {
case CROP:
return Upgrade.Type.CROP;
case DROPS:
return Upgrade.Type.DROPS;
case FLY:
return Upgrade.Type.FLY;
case JUMP:
return Upgrade.Type.JUMP;
case SIZE:
return Upgrade.Type.SIZE;
case SPAWNER:
return Upgrade.Type.SPAWNER;
case SPEED:
return Upgrade.Type.SPEED;
}
return null;
}
public static IslandUpgrade fromImplementation(Upgrade.Type upgrade) {
switch (upgrade) {
case CROP:
return IslandUpgrade.CROP;
case DROPS:
return IslandUpgrade.DROPS;
case FLY:
return IslandUpgrade.FLY;
case JUMP:
return IslandUpgrade.JUMP;
case SIZE:
return IslandUpgrade.SIZE;
case SPAWNER:
return IslandUpgrade.SPAWNER;
case SPEED:
return IslandUpgrade.SPEED;
}
return null;
}
public static IslandMessage toImplementation(com.craftaro.skyblock.api.island.IslandMessage message) {
switch (message) {
case SIGN:
return IslandMessage.SIGN;
case SIGNATURE:
return IslandMessage.SIGNATURE;
case WELCOME:
return IslandMessage.WELCOME;
}
return null;
}
public static com.craftaro.skyblock.api.island.IslandMessage fromImplementation(IslandMessage message) {
switch (message) {
case SIGN:
return com.craftaro.skyblock.api.island.IslandMessage.SIGN;
case SIGNATURE:
return com.craftaro.skyblock.api.island.IslandMessage.SIGNATURE;
case WELCOME:
return com.craftaro.skyblock.api.island.IslandMessage.WELCOME;
}
return null;
}
public static NmsWorldBorder.BorderColor toImplementation(IslandBorderColor color) {
switch (color) {
case BLUE:
return NmsWorldBorder.BorderColor.BLUE;
case GREEN:
return NmsWorldBorder.BorderColor.GREEN;
case RED:
return NmsWorldBorder.BorderColor.RED;
}
return null;
}
public static IslandBorderColor fromImplementation(NmsWorldBorder.BorderColor color) {
switch (color) {
case BLUE:
return IslandBorderColor.BLUE;
case GREEN:
return IslandBorderColor.GREEN;
case RED:
return IslandBorderColor.RED;
}
return null;
}
}

View File

@ -1,13 +1,12 @@
package com.songoda.skyblock.api.visit;
package com.craftaro.skyblock.api.visit;
import com.craftaro.skyblock.api.island.Island;
import com.google.common.base.Preconditions;
import com.songoda.skyblock.api.island.Island;
import java.util.Set;
import java.util.UUID;
public class Visit {
private final Island handle;
public Visit(Island handle) {
@ -94,6 +93,6 @@ public class Visit {
* @return Implementation for the Island
*/
public Island getIsland() {
return handle;
return this.handle;
}
}

View File

@ -1,19 +1,22 @@
package com.songoda.skyblock.ban;
package com.craftaro.skyblock.ban;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.api.event.island.IslandBanEvent;
import com.craftaro.skyblock.api.event.island.IslandUnbanEvent;
import com.craftaro.skyblock.config.FileManager;
import com.eatthepath.uuid.FastUUID;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.IslandBanEvent;
import com.songoda.skyblock.api.event.island.IslandUnbanEvent;
import com.songoda.skyblock.config.FileManager.Config;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public class Ban {
private UUID islandOwnerUUID;
public Ban(UUID islandOwnerUUID) {
@ -21,7 +24,7 @@ public class Ban {
}
public UUID getOwnerUUID() {
return islandOwnerUUID;
return this.islandOwnerUUID;
}
public void setOwnerUUID(UUID islandOwnerUUID) {
@ -33,18 +36,18 @@ public class Ban {
}
public Set<UUID> getBans() {
SkyBlock plugin = SkyBlock.getInstance();
SkyBlock plugin = SkyBlock.getPlugin(SkyBlock.class);
Set<UUID> islandBans = new HashSet<>();
for (String islandBanList : plugin.getFileManager()
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
FastUUID.toString(islandOwnerUUID) + ".yml"))
.getConfig(new File(new File(plugin.getDataFolder(), "ban-data"), FastUUID.toString(this.islandOwnerUUID) + ".yml"))
.getFileConfiguration().getStringList("Bans")) {
UUID uuid = FastUUID.parseUUID(islandBanList);
if (!Bukkit.getOfflinePlayer(uuid).hasPlayedBefore())
if (!Bukkit.getOfflinePlayer(uuid).hasPlayedBefore()) {
continue;
}
islandBans.add(uuid);
}
@ -53,10 +56,10 @@ public class Ban {
}
public void addBan(UUID issuer, UUID banned) {
SkyBlock plugin = SkyBlock.getInstance();
SkyBlock plugin = SkyBlock.getPlugin(SkyBlock.class);
IslandBanEvent islandBanEvent = new IslandBanEvent(
plugin.getIslandManager().getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID))
plugin.getIslandManager().getIsland(Bukkit.getServer().getOfflinePlayer(this.islandOwnerUUID))
.getAPIWrapper(),
Bukkit.getServer().getOfflinePlayer(issuer), Bukkit.getServer().getOfflinePlayer(banned));
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Bukkit.getServer().getPluginManager().callEvent(islandBanEvent));
@ -64,7 +67,7 @@ public class Ban {
if (!islandBanEvent.isCancelled()) {
FileConfiguration configLoad = plugin.getFileManager()
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
FastUUID.toString(islandOwnerUUID) + ".yml"))
FastUUID.toString(this.islandOwnerUUID) + ".yml"))
.getFileConfiguration();
List<String> islandBans = new ArrayList<>(configLoad.getStringList("Bans"));
@ -75,12 +78,12 @@ public class Ban {
}
public void removeBan(UUID uuid) {
SkyBlock plugin = SkyBlock.getInstance();
SkyBlock plugin = SkyBlock.getPlugin(SkyBlock.class);
List<String> islandBans = new ArrayList<>();
FileConfiguration configLoad = plugin.getFileManager()
.getConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
islandOwnerUUID.toString() + ".yml"))
this.islandOwnerUUID.toString() + ".yml"))
.getFileConfiguration();
for (String islandBanList : configLoad.getStringList("Bans")) {
@ -93,20 +96,20 @@ public class Ban {
Bukkit.getServer().getPluginManager()
.callEvent(new IslandUnbanEvent(plugin.getIslandManager()
.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID)).getAPIWrapper(),
.getIsland(Bukkit.getServer().getOfflinePlayer(this.islandOwnerUUID)).getAPIWrapper(),
Bukkit.getServer().getOfflinePlayer(uuid)));
}
public void save() {
SkyBlock plugin = SkyBlock.getInstance();
SkyBlock plugin = SkyBlock.getPlugin(SkyBlock.class);
Config config = plugin.getFileManager().getConfig(new File(
new File(plugin.getDataFolder().toString() + "/ban-data"), islandOwnerUUID.toString() + ".yml"));
FileManager.Config config = plugin.getFileManager().getConfig(new File(
new File(plugin.getDataFolder(), "ban-data"), this.islandOwnerUUID.toString() + ".yml"));
try {
config.getFileConfiguration().save(config.getFile());
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}

View File

@ -1,14 +1,13 @@
package com.songoda.skyblock.ban;
package com.craftaro.skyblock.ban;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.utils.world.LocationUtil;
import com.eatthepath.uuid.FastUUID;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -19,7 +18,6 @@ import java.util.Map;
import java.util.UUID;
public class BanManager {
private final SkyBlock plugin;
private final Map<UUID, Ban> banStorage = new HashMap<>();
@ -38,11 +36,8 @@ public class BanManager {
}
public void loadIslands() {
FileManager fileManager = plugin.getFileManager();
if (!this.plugin.getConfiguration()
.getBoolean("Island.Visitor.Unload")) {
File configFile = new File(plugin.getDataFolder().toString() + "/island-data");
if (!this.plugin.getConfiguration().getBoolean("Island.Visitor.Unload")) {
File configFile = new File(this.plugin.getDataFolder(), "island-data");
if (configFile.exists()) {
for (File fileList : configFile.listFiles()) {
@ -54,15 +49,13 @@ public class BanManager {
}
public void transfer(UUID uuid1, UUID uuid2) {
FileManager fileManager = plugin.getFileManager();
FileManager fileManager = this.plugin.getFileManager();
Ban ban = getIsland(uuid1);
ban.save();
File oldBanDataFile = new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
FastUUID.toString(uuid1) + ".yml");
File newBanDataFile = new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
FastUUID.toString(uuid2) + ".yml");
File oldBanDataFile = new File(new File(this.plugin.getDataFolder(), "ban-data"), FastUUID.toString(uuid1) + ".yml");
File newBanDataFile = new File(new File(this.plugin.getDataFolder(), "ban-data"), FastUUID.toString(uuid2) + ".yml");
fileManager.unloadConfig(oldBanDataFile);
fileManager.unloadConfig(newBanDataFile);
@ -74,58 +67,56 @@ public class BanManager {
}
public void removeVisitor(Island island) {
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
MessageManager messageManager = this.plugin.getMessageManager();
SoundManager soundManager = this.plugin.getSoundManager();
FileConfiguration configLoad = this.plugin.getLanguage();
for (UUID visitorList : plugin.getIslandManager().getVisitorsAtIsland(island)) {
for (UUID visitorList : this.plugin.getIslandManager().getVisitorsAtIsland(island)) {
Player targetPlayer = Bukkit.getServer().getPlayer(visitorList);
LocationUtil.teleportPlayerToSpawn(targetPlayer);
messageManager.sendMessage(targetPlayer, configLoad.getString("Island.Visit.Banned.Island.Message"));
soundManager.playSound(targetPlayer, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F);
soundManager.playSound(targetPlayer, XSound.ENTITY_ENDERMAN_TELEPORT);
}
}
public boolean hasIsland(UUID islandOwnerUUID) {
return banStorage.containsKey(islandOwnerUUID);
return this.banStorage.containsKey(islandOwnerUUID);
}
public Ban getIsland(UUID islandOwnerUUID) {
return banStorage.get(islandOwnerUUID);
return this.banStorage.get(islandOwnerUUID);
}
public Map<UUID, Ban> getIslands() {
return banStorage;
return this.banStorage;
}
public void createIsland(UUID islandOwnerUUID) {
banStorage.put(islandOwnerUUID, new Ban(islandOwnerUUID));
this.banStorage.put(islandOwnerUUID, new Ban(islandOwnerUUID));
}
public void addIsland(UUID islandOwnerUUID, Ban ban) {
banStorage.put(islandOwnerUUID, ban);
this.banStorage.put(islandOwnerUUID, ban);
}
public void removeIsland(UUID islandOwnerUUID) {
banStorage.remove(islandOwnerUUID);
this.banStorage.remove(islandOwnerUUID);
}
public void unloadIsland(UUID islandOwnerUUID) {
if (hasIsland(islandOwnerUUID)) {
plugin.getFileManager().unloadConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
islandOwnerUUID.toString() + ".yml"));
banStorage.remove(islandOwnerUUID);
this.plugin.getFileManager().unloadConfig(new File(new File(this.plugin.getDataFolder(), "ban-data"), islandOwnerUUID.toString() + ".yml"));
this.banStorage.remove(islandOwnerUUID);
}
}
public void deleteIsland(UUID islandOwnerUUID) {
if (hasIsland(islandOwnerUUID)) {
plugin.getFileManager().deleteConfig(new File(new File(plugin.getDataFolder().toString() + "/ban-data"),
islandOwnerUUID.toString() + ".yml"));
banStorage.remove(islandOwnerUUID);
this.plugin.getFileManager().deleteConfig(new File(new File(this.plugin.getDataFolder(), "ban-data"), islandOwnerUUID.toString() + ".yml"));
this.banStorage.remove(islandOwnerUUID);
}
}
}

View File

@ -1,28 +1,32 @@
package com.songoda.skyblock.bank;
package com.craftaro.skyblock.bank;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import com.craftaro.core.hooks.EconomyManager;
import com.craftaro.core.hooks.economies.Economy;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.playerdata.PlayerData;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public class BankManager {
private final HashMap<UUID, List<Transaction>> log;
private final SkyBlock plugin;
public FileConfiguration lang;
public BankManager(SkyBlock plugin) {
this.plugin = plugin;
lang = this.plugin.getLanguage();
log = new HashMap<>();
this.lang = this.plugin.getLanguage();
this.log = new HashMap<>();
loadTransactions();
}
@ -49,42 +53,50 @@ public class BankManager {
}
public List<Transaction> getTransactions(UUID uuid) {
if (log.containsKey(uuid)
&& log.get(uuid) != null
&& !log.get(uuid).isEmpty()) {
return new ArrayList<>(log.get(uuid));
}else {
if (this.log.containsKey(uuid)
&& this.log.get(uuid) != null
&& !this.log.get(uuid).isEmpty()) {
return new ArrayList<>(this.log.get(uuid));
} else {
return new ArrayList<>();
}
}
public void addTransaction(Player p, Transaction transaction) {
if (log.containsKey(p.getUniqueId())) {
log.get(p.getUniqueId()).add(transaction);
}else {
if (this.log.containsKey(p.getUniqueId())) {
this.log.get(p.getUniqueId()).add(transaction);
} else {
List<Transaction> t = new ArrayList<>();
t.add(transaction);
log.put(p.getUniqueId(),t);
this.log.put(p.getUniqueId(), t);
}
}
private void loadTransactions() {
for (UUID uid:SkyBlock.getInstance().getPlayerDataManager().getPlayerData().keySet()) {
log.put(uid,SkyBlock.getInstance().getPlayerDataManager().getPlayerData().get(uid).getTransactions());
Map<UUID, PlayerData> playerDataStorage = SkyBlock.getInstance().getPlayerDataManager().getPlayerData();
synchronized (playerDataStorage) {
for (UUID uid : playerDataStorage.keySet()) {
this.log.put(uid, playerDataStorage.get(uid).getTransactions());
}
}
}
public List<String> getBalanceLore(Player player) {;
Economy economy = plugin.getEconomyManager().getEconomy();
public List<String> getBalanceLore(Player player) {
Economy economy = this.plugin.getEconomyManager().getEconomy();
List<String> result = new ArrayList<>();
result.add("Some error occurred while loading your balance!");
Island island = SkyBlock.getInstance().getIslandManager().getIsland(player);
result.add("If this is null then its a easy to fix bug: "+island.toString());
Island island = SkyBlock.getPlugin(SkyBlock.class).getIslandManager().getIsland(player);
result.add("If this is null then its a easy to fix bug: " + island.toString());
if (island != null) {
double accountBalance = 0;
if (economy != null) {
accountBalance = economy.getBalance(player);
}
result.clear();
result.add(player.getDisplayName()+"'s balance is "+ EconomyManager.formatEconomy(economy.getBalance(player)));
result.add(player.getDisplayName()+"'s island has "+ EconomyManager.formatEconomy(island.getBankBalance()));
result.add(player.getDisplayName() + "'s balance is " + EconomyManager.formatEconomy(accountBalance));
result.add(player.getDisplayName() + "'s island has " + EconomyManager.formatEconomy(island.getBankBalance()));
}
return result;
}
@ -94,12 +106,12 @@ public class BankManager {
}
public List<Transaction> getTransactionList(UUID uuid) {
return log.get(uuid);
return this.log.get(uuid);
}
public BankResponse deposit(Player player, Island island, double amt, boolean admin) {
Economy economy = plugin.getEconomyManager().getEconomy();
FileManager fileManager = plugin.getFileManager();
Economy economy = this.plugin.getEconomyManager().getEconomy();
FileManager fileManager = this.plugin.getFileManager();
// Make sure the amount is positive
if (amt <= 0) {
@ -114,11 +126,15 @@ public class BankManager {
}
}
if(!admin) {
if (!economy.hasBalance(player, amt)) {
if (!admin) {
if (economy == null || !economy.hasBalance(player, amt)) {
if (economy == null) {
this.plugin.getLogger().warning("No compatible economy plugin found Please check your configuration");
}
return BankResponse.NOT_ENOUGH_MONEY;
}
economy.withdrawBalance(player, amt);
}
@ -134,7 +150,7 @@ public class BankManager {
}
public BankResponse withdraw(Player player, Island island, double amt, boolean admin) {
Economy economy = plugin.getEconomyManager().getEconomy();
Economy economy = this.plugin.getEconomyManager().getEconomy();
// Make sure the amount is positive
if (amt <= 0) {
@ -149,11 +165,15 @@ public class BankManager {
}
}
if(!admin){
if (amt > island.getBankBalance()) {
if (!admin) {
if (economy == null || amt > island.getBankBalance()) {
if (economy == null) {
this.plugin.getLogger().warning("No compatible economy plugin found Please check your configuration");
}
return BankResponse.NOT_ENOUGH_MONEY;
}
economy.deposit(player, amt);
}
@ -168,7 +188,7 @@ public class BankManager {
return BankResponse.SUCCESS;
}
public enum BankResponse{
public enum BankResponse {
NOT_ENOUGH_MONEY,
DECIMALS_NOT_ALLOWED,
NEGATIVE_AMOUNT,

View File

@ -1,11 +1,10 @@
package com.songoda.skyblock.bank;
package com.craftaro.skyblock.bank;
import org.bukkit.OfflinePlayer;
import java.util.Date;
public class Transaction {
public OfflinePlayer player;
public float amount;
public Date timestamp;
@ -21,4 +20,4 @@ public class Transaction {
ADMIN,
USER
}
}
}

View File

@ -1,19 +1,14 @@
package com.songoda.skyblock.biome;
package com.craftaro.skyblock.biome;
import com.songoda.core.compatibility.CompatibleBiome;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.blockscanner.ChunkLoader;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandEnvironment;
import com.songoda.skyblock.island.IslandWorld;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.blockscanner.ChunkLoader;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandEnvironment;
import com.craftaro.skyblock.island.IslandWorld;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.text.NumberFormat;
import java.util.ArrayList;
@ -21,7 +16,6 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class BiomeManager {
private final SkyBlock plugin;
private final List<Island> updatingIslands;
private final FileConfiguration language;
@ -30,61 +24,64 @@ public class BiomeManager {
public BiomeManager(SkyBlock plugin) {
this.plugin = plugin;
this.updatingIslands = new ArrayList<>();
this.language = SkyBlock.getInstance().getLanguage();
this.runEveryX = language.getInt("Command.Island.Biome.Progress.Display-Every-X-Updates");
this.language = SkyBlock.getPlugin(SkyBlock.class).getLanguage();
this.runEveryX = this.language.getInt("Command.Island.Biome.Progress.Display-Every-X-Updates");
}
public boolean isUpdating(Island island) {
return updatingIslands.contains(island);
return this.updatingIslands.contains(island);
}
public void addUpdatingIsland(Island island) {
updatingIslands.add(island);
this.updatingIslands.add(island);
}
public void removeUpdatingIsland(Island island) {
updatingIslands.remove(island);
this.updatingIslands.remove(island);
}
public void setBiome(Island island, IslandWorld world, CompatibleBiome biome, CompleteTask task) {
addUpdatingIsland(island);
if (island.getLocation(world, IslandEnvironment.Island) == null) return;
if (island.getLocation(world, IslandEnvironment.ISLAND) == null) {
return;
}
// We keep it sequentially in order to use less RAM
int chunkAmount = (int) Math.ceil(Math.pow(island.getSize()/16d, 2d));
int chunkAmount = (int) Math.ceil(Math.pow(island.getSize() / 16d, 2d));
AtomicInteger progress = new AtomicInteger();
ChunkLoader.startChunkLoadingPerChunk(island, world, plugin.isPaperAsync(), (cachedChunk) -> {
ChunkLoader.startChunkLoadingPerChunk(island, world, this.plugin.isPaperAsync(), (cachedChunk) -> {
// I don't like this. But CompletableFuture#join causes a crash on some setups.
cachedChunk.getChunk().thenAccept(chunk -> {
try {
if (chunk != null)
if (chunk != null) {
biome.setBiome(chunk);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
} catch (IllegalAccessException | InvocationTargetException ex) {
ex.printStackTrace();
}
progress.getAndIncrement();
if (language.getBoolean("Command.Island.Biome.Progress.Should-Display-Message") &&
progress.get() == 1 || progress.get() == chunkAmount || progress.get() % runEveryX == 0) {
if (this.language.getBoolean("Command.Island.Biome.Progress.Should-Display-Message") &&
progress.get() == 1 || progress.get() == chunkAmount || progress.get() % this.runEveryX == 0) {
final double percent = ((double) progress.get() / (double) chunkAmount) * 100;
String message = language.getString("Command.Island.Biome.Progress.Message");
String message = this.language.getString("Command.Island.Biome.Progress.Message");
message = message.replace("%current_updated_chunks%", String.valueOf(progress.get()));
message = message.replace("%max_chunks%", String.valueOf(chunkAmount));
message = message.replace("%percent_whole%", String.valueOf((int) percent));
message = message.replace("%percent%", NumberFormat.getInstance().format(percent));
for (Player player : SkyBlock.getInstance().getIslandManager().getPlayersAtIsland(island)) {
plugin.getMessageManager().sendMessage(player, message);
for (Player player : SkyBlock.getPlugin(SkyBlock.class).getIslandManager().getPlayersAtIsland(island)) {
this.plugin.getMessageManager().sendMessage(player, message);
}
}
});
}, (island1 -> {
removeUpdatingIsland(island1);
if(task != null) {
if (task != null) {
task.onCompleteUpdate();
}
}));

View File

@ -1,9 +1,8 @@
package com.songoda.skyblock.blockscanner;
package com.craftaro.skyblock.blockscanner;
import org.bukkit.World;
public final class BlockInfo {
private final World world;
private final int x;
@ -18,19 +17,18 @@ public final class BlockInfo {
}
public int getX() {
return x;
return this.x;
}
public int getY() {
return y;
return this.y;
}
public int getZ() {
return z;
return this.z;
}
public World getWorld() {
return world;
return this.world;
}
}

View File

@ -1,17 +1,16 @@
package com.songoda.skyblock.blockscanner;
package com.craftaro.skyblock.blockscanner;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.utils.world.WorldUtil;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandEnvironment;
import com.craftaro.skyblock.world.WorldManager;
import com.google.common.collect.Lists;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandEnvironment;
import com.songoda.skyblock.world.WorldManager;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.scheduler.BukkitRunnable;
@ -23,6 +22,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
@ -31,7 +31,6 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public final class BlockScanner extends BukkitRunnable {
private static final Method ID_FIELD;
private static final int MAX_CHUNKS_PER_ITERATION = 2;
private static final int MAX_EMPTY_ITERATIONS = 20;
@ -53,8 +52,8 @@ public final class BlockScanner extends BukkitRunnable {
try {
id = (Integer) ID_FIELD.invoke(chunk.getSnapshot(), x, y, z);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
ex.printStackTrace();
}
return id;
@ -85,7 +84,7 @@ public final class BlockScanner extends BukkitRunnable {
this.completedNum = new AtomicInteger();
this.island = island;
FileConfiguration config = SkyBlock.getInstance().getConfiguration();
FileConfiguration config = SkyBlock.getPlugin(SkyBlock.class).getConfiguration();
int threadCount = 0;
@ -114,9 +113,9 @@ public final class BlockScanner extends BukkitRunnable {
int startY;
if (ignoreY) {
startY = 255;
startY = world.getMaxHeight();
} else {
startY = !ignoreLiquidsY && liquidSection.getBoolean("Enable") && !config.getBoolean("Island.Levelling.ScanLiquid") ? liquidSection.getInt("Height") + 1 : 0;
startY = !ignoreLiquidsY && liquidSection.getBoolean("Enable") && !config.getBoolean("Island.Levelling.ScanLiquid") ? liquidSection.getInt("Height") + 1 : WorldUtil.getMinHeight(world);
}
for (List<CachedChunk> sub : parts) {
@ -128,7 +127,7 @@ public final class BlockScanner extends BukkitRunnable {
}
private void queueWork(World world, int scanY, List<CachedChunk> subList) {
WorldManager worldManager = SkyBlock.getInstance().getWorldManager();
WorldManager worldManager = SkyBlock.getPlugin(SkyBlock.class).getWorldManager();
// The chunks that couldn't be taken snapshot async
List<CachedChunk> pendingChunks = new ArrayList<>();
@ -142,16 +141,16 @@ public final class BlockScanner extends BukkitRunnable {
// This is the actual object that we will use to wait
Condition emptyCondition = lock.newCondition();
Bukkit.getServer().getScheduler().runTaskAsynchronously(SkyBlock.getInstance(), () -> {
Bukkit.getServer().getScheduler().runTaskAsynchronously(SkyBlock.getPlugin(SkyBlock.class), () -> {
// We need to hold the lock on the thread calling the await
lock.lock();
LocationBounds bounds = null;
if (island != null) {
Location islandLocation = island.getLocation(worldManager.getIslandWorld(world), IslandEnvironment.Island);
if (this.island != null) {
Location islandLocation = this.island.getLocation(worldManager.getIslandWorld(world), IslandEnvironment.ISLAND);
Location minLocation = new Location(world, islandLocation.getBlockX() - island.getRadius(), 0, islandLocation.getBlockZ() - island.getRadius());
Location maxLocation = new Location(world, islandLocation.getBlockX() + island.getRadius(), world.getMaxHeight(), islandLocation.getBlockZ() + island.getRadius());
Location minLocation = new Location(world, islandLocation.getBlockX() - this.island.getRadius(), WorldUtil.getMinHeight(world), islandLocation.getBlockZ() - this.island.getRadius());
Location maxLocation = new Location(world, islandLocation.getBlockX() + this.island.getRadius(), world.getMaxHeight(), islandLocation.getBlockZ() + this.island.getRadius());
int minX = Math.min(maxLocation.getBlockX(), minLocation.getBlockX());
int minZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ());
@ -235,7 +234,7 @@ public final class BlockScanner extends BukkitRunnable {
}
if (pendingChunks.isEmpty()) {
if (emptyIterations >= MAX_EMPTY_ITERATIONS) {
if (this.emptyIterations >= MAX_EMPTY_ITERATIONS) {
// Send the signal to unlock the async thread and continue with the processing
emptyCondition.signalAll();
this.cancel();
@ -243,13 +242,13 @@ public final class BlockScanner extends BukkitRunnable {
return;
}
emptyIterations++;
this.emptyIterations++;
}
} finally {
lock.unlock();
}
}
}.runTaskTimer(SkyBlock.getInstance(), 1, 1);
}.runTaskTimer(SkyBlock.getPlugin(SkyBlock.class), 1, 1);
}
private void processCachedChunk(World world, int scanY, CachedChunk shot, LocationBounds bounds) {
@ -272,55 +271,58 @@ public final class BlockScanner extends BukkitRunnable {
for (int x = initX; x <= lastX; x++) {
for (int z = initZ; z <= lastZ; z++) {
for (int y = scanY; y < world.getMaxHeight(); y++) {
final CompatibleMaterial type = CompatibleMaterial.getBlockMaterial(
final Optional<XMaterial> type = CompatibleMaterial.getMaterial(
ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
? shot.getSnapshot().getBlockType(x, y, z) :
MaterialIDHelper.getLegacyMaterial(getBlockTypeID(shot, x, y, z)));
if (type == null) {
if (!type.isPresent()) {
continue;
} else if (type.equals(CompatibleMaterial.AIR) && ignoreAir) {
} else if (CompatibleMaterial.isAir(type.get()) && this.ignoreAir) {
continue;
} else if (type.equals(CompatibleMaterial.WATER) && ignoreLiquids) {
} else if (type.get() == XMaterial.WATER && this.ignoreLiquids) {
continue;
}
blocks.add(new BlockInfo(world, x + (cX), y, z + (cZ)));
this.blocks.add(new BlockInfo(world, x + (cX), y, z + (cZ)));
}
}
}
}
private synchronized int increment() {
return completedNum.getAndIncrement();
return this.completedNum.getAndIncrement();
}
private synchronized int get() {
return completedNum.get();
return this.completedNum.get();
}
@Override
public void run() {
if (get() != threadCount) return;
if (get() != this.threadCount) {
return;
}
tasks.onComplete(blocks);
this.tasks.onComplete(this.blocks);
cancel();
}
public static void startScanner(Map<World, List<CachedChunk>> snapshots, Island island, boolean ignoreLiquids, boolean ignoreLiquidsY, boolean ignoreAir, boolean ignoreY, ScannerTasks tasks) {
if (snapshots == null) throw new IllegalArgumentException("snapshots cannot be null");
if (tasks == null) throw new IllegalArgumentException("tasks cannot be null");
if (snapshots == null) {
throw new IllegalArgumentException("snapshots cannot be null");
}
if (tasks == null) {
throw new IllegalArgumentException("tasks cannot be null");
}
final BlockScanner scanner = new BlockScanner(snapshots, island, ignoreLiquids, ignoreLiquidsY, ignoreAir, ignoreY, tasks);
scanner.runTaskTimer(SkyBlock.getInstance(), 5, 5);
scanner.runTaskTimer(SkyBlock.getPlugin(SkyBlock.class), 5, 5);
}
public interface ScannerTasks {
void onComplete(Queue<BlockInfo> blocks);
}
}

View File

@ -1,4 +1,4 @@
package com.songoda.skyblock.blockscanner;
package com.craftaro.skyblock.blockscanner;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
@ -10,7 +10,6 @@ import java.util.Objects;
import java.util.concurrent.CompletableFuture;
public class CachedChunk {
private final String world;
private final int x;
private final int z;
@ -44,19 +43,21 @@ public class CachedChunk {
public CompletableFuture<Chunk> getChunk() {
World world = Bukkit.getWorld(this.world);
if (world == null)
if (world == null) {
return null;
}
return PaperLib.getChunkAtAsync(world, this.x, this.z);
}
public boolean isSnapshotAvailable() {
return latestSnapshot != null;
return this.latestSnapshot != null;
}
public ChunkSnapshot getSnapshot() {
if (latestSnapshot == null)
if (this.latestSnapshot == null) {
return takeSnapshot();
return latestSnapshot;
}
return this.latestSnapshot;
}
public ChunkSnapshot takeSnapshot() {
@ -64,15 +65,19 @@ public class CachedChunk {
}
@Override
public boolean equals(Object o) {
if (o instanceof Chunk) {
Chunk other = (Chunk) o;
return this.world.equals(other.getWorld().getName()) && this.x == other.getX() && this.z == other.getZ();
} else return false;
public boolean equals(Object obj) {
if (!(obj instanceof Chunk)) {
return false;
}
Chunk other = (Chunk) obj;
return this.world.equals(other.getWorld().getName()) &&
this.x == other.getX() &&
this.z == other.getZ();
}
@Override
public int hashCode() {
return Objects.hash(this.world, this.x, this.z);
}
}
}

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.blockscanner;
package com.craftaro.skyblock.blockscanner;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandEnvironment;
import com.songoda.skyblock.island.IslandWorld;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandEnvironment;
import com.craftaro.skyblock.island.IslandWorld;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.scheduler.BukkitRunnable;
@ -34,35 +34,37 @@ public class ChunkLoader extends BukkitRunnable {
boolean chunkForChunk,
ChunkForChunkScannerTask chunkTask,
CompleteTask complete) {
chunkPerTick = SkyBlock.getInstance().getConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
this.chunkPerTick = SkyBlock.getPlugin(SkyBlock.class).getConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
this.completeTask = complete;
this.chunkTask = chunkTask;
this.chunkForChunk = chunkForChunk;
this.paper = paper;
this.island = island;
Location islandLocation = island.getLocation(islandWorld, IslandEnvironment.Island);
Location islandLocation = island.getLocation(islandWorld, IslandEnvironment.ISLAND);
if (islandLocation == null) return;
if (islandLocation == null) {
return;
}
world = islandLocation.getWorld();
this.world = islandLocation.getWorld();
Location minLocation = new Location(world, islandLocation.getBlockX() - island.getRadius(), 0, islandLocation.getBlockZ() - island.getRadius());
Location maxLocation = new Location(world, islandLocation.getBlockX() + island.getRadius(), world.getMaxHeight(), islandLocation.getBlockZ() + island.getRadius());
Location minLocation = new Location(this.world, islandLocation.getBlockX() - island.getRadius(), 0, islandLocation.getBlockZ() - island.getRadius());
Location maxLocation = new Location(this.world, islandLocation.getBlockX() + island.getRadius(), this.world.getMaxHeight(), islandLocation.getBlockZ() + island.getRadius());
int minX = Math.min(maxLocation.getBlockX(), minLocation.getBlockX()) >> 4 << 4;
minZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4;
this.minZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4;
maxX = Math.max(maxLocation.getBlockX(), minLocation.getBlockX()) >> 4 << 4 | 15;
maxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4 | 15;
this.maxX = Math.max(maxLocation.getBlockX(), minLocation.getBlockX()) >> 4 << 4 | 15;
this.maxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4 | 15;
x = minX;
z = minZ;
this.x = minX;
this.z = this.minZ;
if (paper) {
this.runTaskAsynchronously(SkyBlock.getInstance());
this.runTaskAsynchronously(SkyBlock.getPlugin(SkyBlock.class));
} else {
this.runTaskTimer(SkyBlock.getInstance(), 1L, 0L);
this.runTaskTimer(SkyBlock.getPlugin(SkyBlock.class), 1L, 0L);
}
}
@ -72,70 +74,71 @@ public class ChunkLoader extends BukkitRunnable {
boolean chunkForChunk,
ChunkScannerTask generalTask,
CompleteTask complete) {
chunkPerTick = SkyBlock.getInstance().getConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
this.chunkPerTick = SkyBlock.getPlugin(SkyBlock.class).getConfiguration().getInt("Island.Performance.ChunkPerTick", 25);
this.completeTask = complete;
this.generalTask = generalTask;
this.chunkForChunk = chunkForChunk;
this.paper = paper;
this.island = island;
Location islandLocation = island.getLocation(islandWorld, IslandEnvironment.Island);
Location islandLocation = island.getLocation(islandWorld, IslandEnvironment.ISLAND);
if (islandLocation == null) {
return;
}
if (islandLocation == null) return;
world = islandLocation.getWorld();
this.world = islandLocation.getWorld();
Location minLocation = new Location(
world,
this.world,
islandLocation.getBlockX() - island.getRadius(),
0,
islandLocation.getBlockZ() - island.getRadius());
Location maxLocation = new Location(
world,
this.world,
islandLocation.getBlockX() + island.getRadius(),
world.getMaxHeight(),
this.world.getMaxHeight(),
islandLocation.getBlockZ() + island.getRadius());
int minX = Math.min(maxLocation.getBlockX(), minLocation.getBlockX()) >> 4 << 4;
minZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4;
this.minZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4;
maxX = Math.max(maxLocation.getBlockX(), minLocation.getBlockX()) >> 4 << 4 | 15;
maxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4 | 15;
this.maxX = Math.max(maxLocation.getBlockX(), minLocation.getBlockX()) >> 4 << 4 | 15;
this.maxZ = Math.max(maxLocation.getBlockZ(), minLocation.getBlockZ()) >> 4 << 4 | 15;
x = minX;
z = minZ;
this.x = minX;
this.z = this.minZ;
if (paper) {
this.runTaskAsynchronously(SkyBlock.getInstance());
this.runTaskAsynchronously(SkyBlock.getPlugin(SkyBlock.class));
} else {
this.runTaskTimer(SkyBlock.getInstance(), 1L, 0L);
this.runTaskTimer(SkyBlock.getPlugin(SkyBlock.class), 1L, 0L);
}
}
@Override
public void run() { // TODO New algorithm that start from the center of the island
for (int i = 0; i < chunkPerTick || paper; ++i) {
if (x <= maxX) {
if (z <= maxZ) {
if (!chunkForChunk) {
positions.add(new CachedChunk(world, x, z));
for (int i = 0; i < this.chunkPerTick || this.paper; i++) {
if (this.x <= this.maxX) {
if (this.z <= this.maxZ) {
if (!this.chunkForChunk) {
this.positions.add(new CachedChunk(this.world, this.x >> 4, this.z >> 4));
} else {
if (chunkTask != null) {
chunkTask.onChunkComplete(new CachedChunk(world, x, z));
if (this.chunkTask != null) {
this.chunkTask.onChunkComplete(new CachedChunk(this.world, this.x >> 4, this.z >> 4));
}
}
z += 16;
this.z += 16;
} else {
z = minZ;
x += 16;
this.z = this.minZ;
this.x += 16;
}
} else {
if (generalTask != null) {
generalTask.onComplete(positions);
if (this.generalTask != null) {
this.generalTask.onComplete(this.positions);
}
if (completeTask != null) {
completeTask.onComplete(island);
if (this.completeTask != null) {
this.completeTask.onComplete(this.island);
}
this.cancel();
return;

View File

@ -1,28 +1,28 @@
package com.songoda.skyblock.blockscanner;
package com.craftaro.skyblock.blockscanner;
public class LocationBounds {
private final int minX, minZ, maxX, maxZ;
public LocationBounds(int minX, int minZ, int maxX, int maxZ) {
this.minX = minX;
this.minZ = minZ;
this.maxX = maxX;
this.maxZ = maxZ;
}
public int getMinX() {
return minX;
return this.minX;
}
public int getMinZ() {
return minZ;
return this.minZ;
}
public int getMaxX() {
return maxX;
return this.maxX;
}
public int getMaxZ() {
return maxZ;
return this.maxZ;
}
}

View File

@ -1,24 +1,25 @@
package com.songoda.skyblock.blockscanner;
package com.craftaro.skyblock.blockscanner;
import com.songoda.core.compatibility.ServerVersion;
import com.craftaro.core.compatibility.ServerVersion;
import org.bukkit.Material;
import java.util.HashMap;
import java.util.Map;
@SuppressWarnings("deprecation")
public final class MaterialIDHelper {
private MaterialIDHelper() {
}
private MaterialIDHelper() {}
private final static Map<Integer, Material> MATERIALS;
private static final Map<Integer, Material> MATERIALS;
static {
MATERIALS = new HashMap<>();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
for (Material type : Material.values()) {
if (type.isLegacy()) MATERIALS.put(type.getId(), type);
if (type.isLegacy()) {
MATERIALS.put(type.getId(), type);
}
}
} else {
for (Material type : Material.values()) {

View File

@ -0,0 +1,65 @@
package com.craftaro.skyblock.challenge;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.challenge.challenge.ChallengeCategory;
import com.craftaro.skyblock.challenge.challenge.ChallengeManager;
import com.craftaro.skyblock.challenge.defaultinv.DefaultInventory;
import com.craftaro.skyblock.challenge.inventory.InventoryManager;
import com.craftaro.skyblock.challenge.inventory.inv.ChallengeInventory;
import com.craftaro.skyblock.challenge.player.PlayerManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class FabledChallenge {
private final SkyBlock plugin;
private final ChallengeManager challengeManager;
private final PlayerManager playerManager;
// I use my own inventory api bc it's hard to implement inventories with the
private final InventoryManager inventoryManager;
private final DefaultInventory defaultInventory;
private final ChallengeInventory challengeInventory;
public FabledChallenge(SkyBlock plugin) {
this.plugin = plugin;
this.defaultInventory = new DefaultInventory(plugin);
this.challengeManager = new ChallengeManager(plugin);
this.playerManager = new PlayerManager(plugin);
this.challengeInventory = new ChallengeInventory(this);
this.inventoryManager = new InventoryManager(plugin);
this.inventoryManager.init();
}
public void onDisable() {
this.inventoryManager.closeInventories();
}
public void openChallengeInventory(Player p, ChallengeCategory category) {
if (category == null) {
return;
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> {
this.inventoryManager.openInventory(this.challengeInventory, p, params -> {
params.put(ChallengeInventory.CATEGORY, category);
});
}, 1);
}
// GETTERS
public ChallengeManager getChallengeManager() {
return this.challengeManager;
}
public PlayerManager getPlayerManager() {
return this.playerManager;
}
public InventoryManager getInventoryManager() {
return this.inventoryManager;
}
public DefaultInventory getDefaultInventory() {
return this.defaultInventory;
}
}

View File

@ -1,11 +1,12 @@
package com.songoda.skyblock.challenge.challenge;
package com.craftaro.skyblock.challenge.challenge;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.hooks.economies.Economy;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.bank.BankManager;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
@ -25,10 +26,10 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.regex.Pattern;
public class Challenge {
private final ChallengeCategory category;
private final int id;
private final String name;
@ -56,8 +57,10 @@ public class Challenge {
// Requires
for (String str : requires) {
int idx = str.indexOf(':');
if (idx == -1)
if (idx == -1) {
throw new IllegalArgumentException("Line \"" + str + "\" isn't a correct line");
}
String arg0 = str.substring(0, idx);
String arg1 = str.substring(idx + 1);
try {
@ -72,8 +75,10 @@ public class Challenge {
// Rewards
for (String str : rewards) {
int idx = str.indexOf(':');
if (idx == -1)
if (idx == -1) {
throw new IllegalArgumentException("Line " + str + " isn't a correct line");
}
String arg0 = str.substring(0, idx);
String arg1 = str.substring(idx + 1);
try {
@ -90,35 +95,35 @@ public class Challenge {
// GETTERS
public ChallengeCategory getCategory() {
return category;
return this.category;
}
public int getId() {
return id;
return this.id;
}
public String getName() {
return name;
return this.name;
}
public int getMaxTimes() {
return maxTimes;
return this.maxTimes;
}
public boolean isShowInChat() {
return showInChat;
return this.showInChat;
}
public List<Peer<Type, Object>> getRequires() {
return requires;
return this.requires;
}
public List<Peer<Type, Object>> getRewards() {
return rewards;
return this.rewards;
}
public ItemChallenge getItem() {
return item;
return this.item;
}
public enum Type {
@ -149,14 +154,14 @@ public class Challenge {
@Override
public boolean has(Player p, Object obj) {
List<Integer> is = (List<Integer>) obj;
SkyBlock instance = SkyBlock.getInstance();
SkyBlock instance = SkyBlock.getPlugin(SkyBlock.class);
FileManager.Config config = instance.getFileManager().getConfig(new File(new File(instance.getDataFolder(), "challenge-data"), p.getUniqueId().toString() + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
ConfigurationSection section = fileConfig.getConfigurationSection("challenges");
for (String k : (section != null) ? section.getKeys(false) : new HashSet<String>()) {
int id = fileConfig.getInt("challenges." + k + ".id");
if (is.get(0) == id) {
ChallengeCategory cc = SkyBlock.getInstance().getFabledChallenge().getChallengeManager().getChallenge(id);
ChallengeCategory cc = SkyBlock.getPlugin(SkyBlock.class).getFabledChallenge().getChallengeManager().getChallenge(id);
if (cc != null) {
ConfigurationSection section2 = fileConfig.getConfigurationSection("challenges." + k + ".challenges");
if (section2 != null && !section2.getKeys(false).isEmpty() && section2.getKeys(false).stream().map(d -> "challenges." + k + ".challenges." + d).anyMatch(key -> is.get(1) == fileConfig.getInt(key + ".id") && fileConfig.getInt(key + ".count") >= is.get(2))) {
@ -186,17 +191,18 @@ public class Challenge {
*/
@Override
public ItemStack convert(String value) throws IllegalArgumentException {
if (value == null || "".equalsIgnoreCase(value.trim()))
if (value == null || "".equalsIgnoreCase(value.trim())) {
throw new IllegalArgumentException("Value is empty or null");
}
int index = value.indexOf(' ');
// The id
String id = index == -1 ? value : value.substring(0, index);
// Check if it's a Minecraft item
CompatibleMaterial m = CompatibleMaterial.getMaterial(id);
Optional<XMaterial> m = CompatibleMaterial.getMaterial(id);
//Material m = Material.matchMaterial(id);
if (m == null)
throw new IllegalArgumentException(
"\"" + id + "\" isn't a correct Minecraft Material (value = \"" + value + "\")");
if (!m.isPresent()) {
throw new IllegalArgumentException("\"" + id + "\" isn't a correct Minecraft Material (value = \"" + value + "\")");
}
int amount = 1;
if (index != -1) {
String strAmount = value.substring(index + 1);
@ -207,44 +213,49 @@ public class Challenge {
"\"" + strAmount + "\" isn't a correct number (value = \"" + value + "\")");
}
}
ItemStack item = m.getItem();
ItemStack item = m.get().parseItem();
item.setAmount(amount);
return item;
}
@Override
public boolean has(Player p, Object obj) {
boolean ignoreLore = SkyBlock.getInstance().getConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
boolean ignoreLore = SkyBlock.getPlugin(SkyBlock.class).getConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
if (obj instanceof ItemStack) {
// Check if player has specific item in his inventory
ItemStack is = (ItemStack) obj;
CompatibleMaterial material = CompatibleMaterial.getMaterial(is);
if (ignoreLore)
XMaterial material = CompatibleMaterial.getMaterial(is.getType()).get();
if (ignoreLore) {
return findSimilar(p, material) >= is.getAmount();
}
return p.getInventory().containsAtLeast(is, is.getAmount());
}
return false;
}
private int findSimilar(Player p, CompatibleMaterial material) {
private int findSimilar(Player p, XMaterial material) {
int amountFound = 0;
for (ItemStack item : p.getInventory().getContents())
if (CompatibleMaterial.getMaterial(item) == material)
for (ItemStack item : p.getInventory().getContents()) {
if (material.isSimilar(item)) {
amountFound += item.getAmount();
}
}
return amountFound;
}
@Override
public void executeRequire(Player p, Object obj) {
boolean ignoreLore = SkyBlock.getInstance().getConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
boolean ignoreLore = SkyBlock.getPlugin(SkyBlock.class).getConfiguration().getBoolean("Island.Challenge.IgnoreItemLore", false);
if (obj instanceof ItemStack) {
// Remove specific item in player's inventory
ItemStack is = (ItemStack) obj;
int toRemove = is.getAmount();
for (ItemStack jis : p.getInventory().getContents()) {
if (jis == null) continue;
if (ignoreLore ? CompatibleMaterial.getMaterial(jis) == CompatibleMaterial.getMaterial(is) : jis.isSimilar(is)) {
if (jis == null) {
continue;
}
if (ignoreLore ? CompatibleMaterial.getMaterial(is.getType()).get().isSimilar(jis) : jis.isSimilar(is)) {
if (jis.getAmount() <= toRemove) {
toRemove -= jis.getAmount();
p.getInventory().removeItem(jis);
@ -266,8 +277,9 @@ public class Challenge {
// Give specific item to player
ItemStack is = (ItemStack) obj;
HashMap<Integer, ItemStack> rest = p.getInventory().addItem(is.clone());
for (ItemStack restIs : rest.values())
for (ItemStack restIs : rest.values()) {
p.getWorld().dropItem(p.getLocation(), restIs);
}
}
},
CMD {
@ -276,8 +288,9 @@ public class Challenge {
@Override
public String convert(String value) throws IllegalArgumentException {
// Here we don't have to convert the value because the value is the command
if (value == null || "".equalsIgnoreCase(value))
if (value == null || "".equalsIgnoreCase(value)) {
throw new IllegalArgumentException("Value is empty or null");
}
return value;
}
@ -306,8 +319,9 @@ public class Challenge {
public Integer convert(String value) throws IllegalArgumentException {
// Convert the value to an Integer representing the minimum level of island
// required
if (value == null || "".equalsIgnoreCase(value))
if (value == null || "".equalsIgnoreCase(value)) {
throw new IllegalArgumentException("Value is empty or null");
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException ex) {
@ -320,7 +334,7 @@ public class Challenge {
public boolean has(Player p, Object obj) {
// Check if the level of player's island is greater or equals to the required
// level
Island is = SkyBlock.getInstance().getIslandManager().getIsland(p);
Island is = SkyBlock.getPlugin(SkyBlock.class).getIslandManager().getIsland(p);
// Player doesn't have an island
if (is != null && obj instanceof Number) {
return is.getLevel().getLevel() >= ((Number) obj).longValue();
@ -342,8 +356,9 @@ public class Challenge {
@Override
public Peer<EntityType, Integer> convert(String value) throws IllegalArgumentException {
// We returns the entity type and the number of entity required
if (value == null || "".equalsIgnoreCase(value))
if (value == null || "".equalsIgnoreCase(value)) {
throw new IllegalArgumentException("Value is empty or null");
}
int index = value.indexOf(' ');
// The id
String id = index == -1 ? value : value.substring(0, index);
@ -352,8 +367,7 @@ public class Challenge {
try {
et = EntityType.valueOf(id.toUpperCase());
} catch (Exception ex) {
throw new IllegalArgumentException(
"\"" + id + "\" isn't a correct Minecraft EntityType (value = \"" + value + "\")");
throw new IllegalArgumentException("\"" + id + "\" isn't a correct Minecraft EntityType (value = \"" + value + "\")");
}
int amount = 1;
if (index != -1) {
@ -361,11 +375,10 @@ public class Challenge {
try {
amount = Integer.parseInt(strAmount);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"\"" + strAmount + "\" isn't a correct number (value = \"" + value + "\")");
throw new IllegalArgumentException("\"" + strAmount + "\" isn't a correct number (value = \"" + value + "\")");
}
}
return new Peer<EntityType, Integer>(et, amount);
return new Peer<>(et, amount);
}
@Override
@ -375,10 +388,12 @@ public class Challenge {
List<Entity> entities = p.getNearbyEntities(60, 60, 60);
int count = 0;
for (Entity e : entities) {
if (e.getType() == peer.getKey())
if (e.getType() == peer.getKey()) {
count++;
if (count == peer.getValue())
}
if (count == peer.getValue()) {
return true;
}
}
return false;
}
@ -400,30 +415,31 @@ public class Challenge {
@Override
public Peer<PotionType, Peer<Integer, Integer>> convert(String value) throws IllegalArgumentException {
// We returns the potion required
if (value == null || "".equalsIgnoreCase(value))
if (value == null || "".equalsIgnoreCase(value)) {
throw new IllegalArgumentException("Value is empty or null");
String[] split = space.split(value);
if (split.length != 3)
}
String[] split = this.space.split(value);
if (split.length != 3) {
throw new IllegalArgumentException("Incorrect value : \"" + value + "\"");
}
// The id
// Check if it's a Minecraft item
PotionType pt;
try {
pt = PotionType.valueOf(split[0].toUpperCase());
} catch (Exception ex) {
throw new IllegalArgumentException(
"\"" + split[0] + "\" isn't a correct Minecraft PotionType (value = \"" + value + "\")");
throw new IllegalArgumentException("\"" + split[0] + "\" isn't a correct Minecraft PotionType (value = \"" + value + "\")");
}
// The data
int data;
try {
data = Integer.parseInt(split[1]);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"\"" + split[1] + "\" isn't a correct number (value = \"" + value + "\")");
throw new IllegalArgumentException("\"" + split[1] + "\" isn't a correct number (value = \"" + value + "\")");
}
if (data < 0 || data > 8)
if (data < 0 || data > 8) {
throw new IllegalArgumentException("Data must be between 0 and 8, but is \"" + split[1] + "\"");
}
int amount;
try {
amount = Integer.parseInt(split[2]);
@ -444,8 +460,9 @@ public class Challenge {
&& isSame(is, peer.getKey(), peer.getValue().getKey())) {
// Same potion
count += is.getAmount();
if (count >= peer.getValue().getValue())
if (count >= peer.getValue().getValue()) {
return true;
}
}
}
return false;
@ -479,12 +496,13 @@ public class Challenge {
Peer<PotionType, Peer<Integer, Integer>> peer = (Peer<PotionType, Peer<Integer, Integer>>) obj;
ItemStack is = null;
int data = peer.getValue().getKey();
if (data <= 2)
if (data <= 2) {
is = new ItemStack(Material.POTION, peer.getValue().getValue());
else if (data <= 5)
} else if (data <= 5) {
is = new ItemStack(Material.LINGERING_POTION, peer.getValue().getValue());
else if (data <= 8)
} else if (data <= 8) {
is = new ItemStack(Material.SPLASH_POTION, peer.getValue().getValue());
}
PotionMeta pm = (PotionMeta) is.getItemMeta();
pm.setBasePotionData(new PotionData(peer.getKey(), data == 1 || data == 4 || data == 7,
data == 2 || data == 5 || data == 8));
@ -492,8 +510,9 @@ public class Challenge {
// Add item or drop if inventory is full
HashMap<Integer, ItemStack> rest = p.getInventory().addItem(is);
for (ItemStack restIs : rest.values())
for (ItemStack restIs : rest.values()) {
p.getWorld().dropItem(p.getLocation(), restIs);
}
// TODO LOG
}
@ -518,28 +537,32 @@ public class Challenge {
* </ul>
*/
private boolean isSame(ItemStack is, PotionType type, int data) {
if (data <= 2 && is.getType() != Material.POTION)
if (data <= 2 && is.getType() != Material.POTION) {
return false;
else if (data >= 3 && data <= 5 && is.getType() != Material.LINGERING_POTION)
} else if (data >= 3 && data <= 5 && is.getType() != Material.LINGERING_POTION) {
return false;
else if (data >= 6 && data <= 8 && is.getType() != Material.SPLASH_POTION)
} else if (data >= 6 && data <= 8 && is.getType() != Material.SPLASH_POTION) {
return false;
}
PotionMeta pm = (PotionMeta) is.getItemMeta();
PotionData pd = pm.getBasePotionData();
if (pd.getType() != type)
if (pd.getType() != type) {
return false;
else if ((data == 0 || data == 3 || data == 6) && (pd.isExtended() || pd.isUpgraded()))
} else if ((data == 0 || data == 3 || data == 6) && (pd.isExtended() || pd.isUpgraded())) {
return false;
else if ((data == 1 || data == 4 || data == 7) && !pd.isExtended())
} else if ((data == 1 || data == 4 || data == 7) && !pd.isExtended()) {
return false;
else return (data != 2 && data != 5 && data != 8) || pd.isUpgraded();
} else {
return (data != 2 && data != 5 && data != 8) || pd.isUpgraded();
}
}
},
ECO {
@Override
public Double convert(String value) throws IllegalArgumentException {
if (value == null || "".equalsIgnoreCase(value))
if (value == null || "".equalsIgnoreCase(value)) {
throw new IllegalArgumentException("Value is empty or null");
}
try {
return Double.parseDouble(value);
} catch (NumberFormatException ex) {
@ -550,7 +573,12 @@ public class Challenge {
@Override
public boolean has(Player p, Object obj) {
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
Economy economy = SkyBlock.getPlugin(SkyBlock.class).getEconomyManager().getEconomy();
if (economy == null) {
SkyBlock.getInstance().getLogger().warning("No compatible economy plugin found Please check your configuration");
return false;
}
if (obj instanceof Number) {
return economy.getBalance(p) >= ((Number) obj).doubleValue();
}
@ -559,7 +587,7 @@ public class Challenge {
@Override
public void executeRequire(Player p, Object obj) {
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
Economy economy = SkyBlock.getPlugin(SkyBlock.class).getEconomyManager().getEconomy();
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
economy.withdrawBalance(p, ((Number) obj).doubleValue());
}
@ -567,7 +595,7 @@ public class Challenge {
@Override
public void executeReward(Player p, Object obj) {
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
Economy economy = SkyBlock.getPlugin(SkyBlock.class).getEconomyManager().getEconomy();
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
economy.deposit(p, ((Number) obj).doubleValue());
}
@ -576,8 +604,9 @@ public class Challenge {
BANK {
@Override
public Double convert(String value) throws IllegalArgumentException {
if (value == null || "".equalsIgnoreCase(value))
if (value == null || "".equalsIgnoreCase(value)) {
throw new IllegalArgumentException("Value is empty or null");
}
try {
return Double.parseDouble(value);
} catch (NumberFormatException ex) {
@ -588,7 +617,7 @@ public class Challenge {
@Override
public boolean has(Player p, Object obj) {
Island is = SkyBlock.getInstance().getIslandManager().getIsland(p);
Island is = SkyBlock.getPlugin(SkyBlock.class).getIslandManager().getIsland(p);
if (is != null && obj instanceof Number && ((Number) obj).doubleValue() > 0) {
return is.getBankBalance() >= ((Number) obj).doubleValue();
@ -598,8 +627,8 @@ public class Challenge {
@Override
public void executeRequire(Player p, Object obj) {
Island is = SkyBlock.getInstance().getIslandManager().getIsland(p);
BankManager bankManager = SkyBlock.getInstance().getBankManager();
Island is = SkyBlock.getPlugin(SkyBlock.class).getIslandManager().getIsland(p);
BankManager bankManager = SkyBlock.getPlugin(SkyBlock.class).getBankManager();
if (is != null && obj instanceof Number && ((Number) obj).doubleValue() > 0) {
bankManager.withdraw(p, is, ((Number) obj).doubleValue(), false);
@ -608,8 +637,8 @@ public class Challenge {
@Override
public void executeReward(Player p, Object obj) {
Island is = SkyBlock.getInstance().getIslandManager().getIsland(p);
BankManager bankManager = SkyBlock.getInstance().getBankManager();
Island is = SkyBlock.getPlugin(SkyBlock.class).getIslandManager().getIsland(p);
BankManager bankManager = SkyBlock.getPlugin(SkyBlock.class).getBankManager();
if (is != null && obj instanceof Number) {
bankManager.deposit(p, is, ((Number) obj).doubleValue(), false);

View File

@ -0,0 +1,110 @@
package com.craftaro.skyblock.challenge.challenge;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.Set;
public class ChallengeCategory {
private final int id;
private final String name;
private final HashMap<Integer, Challenge> challenges;
public ChallengeCategory(int id, String name, FileConfiguration config) {
this.id = id;
this.name = name;
this.challenges = new HashMap<>();
loadChallenges(config);
}
private void loadChallenges(FileConfiguration config) {
ConfigurationSection section = config.getConfigurationSection("challenges." + this.id + ".challenges");
if (section == null) {
return; // No challenge here
}
Set<String> keys = section.getKeys(false);
for (String k : keys) {
String key = "challenges." + this.id + ".challenges." + k;
int id = config.getInt(key + ".id");
if (id == 0) {
throw new IllegalArgumentException("Invalid id at category " + this.name + "(" + this.id
+ ") at challenge " + this.name + "(" + id + ")");
}
String name = ChatColor.translateAlternateColorCodes('&', config.getString(key + ".name"));
List<String> require = toColor(config.getStringList(key + ".require"));
List<String> reward = toColor(config.getStringList(key + ".reward"));
int maxTimes = 0;
try {
Integer.parseInt(config.getString(key + ".maxtimes", "unlimited"));
maxTimes = config.getInt(key + ".maxtimes");
} catch (NumberFormatException ignored) {
if (config.getString(key + ".maxtimes", "unlimited").equalsIgnoreCase("unlimited")) {
maxTimes = Integer.MAX_VALUE;
}
}
boolean showInChat = config.getBoolean(key + ".showInChat");
// Item
boolean show = config.getBoolean(key + ".item.show");
int row = show ? config.getInt(key + ".item.row") : 0;
int col = show ? config.getInt(key + ".item.col") : 0;
String strItem = show ? config.getString(key + ".item.item") : "AIR";
if (strItem == null) {
strItem = "AIR";
}
int amount = show ? config.getInt(key + ".item.amount") : 0;
List<String> lore = show ? toColor(config.getStringList(key + ".item.lore")) : new ArrayList<>();
try {
// If an Exception occurs, we don't handle it here but in parent class
Optional<XMaterial> compatibleMaterial = CompatibleMaterial.getMaterial(strItem);
if (!compatibleMaterial.isPresent()) {
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
}
ItemChallenge ic = new ItemChallenge(show, row, col, compatibleMaterial.get(), amount, lore);
Challenge c = new Challenge(this, id, name, maxTimes, showInChat, require, reward, ic);
this.challenges.put(id, c);
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException("Exception at category " + this.name.replace("&", "") + "(" + this.id
+ ") at challenge " + name.replace("&", "") + "(" + id + "): " + ex.getMessage());
}
}
Bukkit.getConsoleSender().sendMessage("[FabledSkyBlock] " + ChatColor.GREEN + "Category " + this.name + ChatColor.GREEN
+ " loaded with " + ChatColor.GOLD + this.challenges.size() + ChatColor.GREEN + " challenges");
}
private List<String> toColor(List<String> list) {
List<String> copy = new ArrayList<>();
if (list == null) {
return copy;
}
for (String str : list) {
copy.add(ChatColor.translateAlternateColorCodes('&', str));
}
return copy;
}
// GETTERS
public Challenge getChallenge(int id) {
return this.challenges.get(id);
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public HashMap<Integer, Challenge> getChallenges() {
return this.challenges;
}
}

View File

@ -0,0 +1,45 @@
package com.craftaro.skyblock.challenge.challenge;
import com.craftaro.skyblock.SkyBlock;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.HashMap;
import java.util.logging.Level;
public class ChallengeManager {
private final SkyBlock plugin;
private final HashMap<Integer, ChallengeCategory> categories;
public ChallengeManager(SkyBlock plugin) {
this.plugin = plugin;
this.categories = new HashMap<>();
loadChallenges();
}
private void loadChallenges() {
FileConfiguration configLoad = this.plugin.getChallenges();
try {
ConfigurationSection section = configLoad.getConfigurationSection("challenges");
if (section != null) {
for (String k : section.getKeys(false)) {
int id = configLoad.getInt("challenges." + k + ".id");
String name = this.plugin.formatText(configLoad.getString("challenges." + k + ".name"));
ChallengeCategory cc = new ChallengeCategory(id, name, configLoad);
this.categories.put(id, cc);
}
}
} catch (IllegalArgumentException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Error while loading challenges:", ex);
return;
}
Bukkit.getConsoleSender().sendMessage("[FabledSkyBlock] " + ChatColor.GREEN + " challenges loaded with " + ChatColor.GOLD + this.categories.size() + ChatColor.GREEN + " categories");
}
public ChallengeCategory getChallenge(int id) {
return this.categories.get(id);
}
}

View File

@ -0,0 +1,87 @@
package com.craftaro.skyblock.challenge.challenge;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.List;
import java.util.UUID;
public class ItemChallenge {
private Challenge challenge;
private final boolean show;
private final int row;
private final int col;
private final XMaterial type;
private final int amount;
private final List<String> lore;
private final String itemTitle;
public ItemChallenge(boolean show, int row, int col, XMaterial type, int amount, List<String> lore) {
this.show = show;
this.row = row;
this.col = col;
this.type = type;
this.amount = amount;
this.lore = lore;
FileConfiguration langConfigLoad = SkyBlock.getPlugin(SkyBlock.class).getLanguage();
this.itemTitle = langConfigLoad.getString("Challenge.Inventory.Item.Title");
}
public ItemStack createItem(UUID player, int amount) {
FileConfiguration langConfigLoad = SkyBlock.getPlugin(SkyBlock.class).getLanguage();
ItemStack is = this.type.parseItem();
is.setAmount(this.amount);
// Air
ItemMeta im = is.getItemMeta();
if (im != null) {
String maxAmount;
if (this.challenge.getMaxTimes() == Integer.MAX_VALUE) {
maxAmount = langConfigLoad.getString("Challenge.Inventory.Unlimited.Message");
} else {
maxAmount = String.valueOf(this.challenge.getMaxTimes());
}
im.setDisplayName(SkyBlock.getPlugin(SkyBlock.class).formatText(this.challenge.getName()).replace("%amount", Integer.toString(amount)).replace("%max", maxAmount));
im.setLore(this.lore);
is.setItemMeta(im);
}
return is;
}
// GETTERS & SETTERS
public Challenge getChallenge() {
return this.challenge;
}
public void setChallenge(Challenge challenge) {
this.challenge = challenge;
}
public boolean isShow() {
return this.show;
}
public int getRow() {
return this.row;
}
public int getCol() {
return this.col;
}
public XMaterial getType() {
return this.type;
}
public int getAmount() {
return this.amount;
}
public List<String> getLore() {
return this.lore;
}
}

View File

@ -0,0 +1,19 @@
package com.craftaro.skyblock.challenge.challenge;
public class Peer<E, F> {
private final E key;
private final F value;
public Peer(E key, F value) {
this.key = key;
this.value = value;
}
public E getKey() {
return this.key;
}
public F getValue() {
return this.value;
}
}

View File

@ -0,0 +1,81 @@
package com.craftaro.skyblock.challenge.defaultinv;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class DefaultInventory {
private final Item defaultItem = new Item(new ItemStack(Material.AIR));
private final int size;
private final Item[][] items;
public DefaultInventory(SkyBlock plugin) {
FileConfiguration configLoad = plugin.getChallenges();
this.size = configLoad.getInt("inventory.size");
this.items = new Item[9][this.size];
ConfigurationSection section = configLoad.getConfigurationSection("inventory.items");
if (section == null)
// No items
{
return;
}
for (String key : section.getKeys(false)) {
String k = "inventory.items." + key;
int row = configLoad.getInt(k + ".row");
int col = configLoad.getInt(k + ".col");
String strItem = configLoad.getString(k + ".item");
int amount = configLoad.getInt(k + ".amount");
String name = plugin.formatText(configLoad.getString(k + ".name"));
List<String> lore = toColor(configLoad.getStringList(k + ".lore"));
int redirect = configLoad.getInt(k + ".redirect");
Optional<XMaterial> material = CompatibleMaterial.getMaterial(strItem);
if (!material.isPresent() || CompatibleMaterial.isAir(material.get())) {
Bukkit.getLogger().warning("Item " + strItem + " is not a Material");
continue;
}
ItemStack is = material.get().parseItem();
is.setAmount(amount);
ItemMeta im = is.getItemMeta();
im.setDisplayName(name);
im.setLore(lore);
is.setItemMeta(im);
this.items[col - 1][row - 1] = new Item(is, redirect);
}
}
private List<String> toColor(List<String> list) {
List<String> copy = new ArrayList<>();
if (list == null) {
return copy;
}
for (String str : list) {
copy.add(ChatColor.translateAlternateColorCodes('&', str));
}
return copy;
}
public Item get(int row, int col) {
Item is = this.items[col][row];
if (is == null) {
is = this.defaultItem;
}
// Clone it
return new Item(is.getItemStack().clone(), is.getRedirect());
}
public int getSize() {
return this.size;
}
}

View File

@ -0,0 +1,25 @@
package com.craftaro.skyblock.challenge.defaultinv;
import org.bukkit.inventory.ItemStack;
public class Item {
private final ItemStack itemStack;
private final int redirect;
public Item(ItemStack itemStack) {
this(itemStack, 0);
}
public Item(ItemStack itemStack, int redirect) {
this.itemStack = itemStack;
this.redirect = redirect;
}
public ItemStack getItemStack() {
return this.itemStack;
}
public int getRedirect() {
return this.redirect;
}
}

View File

@ -0,0 +1,40 @@
/**
*
*/
package com.craftaro.skyblock.challenge.inventory;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import java.util.function.Consumer;
public class ClickableItem {
private final ItemStack item;
private final Consumer<InventoryClickEvent> event;
private ClickableItem(ItemStack item, Consumer<InventoryClickEvent> event) {
this.item = item;
this.event = event;
}
public void run(InventoryClickEvent e) {
this.event.accept(e);
}
public ItemStack getItemStack() {
return this.item;
}
public Consumer<InventoryClickEvent> getEvent() {
return this.event;
}
public static ClickableItem of(ItemStack is) {
return new ClickableItem(is, e -> {
});
}
public static ClickableItem of(ItemStack is, Consumer<InventoryClickEvent> event) {
return new ClickableItem(is, event);
}
}

View File

@ -0,0 +1,243 @@
/**
*
*/
package com.craftaro.skyblock.challenge.inventory;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
public class Inventory {
public static final String TICK = "tick";
private final HashMap<String, Object> values;
private final Player player;
private final InventoryProvider inventoryProvider;
private final int size;
private final List<Integer> excluseCases;
private final ClickableItem[] items;
private final org.bukkit.inventory.Inventory bukkitInventory;
public Inventory(Player player, InventoryProvider inventoryProvider, Consumer<Inventory> params) {
this.values = new HashMap<>();
this.player = player;
this.inventoryProvider = inventoryProvider;
params.accept(this);
this.excluseCases = inventoryProvider.excluseCases(this);
this.size = inventoryProvider.rows(this);
this.items = new ClickableItem[9 * this.size];
this.bukkitInventory = Bukkit.createInventory(player, this.size * 9, inventoryProvider.title(this));
put(TICK, 0);
}
public Player getPlayer() {
return this.player;
}
public InventoryProvider getInventoryProvider() {
return this.inventoryProvider;
}
public org.bukkit.inventory.Inventory getBukkitInventory() {
return this.bukkitInventory;
}
public int getRows() {
return this.size;
}
public List<Integer> getExcludeCases() {
return this.excluseCases;
}
public void set(int col, int row, ClickableItem item) {
if (col < 1 || col > 9) {
throw new IllegalArgumentException("col must be between 1 and 9 but is " + col);
}
if (row < 1 || row > getRows()) {
throw new IllegalArgumentException("row must be between 1 and " + getRows());
}
set(locToPos(col, row), item);
}
public void set(int pos, ClickableItem item) {
if (pos < 0 || pos > this.size * 9 - 1) {
throw new IllegalArgumentException("pos must be between 0 and " + (this.size * 9 - 1) + ", but is " + pos);
}
this.items[pos] = item;
this.bukkitInventory.setItem(pos, item == null ? null : item.getItemStack());
}
/**
* Update the item but keep the old event
*/
public void updateItem(int col, int row, ItemStack is) {
if (col < 1 || col > 9) {
throw new IllegalArgumentException("col must be between 1 and 9 but is " + col);
}
if (row < 1 || row > getRows()) {
throw new IllegalArgumentException("row must be between 1 and " + getRows());
}
updateItem(locToPos(col, row), is);
}
/**
* Update the item but keep the old event
*/
public void updateItem(int pos, ItemStack is) {
if (pos < 0 || pos > this.size * 9 - 1) {
throw new IllegalArgumentException("pos must be between 0 and " + (this.size * 9 - 1) + ", but is " + pos);
}
ClickableItem item = this.items[pos];
if (item == null) {
item = ClickableItem.of(is);
} else {
item = ClickableItem.of(is, item.getEvent());
}
set(pos, item);
}
public void fill(ClickableItem item) {
for (int row = 0; row < this.size; row++) {
for (int col = 0; col < 9; col++) {
set(row * 9 + col, item);
}
}
}
public void rectangle(int col, int row, int width, int height, ClickableItem item) {
if (col < 1 || col > 9) {
throw new IllegalArgumentException("col must be between 1 and 9");
}
if (row < 1 || row > getRows()) {
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
}
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col) {
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
}
if (height < 1 || height > getRows() + 1 - row) {
throw new IllegalArgumentException("The height must be between 1 and " + (getRows() + 1 - row));
}
rectangle(locToPos(col, row), width, height, item);
}
public void rectangle(int pos, int width, int height, ClickableItem item) {
if (pos < 0 || pos > this.size * 9) {
throw new IllegalArgumentException("pos must be between 0 and " + (this.size * 9) + ", but is " + pos);
}
int[] colRow = posToLoc(pos);
int row = colRow[0];
int col = colRow[1];
if (col < 1 || col > 9) {
throw new IllegalArgumentException("col must be between 1 and 9, but is " + col);
}
if (row < 1 || row > 6) {
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
}
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col) {
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
}
if (height < 1 || height > getRows() + 1 - row) {
throw new IllegalArgumentException(
"The height must be between 1 and " + (getRows() + 1 - row) + ", but is " + height);
}
for (int i = col; i < col + width; i++) {
for (int j = row; j < row + height; j++)
// Around
{
if (i == col || i == col + width - 1 || j == row || j == row + height - 1) {
set(i, j, item);
}
}
}
}
public void fillRectangle(int col, int row, int width, int height, ClickableItem item) {
if (col < 1 || col > 9) {
throw new IllegalArgumentException("col must be between 1 and 9, but is " + col);
}
if (row < 1 || row > 6) {
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
}
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col) {
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
}
if (height < 1 || height > getRows() + 1 - row) {
throw new IllegalArgumentException(
"The height must be between 1 and " + (getRows() + 1 - row) + ", but is " + height);
}
fillRectangle(locToPos(col, row), width, height, item);
}
public void fillRectangle(int pos, int width, int height, ClickableItem item) {
if (pos < 0 || pos > this.size * 9) {
throw new IllegalArgumentException("pos must be between 0 and " + (this.size * 9) + ", but is " + pos);
}
int[] colRow = posToLoc(pos);
int row = colRow[0];
int col = colRow[1];
if (col < 1 || col > 9) {
throw new IllegalArgumentException("col must be between 1 and 9, but is " + col);
}
if (row < 1 || row > 6) {
throw new IllegalArgumentException("row must be between 1 and the maximum number of rows, but is " + row);
}
// 10 - col because width starts with 1 and not 0
if (width < 1 || width > 10 - col) {
throw new IllegalArgumentException("The width must be between 1 and " + (10 - col) + ", but is " + width);
}
if (height < 1 || height > getRows() + 1 - row) {
throw new IllegalArgumentException(
"The height must be between 1 and " + (getRows() + 1 - row) + ", but is " + height);
}
for (int i = col; i < col + width; i++) {
for (int j = row; j < row + height; j++) {
set(i, j, item);
}
}
}
public void open() {
this.player.openInventory(this.bukkitInventory);
}
public void handler(InventoryClickEvent e) {
int pos = e.getSlot();
if (pos < 0 || pos > this.items.length) {
return;
}
ClickableItem item = this.items[pos];
if (item == null) {
// Nothing to do
return;
}
item.run(e);
}
public void put(String key, Object value) {
this.values.put(key, value);
}
public Object get(String key) {
return this.values.get(key);
}
public int[] posToLoc(int pos) {
return new int[]{(pos / 9) + 1, (pos % 9) + 1};
}
public int locToPos(int col, int row) {
return (row - 1) * 9 + (col - 1);
}
}

View File

@ -0,0 +1,133 @@
/**
*
*/
package com.craftaro.skyblock.challenge.inventory;
import com.craftaro.skyblock.SkyBlock;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.UUID;
import java.util.function.Consumer;
public class InventoryManager implements Listener {
private final SkyBlock plugin;
private final HashMap<UUID, Inventory> inventories;
public InventoryManager(SkyBlock plugin) {
this.plugin = plugin;
this.inventories = new HashMap<>();
}
public void init() {
Bukkit.getPluginManager().registerEvents(this, this.plugin);
int task = Bukkit.getScheduler().scheduleSyncRepeatingTask(this.plugin, () -> {
if (this.inventories.isEmpty()) {
return;
}
for (Inventory inv : this.inventories.values()) {
int tick = 0;
Object currentTick = inv.get(Inventory.TICK);
if (currentTick instanceof Integer) {
tick = Integer.parseInt(currentTick.toString());
}
inv.put(Inventory.TICK, tick + 1);
inv.getInventoryProvider().update(inv);
}
}, 1, 1);
}
public Inventory openInventory(InventoryProvider provider, Player p) {
return openInventory(provider, p, null);
}
public Inventory openInventory(InventoryProvider provider, Player p, Consumer<Inventory> params) {
Inventory inv = new Inventory(p, provider, params);
inv.getInventoryProvider().init(inv);
this.inventories.put(inv.getPlayer().getUniqueId(), inv);
inv.open();
return inv;
}
public Inventory getInventory(Player p) {
return this.inventories.get(p.getUniqueId());
}
public boolean hasInventoryOpened(Player p) {
return this.inventories.containsKey(p.getUniqueId());
}
public void closeInventory(Player p) {
p.closeInventory();
}
/**
* Close all inventories
*/
public void closeInventories() {
// New ArrayList to prevent CurrentModificationException
for (Inventory inv : new ArrayList<>(this.inventories.values())) {
closeInventory(inv.getPlayer());
}
this.inventories.clear();
}
@EventHandler
public void onPlayerInventoryClick(InventoryClickEvent e) {
org.bukkit.inventory.Inventory clickedInventory = e.getClickedInventory();
if (clickedInventory == null) {
return;
}
Player p = (Player) e.getWhoClicked();
Inventory inv = getInventory(p);
if (inv == null) {
return;
}
if (e.getAction() == InventoryAction.COLLECT_TO_CURSOR) {
e.setCancelled(true);
return;
}
if (e.getRawSlot() >= e.getInventory().getSize() && !e.isShiftClick()) {
return;
}
if (inv.getExcludeCases() == null || !inv.getExcludeCases().contains(e.getSlot())) {
e.setCancelled(true);
}
if (!inv.getBukkitInventory().equals(clickedInventory)) {
// The player doesn't click on the correct inventory
return;
}
inv.handler(e);
}
@EventHandler
public void onPlayerInventoryDrag(InventoryDragEvent e) {
if (!this.inventories.containsKey(e.getWhoClicked().getUniqueId())) {
return;
}
e.setCancelled(false);
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerInventoryClose(InventoryCloseEvent e) {
if (!this.inventories.containsKey(e.getPlayer().getUniqueId())) {
return;
}
org.bukkit.inventory.Inventory invopen = e.getInventory();
Inventory inv = this.inventories.get(e.getPlayer().getUniqueId());
if (!inv.getBukkitInventory().equals(invopen)) {
return;
}
inv.getInventoryProvider().onClose(e, inv);
this.inventories.remove(e.getPlayer().getUniqueId());
}
}

View File

@ -0,0 +1,26 @@
/**
*
*/
package com.craftaro.skyblock.challenge.inventory;
import org.bukkit.event.inventory.InventoryCloseEvent;
import java.util.ArrayList;
import java.util.List;
public interface InventoryProvider {
String title(Inventory inv);
int rows(Inventory inv);
void init(Inventory inv);
void update(Inventory inv);
default List<Integer> excluseCases(Inventory inv) {
return new ArrayList<>();
}
default void onClose(InventoryCloseEvent e, Inventory inv) {
}
}

View File

@ -0,0 +1,129 @@
package com.craftaro.skyblock.challenge.inventory.inv;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.challenge.FabledChallenge;
import com.craftaro.skyblock.challenge.challenge.Challenge;
import com.craftaro.skyblock.challenge.challenge.ChallengeCategory;
import com.craftaro.skyblock.challenge.challenge.ItemChallenge;
import com.craftaro.skyblock.challenge.defaultinv.DefaultInventory;
import com.craftaro.skyblock.challenge.defaultinv.Item;
import com.craftaro.skyblock.challenge.inventory.ClickableItem;
import com.craftaro.skyblock.challenge.inventory.Inventory;
import com.craftaro.skyblock.challenge.inventory.InventoryProvider;
import org.bukkit.Bukkit;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.HashMap;
import java.util.function.Consumer;
import java.util.logging.Level;
public class ChallengeInventory implements InventoryProvider {
public static final String CATEGORY = "ChallengeCategory";
private final FabledChallenge fc;
public ChallengeInventory(FabledChallenge fc) {
this.fc = fc;
}
@Override
public String title(Inventory inv) {
ChallengeCategory category = (ChallengeCategory) inv.get(CATEGORY);
return category.getName();
}
@Override
public int rows(Inventory inv) {
return this.fc.getDefaultInventory().getSize();
}
@Override
public void init(Inventory inv) {
try {
// Initialize the inventory
ChallengeCategory category = (ChallengeCategory) inv.get(CATEGORY);
HashMap<Challenge, Integer> done = this.fc.getPlayerManager()
.getPlayer(inv.getPlayer().getUniqueId());
if (done == null) {
// How is that possible
return;
}
// Set background
DefaultInventory di = this.fc.getDefaultInventory();
for (int row = 0; row < di.getSize(); row++) {
for (int col = 0; col < 9; col++) {
Item item = di.get(row, col);
inv.set(col + 1, row + 1, ClickableItem.of(item.getItemStack(), e -> {
if (item.getRedirect() != 0) {
ChallengeCategory cat = this.fc.getChallengeManager()
.getChallenge(item.getRedirect());
if (cat != null) {
// Open inventory
this.fc.openChallengeInventory(inv.getPlayer(), cat);
}
}
}));
}
}
// Set challenges
for (Challenge c : category.getChallenges().values()) {
ItemChallenge ic = c.getItem();
if (!ic.isShow()) {
continue;
}
int count = done.getOrDefault(c, 0);
ItemStack is = ic.createItem(inv.getPlayer().getUniqueId(), count);
// If challenge is done, add enchantment to show to player that it's done
if (count >= c.getMaxTimes()) {
is.addUnsafeEnchantment(Enchantment.OXYGEN, 1);
}
ItemMeta im = is.getItemMeta();
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
is.setItemMeta(im);
Consumer<InventoryClickEvent> consumer = e -> {
// Count the new value
int count2 = done.getOrDefault(c, 0);
if (count2 >= c.getMaxTimes()) {
// Do not continue if maxtimes has been reached
return;
}
Player p = inv.getPlayer();
if (this.fc.getPlayerManager().doChallenge(p, c)) {
// Ok
// Update count
count2 = done.getOrDefault(c, 0);
// Play sound
XSound.ENTITY_PLAYER_LEVELUP.play(p);
// Update item
ItemStack is2 = ic.createItem(inv.getPlayer().getUniqueId(), count2);
// If challenge is done, add enchantment to show to player that it's done
if (count2 >= c.getMaxTimes()) {
is2.addUnsafeEnchantment(Enchantment.OXYGEN, 1);
}
ItemMeta im2 = is2.getItemMeta();
im2.addItemFlags(ItemFlag.HIDE_ENCHANTS);
is2.setItemMeta(im2);
// Update
inv.updateItem(ic.getCol(), ic.getRow(), is2);
} else {
XSound.BLOCK_GLASS_BREAK.play(p);
}
};
inv.set(ic.getCol(), ic.getRow(), ClickableItem.of(is, consumer));
}
} catch (Exception ex) {
Bukkit.getLogger().log(Level.SEVERE, "", ex);
}
}
@Override
public void update(Inventory inv) {
// Nothing to update here
}
}

View File

@ -0,0 +1,24 @@
package com.craftaro.skyblock.challenge.player;
import com.craftaro.skyblock.challenge.challenge.Challenge;
import java.util.HashMap;
import java.util.UUID;
public class PlayerChallenge {
private final UUID uuid;
private final HashMap<Challenge, Integer> challenges;
public PlayerChallenge(UUID uuid, HashMap<Challenge, Integer> challenges) {
this.uuid = uuid;
this.challenges = challenges;
}
public UUID getUuid() {
return this.uuid;
}
public HashMap<Challenge, Integer> getChallenges() {
return this.challenges;
}
}

View File

@ -0,0 +1,256 @@
package com.craftaro.skyblock.challenge.player;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.challenge.challenge.Challenge;
import com.craftaro.skyblock.challenge.challenge.ChallengeCategory;
import com.craftaro.skyblock.challenge.challenge.Peer;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island;
import com.eatthepath.uuid.FastUUID;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class PlayerManager {
private final SkyBlock plugin;
private final HashMap<UUID, HashMap<Challenge, Integer>> islands;
private final File playersDirectory;
public PlayerManager(SkyBlock plugin) {
this.plugin = plugin;
this.islands = new HashMap<>();
this.playersDirectory = new File(plugin.getDataFolder(), "challenge-data");
if (!this.playersDirectory.exists()) {
this.playersDirectory.mkdirs();
}
Bukkit.getScheduler().runTask(plugin, () -> {
Bukkit.getServer().getOnlinePlayers().stream().map(Entity::getUniqueId).forEach(this::loadPlayer);
});
}
public HashMap<Challenge, Integer> getPlayer(UUID uuid) {
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", false)) {
OfflinePlayer player = Bukkit.getPlayer(uuid);
if (player == null) {
player = Bukkit.getOfflinePlayer(uuid);
}
Island is = this.plugin.getIslandManager().getIsland(player);
if (is != null) {
uuid = is.getOwnerUUID();
}
}
return this.islands.get(uuid);
}
/**
* Load specific player
*
* @param uuid The uuid of specific player
*/
public void loadPlayer(UUID uuid) {
if (this.plugin.getConfiguration().getBoolean("Island.Challenge.PerIsland", true)) {
Island is = this.plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if (is != null) {
uuid = is.getOwnerUUID();
}
}
FileManager.Config config = this.plugin.getFileManager().getConfig(new File(this.playersDirectory, FastUUID.toString(uuid) + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
HashMap<Challenge, Integer> challenges = new HashMap<>();
ConfigurationSection section = fileConfig.getConfigurationSection("challenges");
Set<String> strs = (section != null) ? section.getKeys(false) : new HashSet<>();
for (String k : strs) {
int id = fileConfig.getInt("challenges." + k + ".id");
ChallengeCategory cc = this.plugin.getFabledChallenge().getChallengeManager().getChallenge(id);
// WTF
if (cc == null) {
continue;
}
ConfigurationSection section2 = fileConfig.getConfigurationSection("challenges." + k + ".challenges");
if (section2 != null) {
for (String d : section2.getKeys(false)) {
String key = "challenges." + k + ".challenges." + d;
int cId = fileConfig.getInt(key + ".id");
int count = fileConfig.getInt(key + ".count");
Challenge c = cc.getChallenge(cId);
if (c == null) {
continue;
}
challenges.put(c, count);
}
}
}
this.islands.put(uuid, challenges);
}
/**
* Unload specific player
*
* @param uuid The uuid of specific player
*/
public void unloadPlayer(UUID uuid) {
if (this.plugin.getConfiguration().getBoolean("Island.Challenge.PerIsland", false)) {
OfflinePlayer player = Bukkit.getPlayer(uuid);
if (player == null) {
player = Bukkit.getOfflinePlayer(uuid);
}
Island is = this.plugin.getIslandManager().getIsland(player);
if (is != null) {
if (!this.plugin.getIslandManager().getMembersOnline(is).isEmpty()) {
return;
} else {
uuid = is.getOwnerUUID();
}
}
}
this.islands.remove(uuid);
this.plugin.getFileManager().unloadConfig(new File(this.playersDirectory, FastUUID.toString(uuid) + ".yml"));
}
/**
* Check if a specific player can do a specific challenge
*
* @param p The player
* @param c The challenge
* @return true if a specific player can execute a specific challenge
*/
public boolean canDoChallenge(Player p, Challenge c) {
if (c == null) {
return false;
}
UUID uuid = p.getUniqueId();
if (this.plugin.getConfiguration()
.getBoolean("Island.Challenge.PerIsland", true)) {
Island is = this.plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if (is != null) {
uuid = is.getOwnerUUID();
}
}
HashMap<Challenge, Integer> done = this.islands.get(uuid);
if (done == null) {
// Wtf ?
loadPlayer(uuid);
done = this.islands.get(uuid);
}
int count = done.getOrDefault(c, 0);
if (c.getMaxTimes() != 0 && count >= c.getMaxTimes()) {
return false;
}
// Check if player has required items
for (Peer<Challenge.Type, Object> peer : c.getRequires()) {
if (!peer.getKey().has(p, peer.getValue())) {
return false;
}
}
return true;
}
/**
* Perform specific challenge for specific player
*
* @param p Specific player
* @param c Specific challenge
* @return true if all is good
*/
public boolean doChallenge(Player p, Challenge c) {
if (!canDoChallenge(p, c)) {
return false;
}
UUID uuid = p.getUniqueId();
if (this.plugin.getConfiguration().getBoolean("Island.Challenge.PerIsland", true)) {
Island is = this.plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if (is != null) {
uuid = is.getOwnerUUID();
}
}
HashMap<Challenge, Integer> done = this.islands.get(uuid);
int count = done.getOrDefault(c, 0);
done.put(c, count + 1);
addChallenge(uuid, c);
// Take items
for (Peer<Challenge.Type, Object> peer : c.getRequires()) {
peer.getKey().executeRequire(p, peer.getValue());
}
for (Peer<Challenge.Type, Object> peer : c.getRewards()) {
peer.getKey().executeReward(p, peer.getValue());
}
// Ok, send message
String broadcast = this.plugin.formatText(this.plugin.getLanguage().getString("Challenge.Broadcast"));
if (c.isShowInChat()) {
Bukkit.broadcastMessage(broadcast.replace("%player", p.getName()).replace("%challenge", c.getName())
.replace("%amount", Integer.toString(count + 1))
.replace("%max", Integer.toString(c.getMaxTimes())));
}
return true;
}
public void addChallenge(UUID uuid, Challenge c) {
if (this.plugin.getConfiguration().getBoolean("Island.Challenge.PerIsland", true)) {
Island is = this.plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if (is != null) {
uuid = is.getOwnerUUID();
}
}
FileManager.Config config = this.plugin.getFileManager().getConfig(new File(this.playersDirectory, FastUUID.toString(uuid) + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
int ccId = c.getCategory().getId();
int cId = c.getId();
int count = 1;
if (fileConfig.contains("challenges." + ccId + ".challenges." + cId + ".count")) {
count = fileConfig.getInt("challenges." + ccId + ".challenges." + cId + ".count") + 1;
}
fileConfig.set("challenges." + ccId + ".id", ccId);
fileConfig.set("challenges." + ccId + ".challenges." + cId + ".id", cId);
fileConfig.set("challenges." + ccId + ".challenges." + cId + ".count", count);
try {
fileConfig.save(new File(this.playersDirectory, FastUUID.toString(uuid) + ".yml"));
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* Return the number of time specific player has done a specific challenge
*
* @param uuid The player's uuid
* @param c The challenge
* @return The number of time specific challenge has been done by player
*/
public int getChallengeCount(UUID uuid, Challenge c) {
HashMap<Challenge, Integer> challenges = this.islands.get(uuid);
if (challenges != null) {
return challenges.getOrDefault(c, 0);
} else {
if (this.plugin.getConfiguration().getBoolean("Island.Challenge.PerIsland", true)) {
Island is = this.plugin.getIslandManager().getIsland(Bukkit.getOfflinePlayer(uuid));
if (is != null) {
uuid = is.getOwnerUUID();
}
}
// Not connected, check in file
FileManager.Config config = this.plugin.getFileManager().getConfig(new File(this.playersDirectory,
FastUUID.toString(uuid) + ".yml"));
FileConfiguration fileConfig = config.getFileConfiguration();
int ccId = c.getCategory().getId();
int cId = c.getId();
if (!fileConfig.contains("challenges." + ccId + ".challenges." + cId + ".count")) {
return 0;
}
return fileConfig.getInt("challenges." + ccId + ".challenges." + cId + ".count");
}
}
}

View File

@ -1,21 +1,74 @@
package com.songoda.skyblock.command;
package com.craftaro.skyblock.command;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.command.commands.admin.*;
import com.songoda.skyblock.command.commands.island.CreateCommand;
import com.songoda.skyblock.command.commands.island.DeleteCommand;
import com.songoda.skyblock.command.commands.island.LevelCommand;
import com.songoda.skyblock.command.commands.island.OwnerCommand;
import com.songoda.skyblock.command.commands.island.SetSpawnCommand;
import com.songoda.skyblock.command.commands.island.SettingsCommand;
import com.songoda.skyblock.command.commands.island.UpgradeCommand;
import com.songoda.skyblock.command.commands.island.*;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.ChatComponent;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.commands.admin.AddUpgradeCommand;
import com.craftaro.skyblock.command.commands.admin.AdminBank;
import com.craftaro.skyblock.command.commands.admin.ChatSpyCommand;
import com.craftaro.skyblock.command.commands.admin.CreateCommand;
import com.craftaro.skyblock.command.commands.admin.DeleteCommand;
import com.craftaro.skyblock.command.commands.admin.GeneratorCommand;
import com.craftaro.skyblock.command.commands.admin.LevelCommand;
import com.craftaro.skyblock.command.commands.admin.LevelScanCommand;
import com.craftaro.skyblock.command.commands.admin.OwnerCommand;
import com.craftaro.skyblock.command.commands.admin.ProxyCommand;
import com.craftaro.skyblock.command.commands.admin.RefreshHologramsCommand;
import com.craftaro.skyblock.command.commands.admin.ReloadCommand;
import com.craftaro.skyblock.command.commands.admin.RemoveHologramCommand;
import com.craftaro.skyblock.command.commands.admin.RemoveUpgradeCommand;
import com.craftaro.skyblock.command.commands.admin.SetAlwaysLoadedCommand;
import com.craftaro.skyblock.command.commands.admin.SetBiomeCommand;
import com.craftaro.skyblock.command.commands.admin.SetHologramCommand;
import com.craftaro.skyblock.command.commands.admin.SetMaxMembers;
import com.craftaro.skyblock.command.commands.admin.SetSizeCommand;
import com.craftaro.skyblock.command.commands.admin.SetSpawnCommand;
import com.craftaro.skyblock.command.commands.admin.SettingsCommand;
import com.craftaro.skyblock.command.commands.admin.StackableCommand;
import com.craftaro.skyblock.command.commands.admin.StructureCommand;
import com.craftaro.skyblock.command.commands.admin.UpdateAllIslandsCommand;
import com.craftaro.skyblock.command.commands.admin.UpgradeCommand;
import com.craftaro.skyblock.command.commands.island.AcceptCommand;
import com.craftaro.skyblock.command.commands.island.BanCommand;
import com.craftaro.skyblock.command.commands.island.BankCommand;
import com.craftaro.skyblock.command.commands.island.BansCommand;
import com.craftaro.skyblock.command.commands.island.BiomeCommand;
import com.craftaro.skyblock.command.commands.island.BorderCommand;
import com.craftaro.skyblock.command.commands.island.CancelCommand;
import com.craftaro.skyblock.command.commands.island.ChallengeCommand;
import com.craftaro.skyblock.command.commands.island.ChatCommand;
import com.craftaro.skyblock.command.commands.island.CloseCommand;
import com.craftaro.skyblock.command.commands.island.ConfirmCommand;
import com.craftaro.skyblock.command.commands.island.ControlPanelCommand;
import com.craftaro.skyblock.command.commands.island.CoopCommand;
import com.craftaro.skyblock.command.commands.island.CurrentCommand;
import com.craftaro.skyblock.command.commands.island.DemoteCommand;
import com.craftaro.skyblock.command.commands.island.DenyCommand;
import com.craftaro.skyblock.command.commands.island.InformationCommand;
import com.craftaro.skyblock.command.commands.island.InviteCommand;
import com.craftaro.skyblock.command.commands.island.KickAllCommand;
import com.craftaro.skyblock.command.commands.island.KickCommand;
import com.craftaro.skyblock.command.commands.island.LeaderboardCommand;
import com.craftaro.skyblock.command.commands.island.LeaveCommand;
import com.craftaro.skyblock.command.commands.island.MembersCommand;
import com.craftaro.skyblock.command.commands.island.OpenCommand;
import com.craftaro.skyblock.command.commands.island.PreviewCommand;
import com.craftaro.skyblock.command.commands.island.PromoteCommand;
import com.craftaro.skyblock.command.commands.island.PublicCommand;
import com.craftaro.skyblock.command.commands.island.ScoreboardCommand;
import com.craftaro.skyblock.command.commands.island.TeleportCommand;
import com.craftaro.skyblock.command.commands.island.UnbanCommand;
import com.craftaro.skyblock.command.commands.island.UnlockCommand;
import com.craftaro.skyblock.command.commands.island.ValueCommand;
import com.craftaro.skyblock.command.commands.island.VisitCommand;
import com.craftaro.skyblock.command.commands.island.VisitorsCommand;
import com.craftaro.skyblock.command.commands.island.VoteCommand;
import com.craftaro.skyblock.command.commands.island.WeatherCommand;
import com.craftaro.skyblock.command.commands.island.WhitelistCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.config.FileManager.Config;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.utils.ChatComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@ -29,6 +82,7 @@ import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
@ -36,7 +90,6 @@ import java.util.Arrays;
import java.util.List;
public class CommandManager implements CommandExecutor, TabCompleter {
private final SkyBlock plugin;
private List<SubCommand> islandCommands;
private List<SubCommand> adminCommands;
@ -54,90 +107,90 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
public void registerSubCommands() {
islandCommands = Arrays.asList(
new AcceptCommand(),
new BanCommand(),
new BankCommand(),
new BansCommand(),
new BiomeCommand(),
new BorderCommand(),
new CancelCommand(),
new ChallengeCommand(),
new ChatCommand(),
new CloseCommand(),
new ConfirmCommand(),
new ControlPanelCommand(),
new CoopCommand(),
new CreateCommand(),
new CurrentCommand(),
new DeleteCommand(),
new DemoteCommand(),
new DenyCommand(),
new InformationCommand(),
new InviteCommand(),
new KickAllCommand(),
new KickCommand(),
new LeaderboardCommand(),
new LeaveCommand(),
new LevelCommand(),
new MembersCommand(),
new OpenCommand(),
new OwnerCommand(),
new PreviewCommand(),
new PromoteCommand(),
new PublicCommand(),
new SetSpawnCommand(),
new SettingsCommand(),
new TeleportCommand(),
new UnbanCommand(),
new UnlockCommand(),
new UpgradeCommand(),
new ValueCommand(),
new VisitCommand(),
new VisitorsCommand(),
new VoteCommand(),
new ScoreboardCommand(),
new WeatherCommand(),
new WhitelistCommand()
this.islandCommands = Arrays.asList(
new AcceptCommand(this.plugin),
new BanCommand(this.plugin),
new BankCommand(this.plugin),
new BansCommand(this.plugin),
new BiomeCommand(this.plugin),
new BorderCommand(this.plugin),
new CancelCommand(this.plugin),
new ChallengeCommand(this.plugin),
new ChatCommand(this.plugin),
new CloseCommand(this.plugin),
new ConfirmCommand(this.plugin),
new ControlPanelCommand(this.plugin),
new CoopCommand(this.plugin),
new com.craftaro.skyblock.command.commands.island.CreateCommand(this.plugin),
new CurrentCommand(this.plugin),
new com.craftaro.skyblock.command.commands.island.DeleteCommand(this.plugin),
new DemoteCommand(this.plugin),
new DenyCommand(this.plugin),
new InformationCommand(this.plugin),
new InviteCommand(this.plugin),
new KickAllCommand(this.plugin),
new KickCommand(this.plugin),
new LeaderboardCommand(this.plugin),
new LeaveCommand(this.plugin),
new com.craftaro.skyblock.command.commands.island.LevelCommand(this.plugin),
new MembersCommand(this.plugin),
new OpenCommand(this.plugin),
new com.craftaro.skyblock.command.commands.island.OwnerCommand(this.plugin),
new PreviewCommand(this.plugin),
new PromoteCommand(this.plugin),
new PublicCommand(this.plugin),
new com.craftaro.skyblock.command.commands.island.SetSpawnCommand(this.plugin),
new com.craftaro.skyblock.command.commands.island.SettingsCommand(this.plugin),
new TeleportCommand(this.plugin),
new UnbanCommand(this.plugin),
new UnlockCommand(this.plugin),
new com.craftaro.skyblock.command.commands.island.UpgradeCommand(this.plugin),
new ValueCommand(this.plugin),
new VisitCommand(this.plugin),
new VisitorsCommand(this.plugin),
new VoteCommand(this.plugin),
new ScoreboardCommand(this.plugin),
new WeatherCommand(this.plugin),
new WhitelistCommand(this.plugin)
);
adminCommands = Arrays.asList(
new AddUpgradeCommand(),
new com.songoda.skyblock.command.commands.admin.CreateCommand(),
new com.songoda.skyblock.command.commands.admin.DeleteCommand(),
new GeneratorCommand(),
new com.songoda.skyblock.command.commands.admin.LevelCommand(),
new LevelScanCommand(),
new com.songoda.skyblock.command.commands.admin.OwnerCommand(),
new RefreshHologramsCommand(),
new ReloadCommand(),
new RemoveHologramCommand(),
new RemoveUpgradeCommand(),
new SetBiomeCommand(),
new SetAlwaysLoadedCommand(),
new ProxyCommand(),
new SetHologramCommand(),
new SetSizeCommand(),
new com.songoda.skyblock.command.commands.admin.SetSpawnCommand(),
new com.songoda.skyblock.command.commands.admin.SettingsCommand(),
new StructureCommand(),
new com.songoda.skyblock.command.commands.admin.UpgradeCommand(),
new StackableCommand(),
new AdminBank(),
new SetMaxMembers(),
new ChatSpyCommand(),
new UpdateAllIslandsCommand()
this.adminCommands = Arrays.asList(
new AddUpgradeCommand(this.plugin),
new CreateCommand(this.plugin),
new DeleteCommand(this.plugin),
new GeneratorCommand(this.plugin),
new LevelCommand(this.plugin),
new LevelScanCommand(this.plugin),
new OwnerCommand(this.plugin),
new RefreshHologramsCommand(this.plugin),
new ReloadCommand(this.plugin),
new RemoveHologramCommand(this.plugin),
new RemoveUpgradeCommand(this.plugin),
new SetBiomeCommand(this.plugin),
new SetAlwaysLoadedCommand(this.plugin),
new ProxyCommand(this.plugin),
new SetHologramCommand(this.plugin),
new SetSizeCommand(this.plugin),
new SetSpawnCommand(this.plugin),
new SettingsCommand(this.plugin),
new StructureCommand(this.plugin),
new UpgradeCommand(this.plugin),
new StackableCommand(this.plugin),
new AdminBank(this.plugin),
new SetMaxMembers(this.plugin),
new ChatSpyCommand(this.plugin),
new UpdateAllIslandsCommand(this.plugin)
);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, Command command, @NotNull String s, String[] args) {
if (command.getName().equalsIgnoreCase("island")) {
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
MessageManager messageManager = this.plugin.getMessageManager();
SoundManager soundManager = this.plugin.getSoundManager();
FileConfiguration languageConfigLoad = plugin.getLanguage();
FileConfiguration mainConfig = plugin.getConfiguration();
FileConfiguration languageConfigLoad = this.plugin.getLanguage();
FileConfiguration mainConfig = this.plugin.getConfiguration();
Player player = null;
@ -151,7 +204,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
} else {
String commandToExecute;
String defaultCommand;
if (plugin.getIslandManager().getIsland(player) == null) {
if (this.plugin.getIslandManager().getIsland(player) == null) {
defaultCommand = "island create";
commandToExecute = mainConfig.getString("Command.Island.Aliases.NoIsland", defaultCommand);
} else {
@ -169,9 +222,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
String finalCommandToExecute = commandToExecute;
Bukkit.getServer().getScheduler().runTask(plugin, () ->
Bukkit.getServer().dispatchCommand(sender,
finalCommandToExecute));
Bukkit.getServer().getScheduler().runTask(this.plugin, () -> Bukkit.getServer().dispatchCommand(sender, finalCommandToExecute));
}
return true;
@ -190,7 +241,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (!canUseHelp) {
messageManager.sendMessage(player, languageConfigLoad.getString("Command.PermissionDenied.Island.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return true;
}
@ -205,7 +256,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
} else {
messageManager.sendMessage(player,
languageConfigLoad.getString("Command.Island.Help.Integer.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return true;
}
@ -227,7 +278,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (!canUseHelp) {
messageManager.sendMessage(player, languageConfigLoad.getString("Command.PermissionDenied.Admin.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return true;
}
@ -240,10 +291,8 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (args[2].matches("[0-9]+")) {
page = Integer.parseInt(args[2]);
} else {
messageManager.sendMessage(player,
languageConfigLoad.getString("Command.Island.Help.Integer.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F,
1.0F);
messageManager.sendMessage(player, languageConfigLoad.getString("Command.Island.Help.Integer.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return true;
}
@ -265,20 +314,20 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (subCommand == null) {
messageManager.sendMessage(sender, languageConfigLoad.getString("Command.Island.Argument.Unrecognised.Message"));
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.ENTITY_VILLAGER_NO);
return true;
}
if (!subCommand.hasPermission(sender, isAdmin)) {
messageManager.sendMessage(sender, languageConfigLoad.getString("Command.PermissionDenied." + (isAdmin ? "Admin" : "Island") + ".Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
return true;
}
List<String> arguments = new ArrayList<>(Arrays.asList(args));
arguments.remove(args[0]);
if (adminCommands.contains(subCommand)) {
if (this.adminCommands.contains(subCommand)) {
arguments.remove(args[1]);
}
@ -294,7 +343,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, String[] args) {
if (!(sender instanceof Player)) {
return null;
}
@ -308,7 +357,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (args[0] == null || args[0].isEmpty()) {
commandAliases.add("admin");
for (SubCommand subCommandList : islandCommands) {
for (SubCommand subCommandList : this.islandCommands) {
commandAliases.add(subCommandList.getName());
}
} else {
@ -318,7 +367,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
}
for (SubCommand subCommandList : islandCommands) {
for (SubCommand subCommandList : this.islandCommands) {
if (subCommandList.getName().toLowerCase().contains(args[0].toLowerCase())) {
commandAliases.add(subCommandList.getName());
}
@ -328,11 +377,11 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (isAdmin) {
if (args[0].equalsIgnoreCase("admin")) {
if (args[1] == null || args[1].isEmpty()) {
for (SubCommand subCommandList : adminCommands) {
for (SubCommand subCommandList : this.adminCommands) {
commandAliases.add(subCommandList.getName());
}
} else {
for (SubCommand subCommandList : adminCommands) {
for (SubCommand subCommandList : this.adminCommands) {
if (subCommandList.getName().toLowerCase().contains(args[1].toLowerCase())) {
commandAliases.add(subCommandList.getName());
}
@ -343,7 +392,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
List<String> arguments = getIslandArguments(args[0], args[1]);
if (arguments.size() != 0) {
if (!arguments.isEmpty()) {
commandAliases.addAll(arguments);
}
} else if (args.length == 3) {
@ -351,14 +400,14 @@ public class CommandManager implements CommandExecutor, TabCompleter {
if (args[0].equalsIgnoreCase("admin")) {
List<String> arguments = getAdminArguments(args[1], args[2]);
if (arguments.size() != 0) {
if (!arguments.isEmpty()) {
commandAliases.addAll(arguments);
}
}
}
}
if (commandAliases.size() != 0) {
if (!commandAliases.isEmpty()) {
return commandAliases;
}
}
@ -367,11 +416,11 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
public List<String> getIslandArguments(String arg1, String arg2) {
return this.getArguments(islandCommands, arg1, arg2);
return this.getArguments(this.islandCommands, arg1, arg2);
}
public List<String> getAdminArguments(String arg1, String arg2) {
return this.getArguments(adminCommands, arg1, arg2);
return this.getArguments(this.adminCommands, arg1, arg2);
}
public List<String> getArguments(List<SubCommand> subCommands, String arg1, String arg2) {
@ -399,29 +448,29 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
public void sendPlayerIslandHelpCommands(Player player, int page) {
this.sendPlayerHelpCommands(player, islandCommands, page, false);
this.sendPlayerHelpCommands(player, this.islandCommands, page, false);
}
public void sendPlayerAdminHelpCommands(Player player, int page) {
this.sendPlayerHelpCommands(player, adminCommands, page, true);
this.sendPlayerHelpCommands(player, this.adminCommands, page, true);
}
public void sendPlayerHelpCommands(Player player, List<SubCommand> subCommands, int page, boolean isAdmin) {
FileManager fileManager = plugin.getFileManager();
FileManager fileManager = this.plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
Config config = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
int pageSize = 7;
int nextEndIndex = subCommands.size() - page * pageSize, index = page * pageSize - pageSize,
endIndex = index >= subCommands.size() ? subCommands.size() - 1 : index + pageSize;
boolean showAlises = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
boolean showAliases = fileManager.getConfig(new File(this.plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Command.Help.Aliases.Enable");
if (nextEndIndex <= -7) {
plugin.getMessageManager().sendMessage(player, configLoad.getString("Command.Island.Help.Page.Message"));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
this.plugin.getMessageManager().sendMessage(player, configLoad.getString("Command.Island.Help.Page.Message"));
this.plugin.getSoundManager().playSound(player, XSound.ENTITY_VILLAGER_NO);
return;
}
@ -453,7 +502,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
for (SubCommand subCommand : subCommands) {
StringBuilder commandAliases = new StringBuilder();
if (showAlises) {
if (showAliases) {
for (int i = 0; i < subCommand.getAliases().length; i++) {
commandAliases.append("/").append(subCommand.getAliases()[i]);
}
@ -475,7 +524,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
SubCommand subCommandFromIndex = subCommands.get(index);
StringBuilder commandAliases = new StringBuilder();
if (showAlises) {
if (showAliases) {
for (int i = 0; i < subCommandFromIndex.getAliases().length; i++) {
commandAliases.append("/").append(subCommandFromIndex.getAliases()[i]);
}
@ -494,7 +543,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
}
} else {
plugin.getMessageManager().sendMessage(player, helpLines);
this.plugin.getMessageManager().sendMessage(player, helpLines);
}
}
@ -504,7 +553,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
player.spigot()
.sendMessage(
new ChatComponent(
plugin.formatText(configLoad.getString("Command.Island.Help.Word.Next")),
this.plugin.formatText(configLoad.getString("Command.Island.Help.Word.Next")),
false, null,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island " + subCommandText + "help " + (page + 1)),
@ -513,16 +562,16 @@ public class CommandManager implements CommandExecutor, TabCompleter {
player.spigot()
.sendMessage(
new ChatComponent(
plugin.formatText(configLoad.getString("Command.Island.Help.Word.Previous")),
this.plugin.formatText(configLoad.getString("Command.Island.Help.Word.Previous")),
false, null,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island " + subCommandText + "help " + (page - 1)),
null).addExtraChatComponent(
new ChatComponent(" "
+ ChatColor.translateAlternateColorCodes('&',
configLoad
.getString("Command.Island.Help.Word.Pipe"))
+ " ", false, null, null, null))
new ChatComponent(" "
+ ChatColor.translateAlternateColorCodes('&',
configLoad
.getString("Command.Island.Help.Word.Pipe"))
+ " ", false, null, null, null))
.addExtraChatComponent(new ChatComponent(
ChatColor.translateAlternateColorCodes('&',
configLoad.getString(
@ -547,7 +596,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
}
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_ARROW_HIT.getSound(), 1.0F, 1.0F);
this.plugin.getSoundManager().playSound(player, XSound.ENTITY_ARROW_HIT);
}
public void sendConsoleHelpCommands(CommandSender sender) {
@ -562,21 +611,24 @@ public class CommandManager implements CommandExecutor, TabCompleter {
}
public SubCommand getIslandSubCommand(String cmdName) {
return this.getSubCommand(islandCommands, cmdName);
return this.getSubCommand(this.islandCommands, cmdName);
}
public SubCommand getAdminSubCommand(String cmdName) {
return this.getSubCommand(adminCommands, cmdName);
return this.getSubCommand(this.adminCommands, cmdName);
}
public SubCommand getSubCommand(List<SubCommand> subCommands, String cmdName) {
for (SubCommand command : subCommands) {
if (command.getName().equalsIgnoreCase(cmdName))
if (command.getName().equalsIgnoreCase(cmdName)) {
return command;
}
for (String argList : command.getAliases())
if (argList.equalsIgnoreCase(cmdName))
for (String argList : command.getAliases()) {
if (argList.equalsIgnoreCase(cmdName)) {
return command;
}
}
}
return null;

View File

@ -1,20 +1,16 @@
package com.songoda.skyblock.command;
package com.craftaro.skyblock.command;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.ChatColor;
import com.craftaro.skyblock.SkyBlock;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
import java.io.File;
public abstract class SubCommand {
protected final SkyBlock plugin;
protected final String info;
public SubCommand() {
this.plugin = SkyBlock.getInstance();
public SubCommand(SkyBlock plugin) {
this.plugin = plugin;
this.info = this.plugin.formatText(this.plugin.getLanguage().getString(this.getInfoMessagePath()));
}
@ -35,12 +31,12 @@ public abstract class SubCommand {
}
public boolean hasPermission(Permissible toCheck, boolean isAdmin) {
if (toCheck.hasPermission("fabledskyblock.*"))
if (toCheck.hasPermission("fabledskyblock.*")) {
return true;
}
return isAdmin
? toCheck.hasPermission("fabledskyblock.admin.*") || toCheck.hasPermission("fabledskyblock.admin." + this.getName())
: toCheck.hasPermission("fabledskyblock.island.*") || toCheck.hasPermission("fabledskyblock.island." + this.getName());
}
}

View File

@ -1,17 +1,23 @@
package com.songoda.skyblock.command.commands;
package com.craftaro.skyblock.command.commands;
import com.songoda.skyblock.SkyBlock;
import com.craftaro.skyblock.SkyBlock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class SkyBlockCommand implements CommandExecutor {
private final SkyBlock plugin;
public SkyBlockCommand(SkyBlock plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
public boolean onCommand(CommandSender sender, @NotNull Command command, @NotNull String s, String[] strings) {
sender.sendMessage("");
sender.sendMessage(formatText("FabledSkyBlock &7Version " + SkyBlock.getInstance().getDescription().getVersion() + " Created with <3 by &5&l&oSongoda"));
sender.sendMessage(formatText("FabledSkyBlock &7Version " + this.plugin.getDescription().getVersion() + " Created with <3 by &5&l&oCraftaro"));
sender.sendMessage(formatText("&8 - &a/island help &7 - The default help command."));
sender.sendMessage("");
return true;

View File

@ -1,17 +1,18 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.config.FileManager.Config;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.playerdata.PlayerDataManager;
import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.upgrade.Upgrade;
import com.craftaro.skyblock.utils.player.OfflinePlayer;
import com.eatthepath.uuid.FastUUID;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@ -24,6 +25,9 @@ import java.io.IOException;
import java.util.UUID;
public class AddUpgradeCommand extends SubCommand {
public AddUpgradeCommand(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
@ -36,17 +40,17 @@ public class AddUpgradeCommand extends SubCommand {
}
public void onCommand(CommandSender sender, String[] args) {
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
PlayerDataManager playerDataManager = this.plugin.getPlayerDataManager();
MessageManager messageManager = this.plugin.getMessageManager();
IslandManager islandManager = this.plugin.getIslandManager();
SoundManager soundManager = this.plugin.getSoundManager();
FileManager fileManager = this.plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
Config config = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (args.length == 2) {
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
UUID islandOwnerUUID;
String targetPlayerName;
@ -58,76 +62,72 @@ public class AddUpgradeCommand extends SubCommand {
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
targetPlayerName = targetPlayer.getName();
}
Upgrade.Type upgrade = null;
for(Upgrade.Type type : Upgrade.Type.values()) {
if(type.name().toUpperCase().equals(args[1].toUpperCase())) {
for (Upgrade.Type type : Upgrade.Type.values()) {
if (type.getFriendlyName().equalsIgnoreCase(args[1])) {
upgrade = type;
break;
}
}
if (islandOwnerUUID == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Owner.Message"));
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Owner.Message"));
soundManager.playSound(sender, XSound.ENTITY_VILLAGER_NO);
} else if (upgrade == null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Exist.Message"));
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Exist.Message"));
soundManager.playSound(sender, XSound.ENTITY_VILLAGER_NO);
} else {
if (islandManager.containsIsland(islandOwnerUUID)) {
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(islandOwnerUUID));
if (island.hasUpgrade(upgrade)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message"));
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
return;
}
island.setUpgrade(null, upgrade, true);
} else {
File islandDataFile = new File(plugin.getDataFolder().toString() + "/island-data",
FastUUID.toString(islandOwnerUUID) + ".yml");
File islandDataFile = new File(this.plugin.getDataFolder() + "/island-data", FastUUID.toString(islandOwnerUUID) + ".yml");
if (!fileManager.isFileExist(islandDataFile)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Island.Data.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
return;
}
FileConfiguration islandDataConfigLoad = YamlConfiguration.loadConfiguration(islandDataFile);
if (islandDataConfigLoad.getString("Upgrade." + upgrade.name()) != null) {
if (islandDataConfigLoad.getString("Upgrade." + upgrade.getFriendlyName()) != null) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Upgrade.Already.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
return;
}
islandDataConfigLoad.set("Upgrade." + upgrade.name(), true);
islandDataConfigLoad.set("Upgrade." + upgrade.getFriendlyName(), true);
try {
islandDataConfigLoad.save(islandDataFile);
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Added.Message")
.replace("%player", targetPlayerName).replace("%upgrade", upgrade.name()));
soundManager.playSound(sender, CompatibleSound.BLOCK_NOTE_BLOCK_PLING.getSound(), 1.0F, 1.0F);
.replace("%player", targetPlayerName).replace("%upgrade", upgrade.getFriendlyName()));
soundManager.playSound(sender, XSound.BLOCK_NOTE_BLOCK_PLING);
}
} else {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.AddUpgrade.Invalid.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
}
}

View File

@ -1,17 +1,18 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.gui.bank.GuiBank;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.craftaro.core.hooks.EconomyManager;
import com.craftaro.core.hooks.economies.Economy;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.gui.bank.GuiBank;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.playerdata.PlayerDataManager;
import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
@ -21,96 +22,112 @@ import java.io.File;
import java.util.UUID;
public class AdminBank extends SubCommand {
public AdminBank(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
FileManager fileManager = plugin.getFileManager();
SoundManager soundManager = plugin.getSoundManager();
Economy economy = plugin.getEconomyManager().getEconomy();
PlayerDataManager playerDataManager = this.plugin.getPlayerDataManager();
MessageManager messageManager = this.plugin.getMessageManager();
IslandManager islandManager = this.plugin.getIslandManager();
FileManager fileManager = this.plugin.getFileManager();
SoundManager soundManager = this.plugin.getSoundManager();
Economy economy = this.plugin.getEconomyManager().getEconomy();
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileManager.Config config = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
Island island = islandManager.getIslandAtLocation(player.getLocation());
if (!this.plugin.getConfiguration().getBoolean("Island.Bank.Enable")) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return;
}
if (args.length < 1) {
if (island != null){
plugin.getGuiManager().showGUI(player, new GuiBank(plugin, island, null, true));
if (island != null) {
this.plugin.getGuiManager().showGUI(player, new GuiBank(this.plugin, island, null, true));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.NullIsland.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
} else {
switch (args[0].toLowerCase()) {
case "balance":
double balance = 0;
if (args.length >= 3) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%", args[1]).replace("%bal%", "" + EconomyManager.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(island.getOwnerUUID())))));
if (economy != null) {
balance = economy.getBalance(Bukkit.getOfflinePlayer(island.getOwnerUUID()));
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message")
.replace("%player%", args[1])
.replace("%bal%", EconomyManager.formatEconomy(balance)));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%", args[1]).replace("%bal%", "" + EconomyManager.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(args[1])))));
if (economy != null) {
balance = economy.getBalance(Bukkit.getOfflinePlayer(args[1]));
}
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message")
.replace("%player%", args[1])
.replace("%bal%", EconomyManager.formatEconomy(balance)));
}
return;
case "deposit":
if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
}else {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}
return;
case "withdraw":
if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
}else {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}
return;
case "open":
if(args.length == 2){
Player targetPlayer = Bukkit.getServer().getPlayer(args[1]);
if (args.length == 2) {
Player targetPlayer = Bukkit.getPlayerExact(args[1]);
UUID islandOwnerUUID;
if (targetPlayer == null) {
OfflinePlayer targetPlayerOffline = new OfflinePlayer(args[1]);
islandOwnerUUID = targetPlayerOffline.getOwner();
} else {
islandOwnerUUID = playerDataManager.getPlayerData(targetPlayer).getOwner();
}
island = islandManager.getIsland(Bukkit.getOfflinePlayer(islandOwnerUUID));
}
if (island != null){
plugin.getGuiManager().showGUI(player, new GuiBank(plugin, island, null, true));
if (island != null) {
this.plugin.getGuiManager().showGUI(player, new GuiBank(this.plugin, island, null, true));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.NullIsland.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
break;
default:
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Unexpected.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
}
}
@Override
public void onCommandByConsole(ConsoleCommandSender sender, String[] args) {
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
FileManager fileManager = plugin.getFileManager();
Economy economy = plugin.getEconomyManager().getEconomy();
MessageManager messageManager = this.plugin.getMessageManager();
IslandManager islandManager = this.plugin.getIslandManager();
FileManager fileManager = this.plugin.getFileManager();
Economy economy = this.plugin.getEconomyManager().getEconomy();
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileManager.Config config = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (args.length < 2) {
@ -119,21 +136,27 @@ public class AdminBank extends SubCommand {
}
switch (args[0]) {
case "balance":
messageManager.sendMessage(sender,configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%",args[1]).replace("%bal%",""+ EconomyManager.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(args[1])))));
double balance = 0;
if (economy != null) {
balance = economy.getBalance(Bukkit.getOfflinePlayer(args[1]));
}
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.Balance.Message")
.replace("%player%", args[1])
.replace("%bal%", EconomyManager.formatEconomy(balance)));
return;
case "deposit":
if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
}else {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
} else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}
return;
case "withdraw":
if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
}else {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayerExact(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%", args[1]).replace("%ammount%", EconomyManager.formatEconomy(Double.parseDouble(args[2]))));
} else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}
return;

View File

@ -1,15 +1,16 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.playerdata.PlayerData;
import com.craftaro.skyblock.playerdata.PlayerDataManager;
import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.utils.player.OfflinePlayer;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -19,20 +20,23 @@ import java.util.Set;
import java.util.UUID;
public class ChatSpyCommand extends SubCommand {
public ChatSpyCommand(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
FileManager fileManager = plugin.getFileManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager.Config language = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
PlayerDataManager playerDataManager = this.plugin.getPlayerDataManager();
MessageManager messageManager = this.plugin.getMessageManager();
IslandManager islandManager = this.plugin.getIslandManager();
FileManager fileManager = this.plugin.getFileManager();
SoundManager soundManager = this.plugin.getSoundManager();
FileManager.Config language = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration languageLoad = language.getFileConfiguration();
PlayerData playerData = playerDataManager.getPlayerData(player);
if (args.length < 1) {
toggleSpy(player, messageManager, languageLoad, playerData);
} else {
@ -41,19 +45,19 @@ public class ChatSpyCommand extends SubCommand {
toggleSpy(player, messageManager, languageLoad, playerData);
break;
case "global":
if(!playerData.isGlobalChatSpy()){
if (!playerData.isGlobalChatSpy()) {
playerData.enableGlobalChatSpy();
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.GlobalEnabled.Message"));
} else {
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.GlobalAlreadyEnabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
break;
case "add":
if(args.length == 2){
if (args.length == 2) {
OfflinePlayer offlinePlayer = new OfflinePlayer(args[1]);
Island island = islandManager.getIslandByOwner(offlinePlayer.getBukkitOfflinePlayer());
if(island != null) {
if (island != null) {
playerData.addChatSpyIsland(island);
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.Add.Message")
.replace("%owner", new OfflinePlayer(island.getOwnerUUID()).getName()));
@ -62,14 +66,14 @@ public class ChatSpyCommand extends SubCommand {
}
} else {
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.InvalidArgNumber.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
break;
case "remove":
if(args.length == 2){
if (args.length == 2) {
OfflinePlayer offlinePlayer = new OfflinePlayer(args[1]);
Island island = islandManager.getIslandByOwner(offlinePlayer.getBukkitOfflinePlayer());
if(island != null) {
if (island != null) {
playerData.removeChatSpyIsland(island);
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.Remove.Message")
.replace("%owner", new OfflinePlayer(island.getOwnerUUID()).getName()));
@ -78,14 +82,14 @@ public class ChatSpyCommand extends SubCommand {
}
} else {
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.InvalidArgNumber.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
break;
case "list":
Set<UUID> uuidSet = playerData.getChatSpyIslands();
if(!uuidSet.isEmpty()){
if (!uuidSet.isEmpty()) {
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.List.Start.Message"));
for(UUID uuid : uuidSet) {
for (UUID uuid : uuidSet) {
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.List.List.Message")
.replace("%owner", new OfflinePlayer(uuid).getName()));
}
@ -96,15 +100,15 @@ public class ChatSpyCommand extends SubCommand {
break;
default:
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.InvalidArgNumber.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1f, 1f);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
break;
}
}
}
private void toggleSpy(Player player, MessageManager messageManager, FileConfiguration languageLoad, PlayerData playerData) {
if(playerData != null) {
if(playerData.isChatSpy()){
if (playerData != null) {
if (playerData.isChatSpy()) {
playerData.setChatSpy(false);
messageManager.sendMessage(player, languageLoad.getString("Command.Island.Admin.ChatSpy.Disabled.Message"));
} else {
@ -113,27 +117,27 @@ public class ChatSpyCommand extends SubCommand {
}
}
}
@Override
public void onCommandByConsole(ConsoleCommandSender sender, String[] args) {
sender.sendMessage("SkyBlock | Error: You must be a player to perform that command.");
}
@Override
public String getName() {
return "chatspy";
}
@Override
public String getInfoMessagePath() {
return "Command.Island.Admin.ChatSpy.Info.Message";
}
@Override
public String[] getAliases() {
return new String[]{"spychat", "spy"};
}
@Override
public String[] getArguments() {
return new String[]{"toggle", "global", "add", "remove", "list"};

View File

@ -1,26 +1,30 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.menus.admin.Creator;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.menus.admin.Creator;
import com.craftaro.skyblock.playerdata.PlayerDataManager;
import com.craftaro.skyblock.sound.SoundManager;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
public class CreateCommand extends SubCommand {
public CreateCommand(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
SoundManager soundManager = plugin.getSoundManager();
PlayerDataManager playerDataManager = this.plugin.getPlayerDataManager();
SoundManager soundManager = this.plugin.getSoundManager();
if (playerDataManager.hasPlayerData(player)) {
playerDataManager.getPlayerData(player).setViewer(null);
}
Creator.getInstance().open(player);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_CHEST_OPEN);
}
@Override

View File

@ -1,16 +1,17 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.config.FileManager.Config;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager;
import com.craftaro.skyblock.island.IslandRole;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.utils.player.OfflinePlayer;
import com.craftaro.skyblock.utils.world.LocationUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -23,6 +24,9 @@ import java.io.File;
import java.util.UUID;
public class DeleteCommand extends SubCommand {
public DeleteCommand(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
@ -35,12 +39,12 @@ public class DeleteCommand extends SubCommand {
}
public void onCommand(CommandSender sender, String[] args) {
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
MessageManager messageManager = this.plugin.getMessageManager();
IslandManager islandManager = this.plugin.getIslandManager();
SoundManager soundManager = this.plugin.getSoundManager();
FileManager fileManager = this.plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
Config config = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
Player player = null;
@ -50,7 +54,7 @@ public class DeleteCommand extends SubCommand {
}
if (args.length == 1) {
Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
UUID targetPlayerUUID;
String targetPlayerName;
@ -64,18 +68,16 @@ public class DeleteCommand extends SubCommand {
}
if (targetPlayerUUID == null || !islandManager.isIslandExist(targetPlayerUUID)) {
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Delete.Owner.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Delete.Owner.Message"));
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
} else {
islandManager.loadIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID));
Island island = islandManager.getIsland(Bukkit.getServer().getOfflinePlayer(targetPlayerUUID));
Location spawnLocation = LocationUtil.getSpawnLocation();
if (spawnLocation != null && islandManager.isLocationAtIsland(island, spawnLocation)) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Admin.Delete.Spawn.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Delete.Spawn.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
islandManager.unloadIsland(island, null);
@ -83,25 +85,22 @@ public class DeleteCommand extends SubCommand {
}
for (Player all : Bukkit.getOnlinePlayers()) {
if (island.hasRole(IslandRole.Member, all.getUniqueId())
|| island.hasRole(IslandRole.Operator, all.getUniqueId())) {
all.sendMessage(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Command.Island.Confirmation.Deletion.Broadcast.Message")));
soundManager.playSound(all, CompatibleSound.ENTITY_GENERIC_EXPLODE.getSound(), 10.0F, 10.0F);
if (island.hasRole(IslandRole.MEMBER, all.getUniqueId())
|| island.hasRole(IslandRole.OPERATOR, all.getUniqueId())) {
all.sendMessage(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Confirmation.Deletion.Broadcast.Message")));
soundManager.playSound(all, XSound.ENTITY_GENERIC_EXPLODE, 10, 10);
}
}
island.setDeleted(true);
islandManager.deleteIsland(island, true);
messageManager.sendMessage(sender,
configLoad.getString("Command.Island.Admin.Delete.Deleted.Message").replace("%player",
targetPlayerName));
soundManager.playSound(sender, CompatibleSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Delete.Deleted.Message").replace("%player", targetPlayerName));
soundManager.playSound(sender, XSound.ENTITY_IRON_GOLEM_ATTACK);
}
} else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Delete.Invalid.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
}
}

View File

@ -1,13 +1,14 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.menus.admin.Generator;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.config.FileManager.Config;
import com.craftaro.skyblock.menus.admin.Generator;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.playerdata.PlayerDataManager;
import com.craftaro.skyblock.sound.SoundManager;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -15,27 +16,30 @@ import org.bukkit.entity.Player;
import java.io.File;
public class GeneratorCommand extends SubCommand {
public GeneratorCommand(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
PlayerDataManager playerDataManager = this.plugin.getPlayerDataManager();
MessageManager messageManager = this.plugin.getMessageManager();
SoundManager soundManager = this.plugin.getSoundManager();
FileManager fileManager = this.plugin.getFileManager();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
Config config = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (plugin.getGeneratorManager() == null) {
if (this.plugin.getGeneratorManager() == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Generator.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
} else {
if (playerDataManager.hasPlayerData(player)) {
playerDataManager.getPlayerData(player).setViewer(null);
}
Generator.getInstance().open(player);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_CHEST_OPEN);
}
}

View File

@ -1,20 +1,24 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.menus.admin.Levelling;
import com.songoda.skyblock.sound.SoundManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.menus.admin.Levelling;
import com.craftaro.skyblock.sound.SoundManager;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
public class LevelCommand extends SubCommand {
public LevelCommand(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
SoundManager soundManager = plugin.getSoundManager();
SoundManager soundManager = this.plugin.getSoundManager();
Levelling.getInstance().open(player);
soundManager.playSound(player, CompatibleSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_CHEST_OPEN);
}
@Override

View File

@ -1,13 +1,14 @@
package com.songoda.skyblock.command.commands.admin;
package com.craftaro.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.levelling.IslandLevelManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.command.SubCommand;
import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager;
import com.craftaro.skyblock.levelling.IslandLevelManager;
import com.craftaro.skyblock.message.MessageManager;
import com.craftaro.skyblock.sound.SoundManager;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@ -18,6 +19,9 @@ import org.bukkit.entity.Player;
import java.io.File;
public class LevelScanCommand extends SubCommand {
public LevelScanCommand(SkyBlock plugin) {
super(plugin);
}
@Override
public void onCommandByPlayer(Player player, String[] args) {
@ -30,18 +34,18 @@ public class LevelScanCommand extends SubCommand {
}
private void onCommand(CommandSender sender, String[] args) {
IslandLevelManager levellingManager = plugin.getLevellingManager();
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
IslandLevelManager levellingManager = this.plugin.getLevellingManager();
MessageManager messageManager = this.plugin.getMessageManager();
IslandManager islandManager = this.plugin.getIslandManager();
SoundManager soundManager = this.plugin.getSoundManager();
FileManager fileManager = this.plugin.getFileManager();
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileManager.Config config = fileManager.getConfig(new File(this.plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (args.length == 0) {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.LevelScan.Invalid.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
return;
}
@ -50,14 +54,14 @@ public class LevelScanCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.LevelScan.NoIsland.Message"));
soundManager.playSound(sender, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.BLOCK_ANVIL_LAND);
return;
}
levellingManager.startScan(sender instanceof Player ? (Player) sender : null, island);
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.LevelScan.Started.Message"));
soundManager.playSound(sender, CompatibleSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
soundManager.playSound(sender, XSound.ENTITY_VILLAGER_YES);
}
@Override

Some files were not shown because too many files have changed in this diff Show More