diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 3bcb4b3..fd7b4f3 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -46,20 +46,19 @@ jobs: runs-on: ubuntu-latest needs: build outputs: - changelog: ${{ steps.changelog.outputs.release-notes }} + changelog: ${{ steps.read-changelog.outputs.changelog }} release_type: ${{ steps.release-type.outputs.release_type }} steps: - name: Checkout Code uses: actions/checkout@v4 - - name: Generate Changelog from commits - id: changelog - uses: johnyherangi/create-release-notes@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - format: "- {{subject}}" + - name: Read CHANGELOG.md + id: read-changelog + run: | + # Read file, escape % and newlines for GitHub Actions + CONTENT=$(cat CHANGELOG.md | sed 's/%/%25/g' | sed ':a;N;$!ba;s/\n/%0A/g') + echo "changelog=$CONTENT" >> $GITHUB_OUTPUT - name: Determine release type id: release-type diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0a06881 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +## V1.9.7 RELEASE - Minecraft 1.21.8 + +--- + +### Changelog: +- Potentially fixed permission +- Fixed compatibility with CraftBukkit + +Please report any bugs to the [Discord Server](https://discord.gg/VNXV4PDhfK). The sooner the bug is reported, the faster I can release a new fix which patches it. +Thanks for all the support with this plugin ! <3 \ No newline at end of file diff --git a/pom.xml b/pom.xml index d7b50d1..11da23d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.gamecreep BasicHomes - 1.9.6-RELEASE-1.21.8 + 1.9.7-RELEASE-1.21.8 jar BasicHomes diff --git a/src/main/java/fr/gamecreep/basichomes/Constants.java b/src/main/java/fr/gamecreep/basichomes/Constants.java index 3192559..f0f3288 100644 --- a/src/main/java/fr/gamecreep/basichomes/Constants.java +++ b/src/main/java/fr/gamecreep/basichomes/Constants.java @@ -8,14 +8,25 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class Constants { - public static final String PLUGIN_VERSION = "1.9.6"; + public static final String PLUGIN_VERSION = "1.9.7"; public static final int BSTATS_PLUGIN_ID = 25429; public static final ChatColor INFO_COLOR = ChatColor.DARK_AQUA; public static final ChatColor SUCCESS_COLOR = ChatColor.GREEN; public static final ChatColor WARNING_COLOR = ChatColor.RED; public static final ChatColor SPECIAL_COLOR = ChatColor.GOLD; - public static final net.md_5.bungee.api.ChatColor PLUGIN_COLOR = net.md_5.bungee.api.ChatColor.of("#2596be"); + + public static final String PLUGIN_COLOR; + static { + String colorTemp; + try { + colorTemp = net.md_5.bungee.api.ChatColor.of("#2596be").toString(); + } catch (Throwable t) { + colorTemp = ChatColor.DARK_AQUA.toString(); + } + PLUGIN_COLOR = colorTemp; + } + public static final String MY_HOMES_MENU_NAME = SPECIAL_COLOR + "My Homes"; public static final String HOMES_OF_START_MENU_NAME = SPECIAL_COLOR + "Homes of" + INFO_COLOR + " "; diff --git a/src/main/java/fr/gamecreep/basichomes/files/PermissionDataHandler.java b/src/main/java/fr/gamecreep/basichomes/files/PermissionDataHandler.java index 276a12e..683d0e7 100644 --- a/src/main/java/fr/gamecreep/basichomes/files/PermissionDataHandler.java +++ b/src/main/java/fr/gamecreep/basichomes/files/PermissionDataHandler.java @@ -141,26 +141,27 @@ public List getPlayerGroups(@NonNull final P public void applyPermissions(@NonNull final Player player) { final UUID playerId = player.getUniqueId(); - final PermissionAttachment permissionAttachment = - this.plugin.getPermissionAttachments().getOrDefault(playerId, player.addAttachment(this.plugin)); + final PermissionAttachment oldAttachment = this.plugin.getPermissionAttachments().remove(playerId); + if (oldAttachment != null) { + player.removeAttachment(oldAttachment); + } - permissionAttachment.getPermissions().clear(); + final PermissionAttachment newAttachment = player.addAttachment(this.plugin); final List groups = this.getPlayerGroups(player); - for (final DefaultPermissions.GroupPermission group : groups) { - this.getDefaultPermissions(group).forEach(permissionAttachment::setPermission); + this.getDefaultPermissions(group).forEach(newAttachment::setPermission); } - this.getPlayerPermissions(playerId).forEach(permissionAttachment::setPermission); - this.plugin.getPermissionAttachments().put(playerId, permissionAttachment); + this.getPlayerPermissions(playerId).forEach(newAttachment::setPermission); + + this.plugin.getPermissionAttachments().put(playerId, newAttachment); } public void applyPermissions(@NonNull final UUID playerId) { - for (final Player player : this.plugin.getServer().getOnlinePlayers()) { - if (player.getUniqueId().equals(playerId)) { - this.applyPermissions(player); - } + final Player player = this.plugin.getServer().getPlayer(playerId); + if (player != null && player.isOnline()) { + this.applyPermissions(player); } }